xref: /csrg-svn/usr.sbin/sendmail/cf/m4/proto.m4 (revision 68830)
151222Sericdivert(-1)
251222Seric#
351222Seric# Copyright (c) 1983 Eric P. Allman
463592Sbostic# Copyright (c) 1988, 1993
563592Sbostic#	The Regents of the University of California.  All rights reserved.
651222Seric#
751222Seric# %sccs.include.redist.sh%
851222Seric#
951222Sericdivert(0)
1051222Seric
11*68830SericVERSIONID(`@(#)proto.m4	8.68 (Berkeley) 04/21/95')
1251222Seric
1351322SericMAILER(local)dnl
1451222Seric
1567696Seric# level 6 config file format
1668651SericV6/Berkeley
1768651Sericdivert(-1)
1868651Seric
19*68830Seric# do some sanity checking
20*68830Sericifdef(`__OSTYPE__',,
21*68830Seric	`errprint(`*** ERROR: No system type defined (use OSTYPE macro)')')
22*68830Seric
2368651Seric# pick our default mailers
2468651Sericifdef(`confSMTP_MAILER',, `define(`confSMTP_MAILER', `smtp')')
2568651Sericifdef(`confLOCAL_MAILER',, `define(`confLOCAL_MAILER', `local')')
2664010Sericifdef(`confRELAY_MAILER',,
2764010Seric	`define(`confRELAY_MAILER',
2864010Seric		`ifdef(`_MAILER_smtp_', `relay',
2968651Seric			`ifdef(`_MAILER_uucp', `suucp', `unknown')')')')
3063998Sericdefine(`_SMTP_', `confSMTP_MAILER')dnl		for readability only
3163998Sericdefine(`_LOCAL_', `confLOCAL_MAILER')dnl	for readability only
3264010Sericdefine(`_RELAY_', `confRELAY_MAILER')dnl	for readability only
3352646Seric
3468651Seric# back compatibility with old config files
3568651Sericifdef(`confDEF_GROUP_ID',
3668651Seric	`errprint(`*** confDEF_GROUP_ID is obsolete.')
3768651Seric	 errprint(`    Use confDEF_USER_ID with a colon in the value instead.')')
3868651Sericifdef(`confREAD_TIMEOUT',
3968651Seric	`errprint(`*** confREAD_TIMEOUT is obsolete.')
4068651Seric	 errprint(`    Use individual confTO_<timeout> parameters instead.')')
4168651Sericifdef(`confMESSAGE_TIMEOUT',
4268651Seric	`define(`_ARG_', index(confMESSAGE_TIMEOUT, /))
4368651Seric	 ifelse(_ARG_, -1,
4468651Seric		`define(`confTO_QUEUERETURN', confMESSAGE_TIMEOUT)',
4568651Seric		`define(`confTO_QUEUERETURN',
4668651Seric			substr(confMESSAGE_TIMEOUT, 0, _ARG_))
4768651Seric		 define(`confTO_QUEUEWARN',
4868651Seric			substr(confMESSAGE_TIMEOUT, eval(_ARG_+1)))')')
4968651Sericifdef(`confMIN_FREE_BLOCKS', `ifelse(index(confMIN_FREE_BLOCKS, /), -1,,
5068651Seric	`errprint(`*** compound confMIN_FREE_BLOCKS is obsolete.')
5168651Seric	 errprint(`    Use confMAX_MESSAGE_SIZE for the second part of the value.')')')
5268651Seric
5368651Seric# clean option definitions below....
5468651Sericdefine(`_OPTION', `ifdef(`$2', `O $1=$2', `#O $1`'ifelse($3, `',, `=$3')')')dnl
5568651Seric
5668651Sericdivert(0)dnl
5768651Seric
5851222Seric##################
5951222Seric#   local info   #
6051222Seric##################
6151222Seric
6251889SericCwlocalhost
6351887Sericifdef(`USE_CW_FILE',
6451889Seric`# file containing names of hosts for which we receive email
6564033SericFw`'confCW_FILE',
6664033Seric	`dnl')
6768651Seric
6864321Seric# my official domain name
6968651Seric# ... define this only if sendmail cannot automatically determine your domain
7068651Sericifdef(`confDOMAIN_NAME', `Dj`'confDOMAIN_NAME', `#Dj$w.Foo.COM')
7151222Seric
7268651Sericifdef(`_NULL_CLIENT_ONLY_', `divert(-1)')dnl
7364321Seric
7464321SericCP.
7564321Seric
7651222Sericifdef(`UUCP_RELAY',
7751222Seric`# UUCP relay host
7864033SericDY`'UUCP_RELAY
7960212SericCPUUCP
8057944Seric
8151222Seric')dnl
8251222Sericifdef(`BITNET_RELAY',
8351222Seric`#  BITNET relay host
8464033SericDB`'BITNET_RELAY
8560212SericCPBITNET
8657944Seric
8751222Seric')dnl
8858364Sericifdef(`FAX_RELAY',
8958364Seric`# FAX relay host
9064033SericDF`'FAX_RELAY
9160212SericCPFAX
9258364Seric
9358364Seric')dnl
9464321Seric# "Smart" relay host (may be null)
9564321SericDS`'ifdef(`SMART_HOST', SMART_HOST)
9651222Seric
9767914Sericifdef(`LUSER_RELAY',
9867914Seric`# place to which unknown users should be forwarded
9967914SericKuser user -m -a<>
10067914SericDL`'LUSER_RELAY
10167914Seric', `dnl')
10267914Seric
10368651Seric# operators that cannot be in local usernames (i.e., network indicators)
10468651SericCO @ % ifdef(`_NO_UUCP_', `', `!')
10568651Seric
10668651Seric# a class with just dot (for identifying canonical names)
10768651SericC..
10868651Seric
10958781Sericifdef(`MAILER_TABLE',
11058781Seric`# Mailer table (overriding domains)
11158781SericKmailertable MAILER_TABLE
11258781Seric
11358781Seric')dnl
11463754Sericifdef(`DOMAIN_TABLE',
11563754Seric`# Domain table (adding domains)
11663754SericKdomaintable DOMAIN_TABLE
11763754Seric
11863754Seric')dnl
11951222Seric# who I send unqualified names to (null means deliver locally)
12064033SericDR`'ifdef(`LOCAL_RELAY', LOCAL_RELAY)
12151222Seric
12257527Seric# who gets all local email traffic ($R has precedence for unqualified names)
12364033SericDH`'ifdef(`MAIL_HUB', MAIL_HUB)
12457527Seric
12557245Seric# class L: names that should be delivered locally, even if we have a relay
12657245Seric# class E: names that should be exposed as from this host, even if we masquerade
12767538Seric# class D: dotted names, e.g., root.machinename
12867538Seric#CL root
12967538SericCE root
13051279Sericundivert(5)dnl
13167538Sericifdef(`__DOTTED_USER_LIST__',
13267538Seric	`__DOTTED_USER_LIST__',
13367538Seric	`#CD postmaster')
13451279Seric
13567469Seric# dequoting map
13667469SericKdequote dequote
13757944Seric
13868651Sericdivert(0)dnl
13968651Seric# who I masquerade as (null for no masquerading)
14068651SericDM`'ifdef(`MASQUERADE_NAME', MASQUERADE_NAME)
14168651Seric
14259033Sericundivert(6)dnl
14359033Seric
14457944Seric######################
14557944Seric#   Special macros   #
14657944Seric######################
14757944Seric
14857944Seric# SMTP initial login message
14964033SericDe`'confSMTP_LOGIN_MSG
15057944Seric
15157944Seric# UNIX initial From header format
15264033SericDl`'confFROM_LINE
15357944Seric
15457944Seric# my name for error messages
15564033SericDn`'confMAILER_NAME
15657944Seric
15757944Seric# delimiter (operator) characters
15864033SericDo`'confOPERATORS
15957944Seric
16057944Seric# format of a total name
16167538SericDq`'ifdef(`confFROM_HEADER', confFROM_HEADER, `$?x$x <$g>$|$g$.')
16257944Sericinclude(`../m4/version.m4')
16357944Seric
16457944Seric###############
16557944Seric#   Options   #
16657944Seric###############
16757944Seric
16859887Seric# strip message body to 7 bits on input?
16968651Seric_OPTION(SevenBitInput, `confSEVEN_BIT_INPUT')
17057944Seric
17167550Seric# 8-bit data handling
17268651Seric_OPTION(EightBitMode, `confEIGHT_BIT_HANDLING', adaptive)
17367550Seric
17468651Seric# wait for alias file rebuild (default units: minutes)
17568651Seric_OPTION(AliasWait, `confALIAS_WAIT', 5m)
17657944Seric
17757944Seric# location of alias file
17868651SericO AliasFile=ifdef(`ALIAS_FILE', `ALIAS_FILE', /etc/aliases)
17957944Seric
18058084Seric# minimum number of free blocks on filesystem
18168651Seric_OPTION(MinFreeBlocks, `confMIN_FREE_BLOCKS', 100)
18258084Seric
18368651Seric# maximum message size
18468651Seric_OPTION(MaxMessageSize, `confMAX_MESSAGE_SIZE', 1000000)
18568651Seric
18657944Seric# substitution for space (blank) characters
18768651Seric_OPTION(BlankSub, `confBLANK_SUB', _)
18857944Seric
18965618Seric# avoid connecting to "expensive" mailers on initial submission?
19068651Seric_OPTION(HoldExpensive, `confCON_EXPENSIVE')
19157944Seric
19257944Seric# checkpoint queue runs after every N successful deliveries
19368651Seric_OPTION(CheckpointInterval, `confCHECKPOINT_INTERVAL', 10)
19457944Seric
19557944Seric# default delivery mode
19668651Seric_OPTION(DeliveryMode, `confDELIVERY_MODE', background)
19757944Seric
19857944Seric# automatically rebuild the alias database?
19968651Seric_OPTION(AutoRebuildAliases, `confAUTO_REBUILD')
20057944Seric
20164033Seric# error message header/file
20268651Seric_OPTION(ErrorHeader, `confERROR_MESSAGE', /etc/sendmail.oE)
20357944Seric
20457944Seric# error mode
20568651Seric_OPTION(ErrorMode, `confERROR_MODE', print)
20657944Seric
20757944Seric# save Unix-style "From_" lines at top of header?
20868651Seric_OPTION(SaveFromLine, `confSAVE_FROM_LINES')
20957944Seric
21057944Seric# temporary file mode
21168651Seric_OPTION(TempFileMode, `confTEMP_FILE_MODE', 0600)
21257944Seric
21357944Seric# match recipients against GECOS field?
21468651Seric_OPTION(MatchGECOS, `confMATCH_GECOS')
21557944Seric
21657944Seric# maximum hop count
21768651Seric_OPTION(MaxHopCount, `confMAX_HOP', 17)
21857944Seric
21957944Seric# location of help file
22068651SericO HelpFile=ifdef(`HELP_FILE', HELP_FILE, /usr/lib/sendmail.hf)
22157944Seric
22257944Seric# ignore dots as terminators in incoming messages?
22368651Seric_OPTION(IgnoreDots, `confIGNORE_DOTS')
22457944Seric
22568651Seric# name resolver options
22668651Seric_OPTION(ResolverOptions, `confBIND_OPTS', +AAONLY)
22757944Seric
22859887Seric# deliver MIME-encapsulated error messages?
22968651Seric_OPTION(SendMimeErrors, `confMIME_FORMAT_ERRORS')
23059887Seric
23157944Seric# Forward file search path
23268651Seric_OPTION(ForwardPath, `confFORWARD_PATH', /var/forward/$u:$z/.forward.$w:$z/.forward)
23357944Seric
23457944Seric# open connection cache size
23568651Seric_OPTION(ConnectionCacheSize, `confMCI_CACHE_SIZE', 2)
23657944Seric
23757944Seric# open connection cache timeout
23868651Seric_OPTION(ConnectionCacheTimeout, `confMCI_CACHE_TIMEOUT', 5m)
23957944Seric
24061106Seric# use Errors-To: header?
24168651Seric_OPTION(UseErrorsTo, `confUSE_ERRORS_TO')
24261106Seric
24357944Seric# log level
24468651Seric_OPTION(LogLevel, `confLOG_LEVEL', 10)
24557944Seric
24657944Seric# send to me too, even in an alias expansion?
24768651Seric_OPTION(MeToo, `confME_TOO')
24857944Seric
24957944Seric# verify RHS in newaliases?
25068651Seric_OPTION(CheckAliases, `confCHECK_ALIASES')
25157944Seric
25257944Seric# default messages to old style headers if no special punctuation?
25368651Seric_OPTION(OldStyleHeaders, `confOLD_STYLE_HEADERS')
25457944Seric
25558860Seric# SMTP daemon options
25668651Seric_OPTION(DaemonPortOptions, `confDAEMON_OPTIONS', Port=esmtp)
25758860Seric
25858084Seric# privacy flags
25968651Seric_OPTION(PrivacyOptions, `confPRIVACY_FLAGS', authwarnings)
26058084Seric
26157944Seric# who (if anyone) should get extra copies of error messages
26268651Seric_OPTION(PostMasterCopy, `confCOPY_ERRORS_TO', Postmaster)
26357944Seric
26457944Seric# slope of queue-only function
26568651Seric_OPTION(QueueFactor, `confQUEUE_FACTOR', 600000)
26657944Seric
26757944Seric# queue directory
26868651SericO QueueDirectory=ifdef(`QUEUE_DIR', QUEUE_DIR, /var/spool/mqueue)
26957944Seric
27068651Seric# timeouts (many of these)
27168651Seric_OPTION(Timeout.initial, `confTO_INITIAL', 5m)
27268651Seric_OPTION(Timeout.helo, `confTO_HELO', 5m)
27368651Seric_OPTION(Timeout.mail, `confTO_MAIL', 10m)
27468651Seric_OPTION(Timeout.rcpt, `confTO_RCPT', 1h)
27568651Seric_OPTION(Timeout.datainit, `confTO_DATAINIT', 5m)
27668651Seric_OPTION(Timeout.datablock, `confTO_DATABLOCK', 1h)
27768651Seric_OPTION(Timeout.datafinal, `confTO_DATAFINAL', 1h)
27868651Seric_OPTION(Timeout.rset, `confTO_RSET', 5m)
27968651Seric_OPTION(Timeout.quit, `confTO_QUIT', 2m)
28068651Seric_OPTION(Timeout.misc, `confTO_MISC', 2m)
28168651Seric_OPTION(Timeout.command, `confTO_COMMAND', 1h)
28268651Seric_OPTION(Timeout.ident, `confTO_IDENT', 30s)
28368651Seric_OPTION(Timeout.fileopen, `confTO_FILEOPEN', 60s)
28468651Seric_OPTION(Timeout.queuereturn, `confTO_QUEUERETURN', 5d)
28568651Seric_OPTION(Timeout.queuereturn.normal, `confTO_QUEUERETURN_NORMAL', 5d)
28668651Seric_OPTION(Timeout.queuereturn.urgent, `confTO_QUEUERETURN_URGENT', 2d)
28768651Seric_OPTION(Timeout.queuereturn.non-urgent, `confTO_QUEUERETURN_NONURGENT', 7d)
28868651Seric_OPTION(Timeout.queuewarn, `confTO_QUEUEWARN', 4h)
28968651Seric_OPTION(Timeout.queuewarn.normal, `confTO_QUEUEWARN_NORMAL', 4h)
29068651Seric_OPTION(Timeout.queuewarn.urgent, `confTO_QUEUEWARN_URGENT', 1h)
29168651Seric_OPTION(Timeout.queuewarn.non-urgent, `confTO_QUEUEWARN_NONURGENT', 12h)
29257944Seric
29367810Seric# should we not prune routes in route-addr syntax addresses?
29468651Seric_OPTION(DontPruneRoutes, `confDONT_PRUNE_ROUTES')
29567810Seric
29657944Seric# queue up everything before forking?
29768651Seric_OPTION(SuperSafe, `confSAFE_QUEUE')
29857944Seric
29957944Seric# status file
30068651Seric_OPTION(StatusFile, `STATUS_FILE', /etc/sendmail.st)
30157944Seric
30257944Seric# time zone handling:
30357944Seric#  if undefined, use system default
30457944Seric#  if defined but null, use TZ envariable passed in
30557944Seric#  if defined and non-null, use that info
30668651Sericifelse(confTIME_ZONE, `USE_SYSTEM', `#O TimeZoneSpec=',
30768651Seric	confTIME_ZONE, `USE_TZ', `O TimeZoneSpec=',
30868651Seric	`O TimeZoneSpec=confTIME_ZONE')
30957944Seric
31068651Seric# default UID (can be username or userid:groupid)
31168651Seric_OPTION(DefaultUser, `confDEF_USER_ID', nobody)
31257944Seric
31351887Seric# list of locations of user database file (null means no lookup)
31468651Seric_OPTION(UserDatabaseSpec, `confUSERDB_SPEC', /etc/userdb)
31551222Seric
31658860Seric# fallback MX host
31768651Seric_OPTION(FallbackMXhost, `confFALLBACK_MX', fall.back.host.net)
31858860Seric
31963858Seric# if we are the best MX host for a site, try it directly instead of config err
32068651Seric_OPTION(TryNullMXList, `confTRY_NULL_MX_LIST')
32163858Seric
32257944Seric# load average at which we just queue messages
32368651Seric_OPTION(QueueLA, `confQUEUE_LA', 8)
32457944Seric
32557944Seric# load average at which we refuse connections
32668651Seric_OPTION(RefuseLA, `confREFUSE_LA', 12)
32757944Seric
32857944Seric# work recipient factor
32968651Seric_OPTION(RecipientFactor, `confWORK_RECIPIENT_FACTOR', 30000)
33057944Seric
33157944Seric# deliver each queued job in a separate process?
33268651Seric_OPTION(ForkEachJob, `confSEPARATE_PROC')
33357944Seric
33457944Seric# work class factor
33568651Seric_OPTION(ClassFactor, `confWORK_CLASS_FACTOR', 1800)
33657944Seric
33757944Seric# work time factor
33868651Seric_OPTION(RetryFactor, `confWORK_TIME_FACTOR', 90000)
33957944Seric
34067697Seric# shall we sort the queue by hostname first?
34168651Seric_OPTION(QueueSortOrder, `confQUEUE_SORT_ORDER', priority)
34267697Seric
34368651Seric# minimum time in queue before retry
34468651Seric_OPTION(MinQueueAge, `confMIN_QUEUE_AGE', 30m)
34568651Seric
34668651Seric# default character set
34768651Seric_OPTION(DefaultCharSet, `confDEF_CHAR_SET', iso-8859-1)
34868651Seric
34968651Seric# service switch file (ignored on Solaris, Ultrix, OSF/1, others)
35068651Seric_OPTION(ServiceSwitchFile, `confSERVICE_SWITCH_FILE', /etc/service.switch)
35168651Seric
35268651Seric# dialup line delay on connection failure
35368651Seric_OPTION(DialDelay, `confDIAL_DELAY', 10s)
35468651Seric
35568651Seric# action to take if there are no recipients in the message
35668651Seric_OPTION(NoRecipientAction, `confNO_RCPT_ACTION', add-to-undisclosed)
35768651Seric
35868651Seric# chrooted environment for writing to files
35968651Seric_OPTION(SafeFileEnvironment, `confSAFE_FILE_ENV', /arch)
36068651Seric
36168806Seric# are colons OK in addresses?
36268806Seric_OPTION(ColonOkInAddr, `confCOLON_OK_IN_ADDR')
36368806Seric
36457944Seric###########################
36557944Seric#   Message precedences   #
36657944Seric###########################
36757944Seric
36857944SericPfirst-class=0
36957944SericPspecial-delivery=100
37058070SericPlist=-30
37157944SericPbulk=-60
37257944SericPjunk=-100
37357944Seric
37457944Seric#####################
37557944Seric#   Trusted users   #
37657944Seric#####################
37757944Seric
37868651Seric# this is equivalent to setting class "t"
37968651Seric#Ft/etc/sendmail.trusted
38057944SericTroot
38157944SericTdaemon
38257944SericTuucp
38357944Seric
38457944Seric#########################
38557944Seric#   Format of headers   #
38657944Seric#########################
38757944Seric
38858679SericH?P?Return-Path: $g
38967819SericHReceived: confRECEIVED_HEADER
39057944SericH?D?Resent-Date: $a
39157944SericH?D?Date: $a
39257944SericH?F?Resent-From: $q
39357944SericH?F?From: $q
39457944SericH?x?Full-Name: $x
39557944SericHSubject:
39657944Seric# HPosted-Date: $a
39757944Seric# H?l?Received-Date: $b
39857944SericH?M?Resent-Message-Id: <$t.$i@$j>
39957944SericH?M?Message-Id: <$t.$i@$j>
40068651Sericifdef(`_NULL_CLIENT_ONLY_',
40168651Seric	`include(../m4/nullrelay.m4)m4exit',
40268651Seric	`dnl')
40351222Seric#
40451222Seric######################################################################
40551222Seric######################################################################
40651222Seric#####
40751222Seric#####			REWRITING RULES
40851222Seric#####
40951222Seric######################################################################
41051222Seric######################################################################
41151222Seric
41258678Sericundivert(9)dnl
41351222Seric
41451222Seric###########################################
41551222Seric###  Rulset 3 -- Name Canonicalization  ###
41651222Seric###########################################
41751260SericS3
41851222Seric
41964802Seric# handle null input (translate to <@> special case)
42058499SericR$@			$@ <@>
42158174Seric
42268763Seric# strip group: syntax (not inside angle brackets!) and trailing semicolon
42368763SericR$*			$: $1 <@>			mark addresses
42468763SericR$* < $* > $* <@>	$: $1 < $2 > $3			unmark <addr>
42568763SericR$* :: $* <@>		$: $1 :: $2			unmark host::addr
42668763SericR$* : $* <@>		$: $2				strip colon if marked
42768763SericR$* <@>			$: $1				unmark
42868763SericR$* ;			$: $1				strip trailing semi
42968763Seric
43068763Seric# null input now results from list:; syntax
43168763SericR$@			$@ :; <@>
43268763Seric
43351222Seric# basic textual canonicalization -- note RFC733 heuristic here
43464144SericR$*<$*>$*<$*>$*		$2$3<$4>$5			strip multiple <> <>
43558158SericR$*<$*<$+>$*>$*		<$3>$5				2-level <> nesting
43658499SericR$*<>$*			$@ <@>				MAIL FROM:<> case
43751222SericR$*<$+>$*		$2				basic RFC821/822 parsing
43851222Seric
43951222Seric# make sure <@a,@b,@c:user@d> syntax is easy to parse -- undone later
44055416SericR@ $+ , $+		@ $1 : $2			change all "," to ":"
44151222Seric
44251222Seric# localize and dispose of route-based addresses
44367469SericR@ $+ : $+		$@ $>96 < @$1 > : $2		handle <route-addr>
44451222Seric
44551222Seric# find focus for list syntax
44667469SericR $+ : $* ; @ $+	$@ $>96 $1 : $2 ; < @ $3 >	list syntax
44755416SericR $+ : $* ;		$@ $1 : $2;			list syntax
44851222Seric
44951222Seric# find focus for @ syntax addresses
45055416SericR$+ @ $+		$: $1 < @ $2 >			focus on domain
45155416SericR$+ < $+ @ $+ >		$1 $2 < @ $3 >			move gaze right
45267469SericR$+ < @ $+ >		$@ $>96 $1 < @ $2 >		already canonical
45351222Seric
45464968Seric# do some sanity checking
45564968SericR$* < @ $* : $* > $*	$1 < @ $2 $3 > $4		nix colons in addrs
45664968Seric
45758288Sericifdef(`_NO_UUCP_', `dnl',
45858288Seric`# convert old-style addresses to a domain-based address
45967469SericR$- ! $+		$@ $>96 $2 < @ $1 .UUCP >	resolve uucp names
46067469SericR$+ . $- ! $+		$@ $>96 $3 < @ $1 . $2 >		domain uucps
46167469SericR$+ ! $+		$@ $>96 $2 < @ $1 .UUCP >	uucp subdomains')
46251222Seric
46351222Seric# if we have % signs, take the rightmost one
46455416SericR$* % $*		$1 @ $2				First make them all @s.
46555416SericR$* @ $* @ $*		$1 % $2 @ $3			Undo all but the last.
46667469SericR$* @ $*		$@ $>96 $1 < @ $2 >		Insert < > and finish
46751222Seric
46851222Seric# else we must be a local name
46951222Seric
47051222Seric
47160894Seric################################################
47267469Seric###  Ruleset 96 -- bottom half of ruleset 3  ###
47360894Seric################################################
47451222Seric
47557245Seric#  At this point, everything should be in a "local_part<@domain>extra" format.
47667469SericS96
47751222Seric
47851222Seric# handle special cases for local names
47960262SericR$* < @ localhost > $*		$: $1 < @ $j . > $2		no domain at all
48060262SericR$* < @ localhost . $m > $*	$: $1 < @ $j . > $2		local domain
48160262Sericifdef(`_NO_UUCP_', `dnl',
48260262Seric`R$* < @ localhost . UUCP > $*	$: $1 < @ $j . > $2		.UUCP domain')
48365825SericR$* < @ [ $+ ] > $*		$: $1 < @@ [ $2 ] > $3		mark [a.b.c.d]
48465825SericR$* < @@ $=w > $*		$: $1 < @ $j . > $3		self-literal
48566306SericR$* < @@ $+ > $*		$@ $1 < @ $2 > $3		canon IP addr
48663754Sericifdef(`DOMAIN_TABLE', `
48767450Seric# look up domains in the domain table
48867450SericR$* < @ $+ > $*			$: $1 < @ $(domaintable $2 $) > $3',
48963754Seric`dnl')
49051889Sericundivert(2)dnl
49151222Seric
49259081Sericifdef(`_NO_UUCP_', `dnl',
49359081Seric`ifdef(`UUCP_RELAY',
49451274Seric`# pass UUCP addresses straight through
49564971SericR$* < @ $+ . UUCP > $*		$@ $1 < @ $2 . UUCP . > $3',
49651274Seric`# if really UUCP, handle it immediately
49751322Sericifdef(`_CLASS_U_',
49864971Seric`R$* < @ $=U . UUCP > $*	$@ $1 < @ $2 . UUCP . > $3', `dnl')
49951322Sericifdef(`_CLASS_V_',
50064971Seric`R$* < @ $=V . UUCP > $*	$@ $1 < @ $2 . UUCP . > $3', `dnl')
50151322Sericifdef(`_CLASS_W_',
50264971Seric`R$* < @ $=W . UUCP > $*	$@ $1 < @ $2 . UUCP . > $3', `dnl')
50351322Sericifdef(`_CLASS_X_',
50464971Seric`R$* < @ $=X . UUCP > $*	$@ $1 < @ $2 . UUCP . > $3', `dnl')
50551322Sericifdef(`_CLASS_Y_',
50664971Seric`R$* < @ $=Y . UUCP > $*	$@ $1 < @ $2 . UUCP . > $3', `dnl')
50751267Seric
50851267Seric# try UUCP traffic as a local address
50964971SericR$* < @ $+ . UUCP > $*		$: $1 < @ $[ $2 $] . UUCP . > $3
51067469SericR$* < @ $+ . . UUCP . > $*		$@ $1 < @ $2 . > $3')
51159081Seric')
51265061Sericifdef(`_NO_CANONIFY_', `dnl',
51359081Seric`# pass to name server to make hostname canonical
51461470SericR$* < @ $* $~P > $*		$: $1 < @ $[ $2 $3 $] > $4')
51561470Seric
51665061Seric# local host aliases and pseudo-domains are always canonical
51765061SericR$* < @ $=w > $*		$: $1 < @ $2 . > $3
51864971SericR$* < @ $* $=P > $*		$: $1 < @ $2 $3 . > $4
51965061SericR$* < @ $* . . > $*		$1 < @ $2 . > $3
52064971Seric
52151322Seric# if this is the local hostname, make sure we treat is as canonical
52251322SericR$* < @ $j > $*			$: $1 < @ $j . > $2
52351222Seric
52451322Seric
52551222Seric##################################################
52651222Seric###  Ruleset 4 -- Final Output Post-rewriting  ###
52751222Seric##################################################
52851222SericS4
52951222Seric
53058499SericR$*<@>			$@ $1				handle <> and list:;
53151222Seric
53251322Seric# strip trailing dot off possibly canonical name
53351322SericR$* < @ $+ . > $*	$1 < @ $2 > $3
53451322Seric
53551222Seric# externalize local domain info
53651322SericR$* < $+ > $*		$1 $2 $3			defocus
53751322SericR@ $+ : @ $+ : $+	@ $1 , @ $2 : $3		<route-addr> canonical
53851997SericR@ $*			$@ @ $1				... and exit
53951222Seric
54058288Sericifdef(`_NO_UUCP_', `dnl',
54158288Seric`# UUCP must always be presented in old form
54258288SericR$+ @ $- . UUCP		$2!$1				u@h.UUCP => h!u')
54351222Seric
54451222Seric# delete duplicate local names
54551322SericR$+ % $=w @ $=w		$1 @ $j				u%host@host => u@host
54651222Seric
54751222Seric
54851222Seric
54960894Seric##############################################################
55067469Seric###   Ruleset 97 -- recanonicalize and call ruleset zero   ###
55160894Seric###		   (used for recursive calls)		   ###
55260894Seric##############################################################
55351222Seric
55467469SericS`'97
55551222SericR$*			$: $>3 $1
55651222SericR$*			$@ $>0 $1
55751222Seric
55851222Seric
55951222Seric######################################
56051222Seric###   Ruleset 0 -- Parse Address   ###
56151222Seric######################################
56251222Seric
56351222SericS0
56451222Seric
56567118SericR<@>			$#_LOCAL_ $: <@>		special case error msgs
56666035SericR$* : $* ;		$#error $@ USAGE $: "list:; syntax illegal for recipient addresses"
56765048SericR<@ $+>			$#error $@ USAGE $: "user address required"
56867118SericR$* <$* : $* > $*	$#error $@ USAGE $: "colon illegal in host name part"
56967132SericR$* < @ . > $*		$#error $@ USAGE $: "invalid host name"
57058340Seric
57155416Sericifdef(`_MAILER_smtp_',
57255416Seric`# handle numeric address spec
57367469SericR$* < @ [ $+ ] > $*	$: $>98 $1 < @ [ $2 ] > $3	numeric internet spec
57465191SericR$* < @ [ $+ ] > $*	$#_SMTP_ $@ [$2] $: $1 < @ [$2] > $3	still numeric: send',
57563858Seric	`dnl')
57651222Seric
57751887Seric# now delete the local info -- note $=O to find characters that cause forwarding
57867469SericR$* < @ > $*		$@ $>97 $1		user@ => user
57967469SericR< @ $=w . > : $*	$@ $>97 $2		@here:... -> ...
58067469SericR$* $=O $* < @ $=w . >	$@ $>97 $1 $2 $3		...@here -> ...
58163967Seric
58263967Seric# handle local hacks
58367469SericR$*			$: $>98 $1
58466048Seric
58566048Seric# short circuit local delivery so forwarded email works
58667914Sericifdef(`_STICKY_LOCAL_DOMAIN_',
58767914Seric`R$+ < @ $=w . >		$: < $H > $1 < @ $2 . >		first try hub
58868698SericR< $+ > $+ < $+ >	$>95 < $1 > $2 < $3 >		yep ....
58967914SericR< > $=D . $+ < $+ >	$#_LOCAL_ $: $1 . $2		dotted name?
59068155SericR< > $+ + $* < $+ >	$#_LOCAL_ $: $1 + $2		plussed name?
59167914SericR< > $+ < $+ >		$#_LOCAL_ $: @ $1			nope, local address',
59268698Seric`R$=L < @ $=w . >	$#_LOCAL_ $: @ $1		special local names
59368155SericR$+ < @ $=w . >		$#_LOCAL_ $: $1			regular local name')
59466090Sericifdef(`MAILER_TABLE',
59566090Seric`
59666090Seric# not local -- try mailer table lookup
59766090SericR$* <@ $+ > $*		$: < $2 > $1 < @ $2 > $3	extract host name
59866090SericR< $+ . > $*		$: < $1 > $2			strip trailing dot
59966090SericR< $+ > $*		$: < $(mailertable $1 $) > $2	lookup
60066090SericR< $- : $+ > $*		$# $1 $@ $2 $: $3		check -- resolved?
60166090SericR< $+ > $*		$: $>90 <$1> $2			try domain',
60266090Seric`dnl')
60351260Sericundivert(4)dnl
60451260Seric
60561468Sericifdef(`_NO_UUCP_', `dnl',
60661468Seric`# resolve remotely connected UUCP links (if any)
60751285Sericifdef(`_CLASS_V_',
60867469Seric`R$* < @ $=V . UUCP . > $*		$: $>95 < $V > $1 <@$2.UUCP.> $3',
60952044Seric	`dnl')
61051285Sericifdef(`_CLASS_W_',
61167469Seric`R$* < @ $=W . UUCP . > $*		$: $>95 < $W > $1 <@$2.UUCP.> $3',
61252044Seric	`dnl')
61351285Sericifdef(`_CLASS_X_',
61467469Seric`R$* < @ $=X . UUCP . > $*		$: $>95 < $X > $1 <@$2.UUCP.> $3',
61561468Seric	`dnl')')
61651260Seric
61751222Seric# resolve fake top level domains by forwarding to other hosts
61851222Sericifdef(`BITNET_RELAY',
61967469Seric`R$*<@$+.BITNET.>$*	$: $>95 < $B > $1 <@$2.BITNET.> $3	user@host.BITNET',
62051222Seric	`dnl')
62165149Sericifdef(`_MAILER_pop_',
62265149Seric`R$+ < @ POP. >		$#pop $: $1			user@POP',
62365149Seric	`dnl')
62458364Sericifdef(`_MAILER_fax_',
62564971Seric`R$+ < @ $+ .FAX. >	$#fax $@ $2 $: $1		user@host.FAX',
62658364Seric`ifdef(`FAX_RELAY',
62767469Seric`R$*<@$+.FAX.>$*		$: $>95 < $F > $1 <@$2.FAX.> $3	user@host.FAX',
62858364Seric	`dnl')')
62951222Seric
63051260Sericifdef(`UUCP_RELAY',
63151260Seric`# forward non-local UUCP traffic to our UUCP relay
63267469SericR$*<@$*.UUCP.>$*		$: $>95 < $Y > $1 <@$2.UUCP.> $3	uucp mail',
63355416Seric`ifdef(`_MAILER_uucp_',
63451260Seric`# forward other UUCP traffic straight to UUCP
63565557SericR$* < @ $+ .UUCP. > $*		$#uucp $@ $2 $: $1 < @ $2 .UUCP. > $3	user@host.UUCP',
63651260Seric	`dnl')')
63763967Sericifdef(`_MAILER_usenet_', `
63863754Seric# addresses sent to net.group.USENET will get forwarded to a newsgroup
63965851SericR$+ . USENET		$#usenet $: $1',
64063860Seric	`dnl')
64163754Seric
64258070Sericifdef(`_LOCAL_RULES_',
64358070Seric`# figure out what should stay in our local mail system
64463754Sericundivert(1)', `dnl')
64563754Seric
64664321Seric# pass names that still have a host to a smarthost (if defined)
64767469SericR$* < @ $* > $*		$: $>95 < $S > $1 < @ $2 > $3	glue on smarthost name
64863754Seric
64964321Seric# deal with other remote names
65063946Sericifdef(`_MAILER_smtp_',
65163973Seric`R$* < @$* > $*		$#_SMTP_ $@ $2 $: $1 < @ $2 > $3		user@host.domain',
65264321Seric`R$* < @$* > $*		$#error $@NOHOST $: Unrecognized host name $2')
65351222Seric
65467469Seric# if this is quoted, strip the quotes and try again
65558811SericR$+			$: $(dequote $1 $)		strip quotes
65667469SericR$+ $=O $+		$@ $>97 $1 $2 $3			try again
65758811Seric
65858811Seric# handle locally delivered names
65963998SericR$=L			$#_LOCAL_ $: @ $1			special local names
66063998SericR$+			$#_LOCAL_ $: $1			regular local names
66151222Seric
66255416Seric###########################################################################
66355416Seric###   Ruleset 5 -- special rewriting after aliases have been expanded   ###
66455416Seric###########################################################################
66551222Seric
66651322SericS5
66751322Seric
66867538Seric# if we have a "special dotted user", convert it back to the base name
66967538SericR$=D . *		$#_LOCAL_ $: $1
67067538SericR$=D . $+		$#_LOCAL_ $: $1 . *
67167538Seric
67267914Seric# prepend an empty "forward host" on the front
67367914SericR$+			$: <> $1
67467914Seric
67567914Sericifdef(`LUSER_RELAY',
67667914Seric`# send unrecognized local users to a relay host
67768149SericR< > $+ + $*		$: < $L . > $( user $1 $) + $2
67868149SericR< > $+			$: < $L . > $( user $1 $)	look up user
67968149SericR< $* > $+ <> $*	$: < > $2 $3			found; strip $L
68068149SericR< $* . > $+		$: < $1 > $2			strip extra dot')
68167914Seric
68268149Seric# handle plussed local names
68368149SericR< > $+ + $*		$#_LOCAL_ $@ $2 $: $1
68468149Seric
68558808Seric# see if we have a relay or a hub
68668698SericR< > $+			$: < $H > $1			try hub
68767914SericR< > $+			$: < $R > $1			try relay
68866048SericR< > $+			$@ $1				nope, give up
68967469SericR< $- : $+ > $+		$: $>95 < $1 : $2 > $3 < @ $2 >
69067469SericR< $+ > $+		$@ $>95 < $1 > $2 < @ $1 >
69160540Sericifdef(`MAILER_TABLE',
69260540Seric`
69360540Seric
69463858Seric###################################################################
69563858Seric###  Ruleset 90 -- try domain part of mailertable entry 	###
69663858Seric###################################################################
69760540Seric
69860540SericS90
69966091SericR$* <$- . $+ > $*	$: $1$2 < $(mailertable .$3 $@ $1$2 $@ $2 $) > $4
70066081SericR$* <$- : $+ > $*	$# $2 $@ $3 $: $4		check -- resolved?
70166081SericR$* < . $+ > $*		$@ $>90 $1 . <$2> $3		no -- strip & try again
70266094SericR$* < $* > $*		$: < $(mailertable . $@ $1$2 $) > $3	try "."
70366090SericR<$- : $+ > $*		$# $1 $@ $2 $: $3		"." found?
70466090SericR< $* > $*		$@ $2				no mailertable match',
70560540Seric`dnl')
70663858Seric
70763858Seric###################################################################
70867469Seric###  Ruleset 95 -- canonify mailer:host syntax to triple	###
70964010Seric###################################################################
71064010Seric
71167469SericS95
71264010SericR< > $*			$@ $1				strip off null relay
71364010SericR< $- : $+ > $*		$# $1 $@ $2 $: $3		try qualified mailer
71464010SericR< $=w > $*		$@ $2				delete local host
71564010SericR< $+ > $*		$#_RELAY_ $@ $1 $: $2		use unqualified mailer
71664010Seric
71764010Seric###################################################################
71867469Seric###  Ruleset 98 -- local part of ruleset zero (can be null)	###
71963858Seric###################################################################
72063858Seric
72167469SericS98
72263858Sericundivert(3)dnl
72351222Seric#
72451222Seric######################################################################
72551222Seric######################################################################
72651222Seric#####
72756790Seric`#####			MAILER DEFINITIONS'
72851222Seric#####
72951222Seric######################################################################
73051222Seric######################################################################
73151222Sericundivert(7)dnl
732