xref: /csrg-svn/usr.sbin/sendmail/cf/m4/proto.m4 (revision 67132)
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*67132SericVERSIONID(`@(#)proto.m4	8.47 (Berkeley) 05/13/94')
1251222Seric
1351322SericMAILER(local)dnl
1451222Seric
1560894Sericifdef(`_OLD_SENDMAIL_',
1664010Seric`define(`_SET_95_', 5)dnl
1764010Sericdefine(`_SET_96_', 6)dnl
1863858Sericdefine(`_SET_97_', 7)dnl
1964260Sericdefine(`_SET_98_', 8)dnl
2064260Sericdefine(`confDOMAIN_NAME',
2164260Seric	`ifdef(`NEED_DOMAIN', `$w.$d', `$w')')dnl',
2264260Seric`# level 5 config file format
2364260SericV5
2464010Sericdefine(`_SET_95_', 95)dnl
2560894Sericdefine(`_SET_96_', 96)dnl
2663858Sericdefine(`_SET_97_', 97)dnl
2763858Sericdefine(`_SET_98_', 98)dnl')
2864010Sericifdef(`confSMTP_MAILER',, `define(`confSMTP_MAILER', `smtp')')dnl
2963998Sericifdef(`confLOCAL_MAILER',, `define(`confLOCAL_MAILER', `local')')dnl
3064010Sericifdef(`confRELAY_MAILER',,
3164010Seric	`define(`confRELAY_MAILER',
3264010Seric		`ifdef(`_MAILER_smtp_', `relay',
3364010Seric			`ifdef(`_MAILER_uucp', `suucp', `unknown')')')')dnl
3463998Sericdefine(`_SMTP_', `confSMTP_MAILER')dnl		for readability only
3563998Sericdefine(`_LOCAL_', `confLOCAL_MAILER')dnl	for readability only
3664010Sericdefine(`_RELAY_', `confRELAY_MAILER')dnl	for readability only
3752646Seric
3851222Seric##################
3951222Seric#   local info   #
4051222Seric##################
4151222Seric
4251889SericCwlocalhost
4351887Sericifdef(`USE_CW_FILE',
4451889Seric`# file containing names of hosts for which we receive email
4564033SericFw`'confCW_FILE',
4664033Seric	`dnl')
4764321Sericifdef(`confDOMAIN_NAME', `
4864321Seric# my official domain name
4964321SericDj`'confDOMAIN_NAME',
5064321Seric	`dnl')
5151222Seric
5264321Sericifdef(`_NULL_CLIENT_ONLY_',
5364321Seric`include(../m4/nullrelay.m4)m4exit',
5464321Seric	`dnl')
5564321Seric
5664321SericCP.
5764321Seric
5851222Sericifdef(`UUCP_RELAY',
5951222Seric`# UUCP relay host
6064033SericDY`'UUCP_RELAY
6160212SericCPUUCP
6257944Seric
6351222Seric')dnl
6451222Sericifdef(`BITNET_RELAY',
6551222Seric`#  BITNET relay host
6664033SericDB`'BITNET_RELAY
6760212SericCPBITNET
6857944Seric
6951222Seric')dnl
7058364Sericifdef(`FAX_RELAY',
7158364Seric`# FAX relay host
7264033SericDF`'FAX_RELAY
7360212SericCPFAX
7458364Seric
7558364Seric')dnl
7664321Seric# "Smart" relay host (may be null)
7764321SericDS`'ifdef(`SMART_HOST', SMART_HOST)
7851222Seric
7958781Sericifdef(`MAILER_TABLE',
8058781Seric`# Mailer table (overriding domains)
8158781SericKmailertable MAILER_TABLE
8258781Seric
8358781Seric')dnl
8463754Sericifdef(`DOMAIN_TABLE',
8563754Seric`# Domain table (adding domains)
8663754SericKdomaintable DOMAIN_TABLE
8763754Seric
8863754Seric')dnl
8951222Seric# who I send unqualified names to (null means deliver locally)
9064033SericDR`'ifdef(`LOCAL_RELAY', LOCAL_RELAY)
9151222Seric
9257527Seric# who gets all local email traffic ($R has precedence for unqualified names)
9364033SericDH`'ifdef(`MAIL_HUB', MAIL_HUB)
9457527Seric
9566085Seric# who I masquerade as (null for no masquerading)
9666085SericDM`'ifdef(`MASQUERADE_NAME', MASQUERADE_NAME)
9758070Seric
9857245Seric# class L: names that should be delivered locally, even if we have a relay
9957245Seric# class E: names that should be exposed as from this host, even if we masquerade
10066050Seric#CLroot
10157245SericCEroot
10251279Sericundivert(5)dnl
10351279Seric
10451222Seric# operators that cannot be in local usernames (i.e., network indicators)
10558288SericCO @ % ifdef(`_NO_UUCP_', `', `!')
10651222Seric
10751322Seric# a class with just dot (for identifying canonical names)
10851322SericC..
10951322Seric
11058808Sericifdef(`_OLD_SENDMAIL_', `dnl',
11158808Seric`# dequoting map
11258808SericKdequote dequote')
11357944Seric
11459033Sericundivert(6)dnl
11559033Seric
11657944Seric######################
11757944Seric#   Special macros   #
11857944Seric######################
11957944Seric
12057944Seric# SMTP initial login message
12164033SericDe`'confSMTP_LOGIN_MSG
12257944Seric
12357944Seric# UNIX initial From header format
12464033SericDl`'confFROM_LINE
12557944Seric
12657944Seric# my name for error messages
12764033SericDn`'confMAILER_NAME
12857944Seric
12957944Seric# delimiter (operator) characters
13064033SericDo`'confOPERATORS
13157944Seric
13257944Seric# format of a total name
13364033SericDq`'ifdef(`confFROM_HEADER', confFROM_HEADER,
13464251Seric	ifdef(`_OLD_SENDMAIL_', `$g$?x ($x)$.', `$?x$x <$g>$|$g$.'))
13557944Sericinclude(`../m4/version.m4')
13657944Seric
13757944Seric###############
13857944Seric#   Options   #
13957944Seric###############
14057944Seric
14159887Seric# strip message body to 7 bits on input?
14264033SericO7`'confSEVEN_BIT_INPUT
14357944Seric
14457944Seric# wait (in minutes) for alias file rebuild
14564033SericOa`'confALIAS_WAIT
14657944Seric
14757944Seric# location of alias file
14865825SericOA`'ifdef(`ALIAS_FILE', `ALIAS_FILE', /etc/aliases)
14957944Seric
15058084Seric# minimum number of free blocks on filesystem
15164033SericOb`'confMIN_FREE_BLOCKS
15258084Seric
15357944Seric# substitution for space (blank) characters
15464033SericOB`'confBLANK_SUB
15557944Seric
15665618Seric# avoid connecting to "expensive" mailers on initial submission?
15764033SericOc`'confCON_EXPENSIVE
15857944Seric
15957944Seric# checkpoint queue runs after every N successful deliveries
16064033SericOC`'confCHECKPOINT_INTERVAL
16157944Seric
16257944Seric# default delivery mode
16364033SericOd`'confDELIVERY_MODE
16457944Seric
16557944Seric# automatically rebuild the alias database?
16664033SericOD`'confAUTO_REBUILD
16757944Seric
16864033Seric# error message header/file
16957944Sericifdef(`confERROR_MESSAGE',
17064033Seric	OE`'confERROR_MESSAGE,
17157944Seric	#OE/etc/sendmail.oE)
17257944Seric
17357944Seric# error mode
17457944Sericifdef(`confERROR_MODE',
17564033Seric	Oe`'confERROR_MODE,
17657944Seric	#Oep)
17757944Seric
17857944Seric# save Unix-style "From_" lines at top of header?
17964033SericOf`'confSAVE_FROM_LINES
18057944Seric
18157944Seric# temporary file mode
18264033SericOF`'confTEMP_FILE_MODE
18357944Seric
18457944Seric# match recipients against GECOS field?
18564033SericOG`'confMATCH_GECOS
18657944Seric
18757944Seric# default GID
18864033SericOg`'confDEF_GROUP_ID
18957944Seric
19057944Seric# maximum hop count
19164033SericOh`'confMAX_HOP
19257944Seric
19357944Seric# location of help file
19464033SericOH`'ifdef(`HELP_FILE', HELP_FILE, /usr/lib/sendmail.hf)
19557944Seric
19657944Seric# ignore dots as terminators in incoming messages?
19764033SericOi`'confIGNORE_DOTS
19857944Seric
19957944Seric# Insist that the BIND name server be running to resolve names
20057944Sericifdef(`confBIND_OPTS',
20164033Seric	OI`'confBIND_OPTS,
20257944Seric	#OI)
20357944Seric
20459887Seric# deliver MIME-encapsulated error messages?
20564033SericOj`'confMIME_FORMAT_ERRORS
20659887Seric
20757944Seric# Forward file search path
20857944Sericifdef(`confFORWARD_PATH',
20964033Seric	OJ`'confFORWARD_PATH,
21057944Seric	#OJ/var/forward/$u:$z/.forward.$w:$z/.forward)
21157944Seric
21257944Seric# open connection cache size
21364033SericOk`'confMCI_CACHE_SIZE
21457944Seric
21557944Seric# open connection cache timeout
21664033SericOK`'confMCI_CACHE_TIMEOUT
21757944Seric
21861106Seric# use Errors-To: header?
21964033SericOl`'confUSE_ERRORS_TO
22061106Seric
22157944Seric# log level
22264033SericOL`'confLOG_LEVEL
22357944Seric
22457944Seric# send to me too, even in an alias expansion?
22564033SericOm`'confME_TOO
22657944Seric
22757944Seric# verify RHS in newaliases?
22864033SericOn`'confCHECK_ALIASES
22957944Seric
23057944Seric# default messages to old style headers if no special punctuation?
23164033SericOo`'confOLD_STYLE_HEADERS
23257944Seric
23358860Seric# SMTP daemon options
23458860Sericifdef(`confDAEMON_OPTIONS',
23564033Seric	OO`'confDAEMON_OPTIONS,
23658860Seric	#OOPort=esmtp)
23758860Seric
23858084Seric# privacy flags
23964033SericOp`'confPRIVACY_FLAGS
24058084Seric
24157944Seric# who (if anyone) should get extra copies of error messages
24257944Sericifdef(`confCOPY_ERRORS_TO',
24364033Seric	OP`'confCOPY_ERRORS_TO,
24457944Seric	#OPPostmaster)
24557944Seric
24657944Seric# slope of queue-only function
24757944Sericifdef(`confQUEUE_FACTOR',
24864033Seric	Oq`'confQUEUE_FACTOR,
24957944Seric	#Oq600000)
25057944Seric
25157944Seric# queue directory
25264033SericOQ`'ifdef(`QUEUE_DIR', QUEUE_DIR, /var/spool/mqueue)
25357944Seric
25457944Seric# read timeout -- now OK per RFC 1123 section 5.3.2
25558119Sericifdef(`confREAD_TIMEOUT',
25664033Seric	Or`'confREAD_TIMEOUT,
25758119Seric	#Ordatablock=10m)
25857944Seric
25957944Seric# queue up everything before forking?
26064033SericOs`'confSAFE_QUEUE
26157944Seric
26257944Seric# status file
26364033SericOS`'ifdef(`STATUS_FILE', STATUS_FILE, /etc/sendmail.st)
26457944Seric
26557944Seric# default message timeout interval
26664033SericOT`'confMESSAGE_TIMEOUT
26757944Seric
26857944Seric# time zone handling:
26957944Seric#  if undefined, use system default
27057944Seric#  if defined but null, use TZ envariable passed in
27157944Seric#  if defined and non-null, use that info
27257944Sericifelse(confTIME_ZONE, `USE_SYSTEM', `#Ot',
27364341Seric	confTIME_ZONE, `USE_TZ', `Ot',
27464033Seric	`Ot`'confTIME_ZONE')
27557944Seric
27657944Seric# default UID
27764033SericOu`'confDEF_USER_ID
27857944Seric
27951887Seric# list of locations of user database file (null means no lookup)
28058720SericOU`'ifdef(`confUSERDB_SPEC', `confUSERDB_SPEC')
28151222Seric
28258860Seric# fallback MX host
28358860Sericifdef(`confFALLBACK_MX',
28464033Seric	OV`'confFALLBACK_MX,
28558860Seric	#OVfall.back.host.net)
28658860Seric
28763858Seric# if we are the best MX host for a site, try it directly instead of config err
28864033SericOw`'confTRY_NULL_MX_LIST
28963858Seric
29057944Seric# load average at which we just queue messages
29164033SericOx`'confQUEUE_LA
29257944Seric
29357944Seric# load average at which we refuse connections
29464033SericOX`'confREFUSE_LA
29557944Seric
29657944Seric# work recipient factor
29757944Sericifdef(`confWORK_RECIPIENT_FACTOR',
29864033Seric	Oy`'confWORK_RECIPIENT_FACTOR,
29957944Seric	#Oy30000)
30057944Seric
30157944Seric# deliver each queued job in a separate process?
30264033SericOY`'confSEPARATE_PROC
30357944Seric
30457944Seric# work class factor
30557944Sericifdef(`confWORK_CLASS_FACTOR',
30664033Seric	Oz`'confWORK_CLASS_FACTOR,
30757944Seric	#Oz1800)
30857944Seric
30957944Seric# work time factor
31057944Sericifdef(`confWORK_TIME_FACTOR',
31164033Seric	OZ`'confWORK_TIME_FACTOR,
31257944Seric	#OZ90000)
31357944Seric
31457944Seric###########################
31557944Seric#   Message precedences   #
31657944Seric###########################
31757944Seric
31857944SericPfirst-class=0
31957944SericPspecial-delivery=100
32058070SericPlist=-30
32157944SericPbulk=-60
32257944SericPjunk=-100
32357944Seric
32457944Seric#####################
32557944Seric#   Trusted users   #
32657944Seric#####################
32757944Seric
32857944SericTroot
32957944SericTdaemon
33057944SericTuucp
33157944Seric
33257944Seric#########################
33357944Seric#   Format of headers   #
33457944Seric#########################
33557944Seric
33658679SericH?P?Return-Path: $g
33766015SericHReceived: $?sfrom $s $.$?_($?s$|from $.$_) $.by $j ($v/$Z)$?r with $r$. id $i$?u for $u$.; $b
33857944SericH?D?Resent-Date: $a
33957944SericH?D?Date: $a
34057944SericH?F?Resent-From: $q
34157944SericH?F?From: $q
34257944SericH?x?Full-Name: $x
34357944SericHSubject:
34457944Seric# HPosted-Date: $a
34557944Seric# H?l?Received-Date: $b
34657944SericH?M?Resent-Message-Id: <$t.$i@$j>
34757944SericH?M?Message-Id: <$t.$i@$j>
34851222Seric#
34951222Seric######################################################################
35051222Seric######################################################################
35151222Seric#####
35251222Seric#####			REWRITING RULES
35351222Seric#####
35451222Seric######################################################################
35551222Seric######################################################################
35651222Seric
35758678Sericundivert(9)dnl
35851222Seric
35951222Seric###########################################
36051222Seric###  Rulset 3 -- Name Canonicalization  ###
36151222Seric###########################################
36251260SericS3
36351222Seric
36464802Seric# handle null input (translate to <@> special case)
36558499SericR$@			$@ <@>
36658174Seric
36751222Seric# basic textual canonicalization -- note RFC733 heuristic here
36864144SericR$*<$*>$*<$*>$*		$2$3<$4>$5			strip multiple <> <>
36958158SericR$*<$*<$+>$*>$*		<$3>$5				2-level <> nesting
37058499SericR$*<>$*			$@ <@>				MAIL FROM:<> case
37151222SericR$*<$+>$*		$2				basic RFC821/822 parsing
37251222Seric
37364802Seric# handle list:; syntax as special case
37464802SericR$*:;$*			$@ $1 :; <@>
37564802Seric
37651222Seric# make sure <@a,@b,@c:user@d> syntax is easy to parse -- undone later
37755416SericR@ $+ , $+		@ $1 : $2			change all "," to ":"
37851222Seric
37951222Seric# localize and dispose of route-based addresses
38060894SericR@ $+ : $+		$@ $>_SET_96_ < @$1 > : $2		handle <route-addr>
38151222Seric
38251222Seric# find focus for list syntax
38360894SericR $+ : $* ; @ $+	$@ $>_SET_96_ $1 : $2 ; < @ $3 >	list syntax
38455416SericR $+ : $* ;		$@ $1 : $2;			list syntax
38551222Seric
38651222Seric# find focus for @ syntax addresses
38755416SericR$+ @ $+		$: $1 < @ $2 >			focus on domain
38855416SericR$+ < $+ @ $+ >		$1 $2 < @ $3 >			move gaze right
38960894SericR$+ < @ $+ >		$@ $>_SET_96_ $1 < @ $2 >		already canonical
39051222Seric
39164968Seric# do some sanity checking
39264968SericR$* < @ $* : $* > $*	$1 < @ $2 $3 > $4		nix colons in addrs
39364968Seric
39458288Sericifdef(`_NO_UUCP_', `dnl',
39558288Seric`# convert old-style addresses to a domain-based address
39660894SericR$- ! $+		$@ $>_SET_96_ $2 < @ $1 .UUCP >	resolve uucp names
39760894SericR$+ . $- ! $+		$@ $>_SET_96_ $3 < @ $1 . $2 >		domain uucps
39860894SericR$+ ! $+		$@ $>_SET_96_ $2 < @ $1 .UUCP >	uucp subdomains')
39951222Seric
40051222Seric# if we have % signs, take the rightmost one
40155416SericR$* % $*		$1 @ $2				First make them all @s.
40255416SericR$* @ $* @ $*		$1 % $2 @ $3			Undo all but the last.
40360894SericR$* @ $*		$@ $>_SET_96_ $1 < @ $2 >		Insert < > and finish
40451222Seric
40551222Seric# else we must be a local name
40651222Seric
40751222Seric
40860894Seric################################################
40960894Seric###  Ruleset _SET_96_ -- bottom half of ruleset 3  ###
41060894Seric################################################
41151222Seric
41257245Seric#  At this point, everything should be in a "local_part<@domain>extra" format.
41360894SericS`'_SET_96_
41451222Seric
41551222Seric# handle special cases for local names
41660262SericR$* < @ localhost > $*		$: $1 < @ $j . > $2		no domain at all
41760262SericR$* < @ localhost . $m > $*	$: $1 < @ $j . > $2		local domain
41860262Sericifdef(`_NO_UUCP_', `dnl',
41960262Seric`R$* < @ localhost . UUCP > $*	$: $1 < @ $j . > $2		.UUCP domain')
42065825SericR$* < @ [ $+ ] > $*		$: $1 < @@ [ $2 ] > $3		mark [a.b.c.d]
42165825SericR$* < @@ $=w > $*		$: $1 < @ $j . > $3		self-literal
42266306SericR$* < @@ $+ > $*		$@ $1 < @ $2 > $3		canon IP addr
42363754Sericifdef(`DOMAIN_TABLE', `
42463754Seric# look up unqualified domains in the domain table
42563754SericR$* < @ $- > $*			$: $1 < @ $(domaintable $2 $) > $3',
42663754Seric`dnl')
42751889Sericundivert(2)dnl
42851222Seric
42959081Sericifdef(`_NO_UUCP_', `dnl',
43059081Seric`ifdef(`UUCP_RELAY',
43151274Seric`# pass UUCP addresses straight through
43264971SericR$* < @ $+ . UUCP > $*		$@ $1 < @ $2 . UUCP . > $3',
43351274Seric`# if really UUCP, handle it immediately
43451322Sericifdef(`_CLASS_U_',
43564971Seric`R$* < @ $=U . UUCP > $*	$@ $1 < @ $2 . UUCP . > $3', `dnl')
43651322Sericifdef(`_CLASS_V_',
43764971Seric`R$* < @ $=V . UUCP > $*	$@ $1 < @ $2 . UUCP . > $3', `dnl')
43851322Sericifdef(`_CLASS_W_',
43964971Seric`R$* < @ $=W . UUCP > $*	$@ $1 < @ $2 . UUCP . > $3', `dnl')
44051322Sericifdef(`_CLASS_X_',
44164971Seric`R$* < @ $=X . UUCP > $*	$@ $1 < @ $2 . UUCP . > $3', `dnl')
44251322Sericifdef(`_CLASS_Y_',
44364971Seric`R$* < @ $=Y . UUCP > $*	$@ $1 < @ $2 . UUCP . > $3', `dnl')
44451267Seric
44551267Seric# try UUCP traffic as a local address
44664971SericR$* < @ $+ . UUCP > $*		$: $1 < @ $[ $2 $] . UUCP . > $3
44751992Sericifdef(`_OLD_SENDMAIL_',
44864971Seric`R$* < @ $+ . $+ . UUCP . > $*		$@ $1 < @ $2 . $3 . > $4',
44964971Seric`R$* < @ $+ . . UUCP . > $*		$@ $1 < @ $2 . > $3')')
45059081Seric')
45165061Sericifdef(`_NO_CANONIFY_', `dnl',
45259081Seric`# pass to name server to make hostname canonical
45361470SericR$* < @ $* $~P > $*		$: $1 < @ $[ $2 $3 $] > $4')
45461470Seric
45565061Seric# local host aliases and pseudo-domains are always canonical
45665061SericR$* < @ $=w > $*		$: $1 < @ $2 . > $3
45764971SericR$* < @ $* $=P > $*		$: $1 < @ $2 $3 . > $4
45865061SericR$* < @ $* . . > $*		$1 < @ $2 . > $3
45964971Seric
46051322Seric# if this is the local hostname, make sure we treat is as canonical
46151322SericR$* < @ $j > $*			$: $1 < @ $j . > $2
46251222Seric
46351322Seric
46451222Seric##################################################
46551222Seric###  Ruleset 4 -- Final Output Post-rewriting  ###
46651222Seric##################################################
46751222SericS4
46851222Seric
46958499SericR$*<@>			$@ $1				handle <> and list:;
47051222Seric
47151322Seric# strip trailing dot off possibly canonical name
47251322SericR$* < @ $+ . > $*	$1 < @ $2 > $3
47351322Seric
47451222Seric# externalize local domain info
47551322SericR$* < $+ > $*		$1 $2 $3			defocus
47651322SericR@ $+ : @ $+ : $+	@ $1 , @ $2 : $3		<route-addr> canonical
47751997SericR@ $*			$@ @ $1				... and exit
47851222Seric
47958288Sericifdef(`_NO_UUCP_', `dnl',
48058288Seric`# UUCP must always be presented in old form
48158288SericR$+ @ $- . UUCP		$2!$1				u@h.UUCP => h!u')
48251222Seric
48351222Seric# delete duplicate local names
48451322SericR$+ % $=w @ $=w		$1 @ $j				u%host@host => u@host
48551222Seric
48651222Seric
48751222Seric
48860894Seric##############################################################
48960894Seric###   Ruleset _SET_97_ -- recanonicalize and call ruleset zero   ###
49060894Seric###		   (used for recursive calls)		   ###
49160894Seric##############################################################
49251222Seric
49360894SericS`'_SET_97_
49451222SericR$*			$: $>3 $1
49551222SericR$*			$@ $>0 $1
49651222Seric
49751222Seric
49851222Seric######################################
49951222Seric###   Ruleset 0 -- Parse Address   ###
50051222Seric######################################
50151222Seric
50251222SericS0
50351222Seric
50467118SericR<@>			$#_LOCAL_ $: <@>		special case error msgs
50566035SericR$* : $* ;		$#error $@ USAGE $: "list:; syntax illegal for recipient addresses"
50665048SericR<@ $+>			$#error $@ USAGE $: "user address required"
50767118SericR$* <$* : $* > $*	$#error $@ USAGE $: "colon illegal in host name part"
508*67132SericR$* < @ . > $*		$#error $@ USAGE $: "invalid host name"
50958340Seric
51055416Sericifdef(`_MAILER_smtp_',
51155416Seric`# handle numeric address spec
51263858SericR$* < @ [ $+ ] > $*	$: $>_SET_98_ $1 < @ [ $2 ] > $3	numeric internet spec
51365191SericR$* < @ [ $+ ] > $*	$#_SMTP_ $@ [$2] $: $1 < @ [$2] > $3	still numeric: send',
51463858Seric	`dnl')
51551222Seric
51651887Seric# now delete the local info -- note $=O to find characters that cause forwarding
51764321SericR$* < @ > $*		$@ $>_SET_97_ $1		user@ => user
51864321SericR< @ $=w . > : $*	$@ $>_SET_97_ $2		@here:... -> ...
51964321SericR$* $=O $* < @ $=w . >	$@ $>_SET_97_ $1 $2 $3		...@here -> ...
52063967Seric
52163967Seric# handle local hacks
52263967SericR$*			$: $>_SET_98_ $1
52366048Seric
52466048Seric# short circuit local delivery so forwarded email works
52566048Sericifdef(`_LOCAL_NOT_STICKY_',
52666048Seric`R$=L < @ $=w . >		$#_LOCAL_ $: @ $1			special local names
52766048SericR$+ < @ $=w . >		$#_LOCAL_ $: $1			dispose directly',
52866048Seric`R$+ < @ $=w . >		$: $1 < @ $2 . @ $H >		first try hub
52966048Sericifdef(`_OLD_SENDMAIL_',
53066048Seric`R$+ < $+ @ $-:$+ >	$# $3 $@ $4 $: $1 < $2 >	yep ....
53166048SericR$+ < $+ @ $+ >		$#relay $@ $3 $: $1 < $2 >	yep ....
53266048SericR$+ < $+ @ >		$#_LOCAL_ $: $1			nope, local address',
53366048Seric`R$+ < $+ @ $+ >		$#_LOCAL_ $: $1			yep ....
53466048SericR$+ < $+ @ >		$#_LOCAL_ $: @ $1			nope, local address')')
53566090Sericifdef(`MAILER_TABLE',
53666090Seric`
53766090Seric# not local -- try mailer table lookup
53866090SericR$* <@ $+ > $*		$: < $2 > $1 < @ $2 > $3	extract host name
53966090SericR< $+ . > $*		$: < $1 > $2			strip trailing dot
54066090SericR< $+ > $*		$: < $(mailertable $1 $) > $2	lookup
54166090SericR< $- : $+ > $*		$# $1 $@ $2 $: $3		check -- resolved?
54266090SericR< $+ > $*		$: $>90 <$1> $2			try domain',
54366090Seric`dnl')
54451260Sericundivert(4)dnl
54551260Seric
54661468Sericifdef(`_NO_UUCP_', `dnl',
54761468Seric`# resolve remotely connected UUCP links (if any)
54851285Sericifdef(`_CLASS_V_',
54964971Seric`R$* < @ $=V . UUCP . > $*		$: $>_SET_95_ < $V > $1 <@$2.UUCP.> $3',
55052044Seric	`dnl')
55151285Sericifdef(`_CLASS_W_',
55264971Seric`R$* < @ $=W . UUCP . > $*		$: $>_SET_95_ < $W > $1 <@$2.UUCP.> $3',
55352044Seric	`dnl')
55451285Sericifdef(`_CLASS_X_',
55564971Seric`R$* < @ $=X . UUCP . > $*		$: $>_SET_95_ < $X > $1 <@$2.UUCP.> $3',
55661468Seric	`dnl')')
55751260Seric
55851222Seric# resolve fake top level domains by forwarding to other hosts
55951222Sericifdef(`BITNET_RELAY',
56064971Seric`R$*<@$+.BITNET.>$*	$: $>_SET_95_ < $B > $1 <@$2.BITNET.> $3	user@host.BITNET',
56151222Seric	`dnl')
56265149Sericifdef(`_MAILER_pop_',
56365149Seric`R$+ < @ POP. >		$#pop $: $1			user@POP',
56465149Seric	`dnl')
56558364Sericifdef(`_MAILER_fax_',
56664971Seric`R$+ < @ $+ .FAX. >	$#fax $@ $2 $: $1		user@host.FAX',
56758364Seric`ifdef(`FAX_RELAY',
56864971Seric`R$*<@$+.FAX.>$*		$: $>_SET_95_ < $F > $1 <@$2.FAX.> $3	user@host.FAX',
56958364Seric	`dnl')')
57051222Seric
57151260Sericifdef(`UUCP_RELAY',
57251260Seric`# forward non-local UUCP traffic to our UUCP relay
57364971SericR$*<@$*.UUCP.>$*		$: $>_SET_95_ < $Y > $1 <@$2.UUCP.> $3	uucp mail',
57455416Seric`ifdef(`_MAILER_uucp_',
57551260Seric`# forward other UUCP traffic straight to UUCP
57665557SericR$* < @ $+ .UUCP. > $*		$#uucp $@ $2 $: $1 < @ $2 .UUCP. > $3	user@host.UUCP',
57751260Seric	`dnl')')
57863967Sericifdef(`_MAILER_usenet_', `
57963754Seric# addresses sent to net.group.USENET will get forwarded to a newsgroup
58065851SericR$+ . USENET		$#usenet $: $1',
58163860Seric	`dnl')
58263754Seric
58358070Sericifdef(`_LOCAL_RULES_',
58458070Seric`# figure out what should stay in our local mail system
58563754Sericundivert(1)', `dnl')
58663754Seric
58764321Seric# pass names that still have a host to a smarthost (if defined)
58864010SericR$* < @ $* > $*		$: $>_SET_95_ < $S > $1 < @ $2 > $3	glue on smarthost name
58963754Seric
59064321Seric# deal with other remote names
59163946Sericifdef(`_MAILER_smtp_',
59263973Seric`R$* < @$* > $*		$#_SMTP_ $@ $2 $: $1 < @ $2 > $3		user@host.domain',
59364321Seric`R$* < @$* > $*		$#error $@NOHOST $: Unrecognized host name $2')
59451222Seric
59551992Sericifdef(`_OLD_SENDMAIL_',
59651887Seric`# forward remaining names to local relay, if any
59763998SericR$=L			$#_LOCAL_ $: $1			special local names
59864010SericR$+			$: $>_SET_95_ < $R > $1			try relay
59964010SericR$+			$: $>_SET_95_ < $H > $1			try hub
60064010SericR$+			$#_LOCAL_ $: $1			no relay or hub: local',
60158811Seric
60258811Seric`# if this is quoted, strip the quotes and try again
60358811SericR$+			$: $(dequote $1 $)		strip quotes
60464502SericR$+ $=O $+		$@ $>_SET_97_ $1 $2 $3			try again
60558811Seric
60658811Seric# handle locally delivered names
60763998SericR$=L			$#_LOCAL_ $: @ $1			special local names
60863998SericR$+			$#_LOCAL_ $: $1			regular local names
60951222Seric
61055416Seric###########################################################################
61155416Seric###   Ruleset 5 -- special rewriting after aliases have been expanded   ###
61255416Seric###		   (new sendmail only)					###
61355416Seric###########################################################################
61451222Seric
61551322SericS5
61651322Seric
61758808Seric# see if we have a relay or a hub
61866048SericR$+			$: < $R > $1			try relay
61966048SericR< > $+			$: < $H > $1			try hub
62066048SericR< > $+			$@ $1				nope, give up
62166048SericR< $- : $+ > $+		$: $>_SET_95_ < $1 : $2 > $3 < @ $2 >
62266048SericR< $+ > $+		$@ $>_SET_95_ < $1 > $2 < @ $1 >')
62360540Sericifdef(`MAILER_TABLE',
62460540Seric`
62560540Seric
62663858Seric###################################################################
62763858Seric###  Ruleset 90 -- try domain part of mailertable entry 	###
62863858Seric###		   (new sendmail only)				###
62963858Seric###################################################################
63060540Seric
63160540SericS90
63266091SericR$* <$- . $+ > $*	$: $1$2 < $(mailertable .$3 $@ $1$2 $@ $2 $) > $4
63366081SericR$* <$- : $+ > $*	$# $2 $@ $3 $: $4		check -- resolved?
63466081SericR$* < . $+ > $*		$@ $>90 $1 . <$2> $3		no -- strip & try again
63566094SericR$* < $* > $*		$: < $(mailertable . $@ $1$2 $) > $3	try "."
63666090SericR<$- : $+ > $*		$# $1 $@ $2 $: $3		"." found?
63766090SericR< $* > $*		$@ $2				no mailertable match',
63860540Seric`dnl')
63963858Seric
64063858Seric###################################################################
64164010Seric###  Ruleset _SET_95_ -- canonify mailer:host syntax to triple	###
64264010Seric###################################################################
64364010Seric
64464010SericS`'_SET_95_
64564010SericR< > $*			$@ $1				strip off null relay
64664010SericR< $- : $+ > $*		$# $1 $@ $2 $: $3		try qualified mailer
64764010SericR< $=w > $*		$@ $2				delete local host
64864010SericR< $+ > $*		$#_RELAY_ $@ $1 $: $2		use unqualified mailer
64964010Seric
65064010Seric###################################################################
65163858Seric###  Ruleset _SET_98_ -- local part of ruleset zero (can be null)	###
65263858Seric###################################################################
65363858Seric
65463858SericS`'_SET_98_
65563858Sericundivert(3)dnl
65651222Seric#
65751222Seric######################################################################
65851222Seric######################################################################
65951222Seric#####
66056790Seric`#####			MAILER DEFINITIONS'
66151222Seric#####
66251222Seric######################################################################
66351222Seric######################################################################
66451222Sericundivert(7)dnl
665