xref: /csrg-svn/usr.sbin/sendmail/cf/m4/proto.m4 (revision 60540)
151222Sericdivert(-1)
251222Seric#
351222Seric# Copyright (c) 1983 Eric P. Allman
451222Seric# Copyright (c) 1988 The Regents of the University of California.
551222Seric# All rights reserved.
651222Seric#
751222Seric# %sccs.include.redist.sh%
851222Seric#
951222Sericdivert(0)
1051222Seric
11*60540SericVERSIONID(`@(#)proto.m4	6.41 (Berkeley) 05/28/93')
1251222Seric
1351322SericMAILER(local)dnl
1451222Seric
1552646Sericifdef(`_OLD_SENDMAIL_', `dnl',
1658119Seric`# level 4 config file format
1758119SericV4')
1852646Seric
1951222Seric##################
2051222Seric#   local info   #
2151222Seric##################
2251222Seric
2360212SericCP.
2460212Seric
2551889SericCwlocalhost
2651887Sericifdef(`USE_CW_FILE',
2751889Seric`# file containing names of hosts for which we receive email
2858406SericCONCAT(`Fw', confCW_FILE)', `dnl')
2951222Seric
3051222Sericifdef(`UUCP_RELAY',
3151222Seric`# UUCP relay host
3251281SericCONCAT(DY, UUCP_RELAY)
3360212SericCPUUCP
3457944Seric
3551222Seric')dnl
3651222Sericifdef(`BITNET_RELAY',
3751222Seric`#  BITNET relay host
3851222SericCONCAT(DB, BITNET_RELAY)
3960212SericCPBITNET
4057944Seric
4151222Seric')dnl
4251222Sericifdef(`CSNET_RELAY',
4351222Seric`# CSNET relay host
4451222SericCONCAT(DC, CSNET_RELAY)
4560212SericCPCSNET
4657944Seric
4751222Seric')dnl
4858364Sericifdef(`FAX_RELAY',
4958364Seric`# FAX relay host
5058364SericCONCAT(DF, FAX_RELAY)
5160212SericCPFAX
5258364Seric
5358364Seric')dnl
5458070Sericifdef(`SMART_HOST',
5558070Seric`# "Smart" UUCP relay host
5658070SericCONCAT(DS, SMART_HOST)
5751222Seric
5858070Seric')dnl
5958781Sericifdef(`MAILER_TABLE',
6058781Seric`# Mailer table (overriding domains)
6158781SericKmailertable MAILER_TABLE
6258781Seric
6358781Seric')dnl
6451222Seric# who I send unqualified names to (null means deliver locally)
6551222SericCONCAT(DR, ifdef(`LOCAL_RELAY', LOCAL_RELAY))
6651222Seric
6757527Seric# who gets all local email traffic ($R has precedence for unqualified names)
6857527SericCONCAT(DH, ifdef(`MAIL_HUB', MAIL_HUB))
6957527Seric
7058070Seric# my official hostname ($w or $w.$D)
7158070SericCONCAT(Dj$w, ifdef(`NEED_DOMAIN', .$D))
7258070Seric
7358070Seric# who I masquerade as (can be $j)
7458070SericCONCAT(DM, ifdef(`MASQUERADE_NAME', MASQUERADE_NAME, $j))
7558070Seric
7657245Seric# class L: names that should be delivered locally, even if we have a relay
7757245Seric# class E: names that should be exposed as from this host, even if we masquerade
7851279SericCLroot
7957245SericCEroot
8051279Sericundivert(5)dnl
8151279Seric
8251222Seric# operators that cannot be in local usernames (i.e., network indicators)
8358288SericCO @ % ifdef(`_NO_UUCP_', `', `!')
8451222Seric
8551322Seric# a class with just dot (for identifying canonical names)
8651322SericC..
8751322Seric
8858808Sericifdef(`_OLD_SENDMAIL_', `dnl',
8958808Seric`# dequoting map
9058808SericKdequote dequote')
9157944Seric
9259033Sericundivert(6)dnl
9359033Seric
9457944Seric######################
9557944Seric#   Special macros   #
9657944Seric######################
9757944Seric
9857944Seric# SMTP initial login message
9957944SericCONCAT(De, confSMTP_LOGIN_MSG)
10057944Seric
10157944Seric# UNIX initial From header format
10257944SericCONCAT(Dl, confFROM_LINE)
10357944Seric
10457944Seric# my name for error messages
10557944SericCONCAT(Dn, confMAILER_NAME)
10657944Seric
10757944Seric# delimiter (operator) characters
10857944SericCONCAT(Do, confOPERATORS)
10957944Seric
11057944Seric# format of a total name
11157944SericCONCAT(Dq, ifdef(`confFROM_HEADER', confFROM_HEADER,
11257944Seric	ifdef(`_OLD_SENDMAIL_', `$g$?x ($x)$.', `$?x$x <$g>$|$g$.')))
11357944Sericinclude(`../m4/version.m4')
11457944Seric
11557944Seric###############
11657944Seric#   Options   #
11757944Seric###############
11857944Seric
11959887Seric# strip message body to 7 bits on input?
12059887SericCONCAT(O7, confSEVEN_BIT_INPUT)
12157944Seric
12257944Seric# wait (in minutes) for alias file rebuild
12357944SericCONCAT(Oa, confALIAS_WAIT)
12457944Seric
12557944Seric# location of alias file
12657944SericCONCAT(OA, ifdef(`ALIAS_FILE', ALIAS_FILE, /etc/aliases))
12757944Seric
12858084Seric# minimum number of free blocks on filesystem
12958084SericCONCAT(Ob, confMIN_FREE_BLOCKS)
13058084Seric
13157944Seric# substitution for space (blank) characters
13257944SericCONCAT(OB, confBLANK_SUB)
13357944Seric
13457944Seric# connect to "expensive" mailers on initial submission?
13557944SericCONCAT(Oc, confCON_EXPENSIVE)
13657944Seric
13757944Seric# checkpoint queue runs after every N successful deliveries
13857944SericCONCAT(OC, confCHECKPOINT_INTERVAL)
13957944Seric
14057944Seric# default delivery mode
14157944SericCONCAT(Od, confDELIVERY_MODE)
14257944Seric
14357944Seric# automatically rebuild the alias database?
14457944SericCONCAT(OD, confAUTO_REBUILD)
14557944Seric
14657944Seric# error message header/file */
14757944Sericifdef(`confERROR_MESSAGE',
14857944Seric	concat(OE, confERROR_MESSAGE),
14957944Seric	#OE/etc/sendmail.oE)
15057944Seric
15157944Seric# error mode
15257944Sericifdef(`confERROR_MODE',
15357944Seric	concat(Oe, confERROR_MODE),
15457944Seric	#Oep)
15557944Seric
15657944Seric# save Unix-style "From_" lines at top of header?
15757944SericCONCAT(Of, confSAVE_FROM_LINES)
15857944Seric
15957944Seric# temporary file mode
16057944SericCONCAT(OF, confTEMP_FILE_MODE)
16157944Seric
16257944Seric# match recipients against GECOS field?
16357944SericCONCAT(OG, confMATCH_GECOS)
16457944Seric
16557944Seric# default GID
16657944SericCONCAT(Og, confDEF_GROUP_ID)
16757944Seric
16857944Seric# maximum hop count
16957944SericCONCAT(Oh, confMAX_HOP)
17057944Seric
17157944Seric# location of help file
17257944SericCONCAT(OH, ifdef(`HELP_FILE', HELP_FILE, /usr/lib/sendmail.hf))
17357944Seric
17457944Seric# ignore dots as terminators in incoming messages?
17557944SericCONCAT(Oi, confIGNORE_DOTS)
17657944Seric
17757944Seric# Insist that the BIND name server be running to resolve names
17857944Sericifdef(`confBIND_OPTS',
17957944Seric	CONCAT(OI, confBIND_OPTS),
18057944Seric	#OI)
18157944Seric
18259887Seric# deliver MIME-encapsulated error messages?
18359887SericCONCAT(Oj, confMIME_FORMAT_ERRORS)
18459887Seric
18557944Seric# Forward file search path
18657944Sericifdef(`confFORWARD_PATH',
18757944Seric	CONCAT(OJ, confFORWARD_PATH),
18857944Seric	#OJ/var/forward/$u:$z/.forward.$w:$z/.forward)
18957944Seric
19057944Seric# open connection cache size
19157944SericCONCAT(Ok, confMCI_CACHE_SIZE)
19257944Seric
19357944Seric# open connection cache timeout
19457944SericCONCAT(OK, confMCI_CACHE_TIMEOUT)
19557944Seric
19657944Seric# log level
19757944SericCONCAT(OL, confLOG_LEVEL)
19857944Seric
19957944Seric# send to me too, even in an alias expansion?
20057944SericCONCAT(Om, confME_TOO)
20157944Seric
20257944Seric# verify RHS in newaliases?
20357944SericCONCAT(On, confCHECK_ALIASES)
20457944Seric
20557944Seric# default messages to old style headers if no special punctuation?
20657944SericCONCAT(Oo, confOLD_STYLE_HEADERS)
20757944Seric
20858860Seric# SMTP daemon options
20958860Sericifdef(`confDAEMON_OPTIONS',
21058860Seric	CONCAT(OO, confDAEMON_OPTIONS),
21158860Seric	#OOPort=esmtp)
21258860Seric
21358084Seric# privacy flags
21458084SericCONCAT(Op, confPRIVACY_FLAGS)
21558084Seric
21657944Seric# who (if anyone) should get extra copies of error messages
21757944Sericifdef(`confCOPY_ERRORS_TO',
21857944Seric	CONCAT(OP, confCOPY_ERRORS_TO),
21957944Seric	#OPPostmaster)
22057944Seric
22157944Seric# slope of queue-only function
22257944Sericifdef(`confQUEUE_FACTOR',
22357944Seric	CONCAT(Oq, confQUEUE_FACTOR),
22457944Seric	#Oq600000)
22557944Seric
22657944Seric# queue directory
22757944SericCONCAT(OQ, ifdef(`QUEUE_DIR', QUEUE_DIR, /var/spool/mqueue))
22857944Seric
22957944Seric# read timeout -- now OK per RFC 1123 section 5.3.2
23058119Sericifdef(`confREAD_TIMEOUT',
23158119Seric	CONCAT(Or, confREAD_TIMEOUT),
23258119Seric	#Ordatablock=10m)
23357944Seric
23457944Seric# queue up everything before forking?
23557944SericCONCAT(Os, confSAFE_QUEUE)
23657944Seric
23757944Seric# status file
23857944SericCONCAT(OS, ifdef(`STATUS_FILE', STATUS_FILE, /etc/sendmail.st))
23957944Seric
24057944Seric# default message timeout interval
24157944SericCONCAT(OT, confMESSAGE_TIMEOUT)
24257944Seric
24357944Seric# time zone handling:
24457944Seric#  if undefined, use system default
24557944Seric#  if defined but null, use TZ envariable passed in
24657944Seric#  if defined and non-null, use that info
24757944Sericifelse(confTIME_ZONE, `USE_SYSTEM', `#Ot',
24857944Seric	confTIME_ZONE, `USE_TZ', `',
24957944Seric	`CONCAT(Ot, confTIME_ZONE)')
25057944Seric
25157944Seric# default UID
25257944SericCONCAT(Ou, confDEF_USER_ID)
25357944Seric
25451887Seric# list of locations of user database file (null means no lookup)
25558720SericOU`'ifdef(`confUSERDB_SPEC', `confUSERDB_SPEC')
25651222Seric
25758860Seric# fallback MX host
25858860Sericifdef(`confFALLBACK_MX',
25958860Seric	CONCAT(OV, confFALLBACK_MX),
26058860Seric	#OVfall.back.host.net)
26158860Seric
26257944Seric# load average at which we just queue messages
26357944SericCONCAT(Ox, confQUEUE_LA)
26457944Seric
26557944Seric# load average at which we refuse connections
26657944SericCONCAT(OX, confREFUSE_LA)
26757944Seric
26857944Seric# work recipient factor
26957944Sericifdef(`confWORK_RECIPIENT_FACTOR',
27057944Seric	CONCAT(Oy, confWORK_RECIPIENT_FACTOR),
27157944Seric	#Oy30000)
27257944Seric
27357944Seric# deliver each queued job in a separate process?
27457944SericCONCAT(OY, confSEPARATE_PROC)
27557944Seric
27657944Seric# work class factor
27757944Sericifdef(`confWORK_CLASS_FACTOR',
27857944Seric	CONCAT(Oz, confWORK_CLASS_FACTOR),
27957944Seric	#Oz1800)
28057944Seric
28157944Seric# work time factor
28257944Sericifdef(`confWORK_TIME_FACTOR',
28357944Seric	CONCAT(OZ, confWORK_TIME_FACTOR),
28457944Seric	#OZ90000)
28557944Seric
28657944Seric###########################
28757944Seric#   Message precedences   #
28857944Seric###########################
28957944Seric
29057944SericPfirst-class=0
29157944SericPspecial-delivery=100
29258070SericPlist=-30
29357944SericPbulk=-60
29457944SericPjunk=-100
29557944Seric
29657944Seric#####################
29757944Seric#   Trusted users   #
29857944Seric#####################
29957944Seric
30057944SericTroot
30157944SericTdaemon
30257944SericTuucp
30357944Seric
30457944Seric#########################
30557944Seric#   Format of headers   #
30657944Seric#########################
30757944Seric
30858679SericH?P?Return-Path: $g
30958959SericHReceived: $?sfrom $s $.$?_($_) $.by $j ($v/$Z) id $i; $b
31057944SericH?D?Resent-Date: $a
31157944SericH?D?Date: $a
31257944SericH?F?Resent-From: $q
31357944SericH?F?From: $q
31457944SericH?x?Full-Name: $x
31557944SericHSubject:
31657944Seric# HPosted-Date: $a
31757944Seric# H?l?Received-Date: $b
31857944SericH?M?Resent-Message-Id: <$t.$i@$j>
31957944SericH?M?Message-Id: <$t.$i@$j>
32051222Seric#
32151222Seric######################################################################
32251222Seric######################################################################
32351222Seric#####
32451222Seric#####			REWRITING RULES
32551222Seric#####
32651222Seric######################################################################
32751222Seric######################################################################
32851222Seric
32958678Sericundivert(9)dnl
33051222Seric
33151222Seric###########################################
33251222Seric###  Rulset 3 -- Name Canonicalization  ###
33351222Seric###########################################
33451260SericS3
33551222Seric
33658499Seric# handle null input and list syntax (translate to <@> special case)
33758499SericR$@			$@ <@>
33858707SericR$*:;$*			$@ $1 :; <@>
33958174Seric
34051222Seric# basic textual canonicalization -- note RFC733 heuristic here
34157012SericR$*<$*>$*<$*>$*		<$2>$3$4$5			strip multiple <> <>
34258158SericR$*<$*<$+>$*>$*		<$3>$5				2-level <> nesting
34358499SericR$*<>$*			$@ <@>				MAIL FROM:<> case
34451222SericR$*<$+>$*		$2				basic RFC821/822 parsing
34551222Seric
34651222Seric# make sure <@a,@b,@c:user@d> syntax is easy to parse -- undone later
34755416SericR@ $+ , $+		@ $1 : $2			change all "," to ":"
34851222Seric
34951222Seric# localize and dispose of route-based addresses
35055416SericR@ $+ : $+		$@ $>6 < @$1 > : $2		handle <route-addr>
35151222Seric
35251222Seric# find focus for list syntax
35355416SericR $+ : $* ; @ $+	$@ $>6 $1 : $2 ; < @ $3 >	list syntax
35455416SericR $+ : $* ;		$@ $1 : $2;			list syntax
35551222Seric
35651222Seric# find focus for @ syntax addresses
35755416SericR$+ @ $+		$: $1 < @ $2 >			focus on domain
35855416SericR$+ < $+ @ $+ >		$1 $2 < @ $3 >			move gaze right
35955416SericR$+ < @ $+ >		$@ $>6 $1 < @ $2 >		already canonical
36051222Seric
36158288Sericifdef(`_NO_UUCP_', `dnl',
36258288Seric`# convert old-style addresses to a domain-based address
36355416SericR$- ! $+		$@ $>6 $2 < @ $1 .UUCP >	resolve uucp names
36455416SericR$+ . $- ! $+		$@ $>6 $3 < @ $1 . $2 >		domain uucps
36558288SericR$+ ! $+		$@ $>6 $2 < @ $1 .UUCP >	uucp subdomains')
36651222Seric
36751222Seric# if we have % signs, take the rightmost one
36855416SericR$* % $*		$1 @ $2				First make them all @s.
36955416SericR$* @ $* @ $*		$1 % $2 @ $3			Undo all but the last.
37055416SericR$* @ $*		$@ $>6 $1 < @ $2 >		Insert < > and finish
37151222Seric
37251222Seric# else we must be a local name
37351222Seric
37451222Seric
37551222Seric###############################################
37651222Seric###  Ruleset 6 -- bottom half of ruleset 3  ###
37751222Seric###############################################
37851222Seric
37957245Seric#  At this point, everything should be in a "local_part<@domain>extra" format.
38051222SericS6
38151222Seric
38251222Seric# handle special cases for local names
38360262SericR$* < @ localhost > $*		$: $1 < @ $j . > $2		no domain at all
38460262SericR$* < @ localhost . $m > $*	$: $1 < @ $j . > $2		local domain
38560262Sericifdef(`_NO_UUCP_', `dnl',
38660262Seric`R$* < @ localhost . UUCP > $*	$: $1 < @ $j . > $2		.UUCP domain')
38751889Sericundivert(2)dnl
38851222Seric
38959081Sericifdef(`_NO_UUCP_', `dnl',
39059081Seric`ifdef(`UUCP_RELAY',
39151274Seric`# pass UUCP addresses straight through
39255416SericR$* < @ $+ . UUCP > $*		$@ $1 < @ $2 . UUCP > $3',
39351274Seric`# if really UUCP, handle it immediately
39451322Sericifdef(`_CLASS_U_',
39555416Seric`R$* < @ $=U . UUCP > $*	$@ $1 < @ $2 . UUCP > $3', `dnl')
39651322Sericifdef(`_CLASS_V_',
39755416Seric`R$* < @ $=V . UUCP > $*	$@ $1 < @ $2 . UUCP > $3', `dnl')
39851322Sericifdef(`_CLASS_W_',
39955416Seric`R$* < @ $=W . UUCP > $*	$@ $1 < @ $2 . UUCP > $3', `dnl')
40051322Sericifdef(`_CLASS_X_',
40155416Seric`R$* < @ $=X . UUCP > $*	$@ $1 < @ $2 . UUCP > $3', `dnl')
40251322Sericifdef(`_CLASS_Y_',
40355416Seric`R$* < @ $=Y . UUCP > $*	$@ $1 < @ $2 . UUCP > $3', `dnl')
40451267Seric
40551267Seric# try UUCP traffic as a local address
40655416SericR$* < @ $+ . UUCP > $*		$: $1 < @ $[ $2 $] . UUCP > $3
40751992Sericifdef(`_OLD_SENDMAIL_',
40855416Seric`R$* < @ $+ . $+ . UUCP > $*		$@ $1 < @ $2 . $3 . > $4',
40955416Seric`R$* < @ $+ . . UUCP > $*		$@ $1 < @ $2 . > $3')')
41059081Seric')
41159081Sericifdef(`_NO_CANONIFY_', `dnl',
41259081Seric`# pass to name server to make hostname canonical
41360212SericR$* < @ $* $~P > $*		$: $1 < @ $[ $2 $3 $] > $4
41459081Seric')
41551889Sericundivert(8)dnl
41651889Seric
41751322Seric# if this is the local hostname, make sure we treat is as canonical
41851322SericR$* < @ $j > $*			$: $1 < @ $j . > $2
41951222Seric
42051322Seric
42151222Seric##################################################
42251222Seric###  Ruleset 4 -- Final Output Post-rewriting  ###
42351222Seric##################################################
42451222SericS4
42551222Seric
42658499SericR$*<@>			$@ $1				handle <> and list:;
42751222Seric
42851222Seric# resolve numeric addresses to name if possible
42951322SericR$* < @ [ $+ ] > $*	$: $1 < @ $[ [$2] $] > $3	lookup numeric internet addr
43051222Seric
43151322Seric# strip trailing dot off possibly canonical name
43251322SericR$* < @ $+ . > $*	$1 < @ $2 > $3
43351322Seric
43451222Seric# externalize local domain info
43551322SericR$* < $+ > $*		$1 $2 $3			defocus
43651322SericR@ $+ : @ $+ : $+	@ $1 , @ $2 : $3		<route-addr> canonical
43751997SericR@ $*			$@ @ $1				... and exit
43851222Seric
43958288Sericifdef(`_NO_UUCP_', `dnl',
44058288Seric`# UUCP must always be presented in old form
44158288SericR$+ @ $- . UUCP		$2!$1				u@h.UUCP => h!u')
44251222Seric
44351222Seric# delete duplicate local names
44451322SericR$+ % $=w @ $=w		$1 @ $j				u%host@host => u@host
44551222Seric
44651222Seric
44751222Seric
44851222Seric#############################################################
44951222Seric###   Ruleset 7 -- recanonicalize and call ruleset zero   ###
45051222Seric###		   (used for recursive calls)		  ###
45151222Seric#############################################################
45251222Seric
45351222SericS7
45451222SericR$*			$: $>3 $1
45551222SericR$*			$@ $>0 $1
45651222Seric
45751222Seric
45851222Seric######################################
45951222Seric###   Ruleset 0 -- Parse Address   ###
46051222Seric######################################
46151222Seric
46251222SericS0
46351222Seric
46458562SericR<@>			$#local $: <>			special case error msgs
46559887SericR$*:;<@>		$#error $@ USAGE $: "list:; syntax illegal for recipient addresses"
46658340Seric
46755416Sericifdef(`_MAILER_smtp_',
46855416Seric`# handle numeric address spec
46951322SericR$* < @ [ $+ ] > $*	$: $1 < @ $[ [$2] $] > $3	numeric internet addr
47055416SericR$* < @ [ $+ ] > $*	$#smtp $@ [$2] $: $1 @ [$2] $3	numeric internet spec',
47156785Seric`dnl')
47251222Seric
47351887Seric# now delete the local info -- note $=O to find characters that cause forwarding
47458482SericR$* < @ > $*		$@ $>7 $1			user@ => user
47551322SericR< @ $j . > : $*	$@ $>7 $1			@here:... -> ...
47651322SericR$* $=O $* < @ $j . >	$@ $>7 $1 $2 $3			...@here -> ...
47758781Sericifdef(`MAILER_TABLE',
47858781Seric`
47958781Seric# try mailer table lookup
480*60540SericR$* <@ $+ > $*		$: < $2 > $1 < @ $2 > $3	extract host name
481*60540SericR<$+ . > $*		$: < $1 > $2			strip trailing dot
482*60540SericR<$- . $+ > $*		$: < $(mailertable .$2 $: $) > $3	lookup
483*60540SericR<$- : $+ > $*		$# $1 $@ $2 $: $3		check -- resolved?
484*60540SericR<$- . $+ > $*		$: $>90 <$2> $3			try domain',
48558781Seric`dnl')
48651222Seric
48751222Seric# short circuit local delivery so forwarded email works
48858516Sericifdef(`_LOCAL_NOT_STICKY_',
48958516Seric`R$=L < @ $j . >		$#local $: @ $1			special local names
49058516SericR$+ < @ $j . >		$#local $: $1			dispose directly',
49158516Seric`R$+ < @ $j . >		$: $1 < @ $j @ $H >		first try hub
49251992Sericifdef(`_OLD_SENDMAIL_',
49359635Seric`R$+ < $+ @ $-:$+ >	$# $3 $@ $4 $: $1 < $2 >	yep ....
49459635SericR$+ < $+ @ $+ >		$#relay $@ $3 $: $1 < $2 >	yep ....
49557527SericR$+ < $+ @ >		$#local $: $1			nope, local address',
49657527Seric`R$+ < $+ @ $+ >		$#local $: $1			yep ....
49758516SericR$+ < $+ @ >		$#local $: @ $1			nope, local address')')
49851222Sericundivert(3)dnl
49951260Sericundivert(4)dnl
50051260Seric
50155416Seric# resolve remotely connected UUCP links (if any)
50251285Sericifdef(`_CLASS_V_',
50359635Seric`R$* < @ $=V . UUCP > $*		$#smtp $@ $V $: <@ $V> : $1 @ $2.UUCP $3',
50452044Seric	`dnl')
50551285Sericifdef(`_CLASS_W_',
50659635Seric`R$* < @ $=W . UUCP > $*		$#smtp $@ $W $: <@ $W> : $1 @ $2.UUCP $3',
50752044Seric	`dnl')
50851285Sericifdef(`_CLASS_X_',
50959635Seric`R$* < @ $=X . UUCP > $*		$#smtp $@ $X $: <@ $X> : $1 @ $2.UUCP $3',
51052044Seric	`dnl')
51151260Seric
51251222Seric# resolve fake top level domains by forwarding to other hosts
51351222Sericifdef(`BITNET_RELAY',
51460212Seric`R$*<@$+.BITNET>$*	$#smtp $@ $B. $: $1 <@$2.BITNET> $3	user@host.BITNET',
51551222Seric	`dnl')
51651222Sericifdef(`CSNET_RELAY',
51760212Seric`R$*<@$+.CSNET>$*	$#smtp $@ $C. $: $1 <@$2.CSNET> $3	user@host.CSNET',
51851222Seric	`dnl')
51958364Sericifdef(`_MAILER_fax_',
52058364Seric`R$+ < @ $+ .FAX >	$#fax $@ $2 $: $1			user@host.FAX',
52158364Seric`ifdef(`FAX_RELAY',
52260212Seric`R$*<@$+.FAX>$*		$#smtp $@ $F. $: $1 <@$2.FAX> $3	user@host.FAX',
52358364Seric	`dnl')')
52451222Seric
52551260Sericifdef(`UUCP_RELAY',
52651260Seric`# forward non-local UUCP traffic to our UUCP relay
52760212SericR$*<@$*.UUCP>$*		$#smtp $@ $Y. $: <@ $Y> : $1 @ $2.UUCP $3	uucp mail',
52855416Seric`ifdef(`_MAILER_uucp_',
52951260Seric`# forward other UUCP traffic straight to UUCP
53059604SericR< @ $+ .UUCP > : $+	$#uucp $@ $1 $: $2			@host.UUCP:...
53151322SericR$+ < @ $+ .UUCP >	$#uucp $@ $2 $: $1			user@host.UUCP',
53251260Seric	`dnl')')
53351222Seric
53458070Sericifdef(`_LOCAL_RULES_',
53558070Seric`# figure out what should stay in our local mail system
53658070Sericundivert(1)',
53758070Seric`ifdef(`_MAILER_smtp_',
53855416Seric`# deal with other remote names
53959635SericR$* < @ $* > $*		$#smtp $@ $2 $: $1 < @ $2 > $3		user@host.domain')')
54058070Sericifdef(`SMART_HOST', `
54158070Seric# pass names that still have a host to a smarthost
54258070SericR$* < @ $* > $*		$: < $S > $1 < @ $2 > $3	glue on smarthost name
54359635SericR<$-:$+> $* < @$* > $*	$# $1 $@ $2 $: $3 < @ $4 > $5	if non-null, use it
54459635SericR<$+> $* < @$* > $*	$#suucp $@ $1 $: $2 < @ $3 > $4	if non-null, use it
54558070SericR<> $* < @ $* > $*	$1 < @ $2 > $3			else strip off gunk',
54658070Seric`ifdef(`_LOCAL_RULES_', `
54758070Seric# reject messages that have host names we do not understand
54858070SericR$* < @ $* > $*		$#error $@ NOHOST $: Unrecognized host name $2',
54958070Seric`dnl')')
55058084Sericifdef(`_MAILER_USENET_', `
55158084Seric# addresses sent to net.group.USENET will get forwarded to a newsgroup
55258096SericR$+ . USENET		$# usenet $: $1')
55351222Seric
55451992Sericifdef(`_OLD_SENDMAIL_',
55551887Seric`# forward remaining names to local relay, if any
55652041SericR$=L			$#local $: $1			special local names
55752041SericR$+			$: $1 < @ $R >			append relay
55857527SericR$+ < @ >		$: $1 < @ $H >			no relay, try hub
55957527SericR$+ < @ >		$#local $: $1			no relay or hub: local
56057527SericR$+ < @ $j  >		$#local $: $1			we are relay/hub: local
56158070SericR$+ < @ $-:$+ >		$# $2 $@ $3 $: $1		deliver to relay/hub
56258771SericR$+ < @ $+ >		$#relay $@ $2 $: $1		deliver to relay/hub',
56358811Seric
56458811Seric`# if this is quoted, strip the quotes and try again
56558811SericR$+			$: $(dequote $1 $)		strip quotes
56658811SericR$* $=O $*		$@ $>7 $1 $2 $3			try again
56758811Seric
56858811Seric# handle locally delivered names
56952041SericR$=L			$#local $: @ $1			special local names
57052041SericR$+			$#local $: $1			regular local names
57151222Seric
57255416Seric###########################################################################
57355416Seric###   Ruleset 5 -- special rewriting after aliases have been expanded   ###
57455416Seric###		   (new sendmail only)					###
57555416Seric###########################################################################
57651222Seric
57751322SericS5
57851322Seric
57958808Seric# see if we have a relay or a hub
58058808SericR$+			$: $1 < @ $R >
58157527SericR$+ < @ >		$: $1 < @ $H >			no relay, try hub
58257527SericR$+ < @ $j >		$@ $1				we are relay/hub: local
58358070SericR$+ < @ $-:$+ >		$# $2 $@ $3 $: $1		send to relay or hub
58458808Sericifdef(`_MAILER_smtp_',
58558808Seric`R$+ < @ $+ >		$#relay $@ $2 $: $1		send to relay or hub')')
586*60540Sericifdef(`MAILER_TABLE',
587*60540Seric`
588*60540Seric
589*60540Seric###########################################################################
590*60540Seric###  Ruleset 90 -- try domain part of mailertable entry 		###
591*60540Seric###		   (new sendmail only)					###
592*60540Seric###########################################################################
593*60540Seric
594*60540SericS90
595*60540SericR<$- . $+ > $*		$: < $(mailertable .$2 $: $) > $3	lookup
596*60540SericR<$- : $+ > $*		$# $1 $@ $2 $: $3		check -- resolved?
597*60540SericR<$- . $+ > $*		$@ $>99 <$2> $3			no -- strip & try again
598*60540SericR<$*> $*		$@ $2				no match',
599*60540Seric`dnl')
60051222Seric#
60151222Seric######################################################################
60251222Seric######################################################################
60351222Seric#####
60456790Seric`#####			MAILER DEFINITIONS'
60551222Seric#####
60651222Seric######################################################################
60751222Seric######################################################################
60851222Sericundivert(7)dnl
609