xref: /csrg-svn/usr.sbin/sendmail/cf/m4/proto.m4 (revision 67697)
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*67697SericVERSIONID(`@(#)proto.m4	8.54 (Berkeley) 08/17/94')
1251222Seric
1351322SericMAILER(local)dnl
1451222Seric
1567696Seric# level 6 config file format
1667696SericV6
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
8967538Seric# class D: dotted names, e.g., root.machinename
9067538Seric#CL root
9167538SericCE root
9251279Sericundivert(5)dnl
9367538Sericifdef(`__DOTTED_USER_LIST__',
9467538Seric	`__DOTTED_USER_LIST__',
9567538Seric	`#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
12567538SericDq`'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
13567550Seric# 8-bit data handling
13667550SericO8`'confEIGHT_BIT_HANDLING
13767550Seric
13857944Seric# wait (in minutes) for alias file rebuild
13964033SericOa`'confALIAS_WAIT
14057944Seric
14157944Seric# location of alias file
14265825SericOA`'ifdef(`ALIAS_FILE', `ALIAS_FILE', /etc/aliases)
14357944Seric
14458084Seric# minimum number of free blocks on filesystem
14564033SericOb`'confMIN_FREE_BLOCKS
14658084Seric
14757944Seric# substitution for space (blank) characters
14864033SericOB`'confBLANK_SUB
14957944Seric
15065618Seric# avoid connecting to "expensive" mailers on initial submission?
15164033SericOc`'confCON_EXPENSIVE
15257944Seric
15357944Seric# checkpoint queue runs after every N successful deliveries
15464033SericOC`'confCHECKPOINT_INTERVAL
15557944Seric
15657944Seric# default delivery mode
15764033SericOd`'confDELIVERY_MODE
15857944Seric
15957944Seric# automatically rebuild the alias database?
16064033SericOD`'confAUTO_REBUILD
16157944Seric
16264033Seric# error message header/file
16357944Sericifdef(`confERROR_MESSAGE',
16464033Seric	OE`'confERROR_MESSAGE,
16557944Seric	#OE/etc/sendmail.oE)
16657944Seric
16757944Seric# error mode
16857944Sericifdef(`confERROR_MODE',
16964033Seric	Oe`'confERROR_MODE,
17057944Seric	#Oep)
17157944Seric
17257944Seric# save Unix-style "From_" lines at top of header?
17364033SericOf`'confSAVE_FROM_LINES
17457944Seric
17557944Seric# temporary file mode
17664033SericOF`'confTEMP_FILE_MODE
17757944Seric
17857944Seric# match recipients against GECOS field?
17964033SericOG`'confMATCH_GECOS
18057944Seric
18157944Seric# default GID
18264033SericOg`'confDEF_GROUP_ID
18357944Seric
18457944Seric# maximum hop count
18564033SericOh`'confMAX_HOP
18657944Seric
18757944Seric# location of help file
18864033SericOH`'ifdef(`HELP_FILE', HELP_FILE, /usr/lib/sendmail.hf)
18957944Seric
19057944Seric# ignore dots as terminators in incoming messages?
19164033SericOi`'confIGNORE_DOTS
19257944Seric
19357944Seric# Insist that the BIND name server be running to resolve names
19457944Sericifdef(`confBIND_OPTS',
19564033Seric	OI`'confBIND_OPTS,
19657944Seric	#OI)
19757944Seric
19859887Seric# deliver MIME-encapsulated error messages?
19964033SericOj`'confMIME_FORMAT_ERRORS
20059887Seric
20157944Seric# Forward file search path
20257944Sericifdef(`confFORWARD_PATH',
20364033Seric	OJ`'confFORWARD_PATH,
20457944Seric	#OJ/var/forward/$u:$z/.forward.$w:$z/.forward)
20557944Seric
20657944Seric# open connection cache size
20764033SericOk`'confMCI_CACHE_SIZE
20857944Seric
20957944Seric# open connection cache timeout
21064033SericOK`'confMCI_CACHE_TIMEOUT
21157944Seric
21261106Seric# use Errors-To: header?
21364033SericOl`'confUSE_ERRORS_TO
21461106Seric
21557944Seric# log level
21664033SericOL`'confLOG_LEVEL
21757944Seric
21857944Seric# send to me too, even in an alias expansion?
21964033SericOm`'confME_TOO
22057944Seric
22157944Seric# verify RHS in newaliases?
22264033SericOn`'confCHECK_ALIASES
22357944Seric
22457944Seric# default messages to old style headers if no special punctuation?
22564033SericOo`'confOLD_STYLE_HEADERS
22657944Seric
22758860Seric# SMTP daemon options
22858860Sericifdef(`confDAEMON_OPTIONS',
22964033Seric	OO`'confDAEMON_OPTIONS,
23058860Seric	#OOPort=esmtp)
23158860Seric
23258084Seric# privacy flags
23364033SericOp`'confPRIVACY_FLAGS
23458084Seric
23557944Seric# who (if anyone) should get extra copies of error messages
23657944Sericifdef(`confCOPY_ERRORS_TO',
23764033Seric	OP`'confCOPY_ERRORS_TO,
23857944Seric	#OPPostmaster)
23957944Seric
24057944Seric# slope of queue-only function
24157944Sericifdef(`confQUEUE_FACTOR',
24264033Seric	Oq`'confQUEUE_FACTOR,
24357944Seric	#Oq600000)
24457944Seric
24557944Seric# queue directory
24664033SericOQ`'ifdef(`QUEUE_DIR', QUEUE_DIR, /var/spool/mqueue)
24757944Seric
24857944Seric# read timeout -- now OK per RFC 1123 section 5.3.2
24958119Sericifdef(`confREAD_TIMEOUT',
25064033Seric	Or`'confREAD_TIMEOUT,
25158119Seric	#Ordatablock=10m)
25257944Seric
25357944Seric# queue up everything before forking?
25464033SericOs`'confSAFE_QUEUE
25557944Seric
25657944Seric# status file
25764033SericOS`'ifdef(`STATUS_FILE', STATUS_FILE, /etc/sendmail.st)
25857944Seric
25957944Seric# default message timeout interval
26064033SericOT`'confMESSAGE_TIMEOUT
26157944Seric
26257944Seric# time zone handling:
26357944Seric#  if undefined, use system default
26457944Seric#  if defined but null, use TZ envariable passed in
26557944Seric#  if defined and non-null, use that info
26657944Sericifelse(confTIME_ZONE, `USE_SYSTEM', `#Ot',
26764341Seric	confTIME_ZONE, `USE_TZ', `Ot',
26864033Seric	`Ot`'confTIME_ZONE')
26957944Seric
27057944Seric# default UID
27164033SericOu`'confDEF_USER_ID
27257944Seric
27351887Seric# list of locations of user database file (null means no lookup)
27458720SericOU`'ifdef(`confUSERDB_SPEC', `confUSERDB_SPEC')
27551222Seric
27658860Seric# fallback MX host
27758860Sericifdef(`confFALLBACK_MX',
27864033Seric	OV`'confFALLBACK_MX,
27958860Seric	#OVfall.back.host.net)
28058860Seric
28163858Seric# if we are the best MX host for a site, try it directly instead of config err
28264033SericOw`'confTRY_NULL_MX_LIST
28363858Seric
28457944Seric# load average at which we just queue messages
28564033SericOx`'confQUEUE_LA
28657944Seric
28757944Seric# load average at which we refuse connections
28864033SericOX`'confREFUSE_LA
28957944Seric
29057944Seric# work recipient factor
29157944Sericifdef(`confWORK_RECIPIENT_FACTOR',
29264033Seric	Oy`'confWORK_RECIPIENT_FACTOR,
29357944Seric	#Oy30000)
29457944Seric
29557944Seric# deliver each queued job in a separate process?
29664033SericOY`'confSEPARATE_PROC
29757944Seric
29857944Seric# work class factor
29957944Sericifdef(`confWORK_CLASS_FACTOR',
30064033Seric	Oz`'confWORK_CLASS_FACTOR,
30157944Seric	#Oz1800)
30257944Seric
30357944Seric# work time factor
30457944Sericifdef(`confWORK_TIME_FACTOR',
30564033Seric	OZ`'confWORK_TIME_FACTOR,
30657944Seric	#OZ90000)
30757944Seric
308*67697Seric# do our SMTP peers choke on multi-line greeting messages?
309*67697SericO BrokenSmtpPeers=confBROKEN_SMTP_PEERS
310*67697Seric
311*67697Seric# shall we sort the queue by hostname first?
312*67697SericO SortQueueByHost=confSORT_QUEUE_BY_HOST
313*67697Seric
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
38067469SericR@ $+ : $+		$@ $>96 < @$1 > : $2		handle <route-addr>
38151222Seric
38251222Seric# find focus for list syntax
38367469SericR $+ : $* ; @ $+	$@ $>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
38967469SericR$+ < @ $+ >		$@ $>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
39667469SericR$- ! $+		$@ $>96 $2 < @ $1 .UUCP >	resolve uucp names
39767469SericR$+ . $- ! $+		$@ $>96 $3 < @ $1 . $2 >		domain uucps
39867469SericR$+ ! $+		$@ $>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.
40367469SericR$* @ $*		$@ $>96 $1 < @ $2 >		Insert < > and finish
40451222Seric
40551222Seric# else we must be a local name
40651222Seric
40751222Seric
40860894Seric################################################
40967469Seric###  Ruleset 96 -- bottom half of ruleset 3  ###
41060894Seric################################################
41151222Seric
41257245Seric#  At this point, everything should be in a "local_part<@domain>extra" format.
41367469SericS96
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', `
42467450Seric# look up domains in the domain table
42567450SericR$* < @ $+ > $*			$: $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
44767469SericR$* < @ $+ . . UUCP . > $*		$@ $1 < @ $2 . > $3')
44859081Seric')
44965061Sericifdef(`_NO_CANONIFY_', `dnl',
45059081Seric`# pass to name server to make hostname canonical
45161470SericR$* < @ $* $~P > $*		$: $1 < @ $[ $2 $3 $] > $4')
45261470Seric
45365061Seric# local host aliases and pseudo-domains are always canonical
45465061SericR$* < @ $=w > $*		$: $1 < @ $2 . > $3
45564971SericR$* < @ $* $=P > $*		$: $1 < @ $2 $3 . > $4
45665061SericR$* < @ $* . . > $*		$1 < @ $2 . > $3
45764971Seric
45851322Seric# if this is the local hostname, make sure we treat is as canonical
45951322SericR$* < @ $j > $*			$: $1 < @ $j . > $2
46051222Seric
46151322Seric
46251222Seric##################################################
46351222Seric###  Ruleset 4 -- Final Output Post-rewriting  ###
46451222Seric##################################################
46551222SericS4
46651222Seric
46758499SericR$*<@>			$@ $1				handle <> and list:;
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##############################################################
48767469Seric###   Ruleset 97 -- recanonicalize and call ruleset zero   ###
48860894Seric###		   (used for recursive calls)		   ###
48960894Seric##############################################################
49051222Seric
49167469SericS`'97
49251222SericR$*			$: $>3 $1
49351222SericR$*			$@ $>0 $1
49451222Seric
49551222Seric
49651222Seric######################################
49751222Seric###   Ruleset 0 -- Parse Address   ###
49851222Seric######################################
49951222Seric
50051222SericS0
50151222Seric
50267118SericR<@>			$#_LOCAL_ $: <@>		special case error msgs
50366035SericR$* : $* ;		$#error $@ USAGE $: "list:; syntax illegal for recipient addresses"
50465048SericR<@ $+>			$#error $@ USAGE $: "user address required"
50567118SericR$* <$* : $* > $*	$#error $@ USAGE $: "colon illegal in host name part"
50667132SericR$* < @ . > $*		$#error $@ USAGE $: "invalid host name"
50758340Seric
50855416Sericifdef(`_MAILER_smtp_',
50955416Seric`# handle numeric address spec
51067469SericR$* < @ [ $+ ] > $*	$: $>98 $1 < @ [ $2 ] > $3	numeric internet spec
51165191SericR$* < @ [ $+ ] > $*	$#_SMTP_ $@ [$2] $: $1 < @ [$2] > $3	still numeric: send',
51263858Seric	`dnl')
51351222Seric
51451887Seric# now delete the local info -- note $=O to find characters that cause forwarding
51567469SericR$* < @ > $*		$@ $>97 $1		user@ => user
51667469SericR< @ $=w . > : $*	$@ $>97 $2		@here:... -> ...
51767469SericR$* $=O $* < @ $=w . >	$@ $>97 $1 $2 $3		...@here -> ...
51863967Seric
51963967Seric# handle local hacks
52067469SericR$*			$: $>98 $1
52166048Seric
52266048Seric# short circuit local delivery so forwarded email works
52366048Sericifdef(`_LOCAL_NOT_STICKY_',
52466048Seric`R$=L < @ $=w . >		$#_LOCAL_ $: @ $1			special local names
52566048SericR$+ < @ $=w . >		$#_LOCAL_ $: $1			dispose directly',
52666048Seric`R$+ < @ $=w . >		$: $1 < @ $2 . @ $H >		first try hub
52767469SericR$+ < $+ @ $+ >		$#_LOCAL_ $: $1			yep ....
52867543SericR$=D . $+ < $+ @ >	$#_LOCAL_ $: $1 . $2		dotted name?
52967469SericR$+ < $+ @ >		$#_LOCAL_ $: @ $1			nope, local address')
53066090Sericifdef(`MAILER_TABLE',
53166090Seric`
53266090Seric# not local -- try mailer table lookup
53366090SericR$* <@ $+ > $*		$: < $2 > $1 < @ $2 > $3	extract host name
53466090SericR< $+ . > $*		$: < $1 > $2			strip trailing dot
53566090SericR< $+ > $*		$: < $(mailertable $1 $) > $2	lookup
53666090SericR< $- : $+ > $*		$# $1 $@ $2 $: $3		check -- resolved?
53766090SericR< $+ > $*		$: $>90 <$1> $2			try domain',
53866090Seric`dnl')
53951260Sericundivert(4)dnl
54051260Seric
54161468Sericifdef(`_NO_UUCP_', `dnl',
54261468Seric`# resolve remotely connected UUCP links (if any)
54351285Sericifdef(`_CLASS_V_',
54467469Seric`R$* < @ $=V . UUCP . > $*		$: $>95 < $V > $1 <@$2.UUCP.> $3',
54552044Seric	`dnl')
54651285Sericifdef(`_CLASS_W_',
54767469Seric`R$* < @ $=W . UUCP . > $*		$: $>95 < $W > $1 <@$2.UUCP.> $3',
54852044Seric	`dnl')
54951285Sericifdef(`_CLASS_X_',
55067469Seric`R$* < @ $=X . UUCP . > $*		$: $>95 < $X > $1 <@$2.UUCP.> $3',
55161468Seric	`dnl')')
55251260Seric
55351222Seric# resolve fake top level domains by forwarding to other hosts
55451222Sericifdef(`BITNET_RELAY',
55567469Seric`R$*<@$+.BITNET.>$*	$: $>95 < $B > $1 <@$2.BITNET.> $3	user@host.BITNET',
55651222Seric	`dnl')
55765149Sericifdef(`_MAILER_pop_',
55865149Seric`R$+ < @ POP. >		$#pop $: $1			user@POP',
55965149Seric	`dnl')
56058364Sericifdef(`_MAILER_fax_',
56164971Seric`R$+ < @ $+ .FAX. >	$#fax $@ $2 $: $1		user@host.FAX',
56258364Seric`ifdef(`FAX_RELAY',
56367469Seric`R$*<@$+.FAX.>$*		$: $>95 < $F > $1 <@$2.FAX.> $3	user@host.FAX',
56458364Seric	`dnl')')
56551222Seric
56651260Sericifdef(`UUCP_RELAY',
56751260Seric`# forward non-local UUCP traffic to our UUCP relay
56867469SericR$*<@$*.UUCP.>$*		$: $>95 < $Y > $1 <@$2.UUCP.> $3	uucp mail',
56955416Seric`ifdef(`_MAILER_uucp_',
57051260Seric`# forward other UUCP traffic straight to UUCP
57165557SericR$* < @ $+ .UUCP. > $*		$#uucp $@ $2 $: $1 < @ $2 .UUCP. > $3	user@host.UUCP',
57251260Seric	`dnl')')
57363967Sericifdef(`_MAILER_usenet_', `
57463754Seric# addresses sent to net.group.USENET will get forwarded to a newsgroup
57565851SericR$+ . USENET		$#usenet $: $1',
57663860Seric	`dnl')
57763754Seric
57858070Sericifdef(`_LOCAL_RULES_',
57958070Seric`# figure out what should stay in our local mail system
58063754Sericundivert(1)', `dnl')
58163754Seric
58264321Seric# pass names that still have a host to a smarthost (if defined)
58367469SericR$* < @ $* > $*		$: $>95 < $S > $1 < @ $2 > $3	glue on smarthost name
58463754Seric
58564321Seric# deal with other remote names
58663946Sericifdef(`_MAILER_smtp_',
58763973Seric`R$* < @$* > $*		$#_SMTP_ $@ $2 $: $1 < @ $2 > $3		user@host.domain',
58864321Seric`R$* < @$* > $*		$#error $@NOHOST $: Unrecognized host name $2')
58951222Seric
59067469Seric# if this is quoted, strip the quotes and try again
59158811SericR$+			$: $(dequote $1 $)		strip quotes
59267469SericR$+ $=O $+		$@ $>97 $1 $2 $3			try again
59358811Seric
59458811Seric# handle locally delivered names
59563998SericR$=L			$#_LOCAL_ $: @ $1			special local names
59663998SericR$+			$#_LOCAL_ $: $1			regular local names
59751222Seric
59855416Seric###########################################################################
59955416Seric###   Ruleset 5 -- special rewriting after aliases have been expanded   ###
60055416Seric###		   (new sendmail only)					###
60155416Seric###########################################################################
60251222Seric
60351322SericS5
60451322Seric
60567538Seric# if we have a "special dotted user", convert it back to the base name
60667538SericR$=D . *		$#_LOCAL_ $: $1
60767538SericR$=D . $+		$#_LOCAL_ $: $1 . *
60867538Seric
60958808Seric# see if we have a relay or a hub
61066048SericR$+			$: < $R > $1			try relay
61166048SericR< > $+			$: < $H > $1			try hub
61266048SericR< > $+			$@ $1				nope, give up
61367469SericR< $- : $+ > $+		$: $>95 < $1 : $2 > $3 < @ $2 >
61467469SericR< $+ > $+		$@ $>95 < $1 > $2 < @ $1 >
61560540Sericifdef(`MAILER_TABLE',
61660540Seric`
61760540Seric
61863858Seric###################################################################
61963858Seric###  Ruleset 90 -- try domain part of mailertable entry 	###
62063858Seric###		   (new sendmail only)				###
62163858Seric###################################################################
62260540Seric
62360540SericS90
62466091SericR$* <$- . $+ > $*	$: $1$2 < $(mailertable .$3 $@ $1$2 $@ $2 $) > $4
62566081SericR$* <$- : $+ > $*	$# $2 $@ $3 $: $4		check -- resolved?
62666081SericR$* < . $+ > $*		$@ $>90 $1 . <$2> $3		no -- strip & try again
62766094SericR$* < $* > $*		$: < $(mailertable . $@ $1$2 $) > $3	try "."
62866090SericR<$- : $+ > $*		$# $1 $@ $2 $: $3		"." found?
62966090SericR< $* > $*		$@ $2				no mailertable match',
63060540Seric`dnl')
63163858Seric
63263858Seric###################################################################
63367469Seric###  Ruleset 95 -- canonify mailer:host syntax to triple	###
63464010Seric###################################################################
63564010Seric
63667469SericS95
63764010SericR< > $*			$@ $1				strip off null relay
63864010SericR< $- : $+ > $*		$# $1 $@ $2 $: $3		try qualified mailer
63964010SericR< $=w > $*		$@ $2				delete local host
64064010SericR< $+ > $*		$#_RELAY_ $@ $1 $: $2		use unqualified mailer
64164010Seric
64264010Seric###################################################################
64367469Seric###  Ruleset 98 -- local part of ruleset zero (can be null)	###
64463858Seric###################################################################
64563858Seric
64667469SericS98
64763858Sericundivert(3)dnl
64851222Seric#
64951222Seric######################################################################
65051222Seric######################################################################
65151222Seric#####
65256790Seric`#####			MAILER DEFINITIONS'
65351222Seric#####
65451222Seric######################################################################
65551222Seric######################################################################
65651222Sericundivert(7)dnl
657