xref: /csrg-svn/usr.sbin/sendmail/cf/m4/proto.m4 (revision 64144)
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*64144SericVERSIONID(`@(#)proto.m4	8.12 (Berkeley) 08/08/93')
1251222Seric
1351322SericMAILER(local)dnl
1451222Seric
1560894Sericifdef(`_OLD_SENDMAIL_',
1664010Seric`define(`_SET_95_', 5)dnl
1764010Sericdefine(`_SET_96_', 6)dnl
1863858Sericdefine(`_SET_97_', 7)dnl
1963858Sericdefine(`_SET_98_', 8)dnl',
2058119Seric`# level 4 config file format
2160894SericV4
2264010Sericdefine(`_SET_95_', 95)dnl
2360894Sericdefine(`_SET_96_', 96)dnl
2463858Sericdefine(`_SET_97_', 97)dnl
2563858Sericdefine(`_SET_98_', 98)dnl')
2664010Sericifdef(`confSMTP_MAILER',, `define(`confSMTP_MAILER', `smtp')')dnl
2763998Sericifdef(`confLOCAL_MAILER',, `define(`confLOCAL_MAILER', `local')')dnl
2864010Sericifdef(`confRELAY_MAILER',,
2964010Seric	`define(`confRELAY_MAILER',
3064010Seric		`ifdef(`_MAILER_smtp_', `relay',
3164010Seric			`ifdef(`_MAILER_uucp', `suucp', `unknown')')')')dnl
3263998Sericdefine(`_SMTP_', `confSMTP_MAILER')dnl		for readability only
3363998Sericdefine(`_LOCAL_', `confLOCAL_MAILER')dnl	for readability only
3464010Sericdefine(`_RELAY_', `confRELAY_MAILER')dnl	for readability only
3552646Seric
3651222Seric##################
3751222Seric#   local info   #
3851222Seric##################
3951222Seric
4060212SericCP.
4160212Seric
4251889SericCwlocalhost
4351887Sericifdef(`USE_CW_FILE',
4451889Seric`# file containing names of hosts for which we receive email
4564033SericFw`'confCW_FILE',
4664033Seric	`dnl')
4751222Seric
4851222Sericifdef(`UUCP_RELAY',
4951222Seric`# UUCP relay host
5064033SericDY`'UUCP_RELAY
5160212SericCPUUCP
5257944Seric
5351222Seric')dnl
5451222Sericifdef(`BITNET_RELAY',
5551222Seric`#  BITNET relay host
5664033SericDB`'BITNET_RELAY
5760212SericCPBITNET
5857944Seric
5951222Seric')dnl
6051222Sericifdef(`CSNET_RELAY',
6151222Seric`# CSNET relay host
6264033SericDC`'CSNET_RELAY
6360212SericCPCSNET
6457944Seric
6551222Seric')dnl
6658364Sericifdef(`FAX_RELAY',
6758364Seric`# FAX relay host
6864033SericDF`'FAX_RELAY
6960212SericCPFAX
7058364Seric
7158364Seric')dnl
7258070Sericifdef(`SMART_HOST',
7358070Seric`# "Smart" UUCP relay host
7464033SericDS`'SMART_HOST
7551222Seric
7658070Seric')dnl
7758781Sericifdef(`MAILER_TABLE',
7858781Seric`# Mailer table (overriding domains)
7958781SericKmailertable MAILER_TABLE
8058781Seric
8158781Seric')dnl
8263754Sericifdef(`DOMAIN_TABLE',
8363754Seric`# Domain table (adding domains)
8463754SericKdomaintable DOMAIN_TABLE
8563754Seric
8663754Seric')dnl
8751222Seric# who I send unqualified names to (null means deliver locally)
8864033SericDR`'ifdef(`LOCAL_RELAY', LOCAL_RELAY)
8951222Seric
9057527Seric# who gets all local email traffic ($R has precedence for unqualified names)
9164033SericDH`'ifdef(`MAIL_HUB', MAIL_HUB)
9257527Seric
9358070Seric# my official hostname ($w or $w.$D)
9464033SericDj$w`'ifdef(`NEED_DOMAIN', .$D)
9558070Seric
9658070Seric# who I masquerade as (can be $j)
9764033SericDM`'ifdef(`MASQUERADE_NAME', MASQUERADE_NAME, $j)
9858070Seric
9957245Seric# class L: names that should be delivered locally, even if we have a relay
10057245Seric# class E: names that should be exposed as from this host, even if we masquerade
10151279SericCLroot
10257245SericCEroot
10351279Sericundivert(5)dnl
10451279Seric
10551222Seric# operators that cannot be in local usernames (i.e., network indicators)
10658288SericCO @ % ifdef(`_NO_UUCP_', `', `!')
10751222Seric
10851322Seric# a class with just dot (for identifying canonical names)
10951322SericC..
11051322Seric
11158808Sericifdef(`_OLD_SENDMAIL_', `dnl',
11258808Seric`# dequoting map
11358808SericKdequote dequote')
11457944Seric
11559033Sericundivert(6)dnl
11659033Seric
11757944Seric######################
11857944Seric#   Special macros   #
11957944Seric######################
12057944Seric
12157944Seric# SMTP initial login message
12264033SericDe`'confSMTP_LOGIN_MSG
12357944Seric
12457944Seric# UNIX initial From header format
12564033SericDl`'confFROM_LINE
12657944Seric
12757944Seric# my name for error messages
12864033SericDn`'confMAILER_NAME
12957944Seric
13057944Seric# delimiter (operator) characters
13164033SericDo`'confOPERATORS
13257944Seric
13357944Seric# format of a total name
13464033SericDq`'ifdef(`confFROM_HEADER', confFROM_HEADER,
13557944Seric	ifdef(`_OLD_SENDMAIL_', `$g$?x ($x)$.', `$?x$x <$g>$|$g$.')))
13657944Sericinclude(`../m4/version.m4')
13757944Seric
13857944Seric###############
13957944Seric#   Options   #
14057944Seric###############
14157944Seric
14259887Seric# strip message body to 7 bits on input?
14364033SericO7`'confSEVEN_BIT_INPUT
14457944Seric
14557944Seric# wait (in minutes) for alias file rebuild
14664033SericOa`'confALIAS_WAIT
14757944Seric
14857944Seric# location of alias file
14964033SericOA`'ifdef(`ALIAS_FILE', ALIAS_FILE, /etc/aliases)
15057944Seric
15158084Seric# minimum number of free blocks on filesystem
15264033SericOb`'confMIN_FREE_BLOCKS
15358084Seric
15457944Seric# substitution for space (blank) characters
15564033SericOB`'confBLANK_SUB
15657944Seric
15757944Seric# connect to "expensive" mailers on initial submission?
15864033SericOc`'confCON_EXPENSIVE
15957944Seric
16057944Seric# checkpoint queue runs after every N successful deliveries
16164033SericOC`'confCHECKPOINT_INTERVAL
16257944Seric
16357944Seric# default delivery mode
16464033SericOd`'confDELIVERY_MODE
16557944Seric
16657944Seric# automatically rebuild the alias database?
16764033SericOD`'confAUTO_REBUILD
16857944Seric
16964033Seric# error message header/file
17057944Sericifdef(`confERROR_MESSAGE',
17164033Seric	OE`'confERROR_MESSAGE,
17257944Seric	#OE/etc/sendmail.oE)
17357944Seric
17457944Seric# error mode
17557944Sericifdef(`confERROR_MODE',
17664033Seric	Oe`'confERROR_MODE,
17757944Seric	#Oep)
17857944Seric
17957944Seric# save Unix-style "From_" lines at top of header?
18064033SericOf`'confSAVE_FROM_LINES
18157944Seric
18257944Seric# temporary file mode
18364033SericOF`'confTEMP_FILE_MODE
18457944Seric
18557944Seric# match recipients against GECOS field?
18664033SericOG`'confMATCH_GECOS
18757944Seric
18857944Seric# default GID
18964033SericOg`'confDEF_GROUP_ID
19057944Seric
19157944Seric# maximum hop count
19264033SericOh`'confMAX_HOP
19357944Seric
19457944Seric# location of help file
19564033SericOH`'ifdef(`HELP_FILE', HELP_FILE, /usr/lib/sendmail.hf)
19657944Seric
19757944Seric# ignore dots as terminators in incoming messages?
19864033SericOi`'confIGNORE_DOTS
19957944Seric
20057944Seric# Insist that the BIND name server be running to resolve names
20157944Sericifdef(`confBIND_OPTS',
20264033Seric	OI`'confBIND_OPTS,
20357944Seric	#OI)
20457944Seric
20559887Seric# deliver MIME-encapsulated error messages?
20664033SericOj`'confMIME_FORMAT_ERRORS
20759887Seric
20857944Seric# Forward file search path
20957944Sericifdef(`confFORWARD_PATH',
21064033Seric	OJ`'confFORWARD_PATH,
21157944Seric	#OJ/var/forward/$u:$z/.forward.$w:$z/.forward)
21257944Seric
21357944Seric# open connection cache size
21464033SericOk`'confMCI_CACHE_SIZE
21557944Seric
21657944Seric# open connection cache timeout
21764033SericOK`'confMCI_CACHE_TIMEOUT
21857944Seric
21961106Seric# use Errors-To: header?
22064033SericOl`'confUSE_ERRORS_TO
22161106Seric
22257944Seric# log level
22364033SericOL`'confLOG_LEVEL
22457944Seric
22557944Seric# send to me too, even in an alias expansion?
22664033SericOm`'confME_TOO
22757944Seric
22857944Seric# verify RHS in newaliases?
22964033SericOn`'confCHECK_ALIASES
23057944Seric
23157944Seric# default messages to old style headers if no special punctuation?
23264033SericOo`'confOLD_STYLE_HEADERS
23357944Seric
23458860Seric# SMTP daemon options
23558860Sericifdef(`confDAEMON_OPTIONS',
23664033Seric	OO`'confDAEMON_OPTIONS,
23758860Seric	#OOPort=esmtp)
23858860Seric
23958084Seric# privacy flags
24064033SericOp`'confPRIVACY_FLAGS
24158084Seric
24257944Seric# who (if anyone) should get extra copies of error messages
24357944Sericifdef(`confCOPY_ERRORS_TO',
24464033Seric	OP`'confCOPY_ERRORS_TO,
24557944Seric	#OPPostmaster)
24657944Seric
24757944Seric# slope of queue-only function
24857944Sericifdef(`confQUEUE_FACTOR',
24964033Seric	Oq`'confQUEUE_FACTOR,
25057944Seric	#Oq600000)
25157944Seric
25257944Seric# queue directory
25364033SericOQ`'ifdef(`QUEUE_DIR', QUEUE_DIR, /var/spool/mqueue)
25457944Seric
25557944Seric# read timeout -- now OK per RFC 1123 section 5.3.2
25658119Sericifdef(`confREAD_TIMEOUT',
25764033Seric	Or`'confREAD_TIMEOUT,
25858119Seric	#Ordatablock=10m)
25957944Seric
26057944Seric# queue up everything before forking?
26164033SericOs`'confSAFE_QUEUE
26257944Seric
26357944Seric# status file
26464033SericOS`'ifdef(`STATUS_FILE', STATUS_FILE, /etc/sendmail.st)
26557944Seric
26657944Seric# default message timeout interval
26764033SericOT`'confMESSAGE_TIMEOUT
26857944Seric
26957944Seric# time zone handling:
27057944Seric#  if undefined, use system default
27157944Seric#  if defined but null, use TZ envariable passed in
27257944Seric#  if defined and non-null, use that info
27357944Sericifelse(confTIME_ZONE, `USE_SYSTEM', `#Ot',
27457944Seric	confTIME_ZONE, `USE_TZ', `',
27564033Seric	`Ot`'confTIME_ZONE')
27657944Seric
27757944Seric# default UID
27864033SericOu`'confDEF_USER_ID
27957944Seric
28051887Seric# list of locations of user database file (null means no lookup)
28158720SericOU`'ifdef(`confUSERDB_SPEC', `confUSERDB_SPEC')
28251222Seric
28358860Seric# fallback MX host
28458860Sericifdef(`confFALLBACK_MX',
28564033Seric	OV`'confFALLBACK_MX,
28658860Seric	#OVfall.back.host.net)
28758860Seric
28863858Seric# if we are the best MX host for a site, try it directly instead of config err
28964033SericOw`'confTRY_NULL_MX_LIST
29063858Seric
29157944Seric# load average at which we just queue messages
29264033SericOx`'confQUEUE_LA
29357944Seric
29457944Seric# load average at which we refuse connections
29564033SericOX`'confREFUSE_LA
29657944Seric
29757944Seric# work recipient factor
29857944Sericifdef(`confWORK_RECIPIENT_FACTOR',
29964033Seric	Oy`'confWORK_RECIPIENT_FACTOR,
30057944Seric	#Oy30000)
30157944Seric
30257944Seric# deliver each queued job in a separate process?
30364033SericOY`'confSEPARATE_PROC
30457944Seric
30557944Seric# work class factor
30657944Sericifdef(`confWORK_CLASS_FACTOR',
30764033Seric	Oz`'confWORK_CLASS_FACTOR,
30857944Seric	#Oz1800)
30957944Seric
31057944Seric# work time factor
31157944Sericifdef(`confWORK_TIME_FACTOR',
31264033Seric	OZ`'confWORK_TIME_FACTOR,
31357944Seric	#OZ90000)
31457944Seric
31557944Seric###########################
31657944Seric#   Message precedences   #
31757944Seric###########################
31857944Seric
31957944SericPfirst-class=0
32057944SericPspecial-delivery=100
32158070SericPlist=-30
32257944SericPbulk=-60
32357944SericPjunk=-100
32457944Seric
32557944Seric#####################
32657944Seric#   Trusted users   #
32757944Seric#####################
32857944Seric
32957944SericTroot
33057944SericTdaemon
33157944SericTuucp
33257944Seric
33357944Seric#########################
33457944Seric#   Format of headers   #
33557944Seric#########################
33657944Seric
33758679SericH?P?Return-Path: $g
33864141SericHReceived: $?sfrom $s $.$?_($_) $.by $j ($v/$Z)$?r with $r$. id $i$?u for $u$.; $b
33957944SericH?D?Resent-Date: $a
34057944SericH?D?Date: $a
34157944SericH?F?Resent-From: $q
34257944SericH?F?From: $q
34357944SericH?x?Full-Name: $x
34457944SericHSubject:
34557944Seric# HPosted-Date: $a
34657944Seric# H?l?Received-Date: $b
34757944SericH?M?Resent-Message-Id: <$t.$i@$j>
34857944SericH?M?Message-Id: <$t.$i@$j>
34951222Seric#
35051222Seric######################################################################
35151222Seric######################################################################
35251222Seric#####
35351222Seric#####			REWRITING RULES
35451222Seric#####
35551222Seric######################################################################
35651222Seric######################################################################
35751222Seric
35858678Sericundivert(9)dnl
35951222Seric
36051222Seric###########################################
36151222Seric###  Rulset 3 -- Name Canonicalization  ###
36251222Seric###########################################
36351260SericS3
36451222Seric
36558499Seric# handle null input and list syntax (translate to <@> special case)
36658499SericR$@			$@ <@>
36758707SericR$*:;$*			$@ $1 :; <@>
36858174Seric
36951222Seric# basic textual canonicalization -- note RFC733 heuristic here
370*64144SericR$*<$*>$*<$*>$*		$2$3<$4>$5			strip multiple <> <>
37158158SericR$*<$*<$+>$*>$*		<$3>$5				2-level <> nesting
37258499SericR$*<>$*			$@ <@>				MAIL FROM:<> case
37351222SericR$*<$+>$*		$2				basic RFC821/822 parsing
37451222Seric
37551222Seric# make sure <@a,@b,@c:user@d> syntax is easy to parse -- undone later
37655416SericR@ $+ , $+		@ $1 : $2			change all "," to ":"
37751222Seric
37851222Seric# localize and dispose of route-based addresses
37960894SericR@ $+ : $+		$@ $>_SET_96_ < @$1 > : $2		handle <route-addr>
38051222Seric
38151222Seric# find focus for list syntax
38260894SericR $+ : $* ; @ $+	$@ $>_SET_96_ $1 : $2 ; < @ $3 >	list syntax
38355416SericR $+ : $* ;		$@ $1 : $2;			list syntax
38451222Seric
38551222Seric# find focus for @ syntax addresses
38655416SericR$+ @ $+		$: $1 < @ $2 >			focus on domain
38755416SericR$+ < $+ @ $+ >		$1 $2 < @ $3 >			move gaze right
38860894SericR$+ < @ $+ >		$@ $>_SET_96_ $1 < @ $2 >		already canonical
38951222Seric
39058288Sericifdef(`_NO_UUCP_', `dnl',
39158288Seric`# convert old-style addresses to a domain-based address
39260894SericR$- ! $+		$@ $>_SET_96_ $2 < @ $1 .UUCP >	resolve uucp names
39360894SericR$+ . $- ! $+		$@ $>_SET_96_ $3 < @ $1 . $2 >		domain uucps
39460894SericR$+ ! $+		$@ $>_SET_96_ $2 < @ $1 .UUCP >	uucp subdomains')
39551222Seric
39651222Seric# if we have % signs, take the rightmost one
39755416SericR$* % $*		$1 @ $2				First make them all @s.
39855416SericR$* @ $* @ $*		$1 % $2 @ $3			Undo all but the last.
39960894SericR$* @ $*		$@ $>_SET_96_ $1 < @ $2 >		Insert < > and finish
40051222Seric
40151222Seric# else we must be a local name
40251222Seric
40351222Seric
40460894Seric################################################
40560894Seric###  Ruleset _SET_96_ -- bottom half of ruleset 3  ###
40660894Seric################################################
40751222Seric
40857245Seric#  At this point, everything should be in a "local_part<@domain>extra" format.
40960894SericS`'_SET_96_
41051222Seric
41151222Seric# handle special cases for local names
41260262SericR$* < @ localhost > $*		$: $1 < @ $j . > $2		no domain at all
41360262SericR$* < @ localhost . $m > $*	$: $1 < @ $j . > $2		local domain
41460262Sericifdef(`_NO_UUCP_', `dnl',
41560262Seric`R$* < @ localhost . UUCP > $*	$: $1 < @ $j . > $2		.UUCP domain')
41663754Sericifdef(`DOMAIN_TABLE', `
41763754Seric# look up unqualified domains in the domain table
41863754SericR$* < @ $- > $*			$: $1 < @ $(domaintable $2 $) > $3',
41963754Seric`dnl')
42051889Sericundivert(2)dnl
42151222Seric
42259081Sericifdef(`_NO_UUCP_', `dnl',
42359081Seric`ifdef(`UUCP_RELAY',
42451274Seric`# pass UUCP addresses straight through
42555416SericR$* < @ $+ . UUCP > $*		$@ $1 < @ $2 . UUCP > $3',
42651274Seric`# if really UUCP, handle it immediately
42751322Sericifdef(`_CLASS_U_',
42855416Seric`R$* < @ $=U . UUCP > $*	$@ $1 < @ $2 . UUCP > $3', `dnl')
42951322Sericifdef(`_CLASS_V_',
43055416Seric`R$* < @ $=V . UUCP > $*	$@ $1 < @ $2 . UUCP > $3', `dnl')
43151322Sericifdef(`_CLASS_W_',
43255416Seric`R$* < @ $=W . UUCP > $*	$@ $1 < @ $2 . UUCP > $3', `dnl')
43351322Sericifdef(`_CLASS_X_',
43455416Seric`R$* < @ $=X . UUCP > $*	$@ $1 < @ $2 . UUCP > $3', `dnl')
43551322Sericifdef(`_CLASS_Y_',
43655416Seric`R$* < @ $=Y . UUCP > $*	$@ $1 < @ $2 . UUCP > $3', `dnl')
43751267Seric
43851267Seric# try UUCP traffic as a local address
43955416SericR$* < @ $+ . UUCP > $*		$: $1 < @ $[ $2 $] . UUCP > $3
44051992Sericifdef(`_OLD_SENDMAIL_',
44155416Seric`R$* < @ $+ . $+ . UUCP > $*		$@ $1 < @ $2 . $3 . > $4',
44255416Seric`R$* < @ $+ . . UUCP > $*		$@ $1 < @ $2 . > $3')')
44359081Seric')
44461470Sericifdef(`_NO_CANONIFY_',
44561470Seric`# make sure local host names appear canonical
44661470SericR$* < @ $=w > $*		$: $1 < @ $2 . > $3',
44759081Seric`# pass to name server to make hostname canonical
44861470SericR$* < @ $* $~P > $*		$: $1 < @ $[ $2 $3 $] > $4')
44961470Seric
45051889Sericundivert(8)dnl
45151889Seric
45251322Seric# if this is the local hostname, make sure we treat is as canonical
45351322SericR$* < @ $j > $*			$: $1 < @ $j . > $2
45451222Seric
45551322Seric
45651222Seric##################################################
45751222Seric###  Ruleset 4 -- Final Output Post-rewriting  ###
45851222Seric##################################################
45951222SericS4
46051222Seric
46158499SericR$*<@>			$@ $1				handle <> and list:;
46251222Seric
46351222Seric# resolve numeric addresses to name if possible
46451322SericR$* < @ [ $+ ] > $*	$: $1 < @ $[ [$2] $] > $3	lookup numeric internet addr
46551222Seric
46651322Seric# strip trailing dot off possibly canonical name
46751322SericR$* < @ $+ . > $*	$1 < @ $2 > $3
46851322Seric
46951222Seric# externalize local domain info
47051322SericR$* < $+ > $*		$1 $2 $3			defocus
47151322SericR@ $+ : @ $+ : $+	@ $1 , @ $2 : $3		<route-addr> canonical
47251997SericR@ $*			$@ @ $1				... and exit
47351222Seric
47458288Sericifdef(`_NO_UUCP_', `dnl',
47558288Seric`# UUCP must always be presented in old form
47658288SericR$+ @ $- . UUCP		$2!$1				u@h.UUCP => h!u')
47751222Seric
47851222Seric# delete duplicate local names
47951322SericR$+ % $=w @ $=w		$1 @ $j				u%host@host => u@host
48051222Seric
48151222Seric
48251222Seric
48360894Seric##############################################################
48460894Seric###   Ruleset _SET_97_ -- recanonicalize and call ruleset zero   ###
48560894Seric###		   (used for recursive calls)		   ###
48660894Seric##############################################################
48751222Seric
48860894SericS`'_SET_97_
48951222SericR$*			$: $>3 $1
49051222SericR$*			$@ $>0 $1
49151222Seric
49251222Seric
49351222Seric######################################
49451222Seric###   Ruleset 0 -- Parse Address   ###
49551222Seric######################################
49651222Seric
49751222SericS0
49851222Seric
49963998SericR<@>			$#_LOCAL_ $: <>			special case error msgs
50059887SericR$*:;<@>		$#error $@ USAGE $: "list:; syntax illegal for recipient addresses"
50158340Seric
50255416Sericifdef(`_MAILER_smtp_',
50355416Seric`# handle numeric address spec
50463860Sericifdef(`_NO_CANONIFY_', `dnl',
50563860Seric`R$* < @ [ $+ ] > $*	$: $1 < @ $[ [$2] $] > $3	numeric internet addr')
50663858SericR$* < @ [ $+ ] > $*	$: $>_SET_98_ $1 < @ [ $2 ] > $3	numeric internet spec
50763973SericR$* < @ [ $+ ] > $*	$#_SMTP_ $@ [$2] $: $1 @ [$2] $3	still numeric: send',
50863858Seric	`dnl')
50951222Seric
51051887Seric# now delete the local info -- note $=O to find characters that cause forwarding
51160894SericR$* < @ > $*		$@ $>_SET_97_ $1			user@ => user
51260894SericR< @ $=w . > : $*	$@ $>_SET_97_ $2			@here:... -> ...
51360894SericR$* $=O $* < @ $=w . >	$@ $>_SET_97_ $1 $2 $3			...@here -> ...
51463967Seric
51563967Seric# handle local hacks
51663967SericR$*			$: $>_SET_98_ $1
51758781Sericifdef(`MAILER_TABLE',
51858781Seric`
51958781Seric# try mailer table lookup
52060540SericR$* <@ $+ > $*		$: < $2 > $1 < @ $2 > $3	extract host name
52161106SericR< $+ . > $*		$: < $1 > $2			strip trailing dot
52262582SericR< $+ > $*		$: < $(mailertable $1 $) > $2	lookup
52361106SericR< $- : $+ > $*		$# $1 $@ $2 $: $3		check -- resolved?
52462582SericR< $+ > $*		$: $>90 <$1> $2			try domain',
52558781Seric`dnl')
52651222Seric
52751222Seric# short circuit local delivery so forwarded email works
52858516Sericifdef(`_LOCAL_NOT_STICKY_',
52963998Seric`R$=L < @ $=w . >		$#_LOCAL_ $: @ $1			special local names
53063998SericR$+ < @ $=w . >		$#_LOCAL_ $: $1			dispose directly',
53160894Seric`R$+ < @ $=w . >		$: $1 < @ $2 @ $H >		first try hub
53251992Sericifdef(`_OLD_SENDMAIL_',
53359635Seric`R$+ < $+ @ $-:$+ >	$# $3 $@ $4 $: $1 < $2 >	yep ....
53459635SericR$+ < $+ @ $+ >		$#relay $@ $3 $: $1 < $2 >	yep ....
53563998SericR$+ < $+ @ >		$#_LOCAL_ $: $1			nope, local address',
53663998Seric`R$+ < $+ @ $+ >		$#_LOCAL_ $: $1			yep ....
53763998SericR$+ < $+ @ >		$#_LOCAL_ $: @ $1			nope, local address')')
53851260Sericundivert(4)dnl
53951260Seric
54061468Sericifdef(`_NO_UUCP_', `dnl',
54161468Seric`# resolve remotely connected UUCP links (if any)
54251285Sericifdef(`_CLASS_V_',
54364010Seric`R$* < @ $=V . UUCP > $*		$: $>_SET_95_ < $V > <@ $V> : $1 @ $2.UUCP $3',
54452044Seric	`dnl')
54551285Sericifdef(`_CLASS_W_',
54664010Seric`R$* < @ $=W . UUCP > $*		$: $>_SET_95_ < $W > <@ $W> : $1 @ $2.UUCP $3',
54752044Seric	`dnl')
54851285Sericifdef(`_CLASS_X_',
54964010Seric`R$* < @ $=X . UUCP > $*		$: $>_SET_95_ < $X > <@ $X> : $1 @ $2.UUCP $3',
55061468Seric	`dnl')')
55151260Seric
55251222Seric# resolve fake top level domains by forwarding to other hosts
55351222Sericifdef(`BITNET_RELAY',
55464010Seric`R$*<@$+.BITNET>$*	$: $>_SET_95_ < $B > $1 <@$2.BITNET> $3	user@host.BITNET',
55551222Seric	`dnl')
55651222Sericifdef(`CSNET_RELAY',
55764010Seric`R$*<@$+.CSNET>$*	$: $>_SET_95_ < $C > $1 <@$2.CSNET> $3	user@host.CSNET',
55851222Seric	`dnl')
55958364Sericifdef(`_MAILER_fax_',
56063858Seric`R$+ < @ $+ .FAX >	$#fax $@ $2 $: $1		user@host.FAX',
56158364Seric`ifdef(`FAX_RELAY',
56264010Seric`R$*<@$+.FAX>$*		$: $>_SET_95_ < $F > $1 <@$2.FAX> $3	user@host.FAX',
56358364Seric	`dnl')')
56451222Seric
56551260Sericifdef(`UUCP_RELAY',
56651260Seric`# forward non-local UUCP traffic to our UUCP relay
56764010SericR$*<@$*.UUCP>$*		$: $>_SET_95_ < $Y > <@ $Y> : $1 @ $2.UUCP $3	uucp mail',
56855416Seric`ifdef(`_MAILER_uucp_',
56951260Seric`# forward other UUCP traffic straight to UUCP
57063858SericR< @ $+ .UUCP > : $+	$#uucp $@ $1 $: $2		@host.UUCP:...
57163858SericR$+ < @ $+ .UUCP >	$#uucp $@ $2 $: $1		user@host.UUCP',
57251260Seric	`dnl')')
57363967Sericifdef(`_MAILER_usenet_', `
57463754Seric# addresses sent to net.group.USENET will get forwarded to a newsgroup
57563998SericR$+ . USENET		$#usenet $: $1',
57663860Seric	`dnl')
57763754Seric
57858070Sericifdef(`_LOCAL_RULES_',
57958070Seric`# figure out what should stay in our local mail system
58063754Sericundivert(1)', `dnl')
58163754Seric
58263946Sericifdef(`SMART_HOST',
58363946Seric`# pass names that still have a host to a smarthost
58464010SericR$* < @ $* > $*		$: $>_SET_95_ < $S > $1 < @ $2 > $3	glue on smarthost name
58563858SericR< $- : $+ > $*		$# $1 $@ $2 $: $3		if non-null, use it
58663858SericR< $+ > $*		$#suucp $@ $1 $: $2		if non-null, use it
58763858SericR<> $*			$: $1				else strip off gunk',
58863754Seric
58963754Seric`# deal with other remote names
59063946Sericifdef(`_MAILER_smtp_',
59163973Seric`R$* < @$* > $*		$#_SMTP_ $@ $2 $: $1 < @ $2 > $3		user@host.domain',
59263946Seric`R$* < @$* > $*		$#error $@NOHOST $: Unrecognized host name $2')')
59351222Seric
59451992Sericifdef(`_OLD_SENDMAIL_',
59551887Seric`# forward remaining names to local relay, if any
59663998SericR$=L			$#_LOCAL_ $: $1			special local names
59764010SericR$+			$: $>_SET_95_ < $R > $1			try relay
59864010SericR$+			$: $>_SET_95_ < $H > $1			try hub
59964010SericR$+			$#_LOCAL_ $: $1			no relay or hub: local',
60058811Seric
60158811Seric`# if this is quoted, strip the quotes and try again
60258811SericR$+			$: $(dequote $1 $)		strip quotes
60360894SericR$* $=O $*		$@ $>_SET_97_ $1 $2 $3			try again
60458811Seric
60558811Seric# handle locally delivered names
60663998SericR$=L			$#_LOCAL_ $: @ $1			special local names
60763998SericR$+			$#_LOCAL_ $: $1			regular local names
60851222Seric
60955416Seric###########################################################################
61055416Seric###   Ruleset 5 -- special rewriting after aliases have been expanded   ###
61155416Seric###		   (new sendmail only)					###
61255416Seric###########################################################################
61351222Seric
61451322SericS5
61551322Seric
61658808Seric# see if we have a relay or a hub
61764010SericR$+			$: $>_SET_95_ < $R > $1			try relay
61864010SericR$+			$: $>_SET_95_ < $H > $1			try hub')
61960540Sericifdef(`MAILER_TABLE',
62060540Seric`
62160540Seric
62263858Seric###################################################################
62363858Seric###  Ruleset 90 -- try domain part of mailertable entry 	###
62463858Seric###		   (new sendmail only)				###
62563858Seric###################################################################
62660540Seric
62760540SericS90
62864010SericR<$- . $+ > $*		$: < $(mailertable .$2 $@ $1 $) > $3	lookup
62960540SericR<$- : $+ > $*		$# $1 $@ $2 $: $3		check -- resolved?
63062372SericR< . $+ > $*		$@ $>90 <$1> $2			no -- strip & try again
63160540SericR<$*> $*		$@ $2				no match',
63260540Seric`dnl')
63363858Seric
63463858Seric###################################################################
63564010Seric###  Ruleset _SET_95_ -- canonify mailer:host syntax to triple	###
63664010Seric###################################################################
63764010Seric
63864010SericS`'_SET_95_
63964010SericR< > $*			$@ $1				strip off null relay
64064010SericR< $- : $+ > $*		$# $1 $@ $2 $: $3		try qualified mailer
64164010SericR< $=w > $*		$@ $2				delete local host
64264010SericR< $+ > $*		$#_RELAY_ $@ $1 $: $2		use unqualified mailer
64364010Seric
64464010Seric###################################################################
64563858Seric###  Ruleset _SET_98_ -- local part of ruleset zero (can be null)	###
64663858Seric###################################################################
64763858Seric
64863858SericS`'_SET_98_
64963858Sericundivert(3)dnl
65051222Seric#
65151222Seric######################################################################
65251222Seric######################################################################
65351222Seric#####
65456790Seric`#####			MAILER DEFINITIONS'
65551222Seric#####
65651222Seric######################################################################
65751222Seric######################################################################
65851222Sericundivert(7)dnl
659