xref: /csrg-svn/usr.sbin/sendmail/cf/m4/proto.m4 (revision 68763)
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*68763SericVERSIONID(`@(#)proto.m4	8.65 (Berkeley) 04/10/95')
1251222Seric
1351322SericMAILER(local)dnl
1451222Seric
1567696Seric# level 6 config file format
1668651SericV6/Berkeley
1768651Sericdivert(-1)
1868651Seric
1968651Seric# pick our default mailers
2068651Sericifdef(`confSMTP_MAILER',, `define(`confSMTP_MAILER', `smtp')')
2168651Sericifdef(`confLOCAL_MAILER',, `define(`confLOCAL_MAILER', `local')')
2264010Sericifdef(`confRELAY_MAILER',,
2364010Seric	`define(`confRELAY_MAILER',
2464010Seric		`ifdef(`_MAILER_smtp_', `relay',
2568651Seric			`ifdef(`_MAILER_uucp', `suucp', `unknown')')')')
2663998Sericdefine(`_SMTP_', `confSMTP_MAILER')dnl		for readability only
2763998Sericdefine(`_LOCAL_', `confLOCAL_MAILER')dnl	for readability only
2864010Sericdefine(`_RELAY_', `confRELAY_MAILER')dnl	for readability only
2952646Seric
3068651Seric# back compatibility with old config files
3168651Sericifdef(`confDEF_GROUP_ID',
3268651Seric	`errprint(`*** confDEF_GROUP_ID is obsolete.')
3368651Seric	 errprint(`    Use confDEF_USER_ID with a colon in the value instead.')')
3468651Sericifdef(`confREAD_TIMEOUT',
3568651Seric	`errprint(`*** confREAD_TIMEOUT is obsolete.')
3668651Seric	 errprint(`    Use individual confTO_<timeout> parameters instead.')')
3768651Sericifdef(`confMESSAGE_TIMEOUT',
3868651Seric	`define(`_ARG_', index(confMESSAGE_TIMEOUT, /))
3968651Seric	 ifelse(_ARG_, -1,
4068651Seric		`define(`confTO_QUEUERETURN', confMESSAGE_TIMEOUT)',
4168651Seric		`define(`confTO_QUEUERETURN',
4268651Seric			substr(confMESSAGE_TIMEOUT, 0, _ARG_))
4368651Seric		 define(`confTO_QUEUEWARN',
4468651Seric			substr(confMESSAGE_TIMEOUT, eval(_ARG_+1)))')')
4568651Sericifdef(`confMIN_FREE_BLOCKS', `ifelse(index(confMIN_FREE_BLOCKS, /), -1,,
4668651Seric	`errprint(`*** compound confMIN_FREE_BLOCKS is obsolete.')
4768651Seric	 errprint(`    Use confMAX_MESSAGE_SIZE for the second part of the value.')')')
4868651Seric
4968651Seric# clean option definitions below....
5068651Sericdefine(`_OPTION', `ifdef(`$2', `O $1=$2', `#O $1`'ifelse($3, `',, `=$3')')')dnl
5168651Seric
5268651Sericdivert(0)dnl
5368651Seric
5451222Seric##################
5551222Seric#   local info   #
5651222Seric##################
5751222Seric
5851889SericCwlocalhost
5951887Sericifdef(`USE_CW_FILE',
6051889Seric`# file containing names of hosts for which we receive email
6164033SericFw`'confCW_FILE',
6264033Seric	`dnl')
6368651Seric
6464321Seric# my official domain name
6568651Seric# ... define this only if sendmail cannot automatically determine your domain
6668651Sericifdef(`confDOMAIN_NAME', `Dj`'confDOMAIN_NAME', `#Dj$w.Foo.COM')
6751222Seric
6868651Sericifdef(`_NULL_CLIENT_ONLY_', `divert(-1)')dnl
6964321Seric
7064321SericCP.
7164321Seric
7251222Sericifdef(`UUCP_RELAY',
7351222Seric`# UUCP relay host
7464033SericDY`'UUCP_RELAY
7560212SericCPUUCP
7657944Seric
7751222Seric')dnl
7851222Sericifdef(`BITNET_RELAY',
7951222Seric`#  BITNET relay host
8064033SericDB`'BITNET_RELAY
8160212SericCPBITNET
8257944Seric
8351222Seric')dnl
8458364Sericifdef(`FAX_RELAY',
8558364Seric`# FAX relay host
8664033SericDF`'FAX_RELAY
8760212SericCPFAX
8858364Seric
8958364Seric')dnl
9064321Seric# "Smart" relay host (may be null)
9164321SericDS`'ifdef(`SMART_HOST', SMART_HOST)
9251222Seric
9367914Sericifdef(`LUSER_RELAY',
9467914Seric`# place to which unknown users should be forwarded
9567914SericKuser user -m -a<>
9667914SericDL`'LUSER_RELAY
9767914Seric', `dnl')
9867914Seric
9968651Seric# operators that cannot be in local usernames (i.e., network indicators)
10068651SericCO @ % ifdef(`_NO_UUCP_', `', `!')
10168651Seric
10268651Seric# a class with just dot (for identifying canonical names)
10368651SericC..
10468651Seric
10558781Sericifdef(`MAILER_TABLE',
10658781Seric`# Mailer table (overriding domains)
10758781SericKmailertable MAILER_TABLE
10858781Seric
10958781Seric')dnl
11063754Sericifdef(`DOMAIN_TABLE',
11163754Seric`# Domain table (adding domains)
11263754SericKdomaintable DOMAIN_TABLE
11363754Seric
11463754Seric')dnl
11551222Seric# who I send unqualified names to (null means deliver locally)
11664033SericDR`'ifdef(`LOCAL_RELAY', LOCAL_RELAY)
11751222Seric
11857527Seric# who gets all local email traffic ($R has precedence for unqualified names)
11964033SericDH`'ifdef(`MAIL_HUB', MAIL_HUB)
12057527Seric
12157245Seric# class L: names that should be delivered locally, even if we have a relay
12257245Seric# class E: names that should be exposed as from this host, even if we masquerade
12367538Seric# class D: dotted names, e.g., root.machinename
12467538Seric#CL root
12567538SericCE root
12651279Sericundivert(5)dnl
12767538Sericifdef(`__DOTTED_USER_LIST__',
12867538Seric	`__DOTTED_USER_LIST__',
12967538Seric	`#CD postmaster')
13051279Seric
13167469Seric# dequoting map
13267469SericKdequote dequote
13357944Seric
13468651Sericdivert(0)dnl
13568651Seric# who I masquerade as (null for no masquerading)
13668651SericDM`'ifdef(`MASQUERADE_NAME', MASQUERADE_NAME)
13768651Seric
13859033Sericundivert(6)dnl
13959033Seric
14057944Seric######################
14157944Seric#   Special macros   #
14257944Seric######################
14357944Seric
14457944Seric# SMTP initial login message
14564033SericDe`'confSMTP_LOGIN_MSG
14657944Seric
14757944Seric# UNIX initial From header format
14864033SericDl`'confFROM_LINE
14957944Seric
15057944Seric# my name for error messages
15164033SericDn`'confMAILER_NAME
15257944Seric
15357944Seric# delimiter (operator) characters
15464033SericDo`'confOPERATORS
15557944Seric
15657944Seric# format of a total name
15767538SericDq`'ifdef(`confFROM_HEADER', confFROM_HEADER, `$?x$x <$g>$|$g$.')
15857944Sericinclude(`../m4/version.m4')
15957944Seric
16057944Seric###############
16157944Seric#   Options   #
16257944Seric###############
16357944Seric
16459887Seric# strip message body to 7 bits on input?
16568651Seric_OPTION(SevenBitInput, `confSEVEN_BIT_INPUT')
16657944Seric
16767550Seric# 8-bit data handling
16868651Seric_OPTION(EightBitMode, `confEIGHT_BIT_HANDLING', adaptive)
16967550Seric
17068651Seric# wait for alias file rebuild (default units: minutes)
17168651Seric_OPTION(AliasWait, `confALIAS_WAIT', 5m)
17257944Seric
17357944Seric# location of alias file
17468651SericO AliasFile=ifdef(`ALIAS_FILE', `ALIAS_FILE', /etc/aliases)
17557944Seric
17658084Seric# minimum number of free blocks on filesystem
17768651Seric_OPTION(MinFreeBlocks, `confMIN_FREE_BLOCKS', 100)
17858084Seric
17968651Seric# maximum message size
18068651Seric_OPTION(MaxMessageSize, `confMAX_MESSAGE_SIZE', 1000000)
18168651Seric
18257944Seric# substitution for space (blank) characters
18368651Seric_OPTION(BlankSub, `confBLANK_SUB', _)
18457944Seric
18565618Seric# avoid connecting to "expensive" mailers on initial submission?
18668651Seric_OPTION(HoldExpensive, `confCON_EXPENSIVE')
18757944Seric
18857944Seric# checkpoint queue runs after every N successful deliveries
18968651Seric_OPTION(CheckpointInterval, `confCHECKPOINT_INTERVAL', 10)
19057944Seric
19157944Seric# default delivery mode
19268651Seric_OPTION(DeliveryMode, `confDELIVERY_MODE', background)
19357944Seric
19457944Seric# automatically rebuild the alias database?
19568651Seric_OPTION(AutoRebuildAliases, `confAUTO_REBUILD')
19657944Seric
19764033Seric# error message header/file
19868651Seric_OPTION(ErrorHeader, `confERROR_MESSAGE', /etc/sendmail.oE)
19957944Seric
20057944Seric# error mode
20168651Seric_OPTION(ErrorMode, `confERROR_MODE', print)
20257944Seric
20357944Seric# save Unix-style "From_" lines at top of header?
20468651Seric_OPTION(SaveFromLine, `confSAVE_FROM_LINES')
20557944Seric
20657944Seric# temporary file mode
20768651Seric_OPTION(TempFileMode, `confTEMP_FILE_MODE', 0600)
20857944Seric
20957944Seric# match recipients against GECOS field?
21068651Seric_OPTION(MatchGECOS, `confMATCH_GECOS')
21157944Seric
21257944Seric# maximum hop count
21368651Seric_OPTION(MaxHopCount, `confMAX_HOP', 17)
21457944Seric
21557944Seric# location of help file
21668651SericO HelpFile=ifdef(`HELP_FILE', HELP_FILE, /usr/lib/sendmail.hf)
21757944Seric
21857944Seric# ignore dots as terminators in incoming messages?
21968651Seric_OPTION(IgnoreDots, `confIGNORE_DOTS')
22057944Seric
22168651Seric# name resolver options
22268651Seric_OPTION(ResolverOptions, `confBIND_OPTS', +AAONLY)
22357944Seric
22459887Seric# deliver MIME-encapsulated error messages?
22568651Seric_OPTION(SendMimeErrors, `confMIME_FORMAT_ERRORS')
22659887Seric
22757944Seric# Forward file search path
22868651Seric_OPTION(ForwardPath, `confFORWARD_PATH', /var/forward/$u:$z/.forward.$w:$z/.forward)
22957944Seric
23057944Seric# open connection cache size
23168651Seric_OPTION(ConnectionCacheSize, `confMCI_CACHE_SIZE', 2)
23257944Seric
23357944Seric# open connection cache timeout
23468651Seric_OPTION(ConnectionCacheTimeout, `confMCI_CACHE_TIMEOUT', 5m)
23557944Seric
23661106Seric# use Errors-To: header?
23768651Seric_OPTION(UseErrorsTo, `confUSE_ERRORS_TO')
23861106Seric
23957944Seric# log level
24068651Seric_OPTION(LogLevel, `confLOG_LEVEL', 10)
24157944Seric
24257944Seric# send to me too, even in an alias expansion?
24368651Seric_OPTION(MeToo, `confME_TOO')
24457944Seric
24557944Seric# verify RHS in newaliases?
24668651Seric_OPTION(CheckAliases, `confCHECK_ALIASES')
24757944Seric
24857944Seric# default messages to old style headers if no special punctuation?
24968651Seric_OPTION(OldStyleHeaders, `confOLD_STYLE_HEADERS')
25057944Seric
25158860Seric# SMTP daemon options
25268651Seric_OPTION(DaemonPortOptions, `confDAEMON_OPTIONS', Port=esmtp)
25358860Seric
25458084Seric# privacy flags
25568651Seric_OPTION(PrivacyOptions, `confPRIVACY_FLAGS', authwarnings)
25658084Seric
25757944Seric# who (if anyone) should get extra copies of error messages
25868651Seric_OPTION(PostMasterCopy, `confCOPY_ERRORS_TO', Postmaster)
25957944Seric
26057944Seric# slope of queue-only function
26168651Seric_OPTION(QueueFactor, `confQUEUE_FACTOR', 600000)
26257944Seric
26357944Seric# queue directory
26468651SericO QueueDirectory=ifdef(`QUEUE_DIR', QUEUE_DIR, /var/spool/mqueue)
26557944Seric
26668651Seric# timeouts (many of these)
26768651Seric_OPTION(Timeout.initial, `confTO_INITIAL', 5m)
26868651Seric_OPTION(Timeout.helo, `confTO_HELO', 5m)
26968651Seric_OPTION(Timeout.mail, `confTO_MAIL', 10m)
27068651Seric_OPTION(Timeout.rcpt, `confTO_RCPT', 1h)
27168651Seric_OPTION(Timeout.datainit, `confTO_DATAINIT', 5m)
27268651Seric_OPTION(Timeout.datablock, `confTO_DATABLOCK', 1h)
27368651Seric_OPTION(Timeout.datafinal, `confTO_DATAFINAL', 1h)
27468651Seric_OPTION(Timeout.rset, `confTO_RSET', 5m)
27568651Seric_OPTION(Timeout.quit, `confTO_QUIT', 2m)
27668651Seric_OPTION(Timeout.misc, `confTO_MISC', 2m)
27768651Seric_OPTION(Timeout.command, `confTO_COMMAND', 1h)
27868651Seric_OPTION(Timeout.ident, `confTO_IDENT', 30s)
27968651Seric_OPTION(Timeout.fileopen, `confTO_FILEOPEN', 60s)
28068651Seric_OPTION(Timeout.queuereturn, `confTO_QUEUERETURN', 5d)
28168651Seric_OPTION(Timeout.queuereturn.normal, `confTO_QUEUERETURN_NORMAL', 5d)
28268651Seric_OPTION(Timeout.queuereturn.urgent, `confTO_QUEUERETURN_URGENT', 2d)
28368651Seric_OPTION(Timeout.queuereturn.non-urgent, `confTO_QUEUERETURN_NONURGENT', 7d)
28468651Seric_OPTION(Timeout.queuewarn, `confTO_QUEUEWARN', 4h)
28568651Seric_OPTION(Timeout.queuewarn.normal, `confTO_QUEUEWARN_NORMAL', 4h)
28668651Seric_OPTION(Timeout.queuewarn.urgent, `confTO_QUEUEWARN_URGENT', 1h)
28768651Seric_OPTION(Timeout.queuewarn.non-urgent, `confTO_QUEUEWARN_NONURGENT', 12h)
28857944Seric
28967810Seric# should we not prune routes in route-addr syntax addresses?
29068651Seric_OPTION(DontPruneRoutes, `confDONT_PRUNE_ROUTES')
29167810Seric
29257944Seric# queue up everything before forking?
29368651Seric_OPTION(SuperSafe, `confSAFE_QUEUE')
29457944Seric
29557944Seric# status file
29668651Seric_OPTION(StatusFile, `STATUS_FILE', /etc/sendmail.st)
29757944Seric
29857944Seric# time zone handling:
29957944Seric#  if undefined, use system default
30057944Seric#  if defined but null, use TZ envariable passed in
30157944Seric#  if defined and non-null, use that info
30268651Sericifelse(confTIME_ZONE, `USE_SYSTEM', `#O TimeZoneSpec=',
30368651Seric	confTIME_ZONE, `USE_TZ', `O TimeZoneSpec=',
30468651Seric	`O TimeZoneSpec=confTIME_ZONE')
30557944Seric
30668651Seric# default UID (can be username or userid:groupid)
30768651Seric_OPTION(DefaultUser, `confDEF_USER_ID', nobody)
30857944Seric
30951887Seric# list of locations of user database file (null means no lookup)
31068651Seric_OPTION(UserDatabaseSpec, `confUSERDB_SPEC', /etc/userdb)
31151222Seric
31258860Seric# fallback MX host
31368651Seric_OPTION(FallbackMXhost, `confFALLBACK_MX', fall.back.host.net)
31458860Seric
31563858Seric# if we are the best MX host for a site, try it directly instead of config err
31668651Seric_OPTION(TryNullMXList, `confTRY_NULL_MX_LIST')
31763858Seric
31857944Seric# load average at which we just queue messages
31968651Seric_OPTION(QueueLA, `confQUEUE_LA', 8)
32057944Seric
32157944Seric# load average at which we refuse connections
32268651Seric_OPTION(RefuseLA, `confREFUSE_LA', 12)
32357944Seric
32457944Seric# work recipient factor
32568651Seric_OPTION(RecipientFactor, `confWORK_RECIPIENT_FACTOR', 30000)
32657944Seric
32757944Seric# deliver each queued job in a separate process?
32868651Seric_OPTION(ForkEachJob, `confSEPARATE_PROC')
32957944Seric
33057944Seric# work class factor
33168651Seric_OPTION(ClassFactor, `confWORK_CLASS_FACTOR', 1800)
33257944Seric
33357944Seric# work time factor
33468651Seric_OPTION(RetryFactor, `confWORK_TIME_FACTOR', 90000)
33557944Seric
33667697Seric# do our SMTP peers choke on multi-line greeting messages?
33768651Seric_OPTION(BrokenSmtpPeers, `confBROKEN_SMTP_PEERS')
33867697Seric
33967697Seric# shall we sort the queue by hostname first?
34068651Seric_OPTION(QueueSortOrder, `confQUEUE_SORT_ORDER', priority)
34167697Seric
34268651Seric# minimum time in queue before retry
34368651Seric_OPTION(MinQueueAge, `confMIN_QUEUE_AGE', 30m)
34468651Seric
34568651Seric# default character set
34668651Seric_OPTION(DefaultCharSet, `confDEF_CHAR_SET', iso-8859-1)
34768651Seric
34868651Seric# service switch file (ignored on Solaris, Ultrix, OSF/1, others)
34968651Seric_OPTION(ServiceSwitchFile, `confSERVICE_SWITCH_FILE', /etc/service.switch)
35068651Seric
35168651Seric# dialup line delay on connection failure
35268651Seric_OPTION(DialDelay, `confDIAL_DELAY', 10s)
35368651Seric
35468651Seric# action to take if there are no recipients in the message
35568651Seric_OPTION(NoRecipientAction, `confNO_RCPT_ACTION', add-to-undisclosed)
35668651Seric
35768651Seric# chrooted environment for writing to files
35868651Seric_OPTION(SafeFileEnvironment, `confSAFE_FILE_ENV', /arch)
35968651Seric
36057944Seric###########################
36157944Seric#   Message precedences   #
36257944Seric###########################
36357944Seric
36457944SericPfirst-class=0
36557944SericPspecial-delivery=100
36658070SericPlist=-30
36757944SericPbulk=-60
36857944SericPjunk=-100
36957944Seric
37057944Seric#####################
37157944Seric#   Trusted users   #
37257944Seric#####################
37357944Seric
37468651Seric# this is equivalent to setting class "t"
37568651Seric#Ft/etc/sendmail.trusted
37657944SericTroot
37757944SericTdaemon
37857944SericTuucp
37957944Seric
38057944Seric#########################
38157944Seric#   Format of headers   #
38257944Seric#########################
38357944Seric
38458679SericH?P?Return-Path: $g
38567819SericHReceived: confRECEIVED_HEADER
38657944SericH?D?Resent-Date: $a
38757944SericH?D?Date: $a
38857944SericH?F?Resent-From: $q
38957944SericH?F?From: $q
39057944SericH?x?Full-Name: $x
39157944SericHSubject:
39257944Seric# HPosted-Date: $a
39357944Seric# H?l?Received-Date: $b
39457944SericH?M?Resent-Message-Id: <$t.$i@$j>
39557944SericH?M?Message-Id: <$t.$i@$j>
39668651Sericifdef(`_NULL_CLIENT_ONLY_',
39768651Seric	`include(../m4/nullrelay.m4)m4exit',
39868651Seric	`dnl')
39951222Seric#
40051222Seric######################################################################
40151222Seric######################################################################
40251222Seric#####
40351222Seric#####			REWRITING RULES
40451222Seric#####
40551222Seric######################################################################
40651222Seric######################################################################
40751222Seric
40858678Sericundivert(9)dnl
40951222Seric
41051222Seric###########################################
41151222Seric###  Rulset 3 -- Name Canonicalization  ###
41251222Seric###########################################
41351260SericS3
41451222Seric
41564802Seric# handle null input (translate to <@> special case)
41658499SericR$@			$@ <@>
41758174Seric
418*68763Seric# strip group: syntax (not inside angle brackets!) and trailing semicolon
419*68763SericR$*			$: $1 <@>			mark addresses
420*68763SericR$* < $* > $* <@>	$: $1 < $2 > $3			unmark <addr>
421*68763SericR$* :: $* <@>		$: $1 :: $2			unmark host::addr
422*68763SericR$* : $* <@>		$: $2				strip colon if marked
423*68763SericR$* <@>			$: $1				unmark
424*68763SericR$* ;			$: $1				strip trailing semi
425*68763Seric
426*68763Seric# null input now results from list:; syntax
427*68763SericR$@			$@ :; <@>
428*68763Seric
42951222Seric# basic textual canonicalization -- note RFC733 heuristic here
43064144SericR$*<$*>$*<$*>$*		$2$3<$4>$5			strip multiple <> <>
43158158SericR$*<$*<$+>$*>$*		<$3>$5				2-level <> nesting
43258499SericR$*<>$*			$@ <@>				MAIL FROM:<> case
43351222SericR$*<$+>$*		$2				basic RFC821/822 parsing
43451222Seric
43551222Seric# make sure <@a,@b,@c:user@d> syntax is easy to parse -- undone later
43655416SericR@ $+ , $+		@ $1 : $2			change all "," to ":"
43751222Seric
43851222Seric# localize and dispose of route-based addresses
43967469SericR@ $+ : $+		$@ $>96 < @$1 > : $2		handle <route-addr>
44051222Seric
44151222Seric# find focus for list syntax
44267469SericR $+ : $* ; @ $+	$@ $>96 $1 : $2 ; < @ $3 >	list syntax
44355416SericR $+ : $* ;		$@ $1 : $2;			list syntax
44451222Seric
44551222Seric# find focus for @ syntax addresses
44655416SericR$+ @ $+		$: $1 < @ $2 >			focus on domain
44755416SericR$+ < $+ @ $+ >		$1 $2 < @ $3 >			move gaze right
44867469SericR$+ < @ $+ >		$@ $>96 $1 < @ $2 >		already canonical
44951222Seric
45064968Seric# do some sanity checking
45164968SericR$* < @ $* : $* > $*	$1 < @ $2 $3 > $4		nix colons in addrs
45264968Seric
45358288Sericifdef(`_NO_UUCP_', `dnl',
45458288Seric`# convert old-style addresses to a domain-based address
45567469SericR$- ! $+		$@ $>96 $2 < @ $1 .UUCP >	resolve uucp names
45667469SericR$+ . $- ! $+		$@ $>96 $3 < @ $1 . $2 >		domain uucps
45767469SericR$+ ! $+		$@ $>96 $2 < @ $1 .UUCP >	uucp subdomains')
45851222Seric
45951222Seric# if we have % signs, take the rightmost one
46055416SericR$* % $*		$1 @ $2				First make them all @s.
46155416SericR$* @ $* @ $*		$1 % $2 @ $3			Undo all but the last.
46267469SericR$* @ $*		$@ $>96 $1 < @ $2 >		Insert < > and finish
46351222Seric
46451222Seric# else we must be a local name
46551222Seric
46651222Seric
46760894Seric################################################
46867469Seric###  Ruleset 96 -- bottom half of ruleset 3  ###
46960894Seric################################################
47051222Seric
47157245Seric#  At this point, everything should be in a "local_part<@domain>extra" format.
47267469SericS96
47351222Seric
47451222Seric# handle special cases for local names
47560262SericR$* < @ localhost > $*		$: $1 < @ $j . > $2		no domain at all
47660262SericR$* < @ localhost . $m > $*	$: $1 < @ $j . > $2		local domain
47760262Sericifdef(`_NO_UUCP_', `dnl',
47860262Seric`R$* < @ localhost . UUCP > $*	$: $1 < @ $j . > $2		.UUCP domain')
47965825SericR$* < @ [ $+ ] > $*		$: $1 < @@ [ $2 ] > $3		mark [a.b.c.d]
48065825SericR$* < @@ $=w > $*		$: $1 < @ $j . > $3		self-literal
48166306SericR$* < @@ $+ > $*		$@ $1 < @ $2 > $3		canon IP addr
48263754Sericifdef(`DOMAIN_TABLE', `
48367450Seric# look up domains in the domain table
48467450SericR$* < @ $+ > $*			$: $1 < @ $(domaintable $2 $) > $3',
48563754Seric`dnl')
48651889Sericundivert(2)dnl
48751222Seric
48859081Sericifdef(`_NO_UUCP_', `dnl',
48959081Seric`ifdef(`UUCP_RELAY',
49051274Seric`# pass UUCP addresses straight through
49164971SericR$* < @ $+ . UUCP > $*		$@ $1 < @ $2 . UUCP . > $3',
49251274Seric`# if really UUCP, handle it immediately
49351322Sericifdef(`_CLASS_U_',
49464971Seric`R$* < @ $=U . UUCP > $*	$@ $1 < @ $2 . UUCP . > $3', `dnl')
49551322Sericifdef(`_CLASS_V_',
49664971Seric`R$* < @ $=V . UUCP > $*	$@ $1 < @ $2 . UUCP . > $3', `dnl')
49751322Sericifdef(`_CLASS_W_',
49864971Seric`R$* < @ $=W . UUCP > $*	$@ $1 < @ $2 . UUCP . > $3', `dnl')
49951322Sericifdef(`_CLASS_X_',
50064971Seric`R$* < @ $=X . UUCP > $*	$@ $1 < @ $2 . UUCP . > $3', `dnl')
50151322Sericifdef(`_CLASS_Y_',
50264971Seric`R$* < @ $=Y . UUCP > $*	$@ $1 < @ $2 . UUCP . > $3', `dnl')
50351267Seric
50451267Seric# try UUCP traffic as a local address
50564971SericR$* < @ $+ . UUCP > $*		$: $1 < @ $[ $2 $] . UUCP . > $3
50667469SericR$* < @ $+ . . UUCP . > $*		$@ $1 < @ $2 . > $3')
50759081Seric')
50865061Sericifdef(`_NO_CANONIFY_', `dnl',
50959081Seric`# pass to name server to make hostname canonical
51061470SericR$* < @ $* $~P > $*		$: $1 < @ $[ $2 $3 $] > $4')
51161470Seric
51265061Seric# local host aliases and pseudo-domains are always canonical
51365061SericR$* < @ $=w > $*		$: $1 < @ $2 . > $3
51464971SericR$* < @ $* $=P > $*		$: $1 < @ $2 $3 . > $4
51565061SericR$* < @ $* . . > $*		$1 < @ $2 . > $3
51664971Seric
51751322Seric# if this is the local hostname, make sure we treat is as canonical
51851322SericR$* < @ $j > $*			$: $1 < @ $j . > $2
51951222Seric
52051322Seric
52151222Seric##################################################
52251222Seric###  Ruleset 4 -- Final Output Post-rewriting  ###
52351222Seric##################################################
52451222SericS4
52551222Seric
52658499SericR$*<@>			$@ $1				handle <> and list:;
52751222Seric
52851322Seric# strip trailing dot off possibly canonical name
52951322SericR$* < @ $+ . > $*	$1 < @ $2 > $3
53051322Seric
53151222Seric# externalize local domain info
53251322SericR$* < $+ > $*		$1 $2 $3			defocus
53351322SericR@ $+ : @ $+ : $+	@ $1 , @ $2 : $3		<route-addr> canonical
53451997SericR@ $*			$@ @ $1				... and exit
53551222Seric
53658288Sericifdef(`_NO_UUCP_', `dnl',
53758288Seric`# UUCP must always be presented in old form
53858288SericR$+ @ $- . UUCP		$2!$1				u@h.UUCP => h!u')
53951222Seric
54051222Seric# delete duplicate local names
54151322SericR$+ % $=w @ $=w		$1 @ $j				u%host@host => u@host
54251222Seric
54351222Seric
54451222Seric
54560894Seric##############################################################
54667469Seric###   Ruleset 97 -- recanonicalize and call ruleset zero   ###
54760894Seric###		   (used for recursive calls)		   ###
54860894Seric##############################################################
54951222Seric
55067469SericS`'97
55151222SericR$*			$: $>3 $1
55251222SericR$*			$@ $>0 $1
55351222Seric
55451222Seric
55551222Seric######################################
55651222Seric###   Ruleset 0 -- Parse Address   ###
55751222Seric######################################
55851222Seric
55951222SericS0
56051222Seric
56167118SericR<@>			$#_LOCAL_ $: <@>		special case error msgs
56266035SericR$* : $* ;		$#error $@ USAGE $: "list:; syntax illegal for recipient addresses"
56365048SericR<@ $+>			$#error $@ USAGE $: "user address required"
56467118SericR$* <$* : $* > $*	$#error $@ USAGE $: "colon illegal in host name part"
56567132SericR$* < @ . > $*		$#error $@ USAGE $: "invalid host name"
56658340Seric
56755416Sericifdef(`_MAILER_smtp_',
56855416Seric`# handle numeric address spec
56967469SericR$* < @ [ $+ ] > $*	$: $>98 $1 < @ [ $2 ] > $3	numeric internet spec
57065191SericR$* < @ [ $+ ] > $*	$#_SMTP_ $@ [$2] $: $1 < @ [$2] > $3	still numeric: send',
57163858Seric	`dnl')
57251222Seric
57351887Seric# now delete the local info -- note $=O to find characters that cause forwarding
57467469SericR$* < @ > $*		$@ $>97 $1		user@ => user
57567469SericR< @ $=w . > : $*	$@ $>97 $2		@here:... -> ...
57667469SericR$* $=O $* < @ $=w . >	$@ $>97 $1 $2 $3		...@here -> ...
57763967Seric
57863967Seric# handle local hacks
57967469SericR$*			$: $>98 $1
58066048Seric
58166048Seric# short circuit local delivery so forwarded email works
58267914Sericifdef(`_STICKY_LOCAL_DOMAIN_',
58367914Seric`R$+ < @ $=w . >		$: < $H > $1 < @ $2 . >		first try hub
58468698SericR< $+ > $+ < $+ >	$>95 < $1 > $2 < $3 >		yep ....
58567914SericR< > $=D . $+ < $+ >	$#_LOCAL_ $: $1 . $2		dotted name?
58668155SericR< > $+ + $* < $+ >	$#_LOCAL_ $: $1 + $2		plussed name?
58767914SericR< > $+ < $+ >		$#_LOCAL_ $: @ $1			nope, local address',
58868698Seric`R$=L < @ $=w . >	$#_LOCAL_ $: @ $1		special local names
58968155SericR$+ < @ $=w . >		$#_LOCAL_ $: $1			regular local name')
59066090Sericifdef(`MAILER_TABLE',
59166090Seric`
59266090Seric# not local -- try mailer table lookup
59366090SericR$* <@ $+ > $*		$: < $2 > $1 < @ $2 > $3	extract host name
59466090SericR< $+ . > $*		$: < $1 > $2			strip trailing dot
59566090SericR< $+ > $*		$: < $(mailertable $1 $) > $2	lookup
59666090SericR< $- : $+ > $*		$# $1 $@ $2 $: $3		check -- resolved?
59766090SericR< $+ > $*		$: $>90 <$1> $2			try domain',
59866090Seric`dnl')
59951260Sericundivert(4)dnl
60051260Seric
60161468Sericifdef(`_NO_UUCP_', `dnl',
60261468Seric`# resolve remotely connected UUCP links (if any)
60351285Sericifdef(`_CLASS_V_',
60467469Seric`R$* < @ $=V . UUCP . > $*		$: $>95 < $V > $1 <@$2.UUCP.> $3',
60552044Seric	`dnl')
60651285Sericifdef(`_CLASS_W_',
60767469Seric`R$* < @ $=W . UUCP . > $*		$: $>95 < $W > $1 <@$2.UUCP.> $3',
60852044Seric	`dnl')
60951285Sericifdef(`_CLASS_X_',
61067469Seric`R$* < @ $=X . UUCP . > $*		$: $>95 < $X > $1 <@$2.UUCP.> $3',
61161468Seric	`dnl')')
61251260Seric
61351222Seric# resolve fake top level domains by forwarding to other hosts
61451222Sericifdef(`BITNET_RELAY',
61567469Seric`R$*<@$+.BITNET.>$*	$: $>95 < $B > $1 <@$2.BITNET.> $3	user@host.BITNET',
61651222Seric	`dnl')
61765149Sericifdef(`_MAILER_pop_',
61865149Seric`R$+ < @ POP. >		$#pop $: $1			user@POP',
61965149Seric	`dnl')
62058364Sericifdef(`_MAILER_fax_',
62164971Seric`R$+ < @ $+ .FAX. >	$#fax $@ $2 $: $1		user@host.FAX',
62258364Seric`ifdef(`FAX_RELAY',
62367469Seric`R$*<@$+.FAX.>$*		$: $>95 < $F > $1 <@$2.FAX.> $3	user@host.FAX',
62458364Seric	`dnl')')
62551222Seric
62651260Sericifdef(`UUCP_RELAY',
62751260Seric`# forward non-local UUCP traffic to our UUCP relay
62867469SericR$*<@$*.UUCP.>$*		$: $>95 < $Y > $1 <@$2.UUCP.> $3	uucp mail',
62955416Seric`ifdef(`_MAILER_uucp_',
63051260Seric`# forward other UUCP traffic straight to UUCP
63165557SericR$* < @ $+ .UUCP. > $*		$#uucp $@ $2 $: $1 < @ $2 .UUCP. > $3	user@host.UUCP',
63251260Seric	`dnl')')
63363967Sericifdef(`_MAILER_usenet_', `
63463754Seric# addresses sent to net.group.USENET will get forwarded to a newsgroup
63565851SericR$+ . USENET		$#usenet $: $1',
63663860Seric	`dnl')
63763754Seric
63858070Sericifdef(`_LOCAL_RULES_',
63958070Seric`# figure out what should stay in our local mail system
64063754Sericundivert(1)', `dnl')
64163754Seric
64264321Seric# pass names that still have a host to a smarthost (if defined)
64367469SericR$* < @ $* > $*		$: $>95 < $S > $1 < @ $2 > $3	glue on smarthost name
64463754Seric
64564321Seric# deal with other remote names
64663946Sericifdef(`_MAILER_smtp_',
64763973Seric`R$* < @$* > $*		$#_SMTP_ $@ $2 $: $1 < @ $2 > $3		user@host.domain',
64864321Seric`R$* < @$* > $*		$#error $@NOHOST $: Unrecognized host name $2')
64951222Seric
65067469Seric# if this is quoted, strip the quotes and try again
65158811SericR$+			$: $(dequote $1 $)		strip quotes
65267469SericR$+ $=O $+		$@ $>97 $1 $2 $3			try again
65358811Seric
65458811Seric# handle locally delivered names
65563998SericR$=L			$#_LOCAL_ $: @ $1			special local names
65663998SericR$+			$#_LOCAL_ $: $1			regular local names
65751222Seric
65855416Seric###########################################################################
65955416Seric###   Ruleset 5 -- special rewriting after aliases have been expanded   ###
66055416Seric###########################################################################
66151222Seric
66251322SericS5
66351322Seric
66467538Seric# if we have a "special dotted user", convert it back to the base name
66567538SericR$=D . *		$#_LOCAL_ $: $1
66667538SericR$=D . $+		$#_LOCAL_ $: $1 . *
66767538Seric
66867914Seric# prepend an empty "forward host" on the front
66967914SericR$+			$: <> $1
67067914Seric
67167914Sericifdef(`LUSER_RELAY',
67267914Seric`# send unrecognized local users to a relay host
67368149SericR< > $+ + $*		$: < $L . > $( user $1 $) + $2
67468149SericR< > $+			$: < $L . > $( user $1 $)	look up user
67568149SericR< $* > $+ <> $*	$: < > $2 $3			found; strip $L
67668149SericR< $* . > $+		$: < $1 > $2			strip extra dot')
67767914Seric
67868149Seric# handle plussed local names
67968149SericR< > $+ + $*		$#_LOCAL_ $@ $2 $: $1
68068149Seric
68158808Seric# see if we have a relay or a hub
68268698SericR< > $+			$: < $H > $1			try hub
68367914SericR< > $+			$: < $R > $1			try relay
68466048SericR< > $+			$@ $1				nope, give up
68567469SericR< $- : $+ > $+		$: $>95 < $1 : $2 > $3 < @ $2 >
68667469SericR< $+ > $+		$@ $>95 < $1 > $2 < @ $1 >
68760540Sericifdef(`MAILER_TABLE',
68860540Seric`
68960540Seric
69063858Seric###################################################################
69163858Seric###  Ruleset 90 -- try domain part of mailertable entry 	###
69263858Seric###################################################################
69360540Seric
69460540SericS90
69566091SericR$* <$- . $+ > $*	$: $1$2 < $(mailertable .$3 $@ $1$2 $@ $2 $) > $4
69666081SericR$* <$- : $+ > $*	$# $2 $@ $3 $: $4		check -- resolved?
69766081SericR$* < . $+ > $*		$@ $>90 $1 . <$2> $3		no -- strip & try again
69866094SericR$* < $* > $*		$: < $(mailertable . $@ $1$2 $) > $3	try "."
69966090SericR<$- : $+ > $*		$# $1 $@ $2 $: $3		"." found?
70066090SericR< $* > $*		$@ $2				no mailertable match',
70160540Seric`dnl')
70263858Seric
70363858Seric###################################################################
70467469Seric###  Ruleset 95 -- canonify mailer:host syntax to triple	###
70564010Seric###################################################################
70664010Seric
70767469SericS95
70864010SericR< > $*			$@ $1				strip off null relay
70964010SericR< $- : $+ > $*		$# $1 $@ $2 $: $3		try qualified mailer
71064010SericR< $=w > $*		$@ $2				delete local host
71164010SericR< $+ > $*		$#_RELAY_ $@ $1 $: $2		use unqualified mailer
71264010Seric
71364010Seric###################################################################
71467469Seric###  Ruleset 98 -- local part of ruleset zero (can be null)	###
71563858Seric###################################################################
71663858Seric
71767469SericS98
71863858Sericundivert(3)dnl
71951222Seric#
72051222Seric######################################################################
72151222Seric######################################################################
72251222Seric#####
72356790Seric`#####			MAILER DEFINITIONS'
72451222Seric#####
72551222Seric######################################################################
72651222Seric######################################################################
72751222Sericundivert(7)dnl
728