xref: /csrg-svn/usr.sbin/sendmail/cf/m4/proto.m4 (revision 67914)
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*67914SericVERSIONID(`@(#)proto.m4	8.57 (Berkeley) 11/13/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
68*67914Sericifdef(`LUSER_RELAY',
69*67914Seric`# place to which unknown users should be forwarded
70*67914SericKuser user -m -a<>
71*67914SericDL`'LUSER_RELAY
72*67914Seric', `dnl')
73*67914Seric
7458781Sericifdef(`MAILER_TABLE',
7558781Seric`# Mailer table (overriding domains)
7658781SericKmailertable MAILER_TABLE
7758781Seric
7858781Seric')dnl
7963754Sericifdef(`DOMAIN_TABLE',
8063754Seric`# Domain table (adding domains)
8163754SericKdomaintable DOMAIN_TABLE
8263754Seric
8363754Seric')dnl
8451222Seric# who I send unqualified names to (null means deliver locally)
8564033SericDR`'ifdef(`LOCAL_RELAY', LOCAL_RELAY)
8651222Seric
8757527Seric# who gets all local email traffic ($R has precedence for unqualified names)
8864033SericDH`'ifdef(`MAIL_HUB', MAIL_HUB)
8957527Seric
9066085Seric# who I masquerade as (null for no masquerading)
9166085SericDM`'ifdef(`MASQUERADE_NAME', MASQUERADE_NAME)
9258070Seric
9357245Seric# class L: names that should be delivered locally, even if we have a relay
9457245Seric# class E: names that should be exposed as from this host, even if we masquerade
9567538Seric# class D: dotted names, e.g., root.machinename
9667538Seric#CL root
9767538SericCE root
9851279Sericundivert(5)dnl
9967538Sericifdef(`__DOTTED_USER_LIST__',
10067538Seric	`__DOTTED_USER_LIST__',
10167538Seric	`#CD postmaster')
10251279Seric
10351222Seric# operators that cannot be in local usernames (i.e., network indicators)
10458288SericCO @ % ifdef(`_NO_UUCP_', `', `!')
10551222Seric
10651322Seric# a class with just dot (for identifying canonical names)
10751322SericC..
10851322Seric
10967469Seric# dequoting map
11067469SericKdequote dequote
11157944Seric
11259033Sericundivert(6)dnl
11359033Seric
11457944Seric######################
11557944Seric#   Special macros   #
11657944Seric######################
11757944Seric
11857944Seric# SMTP initial login message
11964033SericDe`'confSMTP_LOGIN_MSG
12057944Seric
12157944Seric# UNIX initial From header format
12264033SericDl`'confFROM_LINE
12357944Seric
12457944Seric# my name for error messages
12564033SericDn`'confMAILER_NAME
12657944Seric
12757944Seric# delimiter (operator) characters
12864033SericDo`'confOPERATORS
12957944Seric
13057944Seric# format of a total name
13167538SericDq`'ifdef(`confFROM_HEADER', confFROM_HEADER, `$?x$x <$g>$|$g$.')
13257944Sericinclude(`../m4/version.m4')
13357944Seric
13457944Seric###############
13557944Seric#   Options   #
13657944Seric###############
13757944Seric
13859887Seric# strip message body to 7 bits on input?
13964033SericO7`'confSEVEN_BIT_INPUT
14057944Seric
14167550Seric# 8-bit data handling
14267550SericO8`'confEIGHT_BIT_HANDLING
14367550Seric
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
25967810Seric# should we not prune routes in route-addr syntax addresses?
26067810SericOR`'confDONT_PRUNE_ROUTES
26167810Seric
26257944Seric# queue up everything before forking?
26364033SericOs`'confSAFE_QUEUE
26457944Seric
26557944Seric# status file
26664033SericOS`'ifdef(`STATUS_FILE', STATUS_FILE, /etc/sendmail.st)
26757944Seric
26857944Seric# default message timeout interval
26964033SericOT`'confMESSAGE_TIMEOUT
27057944Seric
27157944Seric# time zone handling:
27257944Seric#  if undefined, use system default
27357944Seric#  if defined but null, use TZ envariable passed in
27457944Seric#  if defined and non-null, use that info
27557944Sericifelse(confTIME_ZONE, `USE_SYSTEM', `#Ot',
27664341Seric	confTIME_ZONE, `USE_TZ', `Ot',
27764033Seric	`Ot`'confTIME_ZONE')
27857944Seric
27957944Seric# default UID
28064033SericOu`'confDEF_USER_ID
28157944Seric
28251887Seric# list of locations of user database file (null means no lookup)
28358720SericOU`'ifdef(`confUSERDB_SPEC', `confUSERDB_SPEC')
28451222Seric
28558860Seric# fallback MX host
28658860Sericifdef(`confFALLBACK_MX',
28764033Seric	OV`'confFALLBACK_MX,
28858860Seric	#OVfall.back.host.net)
28958860Seric
29063858Seric# if we are the best MX host for a site, try it directly instead of config err
29164033SericOw`'confTRY_NULL_MX_LIST
29263858Seric
29357944Seric# load average at which we just queue messages
29464033SericOx`'confQUEUE_LA
29557944Seric
29657944Seric# load average at which we refuse connections
29764033SericOX`'confREFUSE_LA
29857944Seric
29957944Seric# work recipient factor
30057944Sericifdef(`confWORK_RECIPIENT_FACTOR',
30164033Seric	Oy`'confWORK_RECIPIENT_FACTOR,
30257944Seric	#Oy30000)
30357944Seric
30457944Seric# deliver each queued job in a separate process?
30564033SericOY`'confSEPARATE_PROC
30657944Seric
30757944Seric# work class factor
30857944Sericifdef(`confWORK_CLASS_FACTOR',
30964033Seric	Oz`'confWORK_CLASS_FACTOR,
31057944Seric	#Oz1800)
31157944Seric
31257944Seric# work time factor
31357944Sericifdef(`confWORK_TIME_FACTOR',
31464033Seric	OZ`'confWORK_TIME_FACTOR,
31557944Seric	#OZ90000)
31657944Seric
31767697Seric# do our SMTP peers choke on multi-line greeting messages?
31867697SericO BrokenSmtpPeers=confBROKEN_SMTP_PEERS
31967697Seric
32067697Seric# shall we sort the queue by hostname first?
32167697SericO SortQueueByHost=confSORT_QUEUE_BY_HOST
32267697Seric
32357944Seric###########################
32457944Seric#   Message precedences   #
32557944Seric###########################
32657944Seric
32757944SericPfirst-class=0
32857944SericPspecial-delivery=100
32958070SericPlist=-30
33057944SericPbulk=-60
33157944SericPjunk=-100
33257944Seric
33357944Seric#####################
33457944Seric#   Trusted users   #
33557944Seric#####################
33657944Seric
33757944SericTroot
33857944SericTdaemon
33957944SericTuucp
34057944Seric
34157944Seric#########################
34257944Seric#   Format of headers   #
34357944Seric#########################
34457944Seric
34558679SericH?P?Return-Path: $g
34667819SericHReceived: confRECEIVED_HEADER
34757944SericH?D?Resent-Date: $a
34857944SericH?D?Date: $a
34957944SericH?F?Resent-From: $q
35057944SericH?F?From: $q
35157944SericH?x?Full-Name: $x
35257944SericHSubject:
35357944Seric# HPosted-Date: $a
35457944Seric# H?l?Received-Date: $b
35557944SericH?M?Resent-Message-Id: <$t.$i@$j>
35657944SericH?M?Message-Id: <$t.$i@$j>
35751222Seric#
35851222Seric######################################################################
35951222Seric######################################################################
36051222Seric#####
36151222Seric#####			REWRITING RULES
36251222Seric#####
36351222Seric######################################################################
36451222Seric######################################################################
36551222Seric
36658678Sericundivert(9)dnl
36751222Seric
36851222Seric###########################################
36951222Seric###  Rulset 3 -- Name Canonicalization  ###
37051222Seric###########################################
37151260SericS3
37251222Seric
37364802Seric# handle null input (translate to <@> special case)
37458499SericR$@			$@ <@>
37558174Seric
37651222Seric# basic textual canonicalization -- note RFC733 heuristic here
37764144SericR$*<$*>$*<$*>$*		$2$3<$4>$5			strip multiple <> <>
37858158SericR$*<$*<$+>$*>$*		<$3>$5				2-level <> nesting
37958499SericR$*<>$*			$@ <@>				MAIL FROM:<> case
38051222SericR$*<$+>$*		$2				basic RFC821/822 parsing
38151222Seric
38264802Seric# handle list:; syntax as special case
38364802SericR$*:;$*			$@ $1 :; <@>
38464802Seric
38551222Seric# make sure <@a,@b,@c:user@d> syntax is easy to parse -- undone later
38655416SericR@ $+ , $+		@ $1 : $2			change all "," to ":"
38751222Seric
38851222Seric# localize and dispose of route-based addresses
38967469SericR@ $+ : $+		$@ $>96 < @$1 > : $2		handle <route-addr>
39051222Seric
39151222Seric# find focus for list syntax
39267469SericR $+ : $* ; @ $+	$@ $>96 $1 : $2 ; < @ $3 >	list syntax
39355416SericR $+ : $* ;		$@ $1 : $2;			list syntax
39451222Seric
39551222Seric# find focus for @ syntax addresses
39655416SericR$+ @ $+		$: $1 < @ $2 >			focus on domain
39755416SericR$+ < $+ @ $+ >		$1 $2 < @ $3 >			move gaze right
39867469SericR$+ < @ $+ >		$@ $>96 $1 < @ $2 >		already canonical
39951222Seric
40064968Seric# do some sanity checking
40164968SericR$* < @ $* : $* > $*	$1 < @ $2 $3 > $4		nix colons in addrs
40264968Seric
40358288Sericifdef(`_NO_UUCP_', `dnl',
40458288Seric`# convert old-style addresses to a domain-based address
40567469SericR$- ! $+		$@ $>96 $2 < @ $1 .UUCP >	resolve uucp names
40667469SericR$+ . $- ! $+		$@ $>96 $3 < @ $1 . $2 >		domain uucps
40767469SericR$+ ! $+		$@ $>96 $2 < @ $1 .UUCP >	uucp subdomains')
40851222Seric
40951222Seric# if we have % signs, take the rightmost one
41055416SericR$* % $*		$1 @ $2				First make them all @s.
41155416SericR$* @ $* @ $*		$1 % $2 @ $3			Undo all but the last.
41267469SericR$* @ $*		$@ $>96 $1 < @ $2 >		Insert < > and finish
41351222Seric
41451222Seric# else we must be a local name
41551222Seric
41651222Seric
41760894Seric################################################
41867469Seric###  Ruleset 96 -- bottom half of ruleset 3  ###
41960894Seric################################################
42051222Seric
42157245Seric#  At this point, everything should be in a "local_part<@domain>extra" format.
42267469SericS96
42351222Seric
42451222Seric# handle special cases for local names
42560262SericR$* < @ localhost > $*		$: $1 < @ $j . > $2		no domain at all
42660262SericR$* < @ localhost . $m > $*	$: $1 < @ $j . > $2		local domain
42760262Sericifdef(`_NO_UUCP_', `dnl',
42860262Seric`R$* < @ localhost . UUCP > $*	$: $1 < @ $j . > $2		.UUCP domain')
42965825SericR$* < @ [ $+ ] > $*		$: $1 < @@ [ $2 ] > $3		mark [a.b.c.d]
43065825SericR$* < @@ $=w > $*		$: $1 < @ $j . > $3		self-literal
43166306SericR$* < @@ $+ > $*		$@ $1 < @ $2 > $3		canon IP addr
43263754Sericifdef(`DOMAIN_TABLE', `
43367450Seric# look up domains in the domain table
43467450SericR$* < @ $+ > $*			$: $1 < @ $(domaintable $2 $) > $3',
43563754Seric`dnl')
43651889Sericundivert(2)dnl
43751222Seric
43859081Sericifdef(`_NO_UUCP_', `dnl',
43959081Seric`ifdef(`UUCP_RELAY',
44051274Seric`# pass UUCP addresses straight through
44164971SericR$* < @ $+ . UUCP > $*		$@ $1 < @ $2 . UUCP . > $3',
44251274Seric`# if really UUCP, handle it immediately
44351322Sericifdef(`_CLASS_U_',
44464971Seric`R$* < @ $=U . UUCP > $*	$@ $1 < @ $2 . UUCP . > $3', `dnl')
44551322Sericifdef(`_CLASS_V_',
44664971Seric`R$* < @ $=V . UUCP > $*	$@ $1 < @ $2 . UUCP . > $3', `dnl')
44751322Sericifdef(`_CLASS_W_',
44864971Seric`R$* < @ $=W . UUCP > $*	$@ $1 < @ $2 . UUCP . > $3', `dnl')
44951322Sericifdef(`_CLASS_X_',
45064971Seric`R$* < @ $=X . UUCP > $*	$@ $1 < @ $2 . UUCP . > $3', `dnl')
45151322Sericifdef(`_CLASS_Y_',
45264971Seric`R$* < @ $=Y . UUCP > $*	$@ $1 < @ $2 . UUCP . > $3', `dnl')
45351267Seric
45451267Seric# try UUCP traffic as a local address
45564971SericR$* < @ $+ . UUCP > $*		$: $1 < @ $[ $2 $] . UUCP . > $3
45667469SericR$* < @ $+ . . UUCP . > $*		$@ $1 < @ $2 . > $3')
45759081Seric')
45865061Sericifdef(`_NO_CANONIFY_', `dnl',
45959081Seric`# pass to name server to make hostname canonical
46061470SericR$* < @ $* $~P > $*		$: $1 < @ $[ $2 $3 $] > $4')
46161470Seric
46265061Seric# local host aliases and pseudo-domains are always canonical
46365061SericR$* < @ $=w > $*		$: $1 < @ $2 . > $3
46464971SericR$* < @ $* $=P > $*		$: $1 < @ $2 $3 . > $4
46565061SericR$* < @ $* . . > $*		$1 < @ $2 . > $3
46664971Seric
46751322Seric# if this is the local hostname, make sure we treat is as canonical
46851322SericR$* < @ $j > $*			$: $1 < @ $j . > $2
46951222Seric
47051322Seric
47151222Seric##################################################
47251222Seric###  Ruleset 4 -- Final Output Post-rewriting  ###
47351222Seric##################################################
47451222SericS4
47551222Seric
47658499SericR$*<@>			$@ $1				handle <> and list:;
47751222Seric
47851322Seric# strip trailing dot off possibly canonical name
47951322SericR$* < @ $+ . > $*	$1 < @ $2 > $3
48051322Seric
48151222Seric# externalize local domain info
48251322SericR$* < $+ > $*		$1 $2 $3			defocus
48351322SericR@ $+ : @ $+ : $+	@ $1 , @ $2 : $3		<route-addr> canonical
48451997SericR@ $*			$@ @ $1				... and exit
48551222Seric
48658288Sericifdef(`_NO_UUCP_', `dnl',
48758288Seric`# UUCP must always be presented in old form
48858288SericR$+ @ $- . UUCP		$2!$1				u@h.UUCP => h!u')
48951222Seric
49051222Seric# delete duplicate local names
49151322SericR$+ % $=w @ $=w		$1 @ $j				u%host@host => u@host
49251222Seric
49351222Seric
49451222Seric
49560894Seric##############################################################
49667469Seric###   Ruleset 97 -- recanonicalize and call ruleset zero   ###
49760894Seric###		   (used for recursive calls)		   ###
49860894Seric##############################################################
49951222Seric
50067469SericS`'97
50151222SericR$*			$: $>3 $1
50251222SericR$*			$@ $>0 $1
50351222Seric
50451222Seric
50551222Seric######################################
50651222Seric###   Ruleset 0 -- Parse Address   ###
50751222Seric######################################
50851222Seric
50951222SericS0
51051222Seric
51167118SericR<@>			$#_LOCAL_ $: <@>		special case error msgs
51266035SericR$* : $* ;		$#error $@ USAGE $: "list:; syntax illegal for recipient addresses"
51365048SericR<@ $+>			$#error $@ USAGE $: "user address required"
51467118SericR$* <$* : $* > $*	$#error $@ USAGE $: "colon illegal in host name part"
51567132SericR$* < @ . > $*		$#error $@ USAGE $: "invalid host name"
51658340Seric
51755416Sericifdef(`_MAILER_smtp_',
51855416Seric`# handle numeric address spec
51967469SericR$* < @ [ $+ ] > $*	$: $>98 $1 < @ [ $2 ] > $3	numeric internet spec
52065191SericR$* < @ [ $+ ] > $*	$#_SMTP_ $@ [$2] $: $1 < @ [$2] > $3	still numeric: send',
52163858Seric	`dnl')
52251222Seric
52351887Seric# now delete the local info -- note $=O to find characters that cause forwarding
52467469SericR$* < @ > $*		$@ $>97 $1		user@ => user
52567469SericR< @ $=w . > : $*	$@ $>97 $2		@here:... -> ...
52667469SericR$* $=O $* < @ $=w . >	$@ $>97 $1 $2 $3		...@here -> ...
52763967Seric
52863967Seric# handle local hacks
52967469SericR$*			$: $>98 $1
53066048Seric
53166048Seric# short circuit local delivery so forwarded email works
532*67914Sericifdef(`_STICKY_LOCAL_DOMAIN_',
533*67914Seric`R$+ < @ $=w . >		$: < $H > $1 < @ $2 . >		first try hub
534*67914SericR< $+ > $+ < $+ >	$#_LOCAL_ $: $2			yep ....
535*67914SericR< > $=D . $+ < $+ >	$#_LOCAL_ $: $1 . $2		dotted name?
536*67914SericR< > $+ < $+ >		$#_LOCAL_ $: @ $1			nope, local address',
53766048Seric`R$=L < @ $=w . >		$#_LOCAL_ $: @ $1			special local names
538*67914SericR$+ < @ $=w . >		$#_LOCAL_ $: $1			dispose directly')
53966090Sericifdef(`MAILER_TABLE',
54066090Seric`
54166090Seric# not local -- try mailer table lookup
54266090SericR$* <@ $+ > $*		$: < $2 > $1 < @ $2 > $3	extract host name
54366090SericR< $+ . > $*		$: < $1 > $2			strip trailing dot
54466090SericR< $+ > $*		$: < $(mailertable $1 $) > $2	lookup
54566090SericR< $- : $+ > $*		$# $1 $@ $2 $: $3		check -- resolved?
54666090SericR< $+ > $*		$: $>90 <$1> $2			try domain',
54766090Seric`dnl')
54851260Sericundivert(4)dnl
54951260Seric
55061468Sericifdef(`_NO_UUCP_', `dnl',
55161468Seric`# resolve remotely connected UUCP links (if any)
55251285Sericifdef(`_CLASS_V_',
55367469Seric`R$* < @ $=V . UUCP . > $*		$: $>95 < $V > $1 <@$2.UUCP.> $3',
55452044Seric	`dnl')
55551285Sericifdef(`_CLASS_W_',
55667469Seric`R$* < @ $=W . UUCP . > $*		$: $>95 < $W > $1 <@$2.UUCP.> $3',
55752044Seric	`dnl')
55851285Sericifdef(`_CLASS_X_',
55967469Seric`R$* < @ $=X . UUCP . > $*		$: $>95 < $X > $1 <@$2.UUCP.> $3',
56061468Seric	`dnl')')
56151260Seric
56251222Seric# resolve fake top level domains by forwarding to other hosts
56351222Sericifdef(`BITNET_RELAY',
56467469Seric`R$*<@$+.BITNET.>$*	$: $>95 < $B > $1 <@$2.BITNET.> $3	user@host.BITNET',
56551222Seric	`dnl')
56665149Sericifdef(`_MAILER_pop_',
56765149Seric`R$+ < @ POP. >		$#pop $: $1			user@POP',
56865149Seric	`dnl')
56958364Sericifdef(`_MAILER_fax_',
57064971Seric`R$+ < @ $+ .FAX. >	$#fax $@ $2 $: $1		user@host.FAX',
57158364Seric`ifdef(`FAX_RELAY',
57267469Seric`R$*<@$+.FAX.>$*		$: $>95 < $F > $1 <@$2.FAX.> $3	user@host.FAX',
57358364Seric	`dnl')')
57451222Seric
57551260Sericifdef(`UUCP_RELAY',
57651260Seric`# forward non-local UUCP traffic to our UUCP relay
57767469SericR$*<@$*.UUCP.>$*		$: $>95 < $Y > $1 <@$2.UUCP.> $3	uucp mail',
57855416Seric`ifdef(`_MAILER_uucp_',
57951260Seric`# forward other UUCP traffic straight to UUCP
58065557SericR$* < @ $+ .UUCP. > $*		$#uucp $@ $2 $: $1 < @ $2 .UUCP. > $3	user@host.UUCP',
58151260Seric	`dnl')')
58263967Sericifdef(`_MAILER_usenet_', `
58363754Seric# addresses sent to net.group.USENET will get forwarded to a newsgroup
58465851SericR$+ . USENET		$#usenet $: $1',
58563860Seric	`dnl')
58663754Seric
58758070Sericifdef(`_LOCAL_RULES_',
58858070Seric`# figure out what should stay in our local mail system
58963754Sericundivert(1)', `dnl')
59063754Seric
59164321Seric# pass names that still have a host to a smarthost (if defined)
59267469SericR$* < @ $* > $*		$: $>95 < $S > $1 < @ $2 > $3	glue on smarthost name
59363754Seric
59464321Seric# deal with other remote names
59563946Sericifdef(`_MAILER_smtp_',
59663973Seric`R$* < @$* > $*		$#_SMTP_ $@ $2 $: $1 < @ $2 > $3		user@host.domain',
59764321Seric`R$* < @$* > $*		$#error $@NOHOST $: Unrecognized host name $2')
59851222Seric
59967469Seric# if this is quoted, strip the quotes and try again
60058811SericR$+			$: $(dequote $1 $)		strip quotes
60167469SericR$+ $=O $+		$@ $>97 $1 $2 $3			try again
60258811Seric
60358811Seric# handle locally delivered names
60463998SericR$=L			$#_LOCAL_ $: @ $1			special local names
60563998SericR$+			$#_LOCAL_ $: $1			regular local names
60651222Seric
60755416Seric###########################################################################
60855416Seric###   Ruleset 5 -- special rewriting after aliases have been expanded   ###
60955416Seric###		   (new sendmail only)					###
61055416Seric###########################################################################
61151222Seric
61251322SericS5
61351322Seric
61467538Seric# if we have a "special dotted user", convert it back to the base name
61567538SericR$=D . *		$#_LOCAL_ $: $1
61667538SericR$=D . $+		$#_LOCAL_ $: $1 . *
61767538Seric
618*67914Seric# prepend an empty "forward host" on the front
619*67914SericR$+			$: <> $1
620*67914Seric
621*67914Sericifdef(`LUSER_RELAY',
622*67914Seric`# send unrecognized local users to a relay host
623*67914SericR< > $+			$: < $L > $( user $1 $)		look up user
624*67914SericR< $* > $+ <>		$: <> $2			found; strip $L')
625*67914Seric
62658808Seric# see if we have a relay or a hub
627*67914SericR< > $+			$: < $R > $1			try relay
62866048SericR< > $+			$: < $H > $1			try hub
62966048SericR< > $+			$@ $1				nope, give up
63067469SericR< $- : $+ > $+		$: $>95 < $1 : $2 > $3 < @ $2 >
63167469SericR< $+ > $+		$@ $>95 < $1 > $2 < @ $1 >
63260540Sericifdef(`MAILER_TABLE',
63360540Seric`
63460540Seric
63563858Seric###################################################################
63663858Seric###  Ruleset 90 -- try domain part of mailertable entry 	###
63763858Seric###		   (new sendmail only)				###
63863858Seric###################################################################
63960540Seric
64060540SericS90
64166091SericR$* <$- . $+ > $*	$: $1$2 < $(mailertable .$3 $@ $1$2 $@ $2 $) > $4
64266081SericR$* <$- : $+ > $*	$# $2 $@ $3 $: $4		check -- resolved?
64366081SericR$* < . $+ > $*		$@ $>90 $1 . <$2> $3		no -- strip & try again
64466094SericR$* < $* > $*		$: < $(mailertable . $@ $1$2 $) > $3	try "."
64566090SericR<$- : $+ > $*		$# $1 $@ $2 $: $3		"." found?
64666090SericR< $* > $*		$@ $2				no mailertable match',
64760540Seric`dnl')
64863858Seric
64963858Seric###################################################################
65067469Seric###  Ruleset 95 -- canonify mailer:host syntax to triple	###
65164010Seric###################################################################
65264010Seric
65367469SericS95
65464010SericR< > $*			$@ $1				strip off null relay
65564010SericR< $- : $+ > $*		$# $1 $@ $2 $: $3		try qualified mailer
65664010SericR< $=w > $*		$@ $2				delete local host
65764010SericR< $+ > $*		$#_RELAY_ $@ $1 $: $2		use unqualified mailer
65864010Seric
65964010Seric###################################################################
66067469Seric###  Ruleset 98 -- local part of ruleset zero (can be null)	###
66163858Seric###################################################################
66263858Seric
66367469SericS98
66463858Sericundivert(3)dnl
66551222Seric#
66651222Seric######################################################################
66751222Seric######################################################################
66851222Seric#####
66956790Seric`#####			MAILER DEFINITIONS'
67051222Seric#####
67151222Seric######################################################################
67251222Seric######################################################################
67351222Sericundivert(7)dnl
674