# siteinfo.cf
#
# This file should be copied to some file specific to your organization,
# e.g. MyOrg.cf.  You should then customize that file, and include it from
# your router.cf file.
provide siteinfo

# If hostnames aren't fully qualified around here, define default net.
orgdomain=toronto.edu

# If your organization is known under multiple (pseudo-)domain names, list here:
orgdomains="${orgdomain}|toronto.cdn|toronto.csnet"

# My official hostname
if [ -f /bin/hostname ]; then
	rawhostname=$(/bin/hostname)
elif [ -f /etc/sys_id ]; then
	read rawhostname < /etc/sys_id
else
	rawhostname=$(/bin/uname -n)
fi
hostname=$(canon $rawhostname)	# in case you don't like $orgdomain baggage
sift $hostname in
.+\.(edu|gov|mil|oth|org|net|ca|dk|us|uk)	# add toplevels as you please
	break ;;				# do nothing
.*	hostname=$hostname.$orgdomain ;;	# default domain
tfis
# set hostname to enable message-id generation and checking
hostname $hostname


# For a hostname of 'ephemeral.ai.toronto.edu', this is what should happen:

sift $hostname in
(.*\.)?([^.]+)\.((ca|edu|gov|mil|oth|org|net|us|uucp)|(ac|co|re)\...)
	orgdomain=\2.\3			# toronto.edu or utoronto.ca
	case "$orgdomain" in
	$orgdomains)
		break ;;
	*)	if [ x$orgdomains = x ]; then
			orgdomains=$orgdomain
		else
			echo warning: $orgdomain is not matched by ${orgdomains}!
			orgdomains="$orgdomain|$orgdomains"
		fi ;;
	esac
	break ;;
.*	echo mailer: config: cannot interpret $hostname properly
	exit 1 ;;
tfis

# If we are a subdomain of an organizational domain, we may wish to do
# hostname hiding. Figure out what name we should masquerade as within
# our organizational domain. If not, disable the first case label.

sift "$hostname" in
(.*\.)?([^.]+)\.$orgdomain
	subdomain=\2				# ai
	break ;;
(.*)?\.$orgdomain
	subdomain=\1				# ephemeral.ai
	break ;;
tfis


# This is what it will say on out mail
mydomain=$subdomain.$orgdomain

# Any domain name with these toplevels will not be canonicalized
toplevels='ca|edu|com|net|mil|int|gov|org'
