xref: /csrg-svn/usr.sbin/sendmail/cf/m4/proto.m4 (revision 64260)
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*64260SericVERSIONID(`@(#)proto.m4	8.14 (Berkeley) 08/15/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
19*64260Sericdefine(`_SET_98_', 8)dnl
20*64260Sericdefine(`confDOMAIN_NAME',
21*64260Seric	`ifdef(`NEED_DOMAIN', `$w.$d', `$w')')dnl',
22*64260Seric`# level 5 config file format
23*64260SericV5
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
4260212SericCP.
4360212Seric
4451889SericCwlocalhost
4551887Sericifdef(`USE_CW_FILE',
4651889Seric`# file containing names of hosts for which we receive email
4764033SericFw`'confCW_FILE',
4864033Seric	`dnl')
4951222Seric
5051222Sericifdef(`UUCP_RELAY',
5151222Seric`# UUCP relay host
5264033SericDY`'UUCP_RELAY
5360212SericCPUUCP
5457944Seric
5551222Seric')dnl
5651222Sericifdef(`BITNET_RELAY',
5751222Seric`#  BITNET relay host
5864033SericDB`'BITNET_RELAY
5960212SericCPBITNET
6057944Seric
6151222Seric')dnl
6251222Sericifdef(`CSNET_RELAY',
6351222Seric`# CSNET relay host
6464033SericDC`'CSNET_RELAY
6560212SericCPCSNET
6657944Seric
6751222Seric')dnl
6858364Sericifdef(`FAX_RELAY',
6958364Seric`# FAX relay host
7064033SericDF`'FAX_RELAY
7160212SericCPFAX
7258364Seric
7358364Seric')dnl
7458070Sericifdef(`SMART_HOST',
7558070Seric`# "Smart" UUCP relay host
7664033SericDS`'SMART_HOST
7751222Seric
7858070Seric')dnl
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
95*64260Sericifdef(`confDOMAIN_NAME',
96*64260Seric`# my official domain name
97*64260SericDj`'confDOMAIN_NAME',
98*64260Seric	`dnl')
9958070Seric# who I masquerade as (can be $j)
10064033SericDM`'ifdef(`MASQUERADE_NAME', MASQUERADE_NAME, $j)
10158070Seric
10257245Seric# class L: names that should be delivered locally, even if we have a relay
10357245Seric# class E: names that should be exposed as from this host, even if we masquerade
10451279SericCLroot
10557245SericCEroot
10651279Sericundivert(5)dnl
10751279Seric
10851222Seric# operators that cannot be in local usernames (i.e., network indicators)
10958288SericCO @ % ifdef(`_NO_UUCP_', `', `!')
11051222Seric
11151322Seric# a class with just dot (for identifying canonical names)
11251322SericC..
11351322Seric
11458808Sericifdef(`_OLD_SENDMAIL_', `dnl',
11558808Seric`# dequoting map
11658808SericKdequote dequote')
11757944Seric
11859033Sericundivert(6)dnl
11959033Seric
12057944Seric######################
12157944Seric#   Special macros   #
12257944Seric######################
12357944Seric
12457944Seric# SMTP initial login message
12564033SericDe`'confSMTP_LOGIN_MSG
12657944Seric
12757944Seric# UNIX initial From header format
12864033SericDl`'confFROM_LINE
12957944Seric
13057944Seric# my name for error messages
13164033SericDn`'confMAILER_NAME
13257944Seric
13357944Seric# delimiter (operator) characters
13464033SericDo`'confOPERATORS
13557944Seric
13657944Seric# format of a total name
13764033SericDq`'ifdef(`confFROM_HEADER', confFROM_HEADER,
13864251Seric	ifdef(`_OLD_SENDMAIL_', `$g$?x ($x)$.', `$?x$x <$g>$|$g$.'))
13957944Sericinclude(`../m4/version.m4')
14057944Seric
14157944Seric###############
14257944Seric#   Options   #
14357944Seric###############
14457944Seric
14559887Seric# strip message body to 7 bits on input?
14664033SericO7`'confSEVEN_BIT_INPUT
14757944Seric
14857944Seric# wait (in minutes) for alias file rebuild
14964033SericOa`'confALIAS_WAIT
15057944Seric
15157944Seric# location of alias file
15264033SericOA`'ifdef(`ALIAS_FILE', ALIAS_FILE, /etc/aliases)
15357944Seric
15458084Seric# minimum number of free blocks on filesystem
15564033SericOb`'confMIN_FREE_BLOCKS
15658084Seric
15757944Seric# substitution for space (blank) characters
15864033SericOB`'confBLANK_SUB
15957944Seric
16057944Seric# connect to "expensive" mailers on initial submission?
16164033SericOc`'confCON_EXPENSIVE
16257944Seric
16357944Seric# checkpoint queue runs after every N successful deliveries
16464033SericOC`'confCHECKPOINT_INTERVAL
16557944Seric
16657944Seric# default delivery mode
16764033SericOd`'confDELIVERY_MODE
16857944Seric
16957944Seric# automatically rebuild the alias database?
17064033SericOD`'confAUTO_REBUILD
17157944Seric
17264033Seric# error message header/file
17357944Sericifdef(`confERROR_MESSAGE',
17464033Seric	OE`'confERROR_MESSAGE,
17557944Seric	#OE/etc/sendmail.oE)
17657944Seric
17757944Seric# error mode
17857944Sericifdef(`confERROR_MODE',
17964033Seric	Oe`'confERROR_MODE,
18057944Seric	#Oep)
18157944Seric
18257944Seric# save Unix-style "From_" lines at top of header?
18364033SericOf`'confSAVE_FROM_LINES
18457944Seric
18557944Seric# temporary file mode
18664033SericOF`'confTEMP_FILE_MODE
18757944Seric
18857944Seric# match recipients against GECOS field?
18964033SericOG`'confMATCH_GECOS
19057944Seric
19157944Seric# default GID
19264033SericOg`'confDEF_GROUP_ID
19357944Seric
19457944Seric# maximum hop count
19564033SericOh`'confMAX_HOP
19657944Seric
19757944Seric# location of help file
19864033SericOH`'ifdef(`HELP_FILE', HELP_FILE, /usr/lib/sendmail.hf)
19957944Seric
20057944Seric# ignore dots as terminators in incoming messages?
20164033SericOi`'confIGNORE_DOTS
20257944Seric
20357944Seric# Insist that the BIND name server be running to resolve names
20457944Sericifdef(`confBIND_OPTS',
20564033Seric	OI`'confBIND_OPTS,
20657944Seric	#OI)
20757944Seric
20859887Seric# deliver MIME-encapsulated error messages?
20964033SericOj`'confMIME_FORMAT_ERRORS
21059887Seric
21157944Seric# Forward file search path
21257944Sericifdef(`confFORWARD_PATH',
21364033Seric	OJ`'confFORWARD_PATH,
21457944Seric	#OJ/var/forward/$u:$z/.forward.$w:$z/.forward)
21557944Seric
21657944Seric# open connection cache size
21764033SericOk`'confMCI_CACHE_SIZE
21857944Seric
21957944Seric# open connection cache timeout
22064033SericOK`'confMCI_CACHE_TIMEOUT
22157944Seric
22261106Seric# use Errors-To: header?
22364033SericOl`'confUSE_ERRORS_TO
22461106Seric
22557944Seric# log level
22664033SericOL`'confLOG_LEVEL
22757944Seric
22857944Seric# send to me too, even in an alias expansion?
22964033SericOm`'confME_TOO
23057944Seric
23157944Seric# verify RHS in newaliases?
23264033SericOn`'confCHECK_ALIASES
23357944Seric
23457944Seric# default messages to old style headers if no special punctuation?
23564033SericOo`'confOLD_STYLE_HEADERS
23657944Seric
23758860Seric# SMTP daemon options
23858860Sericifdef(`confDAEMON_OPTIONS',
23964033Seric	OO`'confDAEMON_OPTIONS,
24058860Seric	#OOPort=esmtp)
24158860Seric
24258084Seric# privacy flags
24364033SericOp`'confPRIVACY_FLAGS
24458084Seric
24557944Seric# who (if anyone) should get extra copies of error messages
24657944Sericifdef(`confCOPY_ERRORS_TO',
24764033Seric	OP`'confCOPY_ERRORS_TO,
24857944Seric	#OPPostmaster)
24957944Seric
25057944Seric# slope of queue-only function
25157944Sericifdef(`confQUEUE_FACTOR',
25264033Seric	Oq`'confQUEUE_FACTOR,
25357944Seric	#Oq600000)
25457944Seric
25557944Seric# queue directory
25664033SericOQ`'ifdef(`QUEUE_DIR', QUEUE_DIR, /var/spool/mqueue)
25757944Seric
25857944Seric# read timeout -- now OK per RFC 1123 section 5.3.2
25958119Sericifdef(`confREAD_TIMEOUT',
26064033Seric	Or`'confREAD_TIMEOUT,
26158119Seric	#Ordatablock=10m)
26257944Seric
26357944Seric# queue up everything before forking?
26464033SericOs`'confSAFE_QUEUE
26557944Seric
26657944Seric# status file
26764033SericOS`'ifdef(`STATUS_FILE', STATUS_FILE, /etc/sendmail.st)
26857944Seric
26957944Seric# default message timeout interval
27064033SericOT`'confMESSAGE_TIMEOUT
27157944Seric
27257944Seric# time zone handling:
27357944Seric#  if undefined, use system default
27457944Seric#  if defined but null, use TZ envariable passed in
27557944Seric#  if defined and non-null, use that info
27657944Sericifelse(confTIME_ZONE, `USE_SYSTEM', `#Ot',
27757944Seric	confTIME_ZONE, `USE_TZ', `',
27864033Seric	`Ot`'confTIME_ZONE')
27957944Seric
28057944Seric# default UID
28164033SericOu`'confDEF_USER_ID
28257944Seric
28351887Seric# list of locations of user database file (null means no lookup)
28458720SericOU`'ifdef(`confUSERDB_SPEC', `confUSERDB_SPEC')
28551222Seric
28658860Seric# fallback MX host
28758860Sericifdef(`confFALLBACK_MX',
28864033Seric	OV`'confFALLBACK_MX,
28958860Seric	#OVfall.back.host.net)
29058860Seric
29163858Seric# if we are the best MX host for a site, try it directly instead of config err
29264033SericOw`'confTRY_NULL_MX_LIST
29363858Seric
29457944Seric# load average at which we just queue messages
29564033SericOx`'confQUEUE_LA
29657944Seric
29757944Seric# load average at which we refuse connections
29864033SericOX`'confREFUSE_LA
29957944Seric
30057944Seric# work recipient factor
30157944Sericifdef(`confWORK_RECIPIENT_FACTOR',
30264033Seric	Oy`'confWORK_RECIPIENT_FACTOR,
30357944Seric	#Oy30000)
30457944Seric
30557944Seric# deliver each queued job in a separate process?
30664033SericOY`'confSEPARATE_PROC
30757944Seric
30857944Seric# work class factor
30957944Sericifdef(`confWORK_CLASS_FACTOR',
31064033Seric	Oz`'confWORK_CLASS_FACTOR,
31157944Seric	#Oz1800)
31257944Seric
31357944Seric# work time factor
31457944Sericifdef(`confWORK_TIME_FACTOR',
31564033Seric	OZ`'confWORK_TIME_FACTOR,
31657944Seric	#OZ90000)
31757944Seric
31857944Seric###########################
31957944Seric#   Message precedences   #
32057944Seric###########################
32157944Seric
32257944SericPfirst-class=0
32357944SericPspecial-delivery=100
32458070SericPlist=-30
32557944SericPbulk=-60
32657944SericPjunk=-100
32757944Seric
32857944Seric#####################
32957944Seric#   Trusted users   #
33057944Seric#####################
33157944Seric
33257944SericTroot
33357944SericTdaemon
33457944SericTuucp
33557944Seric
33657944Seric#########################
33757944Seric#   Format of headers   #
33857944Seric#########################
33957944Seric
34058679SericH?P?Return-Path: $g
34164141SericHReceived: $?sfrom $s $.$?_($_) $.by $j ($v/$Z)$?r with $r$. id $i$?u for $u$.; $b
34257944SericH?D?Resent-Date: $a
34357944SericH?D?Date: $a
34457944SericH?F?Resent-From: $q
34557944SericH?F?From: $q
34657944SericH?x?Full-Name: $x
34757944SericHSubject:
34857944Seric# HPosted-Date: $a
34957944Seric# H?l?Received-Date: $b
35057944SericH?M?Resent-Message-Id: <$t.$i@$j>
35157944SericH?M?Message-Id: <$t.$i@$j>
35251222Seric#
35351222Seric######################################################################
35451222Seric######################################################################
35551222Seric#####
35651222Seric#####			REWRITING RULES
35751222Seric#####
35851222Seric######################################################################
35951222Seric######################################################################
36051222Seric
36158678Sericundivert(9)dnl
36251222Seric
36351222Seric###########################################
36451222Seric###  Rulset 3 -- Name Canonicalization  ###
36551222Seric###########################################
36651260SericS3
36751222Seric
36858499Seric# handle null input and list syntax (translate to <@> special case)
36958499SericR$@			$@ <@>
37058707SericR$*:;$*			$@ $1 :; <@>
37158174Seric
37251222Seric# basic textual canonicalization -- note RFC733 heuristic here
37364144SericR$*<$*>$*<$*>$*		$2$3<$4>$5			strip multiple <> <>
37458158SericR$*<$*<$+>$*>$*		<$3>$5				2-level <> nesting
37558499SericR$*<>$*			$@ <@>				MAIL FROM:<> case
37651222SericR$*<$+>$*		$2				basic RFC821/822 parsing
37751222Seric
37851222Seric# make sure <@a,@b,@c:user@d> syntax is easy to parse -- undone later
37955416SericR@ $+ , $+		@ $1 : $2			change all "," to ":"
38051222Seric
38151222Seric# localize and dispose of route-based addresses
38260894SericR@ $+ : $+		$@ $>_SET_96_ < @$1 > : $2		handle <route-addr>
38351222Seric
38451222Seric# find focus for list syntax
38560894SericR $+ : $* ; @ $+	$@ $>_SET_96_ $1 : $2 ; < @ $3 >	list syntax
38655416SericR $+ : $* ;		$@ $1 : $2;			list syntax
38751222Seric
38851222Seric# find focus for @ syntax addresses
38955416SericR$+ @ $+		$: $1 < @ $2 >			focus on domain
39055416SericR$+ < $+ @ $+ >		$1 $2 < @ $3 >			move gaze right
39160894SericR$+ < @ $+ >		$@ $>_SET_96_ $1 < @ $2 >		already canonical
39251222Seric
39358288Sericifdef(`_NO_UUCP_', `dnl',
39458288Seric`# convert old-style addresses to a domain-based address
39560894SericR$- ! $+		$@ $>_SET_96_ $2 < @ $1 .UUCP >	resolve uucp names
39660894SericR$+ . $- ! $+		$@ $>_SET_96_ $3 < @ $1 . $2 >		domain uucps
39760894SericR$+ ! $+		$@ $>_SET_96_ $2 < @ $1 .UUCP >	uucp subdomains')
39851222Seric
39951222Seric# if we have % signs, take the rightmost one
40055416SericR$* % $*		$1 @ $2				First make them all @s.
40155416SericR$* @ $* @ $*		$1 % $2 @ $3			Undo all but the last.
40260894SericR$* @ $*		$@ $>_SET_96_ $1 < @ $2 >		Insert < > and finish
40351222Seric
40451222Seric# else we must be a local name
40551222Seric
40651222Seric
40760894Seric################################################
40860894Seric###  Ruleset _SET_96_ -- bottom half of ruleset 3  ###
40960894Seric################################################
41051222Seric
41157245Seric#  At this point, everything should be in a "local_part<@domain>extra" format.
41260894SericS`'_SET_96_
41351222Seric
41451222Seric# handle special cases for local names
41560262SericR$* < @ localhost > $*		$: $1 < @ $j . > $2		no domain at all
41660262SericR$* < @ localhost . $m > $*	$: $1 < @ $j . > $2		local domain
41760262Sericifdef(`_NO_UUCP_', `dnl',
41860262Seric`R$* < @ localhost . UUCP > $*	$: $1 < @ $j . > $2		.UUCP domain')
41963754Sericifdef(`DOMAIN_TABLE', `
42063754Seric# look up unqualified domains in the domain table
42163754SericR$* < @ $- > $*			$: $1 < @ $(domaintable $2 $) > $3',
42263754Seric`dnl')
42351889Sericundivert(2)dnl
42451222Seric
42559081Sericifdef(`_NO_UUCP_', `dnl',
42659081Seric`ifdef(`UUCP_RELAY',
42751274Seric`# pass UUCP addresses straight through
42855416SericR$* < @ $+ . UUCP > $*		$@ $1 < @ $2 . UUCP > $3',
42951274Seric`# if really UUCP, handle it immediately
43051322Sericifdef(`_CLASS_U_',
43155416Seric`R$* < @ $=U . UUCP > $*	$@ $1 < @ $2 . UUCP > $3', `dnl')
43251322Sericifdef(`_CLASS_V_',
43355416Seric`R$* < @ $=V . UUCP > $*	$@ $1 < @ $2 . UUCP > $3', `dnl')
43451322Sericifdef(`_CLASS_W_',
43555416Seric`R$* < @ $=W . UUCP > $*	$@ $1 < @ $2 . UUCP > $3', `dnl')
43651322Sericifdef(`_CLASS_X_',
43755416Seric`R$* < @ $=X . UUCP > $*	$@ $1 < @ $2 . UUCP > $3', `dnl')
43851322Sericifdef(`_CLASS_Y_',
43955416Seric`R$* < @ $=Y . UUCP > $*	$@ $1 < @ $2 . UUCP > $3', `dnl')
44051267Seric
44151267Seric# try UUCP traffic as a local address
44255416SericR$* < @ $+ . UUCP > $*		$: $1 < @ $[ $2 $] . UUCP > $3
44351992Sericifdef(`_OLD_SENDMAIL_',
44455416Seric`R$* < @ $+ . $+ . UUCP > $*		$@ $1 < @ $2 . $3 . > $4',
44555416Seric`R$* < @ $+ . . UUCP > $*		$@ $1 < @ $2 . > $3')')
44659081Seric')
44761470Sericifdef(`_NO_CANONIFY_',
44861470Seric`# make sure local host names appear canonical
44961470SericR$* < @ $=w > $*		$: $1 < @ $2 . > $3',
45059081Seric`# pass to name server to make hostname canonical
45161470SericR$* < @ $* $~P > $*		$: $1 < @ $[ $2 $3 $] > $4')
45261470Seric
45351889Sericundivert(8)dnl
45451889Seric
45551322Seric# if this is the local hostname, make sure we treat is as canonical
45651322SericR$* < @ $j > $*			$: $1 < @ $j . > $2
45751222Seric
45851322Seric
45951222Seric##################################################
46051222Seric###  Ruleset 4 -- Final Output Post-rewriting  ###
46151222Seric##################################################
46251222SericS4
46351222Seric
46458499SericR$*<@>			$@ $1				handle <> and list:;
46551222Seric
46651222Seric# resolve numeric addresses to name if possible
46751322SericR$* < @ [ $+ ] > $*	$: $1 < @ $[ [$2] $] > $3	lookup numeric internet addr
46851222Seric
46951322Seric# strip trailing dot off possibly canonical name
47051322SericR$* < @ $+ . > $*	$1 < @ $2 > $3
47151322Seric
47251222Seric# externalize local domain info
47351322SericR$* < $+ > $*		$1 $2 $3			defocus
47451322SericR@ $+ : @ $+ : $+	@ $1 , @ $2 : $3		<route-addr> canonical
47551997SericR@ $*			$@ @ $1				... and exit
47651222Seric
47758288Sericifdef(`_NO_UUCP_', `dnl',
47858288Seric`# UUCP must always be presented in old form
47958288SericR$+ @ $- . UUCP		$2!$1				u@h.UUCP => h!u')
48051222Seric
48151222Seric# delete duplicate local names
48251322SericR$+ % $=w @ $=w		$1 @ $j				u%host@host => u@host
48351222Seric
48451222Seric
48551222Seric
48660894Seric##############################################################
48760894Seric###   Ruleset _SET_97_ -- recanonicalize and call ruleset zero   ###
48860894Seric###		   (used for recursive calls)		   ###
48960894Seric##############################################################
49051222Seric
49160894SericS`'_SET_97_
49251222SericR$*			$: $>3 $1
49351222SericR$*			$@ $>0 $1
49451222Seric
49551222Seric
49651222Seric######################################
49751222Seric###   Ruleset 0 -- Parse Address   ###
49851222Seric######################################
49951222Seric
50051222SericS0
50151222Seric
50263998SericR<@>			$#_LOCAL_ $: <>			special case error msgs
50359887SericR$*:;<@>		$#error $@ USAGE $: "list:; syntax illegal for recipient addresses"
50458340Seric
50555416Sericifdef(`_MAILER_smtp_',
50655416Seric`# handle numeric address spec
50763860Sericifdef(`_NO_CANONIFY_', `dnl',
50863860Seric`R$* < @ [ $+ ] > $*	$: $1 < @ $[ [$2] $] > $3	numeric internet addr')
50963858SericR$* < @ [ $+ ] > $*	$: $>_SET_98_ $1 < @ [ $2 ] > $3	numeric internet spec
51063973SericR$* < @ [ $+ ] > $*	$#_SMTP_ $@ [$2] $: $1 @ [$2] $3	still numeric: send',
51163858Seric	`dnl')
51251222Seric
51351887Seric# now delete the local info -- note $=O to find characters that cause forwarding
51460894SericR$* < @ > $*		$@ $>_SET_97_ $1			user@ => user
51560894SericR< @ $=w . > : $*	$@ $>_SET_97_ $2			@here:... -> ...
51660894SericR$* $=O $* < @ $=w . >	$@ $>_SET_97_ $1 $2 $3			...@here -> ...
51763967Seric
51863967Seric# handle local hacks
51963967SericR$*			$: $>_SET_98_ $1
52058781Sericifdef(`MAILER_TABLE',
52158781Seric`
52258781Seric# try mailer table lookup
52360540SericR$* <@ $+ > $*		$: < $2 > $1 < @ $2 > $3	extract host name
52461106SericR< $+ . > $*		$: < $1 > $2			strip trailing dot
52562582SericR< $+ > $*		$: < $(mailertable $1 $) > $2	lookup
52661106SericR< $- : $+ > $*		$# $1 $@ $2 $: $3		check -- resolved?
52762582SericR< $+ > $*		$: $>90 <$1> $2			try domain',
52858781Seric`dnl')
52951222Seric
53051222Seric# short circuit local delivery so forwarded email works
53158516Sericifdef(`_LOCAL_NOT_STICKY_',
53263998Seric`R$=L < @ $=w . >		$#_LOCAL_ $: @ $1			special local names
53363998SericR$+ < @ $=w . >		$#_LOCAL_ $: $1			dispose directly',
53460894Seric`R$+ < @ $=w . >		$: $1 < @ $2 @ $H >		first try hub
53551992Sericifdef(`_OLD_SENDMAIL_',
53659635Seric`R$+ < $+ @ $-:$+ >	$# $3 $@ $4 $: $1 < $2 >	yep ....
53759635SericR$+ < $+ @ $+ >		$#relay $@ $3 $: $1 < $2 >	yep ....
53863998SericR$+ < $+ @ >		$#_LOCAL_ $: $1			nope, local address',
53963998Seric`R$+ < $+ @ $+ >		$#_LOCAL_ $: $1			yep ....
54063998SericR$+ < $+ @ >		$#_LOCAL_ $: @ $1			nope, local address')')
54151260Sericundivert(4)dnl
54251260Seric
54361468Sericifdef(`_NO_UUCP_', `dnl',
54461468Seric`# resolve remotely connected UUCP links (if any)
54551285Sericifdef(`_CLASS_V_',
54664010Seric`R$* < @ $=V . UUCP > $*		$: $>_SET_95_ < $V > <@ $V> : $1 @ $2.UUCP $3',
54752044Seric	`dnl')
54851285Sericifdef(`_CLASS_W_',
54964010Seric`R$* < @ $=W . UUCP > $*		$: $>_SET_95_ < $W > <@ $W> : $1 @ $2.UUCP $3',
55052044Seric	`dnl')
55151285Sericifdef(`_CLASS_X_',
55264010Seric`R$* < @ $=X . UUCP > $*		$: $>_SET_95_ < $X > <@ $X> : $1 @ $2.UUCP $3',
55361468Seric	`dnl')')
55451260Seric
55551222Seric# resolve fake top level domains by forwarding to other hosts
55651222Sericifdef(`BITNET_RELAY',
55764010Seric`R$*<@$+.BITNET>$*	$: $>_SET_95_ < $B > $1 <@$2.BITNET> $3	user@host.BITNET',
55851222Seric	`dnl')
55951222Sericifdef(`CSNET_RELAY',
56064010Seric`R$*<@$+.CSNET>$*	$: $>_SET_95_ < $C > $1 <@$2.CSNET> $3	user@host.CSNET',
56151222Seric	`dnl')
56258364Sericifdef(`_MAILER_fax_',
56363858Seric`R$+ < @ $+ .FAX >	$#fax $@ $2 $: $1		user@host.FAX',
56458364Seric`ifdef(`FAX_RELAY',
56564010Seric`R$*<@$+.FAX>$*		$: $>_SET_95_ < $F > $1 <@$2.FAX> $3	user@host.FAX',
56658364Seric	`dnl')')
56751222Seric
56851260Sericifdef(`UUCP_RELAY',
56951260Seric`# forward non-local UUCP traffic to our UUCP relay
57064010SericR$*<@$*.UUCP>$*		$: $>_SET_95_ < $Y > <@ $Y> : $1 @ $2.UUCP $3	uucp mail',
57155416Seric`ifdef(`_MAILER_uucp_',
57251260Seric`# forward other UUCP traffic straight to UUCP
57363858SericR< @ $+ .UUCP > : $+	$#uucp $@ $1 $: $2		@host.UUCP:...
57463858SericR$+ < @ $+ .UUCP >	$#uucp $@ $2 $: $1		user@host.UUCP',
57551260Seric	`dnl')')
57663967Sericifdef(`_MAILER_usenet_', `
57763754Seric# addresses sent to net.group.USENET will get forwarded to a newsgroup
57863998SericR$+ . USENET		$#usenet $: $1',
57963860Seric	`dnl')
58063754Seric
58158070Sericifdef(`_LOCAL_RULES_',
58258070Seric`# figure out what should stay in our local mail system
58363754Sericundivert(1)', `dnl')
58463754Seric
58563946Sericifdef(`SMART_HOST',
58663946Seric`# pass names that still have a host to a smarthost
58764010SericR$* < @ $* > $*		$: $>_SET_95_ < $S > $1 < @ $2 > $3	glue on smarthost name
58863858SericR< $- : $+ > $*		$# $1 $@ $2 $: $3		if non-null, use it
58963858SericR< $+ > $*		$#suucp $@ $1 $: $2		if non-null, use it
59063858SericR<> $*			$: $1				else strip off gunk',
59163754Seric
59263754Seric`# deal with other remote names
59363946Sericifdef(`_MAILER_smtp_',
59463973Seric`R$* < @$* > $*		$#_SMTP_ $@ $2 $: $1 < @ $2 > $3		user@host.domain',
59563946Seric`R$* < @$* > $*		$#error $@NOHOST $: Unrecognized host name $2')')
59651222Seric
59751992Sericifdef(`_OLD_SENDMAIL_',
59851887Seric`# forward remaining names to local relay, if any
59963998SericR$=L			$#_LOCAL_ $: $1			special local names
60064010SericR$+			$: $>_SET_95_ < $R > $1			try relay
60164010SericR$+			$: $>_SET_95_ < $H > $1			try hub
60264010SericR$+			$#_LOCAL_ $: $1			no relay or hub: local',
60358811Seric
60458811Seric`# if this is quoted, strip the quotes and try again
60558811SericR$+			$: $(dequote $1 $)		strip quotes
60660894SericR$* $=O $*		$@ $>_SET_97_ $1 $2 $3			try again
60758811Seric
60858811Seric# handle locally delivered names
60963998SericR$=L			$#_LOCAL_ $: @ $1			special local names
61063998SericR$+			$#_LOCAL_ $: $1			regular local names
61151222Seric
61255416Seric###########################################################################
61355416Seric###   Ruleset 5 -- special rewriting after aliases have been expanded   ###
61455416Seric###		   (new sendmail only)					###
61555416Seric###########################################################################
61651222Seric
61751322SericS5
61851322Seric
61958808Seric# see if we have a relay or a hub
62064010SericR$+			$: $>_SET_95_ < $R > $1			try relay
62164010SericR$+			$: $>_SET_95_ < $H > $1			try hub')
62260540Sericifdef(`MAILER_TABLE',
62360540Seric`
62460540Seric
62563858Seric###################################################################
62663858Seric###  Ruleset 90 -- try domain part of mailertable entry 	###
62763858Seric###		   (new sendmail only)				###
62863858Seric###################################################################
62960540Seric
63060540SericS90
63164010SericR<$- . $+ > $*		$: < $(mailertable .$2 $@ $1 $) > $3	lookup
63260540SericR<$- : $+ > $*		$# $1 $@ $2 $: $3		check -- resolved?
63362372SericR< . $+ > $*		$@ $>90 <$1> $2			no -- strip & try again
63460540SericR<$*> $*		$@ $2				no match',
63560540Seric`dnl')
63663858Seric
63763858Seric###################################################################
63864010Seric###  Ruleset _SET_95_ -- canonify mailer:host syntax to triple	###
63964010Seric###################################################################
64064010Seric
64164010SericS`'_SET_95_
64264010SericR< > $*			$@ $1				strip off null relay
64364010SericR< $- : $+ > $*		$# $1 $@ $2 $: $3		try qualified mailer
64464010SericR< $=w > $*		$@ $2				delete local host
64564010SericR< $+ > $*		$#_RELAY_ $@ $1 $: $2		use unqualified mailer
64664010Seric
64764010Seric###################################################################
64863858Seric###  Ruleset _SET_98_ -- local part of ruleset zero (can be null)	###
64963858Seric###################################################################
65063858Seric
65163858SericS`'_SET_98_
65263858Sericundivert(3)dnl
65351222Seric#
65451222Seric######################################################################
65551222Seric######################################################################
65651222Seric#####
65756790Seric`#####			MAILER DEFINITIONS'
65851222Seric#####
65951222Seric######################################################################
66051222Seric######################################################################
66151222Sericundivert(7)dnl
662