xref: /csrg-svn/usr.sbin/sendmail/cf/m4/proto.m4 (revision 63998)
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*63998SericVERSIONID(`@(#)proto.m4	8.8 (Berkeley) 07/22/93')
1251222Seric
1351322SericMAILER(local)dnl
1451222Seric
1560894Sericifdef(`_OLD_SENDMAIL_',
1660894Seric`define(`_SET_96_', 6)dnl
1763858Sericdefine(`_SET_97_', 7)dnl
1863858Sericdefine(`_SET_98_', 8)dnl',
1958119Seric`# level 4 config file format
2060894SericV4
2160894Sericdefine(`_SET_96_', 96)dnl
2263858Sericdefine(`_SET_97_', 97)dnl
2363858Sericdefine(`_SET_98_', 98)dnl')
2463973Sericifdef(`confSMTP_MAILER',, `define(`confSMTP_MAILER', `esmtp')')dnl
25*63998Sericifdef(`confLOCAL_MAILER',, `define(`confLOCAL_MAILER', `local')')dnl
26*63998Sericdefine(`_SMTP_', `confSMTP_MAILER')dnl		for readability only
27*63998Sericdefine(`_LOCAL_', `confLOCAL_MAILER')dnl	for readability only
2852646Seric
2951222Seric##################
3051222Seric#   local info   #
3151222Seric##################
3251222Seric
3360212SericCP.
3460212Seric
3551889SericCwlocalhost
3651887Sericifdef(`USE_CW_FILE',
3751889Seric`# file containing names of hosts for which we receive email
3858406SericCONCAT(`Fw', confCW_FILE)', `dnl')
3951222Seric
4051222Sericifdef(`UUCP_RELAY',
4151222Seric`# UUCP relay host
4251281SericCONCAT(DY, UUCP_RELAY)
4360212SericCPUUCP
4457944Seric
4551222Seric')dnl
4651222Sericifdef(`BITNET_RELAY',
4751222Seric`#  BITNET relay host
4851222SericCONCAT(DB, BITNET_RELAY)
4960212SericCPBITNET
5057944Seric
5151222Seric')dnl
5251222Sericifdef(`CSNET_RELAY',
5351222Seric`# CSNET relay host
5451222SericCONCAT(DC, CSNET_RELAY)
5560212SericCPCSNET
5657944Seric
5751222Seric')dnl
5858364Sericifdef(`FAX_RELAY',
5958364Seric`# FAX relay host
6058364SericCONCAT(DF, FAX_RELAY)
6160212SericCPFAX
6258364Seric
6358364Seric')dnl
6458070Sericifdef(`SMART_HOST',
6558070Seric`# "Smart" UUCP relay host
6658070SericCONCAT(DS, SMART_HOST)
6751222Seric
6858070Seric')dnl
6958781Sericifdef(`MAILER_TABLE',
7058781Seric`# Mailer table (overriding domains)
7158781SericKmailertable MAILER_TABLE
7258781Seric
7358781Seric')dnl
7463754Sericifdef(`DOMAIN_TABLE',
7563754Seric`# Domain table (adding domains)
7663754SericKdomaintable DOMAIN_TABLE
7763754Seric
7863754Seric')dnl
7951222Seric# who I send unqualified names to (null means deliver locally)
8051222SericCONCAT(DR, ifdef(`LOCAL_RELAY', LOCAL_RELAY))
8151222Seric
8257527Seric# who gets all local email traffic ($R has precedence for unqualified names)
8357527SericCONCAT(DH, ifdef(`MAIL_HUB', MAIL_HUB))
8457527Seric
8558070Seric# my official hostname ($w or $w.$D)
8658070SericCONCAT(Dj$w, ifdef(`NEED_DOMAIN', .$D))
8758070Seric
8858070Seric# who I masquerade as (can be $j)
8958070SericCONCAT(DM, ifdef(`MASQUERADE_NAME', MASQUERADE_NAME, $j))
9058070Seric
9157245Seric# class L: names that should be delivered locally, even if we have a relay
9257245Seric# class E: names that should be exposed as from this host, even if we masquerade
9351279SericCLroot
9457245SericCEroot
9551279Sericundivert(5)dnl
9651279Seric
9751222Seric# operators that cannot be in local usernames (i.e., network indicators)
9858288SericCO @ % ifdef(`_NO_UUCP_', `', `!')
9951222Seric
10051322Seric# a class with just dot (for identifying canonical names)
10151322SericC..
10251322Seric
10358808Sericifdef(`_OLD_SENDMAIL_', `dnl',
10458808Seric`# dequoting map
10558808SericKdequote dequote')
10657944Seric
10759033Sericundivert(6)dnl
10859033Seric
10957944Seric######################
11057944Seric#   Special macros   #
11157944Seric######################
11257944Seric
11357944Seric# SMTP initial login message
11457944SericCONCAT(De, confSMTP_LOGIN_MSG)
11557944Seric
11657944Seric# UNIX initial From header format
11757944SericCONCAT(Dl, confFROM_LINE)
11857944Seric
11957944Seric# my name for error messages
12057944SericCONCAT(Dn, confMAILER_NAME)
12157944Seric
12257944Seric# delimiter (operator) characters
12357944SericCONCAT(Do, confOPERATORS)
12457944Seric
12557944Seric# format of a total name
12657944SericCONCAT(Dq, ifdef(`confFROM_HEADER', confFROM_HEADER,
12757944Seric	ifdef(`_OLD_SENDMAIL_', `$g$?x ($x)$.', `$?x$x <$g>$|$g$.')))
12857944Sericinclude(`../m4/version.m4')
12957944Seric
13057944Seric###############
13157944Seric#   Options   #
13257944Seric###############
13357944Seric
13459887Seric# strip message body to 7 bits on input?
13559887SericCONCAT(O7, confSEVEN_BIT_INPUT)
13657944Seric
13757944Seric# wait (in minutes) for alias file rebuild
13857944SericCONCAT(Oa, confALIAS_WAIT)
13957944Seric
14057944Seric# location of alias file
14157944SericCONCAT(OA, ifdef(`ALIAS_FILE', ALIAS_FILE, /etc/aliases))
14257944Seric
14358084Seric# minimum number of free blocks on filesystem
14458084SericCONCAT(Ob, confMIN_FREE_BLOCKS)
14558084Seric
14657944Seric# substitution for space (blank) characters
14757944SericCONCAT(OB, confBLANK_SUB)
14857944Seric
14957944Seric# connect to "expensive" mailers on initial submission?
15057944SericCONCAT(Oc, confCON_EXPENSIVE)
15157944Seric
15257944Seric# checkpoint queue runs after every N successful deliveries
15357944SericCONCAT(OC, confCHECKPOINT_INTERVAL)
15457944Seric
15557944Seric# default delivery mode
15657944SericCONCAT(Od, confDELIVERY_MODE)
15757944Seric
15857944Seric# automatically rebuild the alias database?
15957944SericCONCAT(OD, confAUTO_REBUILD)
16057944Seric
16157944Seric# error message header/file */
16257944Sericifdef(`confERROR_MESSAGE',
16363583Seric	CONCAT(OE, confERROR_MESSAGE),
16457944Seric	#OE/etc/sendmail.oE)
16557944Seric
16657944Seric# error mode
16757944Sericifdef(`confERROR_MODE',
16863583Seric	CONCAT(Oe, confERROR_MODE),
16957944Seric	#Oep)
17057944Seric
17157944Seric# save Unix-style "From_" lines at top of header?
17257944SericCONCAT(Of, confSAVE_FROM_LINES)
17357944Seric
17457944Seric# temporary file mode
17557944SericCONCAT(OF, confTEMP_FILE_MODE)
17657944Seric
17757944Seric# match recipients against GECOS field?
17857944SericCONCAT(OG, confMATCH_GECOS)
17957944Seric
18057944Seric# default GID
18157944SericCONCAT(Og, confDEF_GROUP_ID)
18257944Seric
18357944Seric# maximum hop count
18457944SericCONCAT(Oh, confMAX_HOP)
18557944Seric
18657944Seric# location of help file
18757944SericCONCAT(OH, ifdef(`HELP_FILE', HELP_FILE, /usr/lib/sendmail.hf))
18857944Seric
18957944Seric# ignore dots as terminators in incoming messages?
19057944SericCONCAT(Oi, confIGNORE_DOTS)
19157944Seric
19257944Seric# Insist that the BIND name server be running to resolve names
19357944Sericifdef(`confBIND_OPTS',
19457944Seric	CONCAT(OI, confBIND_OPTS),
19557944Seric	#OI)
19657944Seric
19759887Seric# deliver MIME-encapsulated error messages?
19859887SericCONCAT(Oj, confMIME_FORMAT_ERRORS)
19959887Seric
20057944Seric# Forward file search path
20157944Sericifdef(`confFORWARD_PATH',
20257944Seric	CONCAT(OJ, confFORWARD_PATH),
20357944Seric	#OJ/var/forward/$u:$z/.forward.$w:$z/.forward)
20457944Seric
20557944Seric# open connection cache size
20657944SericCONCAT(Ok, confMCI_CACHE_SIZE)
20757944Seric
20857944Seric# open connection cache timeout
20957944SericCONCAT(OK, confMCI_CACHE_TIMEOUT)
21057944Seric
21161106Seric# use Errors-To: header?
21261106SericCONCAT(Ol, confUSE_ERRORS_TO)
21361106Seric
21457944Seric# log level
21557944SericCONCAT(OL, confLOG_LEVEL)
21657944Seric
21757944Seric# send to me too, even in an alias expansion?
21857944SericCONCAT(Om, confME_TOO)
21957944Seric
22057944Seric# verify RHS in newaliases?
22157944SericCONCAT(On, confCHECK_ALIASES)
22257944Seric
22357944Seric# default messages to old style headers if no special punctuation?
22457944SericCONCAT(Oo, confOLD_STYLE_HEADERS)
22557944Seric
22658860Seric# SMTP daemon options
22758860Sericifdef(`confDAEMON_OPTIONS',
22858860Seric	CONCAT(OO, confDAEMON_OPTIONS),
22958860Seric	#OOPort=esmtp)
23058860Seric
23158084Seric# privacy flags
23258084SericCONCAT(Op, confPRIVACY_FLAGS)
23358084Seric
23457944Seric# who (if anyone) should get extra copies of error messages
23557944Sericifdef(`confCOPY_ERRORS_TO',
23657944Seric	CONCAT(OP, confCOPY_ERRORS_TO),
23757944Seric	#OPPostmaster)
23857944Seric
23957944Seric# slope of queue-only function
24057944Sericifdef(`confQUEUE_FACTOR',
24157944Seric	CONCAT(Oq, confQUEUE_FACTOR),
24257944Seric	#Oq600000)
24357944Seric
24457944Seric# queue directory
24557944SericCONCAT(OQ, ifdef(`QUEUE_DIR', QUEUE_DIR, /var/spool/mqueue))
24657944Seric
24757944Seric# read timeout -- now OK per RFC 1123 section 5.3.2
24858119Sericifdef(`confREAD_TIMEOUT',
24958119Seric	CONCAT(Or, confREAD_TIMEOUT),
25058119Seric	#Ordatablock=10m)
25157944Seric
25257944Seric# queue up everything before forking?
25357944SericCONCAT(Os, confSAFE_QUEUE)
25457944Seric
25557944Seric# status file
25657944SericCONCAT(OS, ifdef(`STATUS_FILE', STATUS_FILE, /etc/sendmail.st))
25757944Seric
25857944Seric# default message timeout interval
25957944SericCONCAT(OT, confMESSAGE_TIMEOUT)
26057944Seric
26157944Seric# time zone handling:
26257944Seric#  if undefined, use system default
26357944Seric#  if defined but null, use TZ envariable passed in
26457944Seric#  if defined and non-null, use that info
26557944Sericifelse(confTIME_ZONE, `USE_SYSTEM', `#Ot',
26657944Seric	confTIME_ZONE, `USE_TZ', `',
26757944Seric	`CONCAT(Ot, confTIME_ZONE)')
26857944Seric
26957944Seric# default UID
27057944SericCONCAT(Ou, confDEF_USER_ID)
27157944Seric
27251887Seric# list of locations of user database file (null means no lookup)
27358720SericOU`'ifdef(`confUSERDB_SPEC', `confUSERDB_SPEC')
27451222Seric
27558860Seric# fallback MX host
27658860Sericifdef(`confFALLBACK_MX',
27758860Seric	CONCAT(OV, confFALLBACK_MX),
27858860Seric	#OVfall.back.host.net)
27958860Seric
28063858Seric# if we are the best MX host for a site, try it directly instead of config err
28163858SericCONCAT(Ow, confTRY_NULL_MX_LIST)
28263858Seric
28357944Seric# load average at which we just queue messages
28457944SericCONCAT(Ox, confQUEUE_LA)
28557944Seric
28657944Seric# load average at which we refuse connections
28757944SericCONCAT(OX, confREFUSE_LA)
28857944Seric
28957944Seric# work recipient factor
29057944Sericifdef(`confWORK_RECIPIENT_FACTOR',
29157944Seric	CONCAT(Oy, confWORK_RECIPIENT_FACTOR),
29257944Seric	#Oy30000)
29357944Seric
29457944Seric# deliver each queued job in a separate process?
29557944SericCONCAT(OY, confSEPARATE_PROC)
29657944Seric
29757944Seric# work class factor
29857944Sericifdef(`confWORK_CLASS_FACTOR',
29957944Seric	CONCAT(Oz, confWORK_CLASS_FACTOR),
30057944Seric	#Oz1800)
30157944Seric
30257944Seric# work time factor
30357944Sericifdef(`confWORK_TIME_FACTOR',
30457944Seric	CONCAT(OZ, confWORK_TIME_FACTOR),
30557944Seric	#OZ90000)
30657944Seric
30757944Seric###########################
30857944Seric#   Message precedences   #
30957944Seric###########################
31057944Seric
31157944SericPfirst-class=0
31257944SericPspecial-delivery=100
31358070SericPlist=-30
31457944SericPbulk=-60
31557944SericPjunk=-100
31657944Seric
31757944Seric#####################
31857944Seric#   Trusted users   #
31957944Seric#####################
32057944Seric
32157944SericTroot
32257944SericTdaemon
32357944SericTuucp
32457944Seric
32557944Seric#########################
32657944Seric#   Format of headers   #
32757944Seric#########################
32857944Seric
32958679SericH?P?Return-Path: $g
33060894SericHReceived: $?sfrom $s $.$?_($_) $.by $j ($v/$Z)$?r with $r$. id $i; $b
33157944SericH?D?Resent-Date: $a
33257944SericH?D?Date: $a
33357944SericH?F?Resent-From: $q
33457944SericH?F?From: $q
33557944SericH?x?Full-Name: $x
33657944SericHSubject:
33757944Seric# HPosted-Date: $a
33857944Seric# H?l?Received-Date: $b
33957944SericH?M?Resent-Message-Id: <$t.$i@$j>
34057944SericH?M?Message-Id: <$t.$i@$j>
34151222Seric#
34251222Seric######################################################################
34351222Seric######################################################################
34451222Seric#####
34551222Seric#####			REWRITING RULES
34651222Seric#####
34751222Seric######################################################################
34851222Seric######################################################################
34951222Seric
35058678Sericundivert(9)dnl
35151222Seric
35251222Seric###########################################
35351222Seric###  Rulset 3 -- Name Canonicalization  ###
35451222Seric###########################################
35551260SericS3
35651222Seric
35758499Seric# handle null input and list syntax (translate to <@> special case)
35858499SericR$@			$@ <@>
35958707SericR$*:;$*			$@ $1 :; <@>
36058174Seric
36151222Seric# basic textual canonicalization -- note RFC733 heuristic here
36257012SericR$*<$*>$*<$*>$*		<$2>$3$4$5			strip multiple <> <>
36358158SericR$*<$*<$+>$*>$*		<$3>$5				2-level <> nesting
36458499SericR$*<>$*			$@ <@>				MAIL FROM:<> case
36551222SericR$*<$+>$*		$2				basic RFC821/822 parsing
36651222Seric
36751222Seric# make sure <@a,@b,@c:user@d> syntax is easy to parse -- undone later
36855416SericR@ $+ , $+		@ $1 : $2			change all "," to ":"
36951222Seric
37051222Seric# localize and dispose of route-based addresses
37160894SericR@ $+ : $+		$@ $>_SET_96_ < @$1 > : $2		handle <route-addr>
37251222Seric
37351222Seric# find focus for list syntax
37460894SericR $+ : $* ; @ $+	$@ $>_SET_96_ $1 : $2 ; < @ $3 >	list syntax
37555416SericR $+ : $* ;		$@ $1 : $2;			list syntax
37651222Seric
37751222Seric# find focus for @ syntax addresses
37855416SericR$+ @ $+		$: $1 < @ $2 >			focus on domain
37955416SericR$+ < $+ @ $+ >		$1 $2 < @ $3 >			move gaze right
38060894SericR$+ < @ $+ >		$@ $>_SET_96_ $1 < @ $2 >		already canonical
38151222Seric
38258288Sericifdef(`_NO_UUCP_', `dnl',
38358288Seric`# convert old-style addresses to a domain-based address
38460894SericR$- ! $+		$@ $>_SET_96_ $2 < @ $1 .UUCP >	resolve uucp names
38560894SericR$+ . $- ! $+		$@ $>_SET_96_ $3 < @ $1 . $2 >		domain uucps
38660894SericR$+ ! $+		$@ $>_SET_96_ $2 < @ $1 .UUCP >	uucp subdomains')
38751222Seric
38851222Seric# if we have % signs, take the rightmost one
38955416SericR$* % $*		$1 @ $2				First make them all @s.
39055416SericR$* @ $* @ $*		$1 % $2 @ $3			Undo all but the last.
39160894SericR$* @ $*		$@ $>_SET_96_ $1 < @ $2 >		Insert < > and finish
39251222Seric
39351222Seric# else we must be a local name
39451222Seric
39551222Seric
39660894Seric################################################
39760894Seric###  Ruleset _SET_96_ -- bottom half of ruleset 3  ###
39860894Seric################################################
39951222Seric
40057245Seric#  At this point, everything should be in a "local_part<@domain>extra" format.
40160894SericS`'_SET_96_
40251222Seric
40351222Seric# handle special cases for local names
40460262SericR$* < @ localhost > $*		$: $1 < @ $j . > $2		no domain at all
40560262SericR$* < @ localhost . $m > $*	$: $1 < @ $j . > $2		local domain
40660262Sericifdef(`_NO_UUCP_', `dnl',
40760262Seric`R$* < @ localhost . UUCP > $*	$: $1 < @ $j . > $2		.UUCP domain')
40863754Sericifdef(`DOMAIN_TABLE', `
40963754Seric# look up unqualified domains in the domain table
41063754SericR$* < @ $- > $*			$: $1 < @ $(domaintable $2 $) > $3',
41163754Seric`dnl')
41251889Sericundivert(2)dnl
41351222Seric
41459081Sericifdef(`_NO_UUCP_', `dnl',
41559081Seric`ifdef(`UUCP_RELAY',
41651274Seric`# pass UUCP addresses straight through
41755416SericR$* < @ $+ . UUCP > $*		$@ $1 < @ $2 . UUCP > $3',
41851274Seric`# if really UUCP, handle it immediately
41951322Sericifdef(`_CLASS_U_',
42055416Seric`R$* < @ $=U . UUCP > $*	$@ $1 < @ $2 . UUCP > $3', `dnl')
42151322Sericifdef(`_CLASS_V_',
42255416Seric`R$* < @ $=V . UUCP > $*	$@ $1 < @ $2 . UUCP > $3', `dnl')
42351322Sericifdef(`_CLASS_W_',
42455416Seric`R$* < @ $=W . UUCP > $*	$@ $1 < @ $2 . UUCP > $3', `dnl')
42551322Sericifdef(`_CLASS_X_',
42655416Seric`R$* < @ $=X . UUCP > $*	$@ $1 < @ $2 . UUCP > $3', `dnl')
42751322Sericifdef(`_CLASS_Y_',
42855416Seric`R$* < @ $=Y . UUCP > $*	$@ $1 < @ $2 . UUCP > $3', `dnl')
42951267Seric
43051267Seric# try UUCP traffic as a local address
43155416SericR$* < @ $+ . UUCP > $*		$: $1 < @ $[ $2 $] . UUCP > $3
43251992Sericifdef(`_OLD_SENDMAIL_',
43355416Seric`R$* < @ $+ . $+ . UUCP > $*		$@ $1 < @ $2 . $3 . > $4',
43455416Seric`R$* < @ $+ . . UUCP > $*		$@ $1 < @ $2 . > $3')')
43559081Seric')
43661470Sericifdef(`_NO_CANONIFY_',
43761470Seric`# make sure local host names appear canonical
43861470SericR$* < @ $=w > $*		$: $1 < @ $2 . > $3',
43959081Seric`# pass to name server to make hostname canonical
44061470SericR$* < @ $* $~P > $*		$: $1 < @ $[ $2 $3 $] > $4')
44161470Seric
44251889Sericundivert(8)dnl
44351889Seric
44451322Seric# if this is the local hostname, make sure we treat is as canonical
44551322SericR$* < @ $j > $*			$: $1 < @ $j . > $2
44651222Seric
44751322Seric
44851222Seric##################################################
44951222Seric###  Ruleset 4 -- Final Output Post-rewriting  ###
45051222Seric##################################################
45151222SericS4
45251222Seric
45358499SericR$*<@>			$@ $1				handle <> and list:;
45451222Seric
45551222Seric# resolve numeric addresses to name if possible
45651322SericR$* < @ [ $+ ] > $*	$: $1 < @ $[ [$2] $] > $3	lookup numeric internet addr
45751222Seric
45851322Seric# strip trailing dot off possibly canonical name
45951322SericR$* < @ $+ . > $*	$1 < @ $2 > $3
46051322Seric
46151222Seric# externalize local domain info
46251322SericR$* < $+ > $*		$1 $2 $3			defocus
46351322SericR@ $+ : @ $+ : $+	@ $1 , @ $2 : $3		<route-addr> canonical
46451997SericR@ $*			$@ @ $1				... and exit
46551222Seric
46658288Sericifdef(`_NO_UUCP_', `dnl',
46758288Seric`# UUCP must always be presented in old form
46858288SericR$+ @ $- . UUCP		$2!$1				u@h.UUCP => h!u')
46951222Seric
47051222Seric# delete duplicate local names
47151322SericR$+ % $=w @ $=w		$1 @ $j				u%host@host => u@host
47251222Seric
47351222Seric
47451222Seric
47560894Seric##############################################################
47660894Seric###   Ruleset _SET_97_ -- recanonicalize and call ruleset zero   ###
47760894Seric###		   (used for recursive calls)		   ###
47860894Seric##############################################################
47951222Seric
48060894SericS`'_SET_97_
48151222SericR$*			$: $>3 $1
48251222SericR$*			$@ $>0 $1
48351222Seric
48451222Seric
48551222Seric######################################
48651222Seric###   Ruleset 0 -- Parse Address   ###
48751222Seric######################################
48851222Seric
48951222SericS0
49051222Seric
491*63998SericR<@>			$#_LOCAL_ $: <>			special case error msgs
49259887SericR$*:;<@>		$#error $@ USAGE $: "list:; syntax illegal for recipient addresses"
49358340Seric
49455416Sericifdef(`_MAILER_smtp_',
49555416Seric`# handle numeric address spec
49663860Sericifdef(`_NO_CANONIFY_', `dnl',
49763860Seric`R$* < @ [ $+ ] > $*	$: $1 < @ $[ [$2] $] > $3	numeric internet addr')
49863858SericR$* < @ [ $+ ] > $*	$: $>_SET_98_ $1 < @ [ $2 ] > $3	numeric internet spec
49963973SericR$* < @ [ $+ ] > $*	$#_SMTP_ $@ [$2] $: $1 @ [$2] $3	still numeric: send',
50063858Seric	`dnl')
50151222Seric
50251887Seric# now delete the local info -- note $=O to find characters that cause forwarding
50360894SericR$* < @ > $*		$@ $>_SET_97_ $1			user@ => user
50460894SericR< @ $=w . > : $*	$@ $>_SET_97_ $2			@here:... -> ...
50560894SericR$* $=O $* < @ $=w . >	$@ $>_SET_97_ $1 $2 $3			...@here -> ...
50663967Seric
50763967Seric# handle local hacks
50863967SericR$*			$: $>_SET_98_ $1
50958781Sericifdef(`MAILER_TABLE',
51058781Seric`
51158781Seric# try mailer table lookup
51260540SericR$* <@ $+ > $*		$: < $2 > $1 < @ $2 > $3	extract host name
51361106SericR< $+ . > $*		$: < $1 > $2			strip trailing dot
51462582SericR< $+ > $*		$: < $(mailertable $1 $) > $2	lookup
51561106SericR< $- : $+ > $*		$# $1 $@ $2 $: $3		check -- resolved?
51662582SericR< $+ > $*		$: $>90 <$1> $2			try domain',
51758781Seric`dnl')
51851222Seric
51951222Seric# short circuit local delivery so forwarded email works
52058516Sericifdef(`_LOCAL_NOT_STICKY_',
521*63998Seric`R$=L < @ $=w . >		$#_LOCAL_ $: @ $1			special local names
522*63998SericR$+ < @ $=w . >		$#_LOCAL_ $: $1			dispose directly',
52360894Seric`R$+ < @ $=w . >		$: $1 < @ $2 @ $H >		first try hub
52451992Sericifdef(`_OLD_SENDMAIL_',
52559635Seric`R$+ < $+ @ $-:$+ >	$# $3 $@ $4 $: $1 < $2 >	yep ....
52659635SericR$+ < $+ @ $+ >		$#relay $@ $3 $: $1 < $2 >	yep ....
527*63998SericR$+ < $+ @ >		$#_LOCAL_ $: $1			nope, local address',
528*63998Seric`R$+ < $+ @ $+ >		$#_LOCAL_ $: $1			yep ....
529*63998SericR$+ < $+ @ >		$#_LOCAL_ $: @ $1			nope, local address')')
53051260Sericundivert(4)dnl
53151260Seric
53261468Sericifdef(`_NO_UUCP_', `dnl',
53361468Seric`# resolve remotely connected UUCP links (if any)
53451285Sericifdef(`_CLASS_V_',
53563858Seric`R$* < @ $=V . UUCP > $*		$: < $V > <@ $V> : $1 @ $2.UUCP $3
53663858SericR< $- : $+ > $*			$# $1 $@ $2 $: $3	$=V UUCP routing
53763973SericR< $+ > $*			$#_SMTP_ $@ $1 $: $2
53863858SericR<> $*				$: $1			else strip off gunk',
53952044Seric	`dnl')
54051285Sericifdef(`_CLASS_W_',
54163858Seric`R$* < @ $=W . UUCP > $*		$: < $W > <@ $W> : $1 @ $2.UUCP $3
54263858SericR< $- : $+ > $*			$# $1 $@ $2 $: $3	$=W UUCP routing
54363973SericR< $+ > $*			$#_SMTP_ $@ $1 $: $2
54463858SericR<> $*				$: $1			else strip off gunk',
54552044Seric	`dnl')
54651285Sericifdef(`_CLASS_X_',
54763858Seric`R$* < @ $=X . UUCP > $*		$: < $X > <@ $X> : $1 @ $2.UUCP $3
54863858SericR< $- : $+ > $*			$# $1 $@ $2 $: $3	$=X UUCP routing
54963973SericR< $+ > $*			$#_SMTP_ $@ $1 $: $2
55063858SericR<> $*				$: $1			else strip off gunk',
55161468Seric	`dnl')')
55251260Seric
55351222Seric# resolve fake top level domains by forwarding to other hosts
55451222Sericifdef(`BITNET_RELAY',
55563858Seric`R$*<@$+.BITNET>$*	$: < $B > $1 <@$2.BITNET> $3	user@host.BITNET
55663858SericR< $- : $+ > $*		$# $1 $@ $2 $: $3
55763973SericR< $+ > $*		$#_SMTP_ $@ $1 $: $2
55863858SericR<> $*			$: $1				else strip off gunk',
55951222Seric	`dnl')
56051222Sericifdef(`CSNET_RELAY',
56163858Seric`R$*<@$+.CSNET>$*	$: < $C > $1 <@$2.CSNET> $3	user@host.CSNET
56263858SericR< $- : $+ > $*		$# $1 $@ $2 $: $3
56363973SericR< $+ > $*		$#_SMTP_ $@ $1 $: $2
56463858SericR<> $*			$: $1				else strip off gunk',
56551222Seric	`dnl')
56658364Sericifdef(`_MAILER_fax_',
56763858Seric`R$+ < @ $+ .FAX >	$#fax $@ $2 $: $1		user@host.FAX',
56858364Seric`ifdef(`FAX_RELAY',
56963858Seric`R$*<@$+.FAX>$*		$: < $F > $1 <@$2.FAX> $3	user@host.FAX
57063858SericR< $- : $+ > $*		$# $1 $@ $2 $: $3
57163973SericR< $+ > $*		$#_SMTP_ $@ $1 $: $2
57263858SericR<> $*			$: $1				else strip off gunk',
57358364Seric	`dnl')')
57451222Seric
57551260Sericifdef(`UUCP_RELAY',
57651260Seric`# forward non-local UUCP traffic to our UUCP relay
57763858SericR$*<@$*.UUCP>$*		$: < $Y > <@ $Y> : $1 @ $2.UUCP $3	uucp mail
57863858SericR< $- : $+ > $*		$# $1 $@ $2 $: $3
57963973SericR< $+ > $*		$#_SMTP_ $@ $1 $: $2
58063858SericR<> $*			$: $1				else strip off gunk',
58155416Seric`ifdef(`_MAILER_uucp_',
58251260Seric`# forward other UUCP traffic straight to UUCP
58363858SericR< @ $+ .UUCP > : $+	$#uucp $@ $1 $: $2		@host.UUCP:...
58463858SericR$+ < @ $+ .UUCP >	$#uucp $@ $2 $: $1		user@host.UUCP',
58551260Seric	`dnl')')
58663967Sericifdef(`_MAILER_usenet_', `
58763754Seric# addresses sent to net.group.USENET will get forwarded to a newsgroup
588*63998SericR$+ . USENET		$#usenet $: $1',
58963860Seric	`dnl')
59063754Seric
59158070Sericifdef(`_LOCAL_RULES_',
59258070Seric`# figure out what should stay in our local mail system
59363754Sericundivert(1)', `dnl')
59463754Seric
59563946Sericifdef(`SMART_HOST',
59663946Seric`# pass names that still have a host to a smarthost
59758070SericR$* < @ $* > $*		$: < $S > $1 < @ $2 > $3	glue on smarthost name
59863858SericR< $- : $+ > $*		$# $1 $@ $2 $: $3		if non-null, use it
59963858SericR< $+ > $*		$#suucp $@ $1 $: $2		if non-null, use it
60063858SericR<> $*			$: $1				else strip off gunk',
60163754Seric
60263754Seric`# deal with other remote names
60363946Sericifdef(`_MAILER_smtp_',
60463973Seric`R$* < @$* > $*		$#_SMTP_ $@ $2 $: $1 < @ $2 > $3		user@host.domain',
60563946Seric`R$* < @$* > $*		$#error $@NOHOST $: Unrecognized host name $2')')
60651222Seric
60751992Sericifdef(`_OLD_SENDMAIL_',
60851887Seric`# forward remaining names to local relay, if any
609*63998SericR$=L			$#_LOCAL_ $: $1			special local names
61052041SericR$+			$: $1 < @ $R >			append relay
61157527SericR$+ < @ >		$: $1 < @ $H >			no relay, try hub
612*63998SericR$+ < @ >		$#_LOCAL_ $: $1			no relay or hub: local
613*63998SericR$+ < @ $=w  >		$#_LOCAL_ $: $1			we are relay/hub: local
61458070SericR$+ < @ $-:$+ >		$# $2 $@ $3 $: $1		deliver to relay/hub
61558771SericR$+ < @ $+ >		$#relay $@ $2 $: $1		deliver to relay/hub',
61658811Seric
61758811Seric`# if this is quoted, strip the quotes and try again
61858811SericR$+			$: $(dequote $1 $)		strip quotes
61960894SericR$* $=O $*		$@ $>_SET_97_ $1 $2 $3			try again
62058811Seric
62158811Seric# handle locally delivered names
622*63998SericR$=L			$#_LOCAL_ $: @ $1			special local names
623*63998SericR$+			$#_LOCAL_ $: $1			regular local names
62451222Seric
62555416Seric###########################################################################
62655416Seric###   Ruleset 5 -- special rewriting after aliases have been expanded   ###
62755416Seric###		   (new sendmail only)					###
62855416Seric###########################################################################
62951222Seric
63051322SericS5
63151322Seric
63258808Seric# see if we have a relay or a hub
63358808SericR$+			$: $1 < @ $R >
63457527SericR$+ < @ >		$: $1 < @ $H >			no relay, try hub
63560894SericR$+ < @ $=w >		$@ $1				we are relay/hub: local
63658070SericR$+ < @ $-:$+ >		$# $2 $@ $3 $: $1		send to relay or hub
63758808Sericifdef(`_MAILER_smtp_',
63858808Seric`R$+ < @ $+ >		$#relay $@ $2 $: $1		send to relay or hub')')
63960540Sericifdef(`MAILER_TABLE',
64060540Seric`
64160540Seric
64263858Seric###################################################################
64363858Seric###  Ruleset 90 -- try domain part of mailertable entry 	###
64463858Seric###		   (new sendmail only)				###
64563858Seric###################################################################
64660540Seric
64760540SericS90
64861106SericR<$- . $+ > $*		$: < $(mailertable .$2 $) > $3	lookup
64960540SericR<$- : $+ > $*		$# $1 $@ $2 $: $3		check -- resolved?
65062372SericR< . $+ > $*		$@ $>90 <$1> $2			no -- strip & try again
65160540SericR<$*> $*		$@ $2				no match',
65260540Seric`dnl')
65363858Seric
65463858Seric###################################################################
65563858Seric###  Ruleset _SET_98_ -- local part of ruleset zero (can be null)	###
65663858Seric###################################################################
65763858Seric
65863858SericS`'_SET_98_
65963858Sericundivert(3)dnl
66051222Seric#
66151222Seric######################################################################
66251222Seric######################################################################
66351222Seric#####
66456790Seric`#####			MAILER DEFINITIONS'
66551222Seric#####
66651222Seric######################################################################
66751222Seric######################################################################
66851222Sericundivert(7)dnl
669