xref: /csrg-svn/usr.sbin/sendmail/cf/m4/proto.m4 (revision 63754)
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*63754SericVERSIONID(`@(#)proto.m4	8.2 (Berkeley) 07/11/93')
1251222Seric
1351322SericMAILER(local)dnl
1451222Seric
1560894Sericifdef(`_OLD_SENDMAIL_',
1660894Seric`define(`_SET_96_', 6)dnl
1760894Sericdefine(`_SET_97_', 7)dnl',
1858119Seric`# level 4 config file format
1960894SericV4
2060894Sericdefine(`_SET_96_', 96)dnl
2160894Sericdefine(`_SET_97_', 97)dnl')
2252646Seric
2351222Seric##################
2451222Seric#   local info   #
2551222Seric##################
2651222Seric
2760212SericCP.
2860212Seric
2951889SericCwlocalhost
3051887Sericifdef(`USE_CW_FILE',
3151889Seric`# file containing names of hosts for which we receive email
3258406SericCONCAT(`Fw', confCW_FILE)', `dnl')
3351222Seric
3451222Sericifdef(`UUCP_RELAY',
3551222Seric`# UUCP relay host
3651281SericCONCAT(DY, UUCP_RELAY)
3760212SericCPUUCP
3857944Seric
3951222Seric')dnl
4051222Sericifdef(`BITNET_RELAY',
4151222Seric`#  BITNET relay host
4251222SericCONCAT(DB, BITNET_RELAY)
4360212SericCPBITNET
4457944Seric
4551222Seric')dnl
4651222Sericifdef(`CSNET_RELAY',
4751222Seric`# CSNET relay host
4851222SericCONCAT(DC, CSNET_RELAY)
4960212SericCPCSNET
5057944Seric
5151222Seric')dnl
5258364Sericifdef(`FAX_RELAY',
5358364Seric`# FAX relay host
5458364SericCONCAT(DF, FAX_RELAY)
5560212SericCPFAX
5658364Seric
5758364Seric')dnl
5858070Sericifdef(`SMART_HOST',
5958070Seric`# "Smart" UUCP relay host
6058070SericCONCAT(DS, SMART_HOST)
6151222Seric
6258070Seric')dnl
6358781Sericifdef(`MAILER_TABLE',
6458781Seric`# Mailer table (overriding domains)
6558781SericKmailertable MAILER_TABLE
6658781Seric
6758781Seric')dnl
68*63754Sericifdef(`DOMAIN_TABLE',
69*63754Seric`# Domain table (adding domains)
70*63754SericKdomaintable DOMAIN_TABLE
71*63754Seric
72*63754Seric')dnl
7351222Seric# who I send unqualified names to (null means deliver locally)
7451222SericCONCAT(DR, ifdef(`LOCAL_RELAY', LOCAL_RELAY))
7551222Seric
7657527Seric# who gets all local email traffic ($R has precedence for unqualified names)
7757527SericCONCAT(DH, ifdef(`MAIL_HUB', MAIL_HUB))
7857527Seric
7958070Seric# my official hostname ($w or $w.$D)
8058070SericCONCAT(Dj$w, ifdef(`NEED_DOMAIN', .$D))
8158070Seric
8258070Seric# who I masquerade as (can be $j)
8358070SericCONCAT(DM, ifdef(`MASQUERADE_NAME', MASQUERADE_NAME, $j))
8458070Seric
8557245Seric# class L: names that should be delivered locally, even if we have a relay
8657245Seric# class E: names that should be exposed as from this host, even if we masquerade
8751279SericCLroot
8857245SericCEroot
8951279Sericundivert(5)dnl
9051279Seric
9151222Seric# operators that cannot be in local usernames (i.e., network indicators)
9258288SericCO @ % ifdef(`_NO_UUCP_', `', `!')
9351222Seric
9451322Seric# a class with just dot (for identifying canonical names)
9551322SericC..
9651322Seric
9758808Sericifdef(`_OLD_SENDMAIL_', `dnl',
9858808Seric`# dequoting map
9958808SericKdequote dequote')
10057944Seric
10159033Sericundivert(6)dnl
10259033Seric
10357944Seric######################
10457944Seric#   Special macros   #
10557944Seric######################
10657944Seric
10757944Seric# SMTP initial login message
10857944SericCONCAT(De, confSMTP_LOGIN_MSG)
10957944Seric
11057944Seric# UNIX initial From header format
11157944SericCONCAT(Dl, confFROM_LINE)
11257944Seric
11357944Seric# my name for error messages
11457944SericCONCAT(Dn, confMAILER_NAME)
11557944Seric
11657944Seric# delimiter (operator) characters
11757944SericCONCAT(Do, confOPERATORS)
11857944Seric
11957944Seric# format of a total name
12057944SericCONCAT(Dq, ifdef(`confFROM_HEADER', confFROM_HEADER,
12157944Seric	ifdef(`_OLD_SENDMAIL_', `$g$?x ($x)$.', `$?x$x <$g>$|$g$.')))
12257944Sericinclude(`../m4/version.m4')
12357944Seric
12457944Seric###############
12557944Seric#   Options   #
12657944Seric###############
12757944Seric
12859887Seric# strip message body to 7 bits on input?
12959887SericCONCAT(O7, confSEVEN_BIT_INPUT)
13057944Seric
13157944Seric# wait (in minutes) for alias file rebuild
13257944SericCONCAT(Oa, confALIAS_WAIT)
13357944Seric
13457944Seric# location of alias file
13557944SericCONCAT(OA, ifdef(`ALIAS_FILE', ALIAS_FILE, /etc/aliases))
13657944Seric
13758084Seric# minimum number of free blocks on filesystem
13858084SericCONCAT(Ob, confMIN_FREE_BLOCKS)
13958084Seric
14057944Seric# substitution for space (blank) characters
14157944SericCONCAT(OB, confBLANK_SUB)
14257944Seric
14357944Seric# connect to "expensive" mailers on initial submission?
14457944SericCONCAT(Oc, confCON_EXPENSIVE)
14557944Seric
14657944Seric# checkpoint queue runs after every N successful deliveries
14757944SericCONCAT(OC, confCHECKPOINT_INTERVAL)
14857944Seric
14957944Seric# default delivery mode
15057944SericCONCAT(Od, confDELIVERY_MODE)
15157944Seric
15257944Seric# automatically rebuild the alias database?
15357944SericCONCAT(OD, confAUTO_REBUILD)
15457944Seric
15557944Seric# error message header/file */
15657944Sericifdef(`confERROR_MESSAGE',
15763583Seric	CONCAT(OE, confERROR_MESSAGE),
15857944Seric	#OE/etc/sendmail.oE)
15957944Seric
16057944Seric# error mode
16157944Sericifdef(`confERROR_MODE',
16263583Seric	CONCAT(Oe, confERROR_MODE),
16357944Seric	#Oep)
16457944Seric
16557944Seric# save Unix-style "From_" lines at top of header?
16657944SericCONCAT(Of, confSAVE_FROM_LINES)
16757944Seric
16857944Seric# temporary file mode
16957944SericCONCAT(OF, confTEMP_FILE_MODE)
17057944Seric
17157944Seric# match recipients against GECOS field?
17257944SericCONCAT(OG, confMATCH_GECOS)
17357944Seric
17457944Seric# default GID
17557944SericCONCAT(Og, confDEF_GROUP_ID)
17657944Seric
17757944Seric# maximum hop count
17857944SericCONCAT(Oh, confMAX_HOP)
17957944Seric
18057944Seric# location of help file
18157944SericCONCAT(OH, ifdef(`HELP_FILE', HELP_FILE, /usr/lib/sendmail.hf))
18257944Seric
18357944Seric# ignore dots as terminators in incoming messages?
18457944SericCONCAT(Oi, confIGNORE_DOTS)
18557944Seric
18657944Seric# Insist that the BIND name server be running to resolve names
18757944Sericifdef(`confBIND_OPTS',
18857944Seric	CONCAT(OI, confBIND_OPTS),
18957944Seric	#OI)
19057944Seric
19159887Seric# deliver MIME-encapsulated error messages?
19259887SericCONCAT(Oj, confMIME_FORMAT_ERRORS)
19359887Seric
19457944Seric# Forward file search path
19557944Sericifdef(`confFORWARD_PATH',
19657944Seric	CONCAT(OJ, confFORWARD_PATH),
19757944Seric	#OJ/var/forward/$u:$z/.forward.$w:$z/.forward)
19857944Seric
19957944Seric# open connection cache size
20057944SericCONCAT(Ok, confMCI_CACHE_SIZE)
20157944Seric
20257944Seric# open connection cache timeout
20357944SericCONCAT(OK, confMCI_CACHE_TIMEOUT)
20457944Seric
20561106Seric# use Errors-To: header?
20661106SericCONCAT(Ol, confUSE_ERRORS_TO)
20761106Seric
20857944Seric# log level
20957944SericCONCAT(OL, confLOG_LEVEL)
21057944Seric
21157944Seric# send to me too, even in an alias expansion?
21257944SericCONCAT(Om, confME_TOO)
21357944Seric
21457944Seric# verify RHS in newaliases?
21557944SericCONCAT(On, confCHECK_ALIASES)
21657944Seric
21757944Seric# default messages to old style headers if no special punctuation?
21857944SericCONCAT(Oo, confOLD_STYLE_HEADERS)
21957944Seric
22058860Seric# SMTP daemon options
22158860Sericifdef(`confDAEMON_OPTIONS',
22258860Seric	CONCAT(OO, confDAEMON_OPTIONS),
22358860Seric	#OOPort=esmtp)
22458860Seric
22558084Seric# privacy flags
22658084SericCONCAT(Op, confPRIVACY_FLAGS)
22758084Seric
22857944Seric# who (if anyone) should get extra copies of error messages
22957944Sericifdef(`confCOPY_ERRORS_TO',
23057944Seric	CONCAT(OP, confCOPY_ERRORS_TO),
23157944Seric	#OPPostmaster)
23257944Seric
23357944Seric# slope of queue-only function
23457944Sericifdef(`confQUEUE_FACTOR',
23557944Seric	CONCAT(Oq, confQUEUE_FACTOR),
23657944Seric	#Oq600000)
23757944Seric
23857944Seric# queue directory
23957944SericCONCAT(OQ, ifdef(`QUEUE_DIR', QUEUE_DIR, /var/spool/mqueue))
24057944Seric
24157944Seric# read timeout -- now OK per RFC 1123 section 5.3.2
24258119Sericifdef(`confREAD_TIMEOUT',
24358119Seric	CONCAT(Or, confREAD_TIMEOUT),
24458119Seric	#Ordatablock=10m)
24557944Seric
24657944Seric# queue up everything before forking?
24757944SericCONCAT(Os, confSAFE_QUEUE)
24857944Seric
24957944Seric# status file
25057944SericCONCAT(OS, ifdef(`STATUS_FILE', STATUS_FILE, /etc/sendmail.st))
25157944Seric
25257944Seric# default message timeout interval
25357944SericCONCAT(OT, confMESSAGE_TIMEOUT)
25457944Seric
25557944Seric# time zone handling:
25657944Seric#  if undefined, use system default
25757944Seric#  if defined but null, use TZ envariable passed in
25857944Seric#  if defined and non-null, use that info
25957944Sericifelse(confTIME_ZONE, `USE_SYSTEM', `#Ot',
26057944Seric	confTIME_ZONE, `USE_TZ', `',
26157944Seric	`CONCAT(Ot, confTIME_ZONE)')
26257944Seric
26357944Seric# default UID
26457944SericCONCAT(Ou, confDEF_USER_ID)
26557944Seric
26651887Seric# list of locations of user database file (null means no lookup)
26758720SericOU`'ifdef(`confUSERDB_SPEC', `confUSERDB_SPEC')
26851222Seric
26958860Seric# fallback MX host
27058860Sericifdef(`confFALLBACK_MX',
27158860Seric	CONCAT(OV, confFALLBACK_MX),
27258860Seric	#OVfall.back.host.net)
27358860Seric
27457944Seric# load average at which we just queue messages
27557944SericCONCAT(Ox, confQUEUE_LA)
27657944Seric
27757944Seric# load average at which we refuse connections
27857944SericCONCAT(OX, confREFUSE_LA)
27957944Seric
28057944Seric# work recipient factor
28157944Sericifdef(`confWORK_RECIPIENT_FACTOR',
28257944Seric	CONCAT(Oy, confWORK_RECIPIENT_FACTOR),
28357944Seric	#Oy30000)
28457944Seric
28557944Seric# deliver each queued job in a separate process?
28657944SericCONCAT(OY, confSEPARATE_PROC)
28757944Seric
28857944Seric# work class factor
28957944Sericifdef(`confWORK_CLASS_FACTOR',
29057944Seric	CONCAT(Oz, confWORK_CLASS_FACTOR),
29157944Seric	#Oz1800)
29257944Seric
29357944Seric# work time factor
29457944Sericifdef(`confWORK_TIME_FACTOR',
29557944Seric	CONCAT(OZ, confWORK_TIME_FACTOR),
29657944Seric	#OZ90000)
29757944Seric
29857944Seric###########################
29957944Seric#   Message precedences   #
30057944Seric###########################
30157944Seric
30257944SericPfirst-class=0
30357944SericPspecial-delivery=100
30458070SericPlist=-30
30557944SericPbulk=-60
30657944SericPjunk=-100
30757944Seric
30857944Seric#####################
30957944Seric#   Trusted users   #
31057944Seric#####################
31157944Seric
31257944SericTroot
31357944SericTdaemon
31457944SericTuucp
31557944Seric
31657944Seric#########################
31757944Seric#   Format of headers   #
31857944Seric#########################
31957944Seric
32058679SericH?P?Return-Path: $g
32160894SericHReceived: $?sfrom $s $.$?_($_) $.by $j ($v/$Z)$?r with $r$. id $i; $b
32257944SericH?D?Resent-Date: $a
32357944SericH?D?Date: $a
32457944SericH?F?Resent-From: $q
32557944SericH?F?From: $q
32657944SericH?x?Full-Name: $x
32757944SericHSubject:
32857944Seric# HPosted-Date: $a
32957944Seric# H?l?Received-Date: $b
33057944SericH?M?Resent-Message-Id: <$t.$i@$j>
33157944SericH?M?Message-Id: <$t.$i@$j>
33251222Seric#
33351222Seric######################################################################
33451222Seric######################################################################
33551222Seric#####
33651222Seric#####			REWRITING RULES
33751222Seric#####
33851222Seric######################################################################
33951222Seric######################################################################
34051222Seric
34158678Sericundivert(9)dnl
34251222Seric
34351222Seric###########################################
34451222Seric###  Rulset 3 -- Name Canonicalization  ###
34551222Seric###########################################
34651260SericS3
34751222Seric
34858499Seric# handle null input and list syntax (translate to <@> special case)
34958499SericR$@			$@ <@>
35058707SericR$*:;$*			$@ $1 :; <@>
35158174Seric
35251222Seric# basic textual canonicalization -- note RFC733 heuristic here
35357012SericR$*<$*>$*<$*>$*		<$2>$3$4$5			strip multiple <> <>
35458158SericR$*<$*<$+>$*>$*		<$3>$5				2-level <> nesting
35558499SericR$*<>$*			$@ <@>				MAIL FROM:<> case
35651222SericR$*<$+>$*		$2				basic RFC821/822 parsing
35751222Seric
35851222Seric# make sure <@a,@b,@c:user@d> syntax is easy to parse -- undone later
35955416SericR@ $+ , $+		@ $1 : $2			change all "," to ":"
36051222Seric
36151222Seric# localize and dispose of route-based addresses
36260894SericR@ $+ : $+		$@ $>_SET_96_ < @$1 > : $2		handle <route-addr>
36351222Seric
36451222Seric# find focus for list syntax
36560894SericR $+ : $* ; @ $+	$@ $>_SET_96_ $1 : $2 ; < @ $3 >	list syntax
36655416SericR $+ : $* ;		$@ $1 : $2;			list syntax
36751222Seric
36851222Seric# find focus for @ syntax addresses
36955416SericR$+ @ $+		$: $1 < @ $2 >			focus on domain
37055416SericR$+ < $+ @ $+ >		$1 $2 < @ $3 >			move gaze right
37160894SericR$+ < @ $+ >		$@ $>_SET_96_ $1 < @ $2 >		already canonical
37251222Seric
37358288Sericifdef(`_NO_UUCP_', `dnl',
37458288Seric`# convert old-style addresses to a domain-based address
37560894SericR$- ! $+		$@ $>_SET_96_ $2 < @ $1 .UUCP >	resolve uucp names
37660894SericR$+ . $- ! $+		$@ $>_SET_96_ $3 < @ $1 . $2 >		domain uucps
37760894SericR$+ ! $+		$@ $>_SET_96_ $2 < @ $1 .UUCP >	uucp subdomains')
37851222Seric
37951222Seric# if we have % signs, take the rightmost one
38055416SericR$* % $*		$1 @ $2				First make them all @s.
38155416SericR$* @ $* @ $*		$1 % $2 @ $3			Undo all but the last.
38260894SericR$* @ $*		$@ $>_SET_96_ $1 < @ $2 >		Insert < > and finish
38351222Seric
38451222Seric# else we must be a local name
38551222Seric
38651222Seric
38760894Seric################################################
38860894Seric###  Ruleset _SET_96_ -- bottom half of ruleset 3  ###
38960894Seric################################################
39051222Seric
39157245Seric#  At this point, everything should be in a "local_part<@domain>extra" format.
39260894SericS`'_SET_96_
39351222Seric
39451222Seric# handle special cases for local names
39560262SericR$* < @ localhost > $*		$: $1 < @ $j . > $2		no domain at all
39660262SericR$* < @ localhost . $m > $*	$: $1 < @ $j . > $2		local domain
39760262Sericifdef(`_NO_UUCP_', `dnl',
39860262Seric`R$* < @ localhost . UUCP > $*	$: $1 < @ $j . > $2		.UUCP domain')
399*63754Sericifdef(`DOMAIN_TABLE', `
400*63754Seric# look up unqualified domains in the domain table
401*63754SericR$* < @ $- > $*			$: $1 < @ $(domaintable $2 $) > $3',
402*63754Seric`dnl')
40351889Sericundivert(2)dnl
40451222Seric
40559081Sericifdef(`_NO_UUCP_', `dnl',
40659081Seric`ifdef(`UUCP_RELAY',
40751274Seric`# pass UUCP addresses straight through
40855416SericR$* < @ $+ . UUCP > $*		$@ $1 < @ $2 . UUCP > $3',
40951274Seric`# if really UUCP, handle it immediately
41051322Sericifdef(`_CLASS_U_',
41155416Seric`R$* < @ $=U . UUCP > $*	$@ $1 < @ $2 . UUCP > $3', `dnl')
41251322Sericifdef(`_CLASS_V_',
41355416Seric`R$* < @ $=V . UUCP > $*	$@ $1 < @ $2 . UUCP > $3', `dnl')
41451322Sericifdef(`_CLASS_W_',
41555416Seric`R$* < @ $=W . UUCP > $*	$@ $1 < @ $2 . UUCP > $3', `dnl')
41651322Sericifdef(`_CLASS_X_',
41755416Seric`R$* < @ $=X . UUCP > $*	$@ $1 < @ $2 . UUCP > $3', `dnl')
41851322Sericifdef(`_CLASS_Y_',
41955416Seric`R$* < @ $=Y . UUCP > $*	$@ $1 < @ $2 . UUCP > $3', `dnl')
42051267Seric
42151267Seric# try UUCP traffic as a local address
42255416SericR$* < @ $+ . UUCP > $*		$: $1 < @ $[ $2 $] . UUCP > $3
42351992Sericifdef(`_OLD_SENDMAIL_',
42455416Seric`R$* < @ $+ . $+ . UUCP > $*		$@ $1 < @ $2 . $3 . > $4',
42555416Seric`R$* < @ $+ . . UUCP > $*		$@ $1 < @ $2 . > $3')')
42659081Seric')
42761470Sericifdef(`_NO_CANONIFY_',
42861470Seric`# make sure local host names appear canonical
42961470SericR$* < @ $=w > $*		$: $1 < @ $2 . > $3',
43059081Seric`# pass to name server to make hostname canonical
43161470SericR$* < @ $* $~P > $*		$: $1 < @ $[ $2 $3 $] > $4')
43261470Seric
43351889Sericundivert(8)dnl
43451889Seric
43551322Seric# if this is the local hostname, make sure we treat is as canonical
43651322SericR$* < @ $j > $*			$: $1 < @ $j . > $2
43751222Seric
43851322Seric
43951222Seric##################################################
44051222Seric###  Ruleset 4 -- Final Output Post-rewriting  ###
44151222Seric##################################################
44251222SericS4
44351222Seric
44458499SericR$*<@>			$@ $1				handle <> and list:;
44551222Seric
44651222Seric# resolve numeric addresses to name if possible
44751322SericR$* < @ [ $+ ] > $*	$: $1 < @ $[ [$2] $] > $3	lookup numeric internet addr
44851222Seric
44951322Seric# strip trailing dot off possibly canonical name
45051322SericR$* < @ $+ . > $*	$1 < @ $2 > $3
45151322Seric
45251222Seric# externalize local domain info
45351322SericR$* < $+ > $*		$1 $2 $3			defocus
45451322SericR@ $+ : @ $+ : $+	@ $1 , @ $2 : $3		<route-addr> canonical
45551997SericR@ $*			$@ @ $1				... and exit
45651222Seric
45758288Sericifdef(`_NO_UUCP_', `dnl',
45858288Seric`# UUCP must always be presented in old form
45958288SericR$+ @ $- . UUCP		$2!$1				u@h.UUCP => h!u')
46051222Seric
46151222Seric# delete duplicate local names
46251322SericR$+ % $=w @ $=w		$1 @ $j				u%host@host => u@host
46351222Seric
46451222Seric
46551222Seric
46660894Seric##############################################################
46760894Seric###   Ruleset _SET_97_ -- recanonicalize and call ruleset zero   ###
46860894Seric###		   (used for recursive calls)		   ###
46960894Seric##############################################################
47051222Seric
47160894SericS`'_SET_97_
47251222SericR$*			$: $>3 $1
47351222SericR$*			$@ $>0 $1
47451222Seric
47551222Seric
47651222Seric######################################
47751222Seric###   Ruleset 0 -- Parse Address   ###
47851222Seric######################################
47951222Seric
48051222SericS0
48151222Seric
48258562SericR<@>			$#local $: <>			special case error msgs
48359887SericR$*:;<@>		$#error $@ USAGE $: "list:; syntax illegal for recipient addresses"
48458340Seric
48555416Sericifdef(`_MAILER_smtp_',
48655416Seric`# handle numeric address spec
48751322SericR$* < @ [ $+ ] > $*	$: $1 < @ $[ [$2] $] > $3	numeric internet addr
48855416SericR$* < @ [ $+ ] > $*	$#smtp $@ [$2] $: $1 @ [$2] $3	numeric internet spec',
48956785Seric`dnl')
49051222Seric
49151887Seric# now delete the local info -- note $=O to find characters that cause forwarding
49260894SericR$* < @ > $*		$@ $>_SET_97_ $1			user@ => user
49360894SericR< @ $=w . > : $*	$@ $>_SET_97_ $2			@here:... -> ...
49460894SericR$* $=O $* < @ $=w . >	$@ $>_SET_97_ $1 $2 $3			...@here -> ...
49558781Sericifdef(`MAILER_TABLE',
49658781Seric`
49758781Seric# try mailer table lookup
49860540SericR$* <@ $+ > $*		$: < $2 > $1 < @ $2 > $3	extract host name
49961106SericR< $+ . > $*		$: < $1 > $2			strip trailing dot
50062582SericR< $+ > $*		$: < $(mailertable $1 $) > $2	lookup
50161106SericR< $- : $+ > $*		$# $1 $@ $2 $: $3		check -- resolved?
50262582SericR< $+ > $*		$: $>90 <$1> $2			try domain',
50358781Seric`dnl')
50451222Seric
50551222Seric# short circuit local delivery so forwarded email works
50658516Sericifdef(`_LOCAL_NOT_STICKY_',
50760894Seric`R$=L < @ $=w . >		$#local $: @ $1			special local names
50860894SericR$+ < @ $=w . >		$#local $: $1			dispose directly',
50960894Seric`R$+ < @ $=w . >		$: $1 < @ $2 @ $H >		first try hub
51051992Sericifdef(`_OLD_SENDMAIL_',
51159635Seric`R$+ < $+ @ $-:$+ >	$# $3 $@ $4 $: $1 < $2 >	yep ....
51259635SericR$+ < $+ @ $+ >		$#relay $@ $3 $: $1 < $2 >	yep ....
51357527SericR$+ < $+ @ >		$#local $: $1			nope, local address',
51457527Seric`R$+ < $+ @ $+ >		$#local $: $1			yep ....
51558516SericR$+ < $+ @ >		$#local $: @ $1			nope, local address')')
51651222Sericundivert(3)dnl
51751260Sericundivert(4)dnl
51851260Seric
51961468Sericifdef(`_NO_UUCP_', `dnl',
52061468Seric`# resolve remotely connected UUCP links (if any)
52151285Sericifdef(`_CLASS_V_',
52259635Seric`R$* < @ $=V . UUCP > $*		$#smtp $@ $V $: <@ $V> : $1 @ $2.UUCP $3',
52352044Seric	`dnl')
52451285Sericifdef(`_CLASS_W_',
52559635Seric`R$* < @ $=W . UUCP > $*		$#smtp $@ $W $: <@ $W> : $1 @ $2.UUCP $3',
52652044Seric	`dnl')
52751285Sericifdef(`_CLASS_X_',
52859635Seric`R$* < @ $=X . UUCP > $*		$#smtp $@ $X $: <@ $X> : $1 @ $2.UUCP $3',
52961468Seric	`dnl')')
53051260Seric
53151222Seric# resolve fake top level domains by forwarding to other hosts
53251222Sericifdef(`BITNET_RELAY',
53361468Seric`R$*<@$+.BITNET>$*	$#smtp $@ $B $: $1 <@$2.BITNET> $3	user@host.BITNET',
53451222Seric	`dnl')
53551222Sericifdef(`CSNET_RELAY',
53661468Seric`R$*<@$+.CSNET>$*	$#smtp $@ $C $: $1 <@$2.CSNET> $3	user@host.CSNET',
53751222Seric	`dnl')
53858364Sericifdef(`_MAILER_fax_',
53958364Seric`R$+ < @ $+ .FAX >	$#fax $@ $2 $: $1			user@host.FAX',
54058364Seric`ifdef(`FAX_RELAY',
54161468Seric`R$*<@$+.FAX>$*		$#smtp $@ $F $: $1 <@$2.FAX> $3		user@host.FAX',
54258364Seric	`dnl')')
54351222Seric
54451260Sericifdef(`UUCP_RELAY',
54551260Seric`# forward non-local UUCP traffic to our UUCP relay
54661468SericR$*<@$*.UUCP>$*		$#smtp $@ $Y $: <@ $Y> : $1 @ $2.UUCP $3	uucp mail',
54755416Seric`ifdef(`_MAILER_uucp_',
54851260Seric`# forward other UUCP traffic straight to UUCP
54959604SericR< @ $+ .UUCP > : $+	$#uucp $@ $1 $: $2			@host.UUCP:...
55051322SericR$+ < @ $+ .UUCP >	$#uucp $@ $2 $: $1			user@host.UUCP',
55151260Seric	`dnl')')
55251222Seric
553*63754Sericifdef(`_MAILER_USENET_', `
554*63754Seric# addresses sent to net.group.USENET will get forwarded to a newsgroup
555*63754SericR$+ . USENET		$# usenet $: $1',
556*63754Seric`dnl')
557*63754Seric
55858070Sericifdef(`_LOCAL_RULES_',
55958070Seric`# figure out what should stay in our local mail system
560*63754Sericundivert(1)', `dnl')
561*63754Seric
56258070Sericifdef(`SMART_HOST', `
56358070Seric# pass names that still have a host to a smarthost
56458070SericR$* < @ $* > $*		$: < $S > $1 < @ $2 > $3	glue on smarthost name
56559635SericR<$-:$+> $* < @$* > $*	$# $1 $@ $2 $: $3 < @ $4 > $5	if non-null, use it
56659635SericR<$+> $* < @$* > $*	$#suucp $@ $1 $: $2 < @ $3 > $4	if non-null, use it
56758070SericR<> $* < @ $* > $*	$1 < @ $2 > $3			else strip off gunk',
568*63754Seric
56958070Seric`ifdef(`_LOCAL_RULES_', `
57058070Seric# reject messages that have host names we do not understand
57158070SericR$* < @ $* > $*		$#error $@ NOHOST $: Unrecognized host name $2',
572*63754Seric`ifdef(`_MAILER_smtp_',
573*63754Seric`# deal with other remote names
574*63754SericR$* < @ $* > $*		$#smtp $@ $2 $: $1 < @ $2 > $3		user@host.domain')')')
57551222Seric
57651992Sericifdef(`_OLD_SENDMAIL_',
57751887Seric`# forward remaining names to local relay, if any
57852041SericR$=L			$#local $: $1			special local names
57952041SericR$+			$: $1 < @ $R >			append relay
58057527SericR$+ < @ >		$: $1 < @ $H >			no relay, try hub
58157527SericR$+ < @ >		$#local $: $1			no relay or hub: local
58260894SericR$+ < @ $=w  >		$#local $: $1			we are relay/hub: local
58358070SericR$+ < @ $-:$+ >		$# $2 $@ $3 $: $1		deliver to relay/hub
58458771SericR$+ < @ $+ >		$#relay $@ $2 $: $1		deliver to relay/hub',
58558811Seric
58658811Seric`# if this is quoted, strip the quotes and try again
58758811SericR$+			$: $(dequote $1 $)		strip quotes
58860894SericR$* $=O $*		$@ $>_SET_97_ $1 $2 $3			try again
58958811Seric
59058811Seric# handle locally delivered names
59152041SericR$=L			$#local $: @ $1			special local names
59252041SericR$+			$#local $: $1			regular local names
59351222Seric
59455416Seric###########################################################################
59555416Seric###   Ruleset 5 -- special rewriting after aliases have been expanded   ###
59655416Seric###		   (new sendmail only)					###
59755416Seric###########################################################################
59851222Seric
59951322SericS5
60051322Seric
60158808Seric# see if we have a relay or a hub
60258808SericR$+			$: $1 < @ $R >
60357527SericR$+ < @ >		$: $1 < @ $H >			no relay, try hub
60460894SericR$+ < @ $=w >		$@ $1				we are relay/hub: local
60558070SericR$+ < @ $-:$+ >		$# $2 $@ $3 $: $1		send to relay or hub
60658808Sericifdef(`_MAILER_smtp_',
60758808Seric`R$+ < @ $+ >		$#relay $@ $2 $: $1		send to relay or hub')')
60860540Sericifdef(`MAILER_TABLE',
60960540Seric`
61060540Seric
61160540Seric###########################################################################
61260540Seric###  Ruleset 90 -- try domain part of mailertable entry 		###
61360540Seric###		   (new sendmail only)					###
61460540Seric###########################################################################
61560540Seric
61660540SericS90
61761106SericR<$- . $+ > $*		$: < $(mailertable .$2 $) > $3	lookup
61860540SericR<$- : $+ > $*		$# $1 $@ $2 $: $3		check -- resolved?
61962372SericR< . $+ > $*		$@ $>90 <$1> $2			no -- strip & try again
62060540SericR<$*> $*		$@ $2				no match',
62160540Seric`dnl')
62251222Seric#
62351222Seric######################################################################
62451222Seric######################################################################
62551222Seric#####
62656790Seric`#####			MAILER DEFINITIONS'
62751222Seric#####
62851222Seric######################################################################
62951222Seric######################################################################
63051222Sericundivert(7)dnl
631