xref: /csrg-svn/usr.sbin/sendmail/cf/m4/proto.m4 (revision 67538)
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*67538SericVERSIONID(`@(#)proto.m4	8.50 (Berkeley) 07/16/94')
1251222Seric
1351322SericMAILER(local)dnl
1451222Seric
1567469Seric# level 5 config file format
1664260SericV5
1764010Sericifdef(`confSMTP_MAILER',, `define(`confSMTP_MAILER', `smtp')')dnl
1863998Sericifdef(`confLOCAL_MAILER',, `define(`confLOCAL_MAILER', `local')')dnl
1964010Sericifdef(`confRELAY_MAILER',,
2064010Seric	`define(`confRELAY_MAILER',
2164010Seric		`ifdef(`_MAILER_smtp_', `relay',
2264010Seric			`ifdef(`_MAILER_uucp', `suucp', `unknown')')')')dnl
2363998Sericdefine(`_SMTP_', `confSMTP_MAILER')dnl		for readability only
2463998Sericdefine(`_LOCAL_', `confLOCAL_MAILER')dnl	for readability only
2564010Sericdefine(`_RELAY_', `confRELAY_MAILER')dnl	for readability only
2652646Seric
2751222Seric##################
2851222Seric#   local info   #
2951222Seric##################
3051222Seric
3151889SericCwlocalhost
3251887Sericifdef(`USE_CW_FILE',
3351889Seric`# file containing names of hosts for which we receive email
3464033SericFw`'confCW_FILE',
3564033Seric	`dnl')
3664321Sericifdef(`confDOMAIN_NAME', `
3764321Seric# my official domain name
3864321SericDj`'confDOMAIN_NAME',
3964321Seric	`dnl')
4051222Seric
4164321Sericifdef(`_NULL_CLIENT_ONLY_',
4264321Seric`include(../m4/nullrelay.m4)m4exit',
4364321Seric	`dnl')
4464321Seric
4564321SericCP.
4664321Seric
4751222Sericifdef(`UUCP_RELAY',
4851222Seric`# UUCP relay host
4964033SericDY`'UUCP_RELAY
5060212SericCPUUCP
5157944Seric
5251222Seric')dnl
5351222Sericifdef(`BITNET_RELAY',
5451222Seric`#  BITNET relay host
5564033SericDB`'BITNET_RELAY
5660212SericCPBITNET
5757944Seric
5851222Seric')dnl
5958364Sericifdef(`FAX_RELAY',
6058364Seric`# FAX relay host
6164033SericDF`'FAX_RELAY
6260212SericCPFAX
6358364Seric
6458364Seric')dnl
6564321Seric# "Smart" relay host (may be null)
6664321SericDS`'ifdef(`SMART_HOST', SMART_HOST)
6751222Seric
6858781Sericifdef(`MAILER_TABLE',
6958781Seric`# Mailer table (overriding domains)
7058781SericKmailertable MAILER_TABLE
7158781Seric
7258781Seric')dnl
7363754Sericifdef(`DOMAIN_TABLE',
7463754Seric`# Domain table (adding domains)
7563754SericKdomaintable DOMAIN_TABLE
7663754Seric
7763754Seric')dnl
7851222Seric# who I send unqualified names to (null means deliver locally)
7964033SericDR`'ifdef(`LOCAL_RELAY', LOCAL_RELAY)
8051222Seric
8157527Seric# who gets all local email traffic ($R has precedence for unqualified names)
8264033SericDH`'ifdef(`MAIL_HUB', MAIL_HUB)
8357527Seric
8466085Seric# who I masquerade as (null for no masquerading)
8566085SericDM`'ifdef(`MASQUERADE_NAME', MASQUERADE_NAME)
8658070Seric
8757245Seric# class L: names that should be delivered locally, even if we have a relay
8857245Seric# class E: names that should be exposed as from this host, even if we masquerade
89*67538Seric# class D: dotted names, e.g., root.machinename
90*67538Seric#CL root
91*67538SericCE root
9251279Sericundivert(5)dnl
93*67538Sericifdef(`__DOTTED_USER_LIST__',
94*67538Seric	`__DOTTED_USER_LIST__',
95*67538Seric	`#CD postmaster')
9651279Seric
9751222Seric# operators that cannot be in local usernames (i.e., network indicators)
9858288SericCO @ % ifdef(`_NO_UUCP_', `', `!')
9951222Seric
10051322Seric# a class with just dot (for identifying canonical names)
10151322SericC..
10251322Seric
10367469Seric# dequoting map
10467469SericKdequote dequote
10557944Seric
10659033Sericundivert(6)dnl
10759033Seric
10857944Seric######################
10957944Seric#   Special macros   #
11057944Seric######################
11157944Seric
11257944Seric# SMTP initial login message
11364033SericDe`'confSMTP_LOGIN_MSG
11457944Seric
11557944Seric# UNIX initial From header format
11664033SericDl`'confFROM_LINE
11757944Seric
11857944Seric# my name for error messages
11964033SericDn`'confMAILER_NAME
12057944Seric
12157944Seric# delimiter (operator) characters
12264033SericDo`'confOPERATORS
12357944Seric
12457944Seric# format of a total name
125*67538SericDq`'ifdef(`confFROM_HEADER', confFROM_HEADER, `$?x$x <$g>$|$g$.')
12657944Sericinclude(`../m4/version.m4')
12757944Seric
12857944Seric###############
12957944Seric#   Options   #
13057944Seric###############
13157944Seric
13259887Seric# strip message body to 7 bits on input?
13364033SericO7`'confSEVEN_BIT_INPUT
13457944Seric
13557944Seric# wait (in minutes) for alias file rebuild
13664033SericOa`'confALIAS_WAIT
13757944Seric
13857944Seric# location of alias file
13965825SericOA`'ifdef(`ALIAS_FILE', `ALIAS_FILE', /etc/aliases)
14057944Seric
14158084Seric# minimum number of free blocks on filesystem
14264033SericOb`'confMIN_FREE_BLOCKS
14358084Seric
14457944Seric# substitution for space (blank) characters
14564033SericOB`'confBLANK_SUB
14657944Seric
14765618Seric# avoid connecting to "expensive" mailers on initial submission?
14864033SericOc`'confCON_EXPENSIVE
14957944Seric
15057944Seric# checkpoint queue runs after every N successful deliveries
15164033SericOC`'confCHECKPOINT_INTERVAL
15257944Seric
15357944Seric# default delivery mode
15464033SericOd`'confDELIVERY_MODE
15557944Seric
15657944Seric# automatically rebuild the alias database?
15764033SericOD`'confAUTO_REBUILD
15857944Seric
15964033Seric# error message header/file
16057944Sericifdef(`confERROR_MESSAGE',
16164033Seric	OE`'confERROR_MESSAGE,
16257944Seric	#OE/etc/sendmail.oE)
16357944Seric
16457944Seric# error mode
16557944Sericifdef(`confERROR_MODE',
16664033Seric	Oe`'confERROR_MODE,
16757944Seric	#Oep)
16857944Seric
16957944Seric# save Unix-style "From_" lines at top of header?
17064033SericOf`'confSAVE_FROM_LINES
17157944Seric
17257944Seric# temporary file mode
17364033SericOF`'confTEMP_FILE_MODE
17457944Seric
17557944Seric# match recipients against GECOS field?
17664033SericOG`'confMATCH_GECOS
17757944Seric
17857944Seric# default GID
17964033SericOg`'confDEF_GROUP_ID
18057944Seric
18157944Seric# maximum hop count
18264033SericOh`'confMAX_HOP
18357944Seric
18457944Seric# location of help file
18564033SericOH`'ifdef(`HELP_FILE', HELP_FILE, /usr/lib/sendmail.hf)
18657944Seric
18757944Seric# ignore dots as terminators in incoming messages?
18864033SericOi`'confIGNORE_DOTS
18957944Seric
19057944Seric# Insist that the BIND name server be running to resolve names
19157944Sericifdef(`confBIND_OPTS',
19264033Seric	OI`'confBIND_OPTS,
19357944Seric	#OI)
19457944Seric
19559887Seric# deliver MIME-encapsulated error messages?
19664033SericOj`'confMIME_FORMAT_ERRORS
19759887Seric
19857944Seric# Forward file search path
19957944Sericifdef(`confFORWARD_PATH',
20064033Seric	OJ`'confFORWARD_PATH,
20157944Seric	#OJ/var/forward/$u:$z/.forward.$w:$z/.forward)
20257944Seric
20357944Seric# open connection cache size
20464033SericOk`'confMCI_CACHE_SIZE
20557944Seric
20657944Seric# open connection cache timeout
20764033SericOK`'confMCI_CACHE_TIMEOUT
20857944Seric
20961106Seric# use Errors-To: header?
21064033SericOl`'confUSE_ERRORS_TO
21161106Seric
21257944Seric# log level
21364033SericOL`'confLOG_LEVEL
21457944Seric
21557944Seric# send to me too, even in an alias expansion?
21664033SericOm`'confME_TOO
21757944Seric
21857944Seric# verify RHS in newaliases?
21964033SericOn`'confCHECK_ALIASES
22057944Seric
22157944Seric# default messages to old style headers if no special punctuation?
22264033SericOo`'confOLD_STYLE_HEADERS
22357944Seric
22458860Seric# SMTP daemon options
22558860Sericifdef(`confDAEMON_OPTIONS',
22664033Seric	OO`'confDAEMON_OPTIONS,
22758860Seric	#OOPort=esmtp)
22858860Seric
22958084Seric# privacy flags
23064033SericOp`'confPRIVACY_FLAGS
23158084Seric
23257944Seric# who (if anyone) should get extra copies of error messages
23357944Sericifdef(`confCOPY_ERRORS_TO',
23464033Seric	OP`'confCOPY_ERRORS_TO,
23557944Seric	#OPPostmaster)
23657944Seric
23757944Seric# slope of queue-only function
23857944Sericifdef(`confQUEUE_FACTOR',
23964033Seric	Oq`'confQUEUE_FACTOR,
24057944Seric	#Oq600000)
24157944Seric
24257944Seric# queue directory
24364033SericOQ`'ifdef(`QUEUE_DIR', QUEUE_DIR, /var/spool/mqueue)
24457944Seric
24557944Seric# read timeout -- now OK per RFC 1123 section 5.3.2
24658119Sericifdef(`confREAD_TIMEOUT',
24764033Seric	Or`'confREAD_TIMEOUT,
24858119Seric	#Ordatablock=10m)
24957944Seric
25057944Seric# queue up everything before forking?
25164033SericOs`'confSAFE_QUEUE
25257944Seric
25357944Seric# status file
25464033SericOS`'ifdef(`STATUS_FILE', STATUS_FILE, /etc/sendmail.st)
25557944Seric
25657944Seric# default message timeout interval
25764033SericOT`'confMESSAGE_TIMEOUT
25857944Seric
25957944Seric# time zone handling:
26057944Seric#  if undefined, use system default
26157944Seric#  if defined but null, use TZ envariable passed in
26257944Seric#  if defined and non-null, use that info
26357944Sericifelse(confTIME_ZONE, `USE_SYSTEM', `#Ot',
26464341Seric	confTIME_ZONE, `USE_TZ', `Ot',
26564033Seric	`Ot`'confTIME_ZONE')
26657944Seric
26757944Seric# default UID
26864033SericOu`'confDEF_USER_ID
26957944Seric
27051887Seric# list of locations of user database file (null means no lookup)
27158720SericOU`'ifdef(`confUSERDB_SPEC', `confUSERDB_SPEC')
27251222Seric
27358860Seric# fallback MX host
27458860Sericifdef(`confFALLBACK_MX',
27564033Seric	OV`'confFALLBACK_MX,
27658860Seric	#OVfall.back.host.net)
27758860Seric
27863858Seric# if we are the best MX host for a site, try it directly instead of config err
27964033SericOw`'confTRY_NULL_MX_LIST
28063858Seric
28157944Seric# load average at which we just queue messages
28264033SericOx`'confQUEUE_LA
28357944Seric
28457944Seric# load average at which we refuse connections
28564033SericOX`'confREFUSE_LA
28657944Seric
28757944Seric# work recipient factor
28857944Sericifdef(`confWORK_RECIPIENT_FACTOR',
28964033Seric	Oy`'confWORK_RECIPIENT_FACTOR,
29057944Seric	#Oy30000)
29157944Seric
29257944Seric# deliver each queued job in a separate process?
29364033SericOY`'confSEPARATE_PROC
29457944Seric
29557944Seric# work class factor
29657944Sericifdef(`confWORK_CLASS_FACTOR',
29764033Seric	Oz`'confWORK_CLASS_FACTOR,
29857944Seric	#Oz1800)
29957944Seric
30057944Seric# work time factor
30157944Sericifdef(`confWORK_TIME_FACTOR',
30264033Seric	OZ`'confWORK_TIME_FACTOR,
30357944Seric	#OZ90000)
30457944Seric
30557944Seric###########################
30657944Seric#   Message precedences   #
30757944Seric###########################
30857944Seric
30957944SericPfirst-class=0
31057944SericPspecial-delivery=100
31158070SericPlist=-30
31257944SericPbulk=-60
31357944SericPjunk=-100
31457944Seric
31557944Seric#####################
31657944Seric#   Trusted users   #
31757944Seric#####################
31857944Seric
31957944SericTroot
32057944SericTdaemon
32157944SericTuucp
32257944Seric
32357944Seric#########################
32457944Seric#   Format of headers   #
32557944Seric#########################
32657944Seric
32758679SericH?P?Return-Path: $g
32866015SericHReceived: $?sfrom $s $.$?_($?s$|from $.$_) $.by $j ($v/$Z)$?r with $r$. id $i$?u for $u$.; $b
32957944SericH?D?Resent-Date: $a
33057944SericH?D?Date: $a
33157944SericH?F?Resent-From: $q
33257944SericH?F?From: $q
33357944SericH?x?Full-Name: $x
33457944SericHSubject:
33557944Seric# HPosted-Date: $a
33657944Seric# H?l?Received-Date: $b
33757944SericH?M?Resent-Message-Id: <$t.$i@$j>
33857944SericH?M?Message-Id: <$t.$i@$j>
33951222Seric#
34051222Seric######################################################################
34151222Seric######################################################################
34251222Seric#####
34351222Seric#####			REWRITING RULES
34451222Seric#####
34551222Seric######################################################################
34651222Seric######################################################################
34751222Seric
34858678Sericundivert(9)dnl
34951222Seric
35051222Seric###########################################
35151222Seric###  Rulset 3 -- Name Canonicalization  ###
35251222Seric###########################################
35351260SericS3
35451222Seric
35564802Seric# handle null input (translate to <@> special case)
35658499SericR$@			$@ <@>
35758174Seric
35851222Seric# basic textual canonicalization -- note RFC733 heuristic here
35964144SericR$*<$*>$*<$*>$*		$2$3<$4>$5			strip multiple <> <>
36058158SericR$*<$*<$+>$*>$*		<$3>$5				2-level <> nesting
36158499SericR$*<>$*			$@ <@>				MAIL FROM:<> case
36251222SericR$*<$+>$*		$2				basic RFC821/822 parsing
36351222Seric
36464802Seric# handle list:; syntax as special case
36564802SericR$*:;$*			$@ $1 :; <@>
36664802Seric
36751222Seric# make sure <@a,@b,@c:user@d> syntax is easy to parse -- undone later
36855416SericR@ $+ , $+		@ $1 : $2			change all "," to ":"
36951222Seric
37051222Seric# localize and dispose of route-based addresses
37167469SericR@ $+ : $+		$@ $>96 < @$1 > : $2		handle <route-addr>
37251222Seric
37351222Seric# find focus for list syntax
37467469SericR $+ : $* ; @ $+	$@ $>96 $1 : $2 ; < @ $3 >	list syntax
37555416SericR $+ : $* ;		$@ $1 : $2;			list syntax
37651222Seric
37751222Seric# find focus for @ syntax addresses
37855416SericR$+ @ $+		$: $1 < @ $2 >			focus on domain
37955416SericR$+ < $+ @ $+ >		$1 $2 < @ $3 >			move gaze right
38067469SericR$+ < @ $+ >		$@ $>96 $1 < @ $2 >		already canonical
38151222Seric
38264968Seric# do some sanity checking
38364968SericR$* < @ $* : $* > $*	$1 < @ $2 $3 > $4		nix colons in addrs
38464968Seric
38558288Sericifdef(`_NO_UUCP_', `dnl',
38658288Seric`# convert old-style addresses to a domain-based address
38767469SericR$- ! $+		$@ $>96 $2 < @ $1 .UUCP >	resolve uucp names
38867469SericR$+ . $- ! $+		$@ $>96 $3 < @ $1 . $2 >		domain uucps
38967469SericR$+ ! $+		$@ $>96 $2 < @ $1 .UUCP >	uucp subdomains')
39051222Seric
39151222Seric# if we have % signs, take the rightmost one
39255416SericR$* % $*		$1 @ $2				First make them all @s.
39355416SericR$* @ $* @ $*		$1 % $2 @ $3			Undo all but the last.
39467469SericR$* @ $*		$@ $>96 $1 < @ $2 >		Insert < > and finish
39551222Seric
39651222Seric# else we must be a local name
39751222Seric
39851222Seric
39960894Seric################################################
40067469Seric###  Ruleset 96 -- bottom half of ruleset 3  ###
40160894Seric################################################
40251222Seric
40357245Seric#  At this point, everything should be in a "local_part<@domain>extra" format.
40467469SericS96
40551222Seric
40651222Seric# handle special cases for local names
40760262SericR$* < @ localhost > $*		$: $1 < @ $j . > $2		no domain at all
40860262SericR$* < @ localhost . $m > $*	$: $1 < @ $j . > $2		local domain
40960262Sericifdef(`_NO_UUCP_', `dnl',
41060262Seric`R$* < @ localhost . UUCP > $*	$: $1 < @ $j . > $2		.UUCP domain')
41165825SericR$* < @ [ $+ ] > $*		$: $1 < @@ [ $2 ] > $3		mark [a.b.c.d]
41265825SericR$* < @@ $=w > $*		$: $1 < @ $j . > $3		self-literal
41366306SericR$* < @@ $+ > $*		$@ $1 < @ $2 > $3		canon IP addr
41463754Sericifdef(`DOMAIN_TABLE', `
41567450Seric# look up domains in the domain table
41667450SericR$* < @ $+ > $*			$: $1 < @ $(domaintable $2 $) > $3',
41763754Seric`dnl')
41851889Sericundivert(2)dnl
41951222Seric
42059081Sericifdef(`_NO_UUCP_', `dnl',
42159081Seric`ifdef(`UUCP_RELAY',
42251274Seric`# pass UUCP addresses straight through
42364971SericR$* < @ $+ . UUCP > $*		$@ $1 < @ $2 . UUCP . > $3',
42451274Seric`# if really UUCP, handle it immediately
42551322Sericifdef(`_CLASS_U_',
42664971Seric`R$* < @ $=U . UUCP > $*	$@ $1 < @ $2 . UUCP . > $3', `dnl')
42751322Sericifdef(`_CLASS_V_',
42864971Seric`R$* < @ $=V . UUCP > $*	$@ $1 < @ $2 . UUCP . > $3', `dnl')
42951322Sericifdef(`_CLASS_W_',
43064971Seric`R$* < @ $=W . UUCP > $*	$@ $1 < @ $2 . UUCP . > $3', `dnl')
43151322Sericifdef(`_CLASS_X_',
43264971Seric`R$* < @ $=X . UUCP > $*	$@ $1 < @ $2 . UUCP . > $3', `dnl')
43351322Sericifdef(`_CLASS_Y_',
43464971Seric`R$* < @ $=Y . UUCP > $*	$@ $1 < @ $2 . UUCP . > $3', `dnl')
43551267Seric
43651267Seric# try UUCP traffic as a local address
43764971SericR$* < @ $+ . UUCP > $*		$: $1 < @ $[ $2 $] . UUCP . > $3
43867469SericR$* < @ $+ . . UUCP . > $*		$@ $1 < @ $2 . > $3')
43959081Seric')
44065061Sericifdef(`_NO_CANONIFY_', `dnl',
44159081Seric`# pass to name server to make hostname canonical
44261470SericR$* < @ $* $~P > $*		$: $1 < @ $[ $2 $3 $] > $4')
44361470Seric
44465061Seric# local host aliases and pseudo-domains are always canonical
44565061SericR$* < @ $=w > $*		$: $1 < @ $2 . > $3
44664971SericR$* < @ $* $=P > $*		$: $1 < @ $2 $3 . > $4
44765061SericR$* < @ $* . . > $*		$1 < @ $2 . > $3
44864971Seric
44951322Seric# if this is the local hostname, make sure we treat is as canonical
45051322SericR$* < @ $j > $*			$: $1 < @ $j . > $2
45151222Seric
45251322Seric
45351222Seric##################################################
45451222Seric###  Ruleset 4 -- Final Output Post-rewriting  ###
45551222Seric##################################################
45651222SericS4
45751222Seric
45858499SericR$*<@>			$@ $1				handle <> and list:;
45951222Seric
46051322Seric# strip trailing dot off possibly canonical name
46151322SericR$* < @ $+ . > $*	$1 < @ $2 > $3
46251322Seric
46351222Seric# externalize local domain info
46451322SericR$* < $+ > $*		$1 $2 $3			defocus
46551322SericR@ $+ : @ $+ : $+	@ $1 , @ $2 : $3		<route-addr> canonical
46651997SericR@ $*			$@ @ $1				... and exit
46751222Seric
46858288Sericifdef(`_NO_UUCP_', `dnl',
46958288Seric`# UUCP must always be presented in old form
47058288SericR$+ @ $- . UUCP		$2!$1				u@h.UUCP => h!u')
47151222Seric
47251222Seric# delete duplicate local names
47351322SericR$+ % $=w @ $=w		$1 @ $j				u%host@host => u@host
47451222Seric
47551222Seric
47651222Seric
47760894Seric##############################################################
47867469Seric###   Ruleset 97 -- recanonicalize and call ruleset zero   ###
47960894Seric###		   (used for recursive calls)		   ###
48060894Seric##############################################################
48151222Seric
48267469SericS`'97
48351222SericR$*			$: $>3 $1
48451222SericR$*			$@ $>0 $1
48551222Seric
48651222Seric
48751222Seric######################################
48851222Seric###   Ruleset 0 -- Parse Address   ###
48951222Seric######################################
49051222Seric
49151222SericS0
49251222Seric
49367118SericR<@>			$#_LOCAL_ $: <@>		special case error msgs
49466035SericR$* : $* ;		$#error $@ USAGE $: "list:; syntax illegal for recipient addresses"
49565048SericR<@ $+>			$#error $@ USAGE $: "user address required"
49667118SericR$* <$* : $* > $*	$#error $@ USAGE $: "colon illegal in host name part"
49767132SericR$* < @ . > $*		$#error $@ USAGE $: "invalid host name"
49858340Seric
49955416Sericifdef(`_MAILER_smtp_',
50055416Seric`# handle numeric address spec
50167469SericR$* < @ [ $+ ] > $*	$: $>98 $1 < @ [ $2 ] > $3	numeric internet spec
50265191SericR$* < @ [ $+ ] > $*	$#_SMTP_ $@ [$2] $: $1 < @ [$2] > $3	still numeric: send',
50363858Seric	`dnl')
50451222Seric
50551887Seric# now delete the local info -- note $=O to find characters that cause forwarding
50667469SericR$* < @ > $*		$@ $>97 $1		user@ => user
50767469SericR< @ $=w . > : $*	$@ $>97 $2		@here:... -> ...
50867469SericR$* $=O $* < @ $=w . >	$@ $>97 $1 $2 $3		...@here -> ...
50963967Seric
51063967Seric# handle local hacks
51167469SericR$*			$: $>98 $1
51266048Seric
51366048Seric# short circuit local delivery so forwarded email works
51466048Sericifdef(`_LOCAL_NOT_STICKY_',
51566048Seric`R$=L < @ $=w . >		$#_LOCAL_ $: @ $1			special local names
51666048SericR$+ < @ $=w . >		$#_LOCAL_ $: $1			dispose directly',
51766048Seric`R$+ < @ $=w . >		$: $1 < @ $2 . @ $H >		first try hub
51867469SericR$+ < $+ @ $+ >		$#_LOCAL_ $: $1			yep ....
51967469SericR$+ < $+ @ >		$#_LOCAL_ $: @ $1			nope, local address')
52066090Sericifdef(`MAILER_TABLE',
52166090Seric`
52266090Seric# not local -- try mailer table lookup
52366090SericR$* <@ $+ > $*		$: < $2 > $1 < @ $2 > $3	extract host name
52466090SericR< $+ . > $*		$: < $1 > $2			strip trailing dot
52566090SericR< $+ > $*		$: < $(mailertable $1 $) > $2	lookup
52666090SericR< $- : $+ > $*		$# $1 $@ $2 $: $3		check -- resolved?
52766090SericR< $+ > $*		$: $>90 <$1> $2			try domain',
52866090Seric`dnl')
52951260Sericundivert(4)dnl
53051260Seric
53161468Sericifdef(`_NO_UUCP_', `dnl',
53261468Seric`# resolve remotely connected UUCP links (if any)
53351285Sericifdef(`_CLASS_V_',
53467469Seric`R$* < @ $=V . UUCP . > $*		$: $>95 < $V > $1 <@$2.UUCP.> $3',
53552044Seric	`dnl')
53651285Sericifdef(`_CLASS_W_',
53767469Seric`R$* < @ $=W . UUCP . > $*		$: $>95 < $W > $1 <@$2.UUCP.> $3',
53852044Seric	`dnl')
53951285Sericifdef(`_CLASS_X_',
54067469Seric`R$* < @ $=X . UUCP . > $*		$: $>95 < $X > $1 <@$2.UUCP.> $3',
54161468Seric	`dnl')')
54251260Seric
54351222Seric# resolve fake top level domains by forwarding to other hosts
54451222Sericifdef(`BITNET_RELAY',
54567469Seric`R$*<@$+.BITNET.>$*	$: $>95 < $B > $1 <@$2.BITNET.> $3	user@host.BITNET',
54651222Seric	`dnl')
54765149Sericifdef(`_MAILER_pop_',
54865149Seric`R$+ < @ POP. >		$#pop $: $1			user@POP',
54965149Seric	`dnl')
55058364Sericifdef(`_MAILER_fax_',
55164971Seric`R$+ < @ $+ .FAX. >	$#fax $@ $2 $: $1		user@host.FAX',
55258364Seric`ifdef(`FAX_RELAY',
55367469Seric`R$*<@$+.FAX.>$*		$: $>95 < $F > $1 <@$2.FAX.> $3	user@host.FAX',
55458364Seric	`dnl')')
55551222Seric
55651260Sericifdef(`UUCP_RELAY',
55751260Seric`# forward non-local UUCP traffic to our UUCP relay
55867469SericR$*<@$*.UUCP.>$*		$: $>95 < $Y > $1 <@$2.UUCP.> $3	uucp mail',
55955416Seric`ifdef(`_MAILER_uucp_',
56051260Seric`# forward other UUCP traffic straight to UUCP
56165557SericR$* < @ $+ .UUCP. > $*		$#uucp $@ $2 $: $1 < @ $2 .UUCP. > $3	user@host.UUCP',
56251260Seric	`dnl')')
56363967Sericifdef(`_MAILER_usenet_', `
56463754Seric# addresses sent to net.group.USENET will get forwarded to a newsgroup
56565851SericR$+ . USENET		$#usenet $: $1',
56663860Seric	`dnl')
56763754Seric
56858070Sericifdef(`_LOCAL_RULES_',
56958070Seric`# figure out what should stay in our local mail system
57063754Sericundivert(1)', `dnl')
57163754Seric
57264321Seric# pass names that still have a host to a smarthost (if defined)
57367469SericR$* < @ $* > $*		$: $>95 < $S > $1 < @ $2 > $3	glue on smarthost name
57463754Seric
57564321Seric# deal with other remote names
57663946Sericifdef(`_MAILER_smtp_',
57763973Seric`R$* < @$* > $*		$#_SMTP_ $@ $2 $: $1 < @ $2 > $3		user@host.domain',
57864321Seric`R$* < @$* > $*		$#error $@NOHOST $: Unrecognized host name $2')
57951222Seric
58067469Seric# if this is quoted, strip the quotes and try again
58158811SericR$+			$: $(dequote $1 $)		strip quotes
58267469SericR$+ $=O $+		$@ $>97 $1 $2 $3			try again
58358811Seric
58458811Seric# handle locally delivered names
58563998SericR$=L			$#_LOCAL_ $: @ $1			special local names
58663998SericR$+			$#_LOCAL_ $: $1			regular local names
58751222Seric
58855416Seric###########################################################################
58955416Seric###   Ruleset 5 -- special rewriting after aliases have been expanded   ###
59055416Seric###		   (new sendmail only)					###
59155416Seric###########################################################################
59251222Seric
59351322SericS5
59451322Seric
595*67538Seric# if we have a "special dotted user", convert it back to the base name
596*67538SericR$=D . *		$#_LOCAL_ $: $1
597*67538SericR$=D . $+		$#_LOCAL_ $: $1 . *
598*67538Seric
59958808Seric# see if we have a relay or a hub
60066048SericR$+			$: < $R > $1			try relay
60166048SericR< > $+			$: < $H > $1			try hub
60266048SericR< > $+			$@ $1				nope, give up
60367469SericR< $- : $+ > $+		$: $>95 < $1 : $2 > $3 < @ $2 >
60467469SericR< $+ > $+		$@ $>95 < $1 > $2 < @ $1 >
60560540Sericifdef(`MAILER_TABLE',
60660540Seric`
60760540Seric
60863858Seric###################################################################
60963858Seric###  Ruleset 90 -- try domain part of mailertable entry 	###
61063858Seric###		   (new sendmail only)				###
61163858Seric###################################################################
61260540Seric
61360540SericS90
61466091SericR$* <$- . $+ > $*	$: $1$2 < $(mailertable .$3 $@ $1$2 $@ $2 $) > $4
61566081SericR$* <$- : $+ > $*	$# $2 $@ $3 $: $4		check -- resolved?
61666081SericR$* < . $+ > $*		$@ $>90 $1 . <$2> $3		no -- strip & try again
61766094SericR$* < $* > $*		$: < $(mailertable . $@ $1$2 $) > $3	try "."
61866090SericR<$- : $+ > $*		$# $1 $@ $2 $: $3		"." found?
61966090SericR< $* > $*		$@ $2				no mailertable match',
62060540Seric`dnl')
62163858Seric
62263858Seric###################################################################
62367469Seric###  Ruleset 95 -- canonify mailer:host syntax to triple	###
62464010Seric###################################################################
62564010Seric
62667469SericS95
62764010SericR< > $*			$@ $1				strip off null relay
62864010SericR< $- : $+ > $*		$# $1 $@ $2 $: $3		try qualified mailer
62964010SericR< $=w > $*		$@ $2				delete local host
63064010SericR< $+ > $*		$#_RELAY_ $@ $1 $: $2		use unqualified mailer
63164010Seric
63264010Seric###################################################################
63367469Seric###  Ruleset 98 -- local part of ruleset zero (can be null)	###
63463858Seric###################################################################
63563858Seric
63667469SericS98
63763858Sericundivert(3)dnl
63851222Seric#
63951222Seric######################################################################
64051222Seric######################################################################
64151222Seric#####
64256790Seric`#####			MAILER DEFINITIONS'
64351222Seric#####
64451222Seric######################################################################
64551222Seric######################################################################
64651222Sericundivert(7)dnl
647