xref: /csrg-svn/usr.sbin/sendmail/cf/m4/proto.m4 (revision 68651)
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*68651SericVERSIONID(`@(#)proto.m4	8.63 (Berkeley) 03/30/95')
1251222Seric
1351322SericMAILER(local)dnl
1451222Seric
1567696Seric# level 6 config file format
16*68651SericV6/Berkeley
17*68651Sericdivert(-1)
18*68651Seric
19*68651Seric# pick our default mailers
20*68651Sericifdef(`confSMTP_MAILER',, `define(`confSMTP_MAILER', `smtp')')
21*68651Sericifdef(`confLOCAL_MAILER',, `define(`confLOCAL_MAILER', `local')')
2264010Sericifdef(`confRELAY_MAILER',,
2364010Seric	`define(`confRELAY_MAILER',
2464010Seric		`ifdef(`_MAILER_smtp_', `relay',
25*68651Seric			`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
30*68651Seric# back compatibility with old config files
31*68651Sericifdef(`confDEF_GROUP_ID',
32*68651Seric	`errprint(`*** confDEF_GROUP_ID is obsolete.')
33*68651Seric	 errprint(`    Use confDEF_USER_ID with a colon in the value instead.')')
34*68651Sericifdef(`confREAD_TIMEOUT',
35*68651Seric	`errprint(`*** confREAD_TIMEOUT is obsolete.')
36*68651Seric	 errprint(`    Use individual confTO_<timeout> parameters instead.')')
37*68651Sericifdef(`confMESSAGE_TIMEOUT',
38*68651Seric	`define(`_ARG_', index(confMESSAGE_TIMEOUT, /))
39*68651Seric	 ifelse(_ARG_, -1,
40*68651Seric		`define(`confTO_QUEUERETURN', confMESSAGE_TIMEOUT)',
41*68651Seric		`define(`confTO_QUEUERETURN',
42*68651Seric			substr(confMESSAGE_TIMEOUT, 0, _ARG_))
43*68651Seric		 define(`confTO_QUEUEWARN',
44*68651Seric			substr(confMESSAGE_TIMEOUT, eval(_ARG_+1)))')')
45*68651Sericifdef(`confMIN_FREE_BLOCKS', `ifelse(index(confMIN_FREE_BLOCKS, /), -1,,
46*68651Seric	`errprint(`*** compound confMIN_FREE_BLOCKS is obsolete.')
47*68651Seric	 errprint(`    Use confMAX_MESSAGE_SIZE for the second part of the value.')')')
48*68651Seric
49*68651Seric# clean option definitions below....
50*68651Sericdefine(`_OPTION', `ifdef(`$2', `O $1=$2', `#O $1`'ifelse($3, `',, `=$3')')')dnl
51*68651Seric
52*68651Sericdivert(0)dnl
53*68651Seric
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')
63*68651Seric
6464321Seric# my official domain name
65*68651Seric# ... define this only if sendmail cannot automatically determine your domain
66*68651Sericifdef(`confDOMAIN_NAME', `Dj`'confDOMAIN_NAME', `#Dj$w.Foo.COM')
6751222Seric
68*68651Sericifdef(`_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
99*68651Seric# operators that cannot be in local usernames (i.e., network indicators)
100*68651SericCO @ % ifdef(`_NO_UUCP_', `', `!')
101*68651Seric
102*68651Seric# a class with just dot (for identifying canonical names)
103*68651SericC..
104*68651Seric
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
134*68651Sericdivert(0)dnl
135*68651Seric# who I masquerade as (null for no masquerading)
136*68651SericDM`'ifdef(`MASQUERADE_NAME', MASQUERADE_NAME)
137*68651Seric
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?
165*68651Seric_OPTION(SevenBitInput, `confSEVEN_BIT_INPUT')
16657944Seric
16767550Seric# 8-bit data handling
168*68651Seric_OPTION(EightBitMode, `confEIGHT_BIT_HANDLING', adaptive)
16967550Seric
170*68651Seric# wait for alias file rebuild (default units: minutes)
171*68651Seric_OPTION(AliasWait, `confALIAS_WAIT', 5m)
17257944Seric
17357944Seric# location of alias file
174*68651SericO AliasFile=ifdef(`ALIAS_FILE', `ALIAS_FILE', /etc/aliases)
17557944Seric
17658084Seric# minimum number of free blocks on filesystem
177*68651Seric_OPTION(MinFreeBlocks, `confMIN_FREE_BLOCKS', 100)
17858084Seric
179*68651Seric# maximum message size
180*68651Seric_OPTION(MaxMessageSize, `confMAX_MESSAGE_SIZE', 1000000)
181*68651Seric
18257944Seric# substitution for space (blank) characters
183*68651Seric_OPTION(BlankSub, `confBLANK_SUB', _)
18457944Seric
18565618Seric# avoid connecting to "expensive" mailers on initial submission?
186*68651Seric_OPTION(HoldExpensive, `confCON_EXPENSIVE')
18757944Seric
18857944Seric# checkpoint queue runs after every N successful deliveries
189*68651Seric_OPTION(CheckpointInterval, `confCHECKPOINT_INTERVAL', 10)
19057944Seric
19157944Seric# default delivery mode
192*68651Seric_OPTION(DeliveryMode, `confDELIVERY_MODE', background)
19357944Seric
19457944Seric# automatically rebuild the alias database?
195*68651Seric_OPTION(AutoRebuildAliases, `confAUTO_REBUILD')
19657944Seric
19764033Seric# error message header/file
198*68651Seric_OPTION(ErrorHeader, `confERROR_MESSAGE', /etc/sendmail.oE)
19957944Seric
20057944Seric# error mode
201*68651Seric_OPTION(ErrorMode, `confERROR_MODE', print)
20257944Seric
20357944Seric# save Unix-style "From_" lines at top of header?
204*68651Seric_OPTION(SaveFromLine, `confSAVE_FROM_LINES')
20557944Seric
20657944Seric# temporary file mode
207*68651Seric_OPTION(TempFileMode, `confTEMP_FILE_MODE', 0600)
20857944Seric
20957944Seric# match recipients against GECOS field?
210*68651Seric_OPTION(MatchGECOS, `confMATCH_GECOS')
21157944Seric
21257944Seric# maximum hop count
213*68651Seric_OPTION(MaxHopCount, `confMAX_HOP', 17)
21457944Seric
21557944Seric# location of help file
216*68651SericO HelpFile=ifdef(`HELP_FILE', HELP_FILE, /usr/lib/sendmail.hf)
21757944Seric
21857944Seric# ignore dots as terminators in incoming messages?
219*68651Seric_OPTION(IgnoreDots, `confIGNORE_DOTS')
22057944Seric
221*68651Seric# name resolver options
222*68651Seric_OPTION(ResolverOptions, `confBIND_OPTS', +AAONLY)
22357944Seric
22459887Seric# deliver MIME-encapsulated error messages?
225*68651Seric_OPTION(SendMimeErrors, `confMIME_FORMAT_ERRORS')
22659887Seric
22757944Seric# Forward file search path
228*68651Seric_OPTION(ForwardPath, `confFORWARD_PATH', /var/forward/$u:$z/.forward.$w:$z/.forward)
22957944Seric
23057944Seric# open connection cache size
231*68651Seric_OPTION(ConnectionCacheSize, `confMCI_CACHE_SIZE', 2)
23257944Seric
23357944Seric# open connection cache timeout
234*68651Seric_OPTION(ConnectionCacheTimeout, `confMCI_CACHE_TIMEOUT', 5m)
23557944Seric
23661106Seric# use Errors-To: header?
237*68651Seric_OPTION(UseErrorsTo, `confUSE_ERRORS_TO')
23861106Seric
23957944Seric# log level
240*68651Seric_OPTION(LogLevel, `confLOG_LEVEL', 10)
24157944Seric
24257944Seric# send to me too, even in an alias expansion?
243*68651Seric_OPTION(MeToo, `confME_TOO')
24457944Seric
24557944Seric# verify RHS in newaliases?
246*68651Seric_OPTION(CheckAliases, `confCHECK_ALIASES')
24757944Seric
24857944Seric# default messages to old style headers if no special punctuation?
249*68651Seric_OPTION(OldStyleHeaders, `confOLD_STYLE_HEADERS')
25057944Seric
25158860Seric# SMTP daemon options
252*68651Seric_OPTION(DaemonPortOptions, `confDAEMON_OPTIONS', Port=esmtp)
25358860Seric
25458084Seric# privacy flags
255*68651Seric_OPTION(PrivacyOptions, `confPRIVACY_FLAGS', authwarnings)
25658084Seric
25757944Seric# who (if anyone) should get extra copies of error messages
258*68651Seric_OPTION(PostMasterCopy, `confCOPY_ERRORS_TO', Postmaster)
25957944Seric
26057944Seric# slope of queue-only function
261*68651Seric_OPTION(QueueFactor, `confQUEUE_FACTOR', 600000)
26257944Seric
26357944Seric# queue directory
264*68651SericO QueueDirectory=ifdef(`QUEUE_DIR', QUEUE_DIR, /var/spool/mqueue)
26557944Seric
266*68651Seric# timeouts (many of these)
267*68651Seric_OPTION(Timeout.initial, `confTO_INITIAL', 5m)
268*68651Seric_OPTION(Timeout.helo, `confTO_HELO', 5m)
269*68651Seric_OPTION(Timeout.mail, `confTO_MAIL', 10m)
270*68651Seric_OPTION(Timeout.rcpt, `confTO_RCPT', 1h)
271*68651Seric_OPTION(Timeout.datainit, `confTO_DATAINIT', 5m)
272*68651Seric_OPTION(Timeout.datablock, `confTO_DATABLOCK', 1h)
273*68651Seric_OPTION(Timeout.datafinal, `confTO_DATAFINAL', 1h)
274*68651Seric_OPTION(Timeout.rset, `confTO_RSET', 5m)
275*68651Seric_OPTION(Timeout.quit, `confTO_QUIT', 2m)
276*68651Seric_OPTION(Timeout.misc, `confTO_MISC', 2m)
277*68651Seric_OPTION(Timeout.command, `confTO_COMMAND', 1h)
278*68651Seric_OPTION(Timeout.ident, `confTO_IDENT', 30s)
279*68651Seric_OPTION(Timeout.fileopen, `confTO_FILEOPEN', 60s)
280*68651Seric_OPTION(Timeout.queuereturn, `confTO_QUEUERETURN', 5d)
281*68651Seric_OPTION(Timeout.queuereturn.normal, `confTO_QUEUERETURN_NORMAL', 5d)
282*68651Seric_OPTION(Timeout.queuereturn.urgent, `confTO_QUEUERETURN_URGENT', 2d)
283*68651Seric_OPTION(Timeout.queuereturn.non-urgent, `confTO_QUEUERETURN_NONURGENT', 7d)
284*68651Seric_OPTION(Timeout.queuewarn, `confTO_QUEUEWARN', 4h)
285*68651Seric_OPTION(Timeout.queuewarn.normal, `confTO_QUEUEWARN_NORMAL', 4h)
286*68651Seric_OPTION(Timeout.queuewarn.urgent, `confTO_QUEUEWARN_URGENT', 1h)
287*68651Seric_OPTION(Timeout.queuewarn.non-urgent, `confTO_QUEUEWARN_NONURGENT', 12h)
28857944Seric
28967810Seric# should we not prune routes in route-addr syntax addresses?
290*68651Seric_OPTION(DontPruneRoutes, `confDONT_PRUNE_ROUTES')
29167810Seric
29257944Seric# queue up everything before forking?
293*68651Seric_OPTION(SuperSafe, `confSAFE_QUEUE')
29457944Seric
29557944Seric# status file
296*68651Seric_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
302*68651Sericifelse(confTIME_ZONE, `USE_SYSTEM', `#O TimeZoneSpec=',
303*68651Seric	confTIME_ZONE, `USE_TZ', `O TimeZoneSpec=',
304*68651Seric	`O TimeZoneSpec=confTIME_ZONE')
30557944Seric
306*68651Seric# default UID (can be username or userid:groupid)
307*68651Seric_OPTION(DefaultUser, `confDEF_USER_ID', nobody)
30857944Seric
30951887Seric# list of locations of user database file (null means no lookup)
310*68651Seric_OPTION(UserDatabaseSpec, `confUSERDB_SPEC', /etc/userdb)
31151222Seric
31258860Seric# fallback MX host
313*68651Seric_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
316*68651Seric_OPTION(TryNullMXList, `confTRY_NULL_MX_LIST')
31763858Seric
31857944Seric# load average at which we just queue messages
319*68651Seric_OPTION(QueueLA, `confQUEUE_LA', 8)
32057944Seric
32157944Seric# load average at which we refuse connections
322*68651Seric_OPTION(RefuseLA, `confREFUSE_LA', 12)
32357944Seric
32457944Seric# work recipient factor
325*68651Seric_OPTION(RecipientFactor, `confWORK_RECIPIENT_FACTOR', 30000)
32657944Seric
32757944Seric# deliver each queued job in a separate process?
328*68651Seric_OPTION(ForkEachJob, `confSEPARATE_PROC')
32957944Seric
33057944Seric# work class factor
331*68651Seric_OPTION(ClassFactor, `confWORK_CLASS_FACTOR', 1800)
33257944Seric
33357944Seric# work time factor
334*68651Seric_OPTION(RetryFactor, `confWORK_TIME_FACTOR', 90000)
33557944Seric
33667697Seric# do our SMTP peers choke on multi-line greeting messages?
337*68651Seric_OPTION(BrokenSmtpPeers, `confBROKEN_SMTP_PEERS')
33867697Seric
33967697Seric# shall we sort the queue by hostname first?
340*68651Seric_OPTION(QueueSortOrder, `confQUEUE_SORT_ORDER', priority)
34167697Seric
342*68651Seric# minimum time in queue before retry
343*68651Seric_OPTION(MinQueueAge, `confMIN_QUEUE_AGE', 30m)
344*68651Seric
345*68651Seric# default character set
346*68651Seric_OPTION(DefaultCharSet, `confDEF_CHAR_SET', iso-8859-1)
347*68651Seric
348*68651Seric# service switch file (ignored on Solaris, Ultrix, OSF/1, others)
349*68651Seric_OPTION(ServiceSwitchFile, `confSERVICE_SWITCH_FILE', /etc/service.switch)
350*68651Seric
351*68651Seric# dialup line delay on connection failure
352*68651Seric_OPTION(DialDelay, `confDIAL_DELAY', 10s)
353*68651Seric
354*68651Seric# action to take if there are no recipients in the message
355*68651Seric_OPTION(NoRecipientAction, `confNO_RCPT_ACTION', add-to-undisclosed)
356*68651Seric
357*68651Seric# chrooted environment for writing to files
358*68651Seric_OPTION(SafeFileEnvironment, `confSAFE_FILE_ENV', /arch)
359*68651Seric
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
374*68651Seric# this is equivalent to setting class "t"
375*68651Seric#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>
396*68651Sericifdef(`_NULL_CLIENT_ONLY_',
397*68651Seric	`include(../m4/nullrelay.m4)m4exit',
398*68651Seric	`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
41851222Seric# basic textual canonicalization -- note RFC733 heuristic here
41964144SericR$*<$*>$*<$*>$*		$2$3<$4>$5			strip multiple <> <>
42058158SericR$*<$*<$+>$*>$*		<$3>$5				2-level <> nesting
42158499SericR$*<>$*			$@ <@>				MAIL FROM:<> case
42251222SericR$*<$+>$*		$2				basic RFC821/822 parsing
42351222Seric
42464802Seric# handle list:; syntax as special case
42564802SericR$*:;$*			$@ $1 :; <@>
42664802Seric
42751222Seric# make sure <@a,@b,@c:user@d> syntax is easy to parse -- undone later
42855416SericR@ $+ , $+		@ $1 : $2			change all "," to ":"
42951222Seric
43051222Seric# localize and dispose of route-based addresses
43167469SericR@ $+ : $+		$@ $>96 < @$1 > : $2		handle <route-addr>
43251222Seric
43351222Seric# find focus for list syntax
43467469SericR $+ : $* ; @ $+	$@ $>96 $1 : $2 ; < @ $3 >	list syntax
43555416SericR $+ : $* ;		$@ $1 : $2;			list syntax
43651222Seric
43751222Seric# find focus for @ syntax addresses
43855416SericR$+ @ $+		$: $1 < @ $2 >			focus on domain
43955416SericR$+ < $+ @ $+ >		$1 $2 < @ $3 >			move gaze right
44067469SericR$+ < @ $+ >		$@ $>96 $1 < @ $2 >		already canonical
44151222Seric
44264968Seric# do some sanity checking
44364968SericR$* < @ $* : $* > $*	$1 < @ $2 $3 > $4		nix colons in addrs
44464968Seric
44558288Sericifdef(`_NO_UUCP_', `dnl',
44658288Seric`# convert old-style addresses to a domain-based address
44767469SericR$- ! $+		$@ $>96 $2 < @ $1 .UUCP >	resolve uucp names
44867469SericR$+ . $- ! $+		$@ $>96 $3 < @ $1 . $2 >		domain uucps
44967469SericR$+ ! $+		$@ $>96 $2 < @ $1 .UUCP >	uucp subdomains')
45051222Seric
45151222Seric# if we have % signs, take the rightmost one
45255416SericR$* % $*		$1 @ $2				First make them all @s.
45355416SericR$* @ $* @ $*		$1 % $2 @ $3			Undo all but the last.
45467469SericR$* @ $*		$@ $>96 $1 < @ $2 >		Insert < > and finish
45551222Seric
45651222Seric# else we must be a local name
45751222Seric
45851222Seric
45960894Seric################################################
46067469Seric###  Ruleset 96 -- bottom half of ruleset 3  ###
46160894Seric################################################
46251222Seric
46357245Seric#  At this point, everything should be in a "local_part<@domain>extra" format.
46467469SericS96
46551222Seric
46651222Seric# handle special cases for local names
46760262SericR$* < @ localhost > $*		$: $1 < @ $j . > $2		no domain at all
46860262SericR$* < @ localhost . $m > $*	$: $1 < @ $j . > $2		local domain
46960262Sericifdef(`_NO_UUCP_', `dnl',
47060262Seric`R$* < @ localhost . UUCP > $*	$: $1 < @ $j . > $2		.UUCP domain')
47165825SericR$* < @ [ $+ ] > $*		$: $1 < @@ [ $2 ] > $3		mark [a.b.c.d]
47265825SericR$* < @@ $=w > $*		$: $1 < @ $j . > $3		self-literal
47366306SericR$* < @@ $+ > $*		$@ $1 < @ $2 > $3		canon IP addr
47463754Sericifdef(`DOMAIN_TABLE', `
47567450Seric# look up domains in the domain table
47667450SericR$* < @ $+ > $*			$: $1 < @ $(domaintable $2 $) > $3',
47763754Seric`dnl')
47851889Sericundivert(2)dnl
47951222Seric
48059081Sericifdef(`_NO_UUCP_', `dnl',
48159081Seric`ifdef(`UUCP_RELAY',
48251274Seric`# pass UUCP addresses straight through
48364971SericR$* < @ $+ . UUCP > $*		$@ $1 < @ $2 . UUCP . > $3',
48451274Seric`# if really UUCP, handle it immediately
48551322Sericifdef(`_CLASS_U_',
48664971Seric`R$* < @ $=U . UUCP > $*	$@ $1 < @ $2 . UUCP . > $3', `dnl')
48751322Sericifdef(`_CLASS_V_',
48864971Seric`R$* < @ $=V . UUCP > $*	$@ $1 < @ $2 . UUCP . > $3', `dnl')
48951322Sericifdef(`_CLASS_W_',
49064971Seric`R$* < @ $=W . UUCP > $*	$@ $1 < @ $2 . UUCP . > $3', `dnl')
49151322Sericifdef(`_CLASS_X_',
49264971Seric`R$* < @ $=X . UUCP > $*	$@ $1 < @ $2 . UUCP . > $3', `dnl')
49351322Sericifdef(`_CLASS_Y_',
49464971Seric`R$* < @ $=Y . UUCP > $*	$@ $1 < @ $2 . UUCP . > $3', `dnl')
49551267Seric
49651267Seric# try UUCP traffic as a local address
49764971SericR$* < @ $+ . UUCP > $*		$: $1 < @ $[ $2 $] . UUCP . > $3
49867469SericR$* < @ $+ . . UUCP . > $*		$@ $1 < @ $2 . > $3')
49959081Seric')
50065061Sericifdef(`_NO_CANONIFY_', `dnl',
50159081Seric`# pass to name server to make hostname canonical
50261470SericR$* < @ $* $~P > $*		$: $1 < @ $[ $2 $3 $] > $4')
50361470Seric
50465061Seric# local host aliases and pseudo-domains are always canonical
50565061SericR$* < @ $=w > $*		$: $1 < @ $2 . > $3
50664971SericR$* < @ $* $=P > $*		$: $1 < @ $2 $3 . > $4
50765061SericR$* < @ $* . . > $*		$1 < @ $2 . > $3
50864971Seric
50951322Seric# if this is the local hostname, make sure we treat is as canonical
51051322SericR$* < @ $j > $*			$: $1 < @ $j . > $2
51151222Seric
51251322Seric
51351222Seric##################################################
51451222Seric###  Ruleset 4 -- Final Output Post-rewriting  ###
51551222Seric##################################################
51651222SericS4
51751222Seric
51858499SericR$*<@>			$@ $1				handle <> and list:;
51951222Seric
52051322Seric# strip trailing dot off possibly canonical name
52151322SericR$* < @ $+ . > $*	$1 < @ $2 > $3
52251322Seric
52351222Seric# externalize local domain info
52451322SericR$* < $+ > $*		$1 $2 $3			defocus
52551322SericR@ $+ : @ $+ : $+	@ $1 , @ $2 : $3		<route-addr> canonical
52651997SericR@ $*			$@ @ $1				... and exit
52751222Seric
52858288Sericifdef(`_NO_UUCP_', `dnl',
52958288Seric`# UUCP must always be presented in old form
53058288SericR$+ @ $- . UUCP		$2!$1				u@h.UUCP => h!u')
53151222Seric
53251222Seric# delete duplicate local names
53351322SericR$+ % $=w @ $=w		$1 @ $j				u%host@host => u@host
53451222Seric
53551222Seric
53651222Seric
53760894Seric##############################################################
53867469Seric###   Ruleset 97 -- recanonicalize and call ruleset zero   ###
53960894Seric###		   (used for recursive calls)		   ###
54060894Seric##############################################################
54151222Seric
54267469SericS`'97
54351222SericR$*			$: $>3 $1
54451222SericR$*			$@ $>0 $1
54551222Seric
54651222Seric
54751222Seric######################################
54851222Seric###   Ruleset 0 -- Parse Address   ###
54951222Seric######################################
55051222Seric
55151222SericS0
55251222Seric
55367118SericR<@>			$#_LOCAL_ $: <@>		special case error msgs
55466035SericR$* : $* ;		$#error $@ USAGE $: "list:; syntax illegal for recipient addresses"
55565048SericR<@ $+>			$#error $@ USAGE $: "user address required"
55667118SericR$* <$* : $* > $*	$#error $@ USAGE $: "colon illegal in host name part"
55767132SericR$* < @ . > $*		$#error $@ USAGE $: "invalid host name"
55858340Seric
55955416Sericifdef(`_MAILER_smtp_',
56055416Seric`# handle numeric address spec
56167469SericR$* < @ [ $+ ] > $*	$: $>98 $1 < @ [ $2 ] > $3	numeric internet spec
56265191SericR$* < @ [ $+ ] > $*	$#_SMTP_ $@ [$2] $: $1 < @ [$2] > $3	still numeric: send',
56363858Seric	`dnl')
56451222Seric
56551887Seric# now delete the local info -- note $=O to find characters that cause forwarding
56667469SericR$* < @ > $*		$@ $>97 $1		user@ => user
56767469SericR< @ $=w . > : $*	$@ $>97 $2		@here:... -> ...
56867469SericR$* $=O $* < @ $=w . >	$@ $>97 $1 $2 $3		...@here -> ...
56963967Seric
57063967Seric# handle local hacks
57167469SericR$*			$: $>98 $1
57266048Seric
57366048Seric# short circuit local delivery so forwarded email works
57467914Sericifdef(`_STICKY_LOCAL_DOMAIN_',
57567914Seric`R$+ < @ $=w . >		$: < $H > $1 < @ $2 . >		first try hub
57668155SericR< $+ > $+ < $+ >	$#_LOCAL_ $: $2			yep ....
57767914SericR< > $=D . $+ < $+ >	$#_LOCAL_ $: $1 . $2		dotted name?
57868155SericR< > $+ + $* < $+ >	$#_LOCAL_ $: $1 + $2		plussed name?
57967914SericR< > $+ < $+ >		$#_LOCAL_ $: @ $1			nope, local address',
58066048Seric`R$=L < @ $=w . >		$#_LOCAL_ $: @ $1			special local names
58168155SericR$+ < @ $=w . >		$#_LOCAL_ $: $1			regular local name')
58266090Sericifdef(`MAILER_TABLE',
58366090Seric`
58466090Seric# not local -- try mailer table lookup
58566090SericR$* <@ $+ > $*		$: < $2 > $1 < @ $2 > $3	extract host name
58666090SericR< $+ . > $*		$: < $1 > $2			strip trailing dot
58766090SericR< $+ > $*		$: < $(mailertable $1 $) > $2	lookup
58866090SericR< $- : $+ > $*		$# $1 $@ $2 $: $3		check -- resolved?
58966090SericR< $+ > $*		$: $>90 <$1> $2			try domain',
59066090Seric`dnl')
59151260Sericundivert(4)dnl
59251260Seric
59361468Sericifdef(`_NO_UUCP_', `dnl',
59461468Seric`# resolve remotely connected UUCP links (if any)
59551285Sericifdef(`_CLASS_V_',
59667469Seric`R$* < @ $=V . UUCP . > $*		$: $>95 < $V > $1 <@$2.UUCP.> $3',
59752044Seric	`dnl')
59851285Sericifdef(`_CLASS_W_',
59967469Seric`R$* < @ $=W . UUCP . > $*		$: $>95 < $W > $1 <@$2.UUCP.> $3',
60052044Seric	`dnl')
60151285Sericifdef(`_CLASS_X_',
60267469Seric`R$* < @ $=X . UUCP . > $*		$: $>95 < $X > $1 <@$2.UUCP.> $3',
60361468Seric	`dnl')')
60451260Seric
60551222Seric# resolve fake top level domains by forwarding to other hosts
60651222Sericifdef(`BITNET_RELAY',
60767469Seric`R$*<@$+.BITNET.>$*	$: $>95 < $B > $1 <@$2.BITNET.> $3	user@host.BITNET',
60851222Seric	`dnl')
60965149Sericifdef(`_MAILER_pop_',
61065149Seric`R$+ < @ POP. >		$#pop $: $1			user@POP',
61165149Seric	`dnl')
61258364Sericifdef(`_MAILER_fax_',
61364971Seric`R$+ < @ $+ .FAX. >	$#fax $@ $2 $: $1		user@host.FAX',
61458364Seric`ifdef(`FAX_RELAY',
61567469Seric`R$*<@$+.FAX.>$*		$: $>95 < $F > $1 <@$2.FAX.> $3	user@host.FAX',
61658364Seric	`dnl')')
61751222Seric
61851260Sericifdef(`UUCP_RELAY',
61951260Seric`# forward non-local UUCP traffic to our UUCP relay
62067469SericR$*<@$*.UUCP.>$*		$: $>95 < $Y > $1 <@$2.UUCP.> $3	uucp mail',
62155416Seric`ifdef(`_MAILER_uucp_',
62251260Seric`# forward other UUCP traffic straight to UUCP
62365557SericR$* < @ $+ .UUCP. > $*		$#uucp $@ $2 $: $1 < @ $2 .UUCP. > $3	user@host.UUCP',
62451260Seric	`dnl')')
62563967Sericifdef(`_MAILER_usenet_', `
62663754Seric# addresses sent to net.group.USENET will get forwarded to a newsgroup
62765851SericR$+ . USENET		$#usenet $: $1',
62863860Seric	`dnl')
62963754Seric
63058070Sericifdef(`_LOCAL_RULES_',
63158070Seric`# figure out what should stay in our local mail system
63263754Sericundivert(1)', `dnl')
63363754Seric
63464321Seric# pass names that still have a host to a smarthost (if defined)
63567469SericR$* < @ $* > $*		$: $>95 < $S > $1 < @ $2 > $3	glue on smarthost name
63663754Seric
63764321Seric# deal with other remote names
63863946Sericifdef(`_MAILER_smtp_',
63963973Seric`R$* < @$* > $*		$#_SMTP_ $@ $2 $: $1 < @ $2 > $3		user@host.domain',
64064321Seric`R$* < @$* > $*		$#error $@NOHOST $: Unrecognized host name $2')
64151222Seric
64267469Seric# if this is quoted, strip the quotes and try again
64358811SericR$+			$: $(dequote $1 $)		strip quotes
64467469SericR$+ $=O $+		$@ $>97 $1 $2 $3			try again
64558811Seric
64658811Seric# handle locally delivered names
64763998SericR$=L			$#_LOCAL_ $: @ $1			special local names
64863998SericR$+			$#_LOCAL_ $: $1			regular local names
64951222Seric
65055416Seric###########################################################################
65155416Seric###   Ruleset 5 -- special rewriting after aliases have been expanded   ###
65255416Seric###########################################################################
65351222Seric
65451322SericS5
65551322Seric
65667538Seric# if we have a "special dotted user", convert it back to the base name
65767538SericR$=D . *		$#_LOCAL_ $: $1
65867538SericR$=D . $+		$#_LOCAL_ $: $1 . *
65967538Seric
66067914Seric# prepend an empty "forward host" on the front
66167914SericR$+			$: <> $1
66267914Seric
66367914Sericifdef(`LUSER_RELAY',
66467914Seric`# send unrecognized local users to a relay host
66568149SericR< > $+ + $*		$: < $L . > $( user $1 $) + $2
66668149SericR< > $+			$: < $L . > $( user $1 $)	look up user
66768149SericR< $* > $+ <> $*	$: < > $2 $3			found; strip $L
66868149SericR< $* . > $+		$: < $1 > $2			strip extra dot')
66967914Seric
67068149Seric# handle plussed local names
67168149SericR< > $+ + $*		$#_LOCAL_ $@ $2 $: $1
67268149Seric
67358808Seric# see if we have a relay or a hub
67467914SericR< > $+			$: < $R > $1			try relay
67566048SericR< > $+			$: < $H > $1			try hub
67666048SericR< > $+			$@ $1				nope, give up
67767469SericR< $- : $+ > $+		$: $>95 < $1 : $2 > $3 < @ $2 >
67867469SericR< $+ > $+		$@ $>95 < $1 > $2 < @ $1 >
67960540Sericifdef(`MAILER_TABLE',
68060540Seric`
68160540Seric
68263858Seric###################################################################
68363858Seric###  Ruleset 90 -- try domain part of mailertable entry 	###
68463858Seric###################################################################
68560540Seric
68660540SericS90
68766091SericR$* <$- . $+ > $*	$: $1$2 < $(mailertable .$3 $@ $1$2 $@ $2 $) > $4
68866081SericR$* <$- : $+ > $*	$# $2 $@ $3 $: $4		check -- resolved?
68966081SericR$* < . $+ > $*		$@ $>90 $1 . <$2> $3		no -- strip & try again
69066094SericR$* < $* > $*		$: < $(mailertable . $@ $1$2 $) > $3	try "."
69166090SericR<$- : $+ > $*		$# $1 $@ $2 $: $3		"." found?
69266090SericR< $* > $*		$@ $2				no mailertable match',
69360540Seric`dnl')
69463858Seric
69563858Seric###################################################################
69667469Seric###  Ruleset 95 -- canonify mailer:host syntax to triple	###
69764010Seric###################################################################
69864010Seric
69967469SericS95
70064010SericR< > $*			$@ $1				strip off null relay
70164010SericR< $- : $+ > $*		$# $1 $@ $2 $: $3		try qualified mailer
70264010SericR< $=w > $*		$@ $2				delete local host
70364010SericR< $+ > $*		$#_RELAY_ $@ $1 $: $2		use unqualified mailer
70464010Seric
70564010Seric###################################################################
70667469Seric###  Ruleset 98 -- local part of ruleset zero (can be null)	###
70763858Seric###################################################################
70863858Seric
70967469SericS98
71063858Sericundivert(3)dnl
71151222Seric#
71251222Seric######################################################################
71351222Seric######################################################################
71451222Seric#####
71556790Seric`#####			MAILER DEFINITIONS'
71651222Seric#####
71751222Seric######################################################################
71851222Seric######################################################################
71951222Sericundivert(7)dnl
720