xref: /csrg-svn/usr.sbin/sendmail/cf/m4/proto.m4 (revision 62372)
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*62372SericVERSIONID(`@(#)proto.m4	6.46 (Berkeley) 06/06/93')
1251222Seric
1351322SericMAILER(local)dnl
1451222Seric
1560894Sericifdef(`_OLD_SENDMAIL_',
1660894Seric`define(`_SET_96_', 6)dnl
1760894Sericdefine(`_SET_97_', 7)dnl',
1858119Seric`# level 4 config file format
1960894SericV4
2060894Sericdefine(`_SET_96_', 96)dnl
2160894Sericdefine(`_SET_97_', 97)dnl')
2252646Seric
2351222Seric##################
2451222Seric#   local info   #
2551222Seric##################
2651222Seric
2760212SericCP.
2860212Seric
2951889SericCwlocalhost
3051887Sericifdef(`USE_CW_FILE',
3151889Seric`# file containing names of hosts for which we receive email
3258406SericCONCAT(`Fw', confCW_FILE)', `dnl')
3351222Seric
3451222Sericifdef(`UUCP_RELAY',
3551222Seric`# UUCP relay host
3651281SericCONCAT(DY, UUCP_RELAY)
3760212SericCPUUCP
3857944Seric
3951222Seric')dnl
4051222Sericifdef(`BITNET_RELAY',
4151222Seric`#  BITNET relay host
4251222SericCONCAT(DB, BITNET_RELAY)
4360212SericCPBITNET
4457944Seric
4551222Seric')dnl
4651222Sericifdef(`CSNET_RELAY',
4751222Seric`# CSNET relay host
4851222SericCONCAT(DC, CSNET_RELAY)
4960212SericCPCSNET
5057944Seric
5151222Seric')dnl
5258364Sericifdef(`FAX_RELAY',
5358364Seric`# FAX relay host
5458364SericCONCAT(DF, FAX_RELAY)
5560212SericCPFAX
5658364Seric
5758364Seric')dnl
5858070Sericifdef(`SMART_HOST',
5958070Seric`# "Smart" UUCP relay host
6058070SericCONCAT(DS, SMART_HOST)
6151222Seric
6258070Seric')dnl
6358781Sericifdef(`MAILER_TABLE',
6458781Seric`# Mailer table (overriding domains)
6558781SericKmailertable MAILER_TABLE
6658781Seric
6758781Seric')dnl
6851222Seric# who I send unqualified names to (null means deliver locally)
6951222SericCONCAT(DR, ifdef(`LOCAL_RELAY', LOCAL_RELAY))
7051222Seric
7157527Seric# who gets all local email traffic ($R has precedence for unqualified names)
7257527SericCONCAT(DH, ifdef(`MAIL_HUB', MAIL_HUB))
7357527Seric
7458070Seric# my official hostname ($w or $w.$D)
7558070SericCONCAT(Dj$w, ifdef(`NEED_DOMAIN', .$D))
7658070Seric
7758070Seric# who I masquerade as (can be $j)
7858070SericCONCAT(DM, ifdef(`MASQUERADE_NAME', MASQUERADE_NAME, $j))
7958070Seric
8057245Seric# class L: names that should be delivered locally, even if we have a relay
8157245Seric# class E: names that should be exposed as from this host, even if we masquerade
8251279SericCLroot
8357245SericCEroot
8451279Sericundivert(5)dnl
8551279Seric
8651222Seric# operators that cannot be in local usernames (i.e., network indicators)
8758288SericCO @ % ifdef(`_NO_UUCP_', `', `!')
8851222Seric
8951322Seric# a class with just dot (for identifying canonical names)
9051322SericC..
9151322Seric
9258808Sericifdef(`_OLD_SENDMAIL_', `dnl',
9358808Seric`# dequoting map
9458808SericKdequote dequote')
9557944Seric
9659033Sericundivert(6)dnl
9759033Seric
9857944Seric######################
9957944Seric#   Special macros   #
10057944Seric######################
10157944Seric
10257944Seric# SMTP initial login message
10357944SericCONCAT(De, confSMTP_LOGIN_MSG)
10457944Seric
10557944Seric# UNIX initial From header format
10657944SericCONCAT(Dl, confFROM_LINE)
10757944Seric
10857944Seric# my name for error messages
10957944SericCONCAT(Dn, confMAILER_NAME)
11057944Seric
11157944Seric# delimiter (operator) characters
11257944SericCONCAT(Do, confOPERATORS)
11357944Seric
11457944Seric# format of a total name
11557944SericCONCAT(Dq, ifdef(`confFROM_HEADER', confFROM_HEADER,
11657944Seric	ifdef(`_OLD_SENDMAIL_', `$g$?x ($x)$.', `$?x$x <$g>$|$g$.')))
11757944Sericinclude(`../m4/version.m4')
11857944Seric
11957944Seric###############
12057944Seric#   Options   #
12157944Seric###############
12257944Seric
12359887Seric# strip message body to 7 bits on input?
12459887SericCONCAT(O7, confSEVEN_BIT_INPUT)
12557944Seric
12657944Seric# wait (in minutes) for alias file rebuild
12757944SericCONCAT(Oa, confALIAS_WAIT)
12857944Seric
12957944Seric# location of alias file
13057944SericCONCAT(OA, ifdef(`ALIAS_FILE', ALIAS_FILE, /etc/aliases))
13157944Seric
13258084Seric# minimum number of free blocks on filesystem
13358084SericCONCAT(Ob, confMIN_FREE_BLOCKS)
13458084Seric
13557944Seric# substitution for space (blank) characters
13657944SericCONCAT(OB, confBLANK_SUB)
13757944Seric
13857944Seric# connect to "expensive" mailers on initial submission?
13957944SericCONCAT(Oc, confCON_EXPENSIVE)
14057944Seric
14157944Seric# checkpoint queue runs after every N successful deliveries
14257944SericCONCAT(OC, confCHECKPOINT_INTERVAL)
14357944Seric
14457944Seric# default delivery mode
14557944SericCONCAT(Od, confDELIVERY_MODE)
14657944Seric
14757944Seric# automatically rebuild the alias database?
14857944SericCONCAT(OD, confAUTO_REBUILD)
14957944Seric
15057944Seric# error message header/file */
15157944Sericifdef(`confERROR_MESSAGE',
15257944Seric	concat(OE, confERROR_MESSAGE),
15357944Seric	#OE/etc/sendmail.oE)
15457944Seric
15557944Seric# error mode
15657944Sericifdef(`confERROR_MODE',
15757944Seric	concat(Oe, confERROR_MODE),
15857944Seric	#Oep)
15957944Seric
16057944Seric# save Unix-style "From_" lines at top of header?
16157944SericCONCAT(Of, confSAVE_FROM_LINES)
16257944Seric
16357944Seric# temporary file mode
16457944SericCONCAT(OF, confTEMP_FILE_MODE)
16557944Seric
16657944Seric# match recipients against GECOS field?
16757944SericCONCAT(OG, confMATCH_GECOS)
16857944Seric
16957944Seric# default GID
17057944SericCONCAT(Og, confDEF_GROUP_ID)
17157944Seric
17257944Seric# maximum hop count
17357944SericCONCAT(Oh, confMAX_HOP)
17457944Seric
17557944Seric# location of help file
17657944SericCONCAT(OH, ifdef(`HELP_FILE', HELP_FILE, /usr/lib/sendmail.hf))
17757944Seric
17857944Seric# ignore dots as terminators in incoming messages?
17957944SericCONCAT(Oi, confIGNORE_DOTS)
18057944Seric
18157944Seric# Insist that the BIND name server be running to resolve names
18257944Sericifdef(`confBIND_OPTS',
18357944Seric	CONCAT(OI, confBIND_OPTS),
18457944Seric	#OI)
18557944Seric
18659887Seric# deliver MIME-encapsulated error messages?
18759887SericCONCAT(Oj, confMIME_FORMAT_ERRORS)
18859887Seric
18957944Seric# Forward file search path
19057944Sericifdef(`confFORWARD_PATH',
19157944Seric	CONCAT(OJ, confFORWARD_PATH),
19257944Seric	#OJ/var/forward/$u:$z/.forward.$w:$z/.forward)
19357944Seric
19457944Seric# open connection cache size
19557944SericCONCAT(Ok, confMCI_CACHE_SIZE)
19657944Seric
19757944Seric# open connection cache timeout
19857944SericCONCAT(OK, confMCI_CACHE_TIMEOUT)
19957944Seric
20061106Seric# use Errors-To: header?
20161106SericCONCAT(Ol, confUSE_ERRORS_TO)
20261106Seric
20357944Seric# log level
20457944SericCONCAT(OL, confLOG_LEVEL)
20557944Seric
20657944Seric# send to me too, even in an alias expansion?
20757944SericCONCAT(Om, confME_TOO)
20857944Seric
20957944Seric# verify RHS in newaliases?
21057944SericCONCAT(On, confCHECK_ALIASES)
21157944Seric
21257944Seric# default messages to old style headers if no special punctuation?
21357944SericCONCAT(Oo, confOLD_STYLE_HEADERS)
21457944Seric
21558860Seric# SMTP daemon options
21658860Sericifdef(`confDAEMON_OPTIONS',
21758860Seric	CONCAT(OO, confDAEMON_OPTIONS),
21858860Seric	#OOPort=esmtp)
21958860Seric
22058084Seric# privacy flags
22158084SericCONCAT(Op, confPRIVACY_FLAGS)
22258084Seric
22357944Seric# who (if anyone) should get extra copies of error messages
22457944Sericifdef(`confCOPY_ERRORS_TO',
22557944Seric	CONCAT(OP, confCOPY_ERRORS_TO),
22657944Seric	#OPPostmaster)
22757944Seric
22857944Seric# slope of queue-only function
22957944Sericifdef(`confQUEUE_FACTOR',
23057944Seric	CONCAT(Oq, confQUEUE_FACTOR),
23157944Seric	#Oq600000)
23257944Seric
23357944Seric# queue directory
23457944SericCONCAT(OQ, ifdef(`QUEUE_DIR', QUEUE_DIR, /var/spool/mqueue))
23557944Seric
23657944Seric# read timeout -- now OK per RFC 1123 section 5.3.2
23758119Sericifdef(`confREAD_TIMEOUT',
23858119Seric	CONCAT(Or, confREAD_TIMEOUT),
23958119Seric	#Ordatablock=10m)
24057944Seric
24157944Seric# queue up everything before forking?
24257944SericCONCAT(Os, confSAFE_QUEUE)
24357944Seric
24457944Seric# status file
24557944SericCONCAT(OS, ifdef(`STATUS_FILE', STATUS_FILE, /etc/sendmail.st))
24657944Seric
24757944Seric# default message timeout interval
24857944SericCONCAT(OT, confMESSAGE_TIMEOUT)
24957944Seric
25057944Seric# time zone handling:
25157944Seric#  if undefined, use system default
25257944Seric#  if defined but null, use TZ envariable passed in
25357944Seric#  if defined and non-null, use that info
25457944Sericifelse(confTIME_ZONE, `USE_SYSTEM', `#Ot',
25557944Seric	confTIME_ZONE, `USE_TZ', `',
25657944Seric	`CONCAT(Ot, confTIME_ZONE)')
25757944Seric
25857944Seric# default UID
25957944SericCONCAT(Ou, confDEF_USER_ID)
26057944Seric
26151887Seric# list of locations of user database file (null means no lookup)
26258720SericOU`'ifdef(`confUSERDB_SPEC', `confUSERDB_SPEC')
26351222Seric
26458860Seric# fallback MX host
26558860Sericifdef(`confFALLBACK_MX',
26658860Seric	CONCAT(OV, confFALLBACK_MX),
26758860Seric	#OVfall.back.host.net)
26858860Seric
26957944Seric# load average at which we just queue messages
27057944SericCONCAT(Ox, confQUEUE_LA)
27157944Seric
27257944Seric# load average at which we refuse connections
27357944SericCONCAT(OX, confREFUSE_LA)
27457944Seric
27557944Seric# work recipient factor
27657944Sericifdef(`confWORK_RECIPIENT_FACTOR',
27757944Seric	CONCAT(Oy, confWORK_RECIPIENT_FACTOR),
27857944Seric	#Oy30000)
27957944Seric
28057944Seric# deliver each queued job in a separate process?
28157944SericCONCAT(OY, confSEPARATE_PROC)
28257944Seric
28357944Seric# work class factor
28457944Sericifdef(`confWORK_CLASS_FACTOR',
28557944Seric	CONCAT(Oz, confWORK_CLASS_FACTOR),
28657944Seric	#Oz1800)
28757944Seric
28857944Seric# work time factor
28957944Sericifdef(`confWORK_TIME_FACTOR',
29057944Seric	CONCAT(OZ, confWORK_TIME_FACTOR),
29157944Seric	#OZ90000)
29257944Seric
29357944Seric###########################
29457944Seric#   Message precedences   #
29557944Seric###########################
29657944Seric
29757944SericPfirst-class=0
29857944SericPspecial-delivery=100
29958070SericPlist=-30
30057944SericPbulk=-60
30157944SericPjunk=-100
30257944Seric
30357944Seric#####################
30457944Seric#   Trusted users   #
30557944Seric#####################
30657944Seric
30757944SericTroot
30857944SericTdaemon
30957944SericTuucp
31057944Seric
31157944Seric#########################
31257944Seric#   Format of headers   #
31357944Seric#########################
31457944Seric
31558679SericH?P?Return-Path: $g
31660894SericHReceived: $?sfrom $s $.$?_($_) $.by $j ($v/$Z)$?r with $r$. id $i; $b
31757944SericH?D?Resent-Date: $a
31857944SericH?D?Date: $a
31957944SericH?F?Resent-From: $q
32057944SericH?F?From: $q
32157944SericH?x?Full-Name: $x
32257944SericHSubject:
32357944Seric# HPosted-Date: $a
32457944Seric# H?l?Received-Date: $b
32557944SericH?M?Resent-Message-Id: <$t.$i@$j>
32657944SericH?M?Message-Id: <$t.$i@$j>
32751222Seric#
32851222Seric######################################################################
32951222Seric######################################################################
33051222Seric#####
33151222Seric#####			REWRITING RULES
33251222Seric#####
33351222Seric######################################################################
33451222Seric######################################################################
33551222Seric
33658678Sericundivert(9)dnl
33751222Seric
33851222Seric###########################################
33951222Seric###  Rulset 3 -- Name Canonicalization  ###
34051222Seric###########################################
34151260SericS3
34251222Seric
34358499Seric# handle null input and list syntax (translate to <@> special case)
34458499SericR$@			$@ <@>
34558707SericR$*:;$*			$@ $1 :; <@>
34658174Seric
34751222Seric# basic textual canonicalization -- note RFC733 heuristic here
34857012SericR$*<$*>$*<$*>$*		<$2>$3$4$5			strip multiple <> <>
34958158SericR$*<$*<$+>$*>$*		<$3>$5				2-level <> nesting
35058499SericR$*<>$*			$@ <@>				MAIL FROM:<> case
35151222SericR$*<$+>$*		$2				basic RFC821/822 parsing
35251222Seric
35351222Seric# make sure <@a,@b,@c:user@d> syntax is easy to parse -- undone later
35455416SericR@ $+ , $+		@ $1 : $2			change all "," to ":"
35551222Seric
35651222Seric# localize and dispose of route-based addresses
35760894SericR@ $+ : $+		$@ $>_SET_96_ < @$1 > : $2		handle <route-addr>
35851222Seric
35951222Seric# find focus for list syntax
36060894SericR $+ : $* ; @ $+	$@ $>_SET_96_ $1 : $2 ; < @ $3 >	list syntax
36155416SericR $+ : $* ;		$@ $1 : $2;			list syntax
36251222Seric
36351222Seric# find focus for @ syntax addresses
36455416SericR$+ @ $+		$: $1 < @ $2 >			focus on domain
36555416SericR$+ < $+ @ $+ >		$1 $2 < @ $3 >			move gaze right
36660894SericR$+ < @ $+ >		$@ $>_SET_96_ $1 < @ $2 >		already canonical
36751222Seric
36858288Sericifdef(`_NO_UUCP_', `dnl',
36958288Seric`# convert old-style addresses to a domain-based address
37060894SericR$- ! $+		$@ $>_SET_96_ $2 < @ $1 .UUCP >	resolve uucp names
37160894SericR$+ . $- ! $+		$@ $>_SET_96_ $3 < @ $1 . $2 >		domain uucps
37260894SericR$+ ! $+		$@ $>_SET_96_ $2 < @ $1 .UUCP >	uucp subdomains')
37351222Seric
37451222Seric# if we have % signs, take the rightmost one
37555416SericR$* % $*		$1 @ $2				First make them all @s.
37655416SericR$* @ $* @ $*		$1 % $2 @ $3			Undo all but the last.
37760894SericR$* @ $*		$@ $>_SET_96_ $1 < @ $2 >		Insert < > and finish
37851222Seric
37951222Seric# else we must be a local name
38051222Seric
38151222Seric
38260894Seric################################################
38360894Seric###  Ruleset _SET_96_ -- bottom half of ruleset 3  ###
38460894Seric################################################
38551222Seric
38657245Seric#  At this point, everything should be in a "local_part<@domain>extra" format.
38760894SericS`'_SET_96_
38851222Seric
38951222Seric# handle special cases for local names
39060262SericR$* < @ localhost > $*		$: $1 < @ $j . > $2		no domain at all
39160262SericR$* < @ localhost . $m > $*	$: $1 < @ $j . > $2		local domain
39260262Sericifdef(`_NO_UUCP_', `dnl',
39360262Seric`R$* < @ localhost . UUCP > $*	$: $1 < @ $j . > $2		.UUCP domain')
39451889Sericundivert(2)dnl
39551222Seric
39659081Sericifdef(`_NO_UUCP_', `dnl',
39759081Seric`ifdef(`UUCP_RELAY',
39851274Seric`# pass UUCP addresses straight through
39955416SericR$* < @ $+ . UUCP > $*		$@ $1 < @ $2 . UUCP > $3',
40051274Seric`# if really UUCP, handle it immediately
40151322Sericifdef(`_CLASS_U_',
40255416Seric`R$* < @ $=U . UUCP > $*	$@ $1 < @ $2 . UUCP > $3', `dnl')
40351322Sericifdef(`_CLASS_V_',
40455416Seric`R$* < @ $=V . UUCP > $*	$@ $1 < @ $2 . UUCP > $3', `dnl')
40551322Sericifdef(`_CLASS_W_',
40655416Seric`R$* < @ $=W . UUCP > $*	$@ $1 < @ $2 . UUCP > $3', `dnl')
40751322Sericifdef(`_CLASS_X_',
40855416Seric`R$* < @ $=X . UUCP > $*	$@ $1 < @ $2 . UUCP > $3', `dnl')
40951322Sericifdef(`_CLASS_Y_',
41055416Seric`R$* < @ $=Y . UUCP > $*	$@ $1 < @ $2 . UUCP > $3', `dnl')
41151267Seric
41251267Seric# try UUCP traffic as a local address
41355416SericR$* < @ $+ . UUCP > $*		$: $1 < @ $[ $2 $] . UUCP > $3
41451992Sericifdef(`_OLD_SENDMAIL_',
41555416Seric`R$* < @ $+ . $+ . UUCP > $*		$@ $1 < @ $2 . $3 . > $4',
41655416Seric`R$* < @ $+ . . UUCP > $*		$@ $1 < @ $2 . > $3')')
41759081Seric')
41861470Sericifdef(`_NO_CANONIFY_',
41961470Seric`# make sure local host names appear canonical
42061470SericR$* < @ $=w > $*		$: $1 < @ $2 . > $3',
42159081Seric`# pass to name server to make hostname canonical
42261470SericR$* < @ $* $~P > $*		$: $1 < @ $[ $2 $3 $] > $4')
42361470Seric
42451889Sericundivert(8)dnl
42551889Seric
42651322Seric# if this is the local hostname, make sure we treat is as canonical
42751322SericR$* < @ $j > $*			$: $1 < @ $j . > $2
42851222Seric
42951322Seric
43051222Seric##################################################
43151222Seric###  Ruleset 4 -- Final Output Post-rewriting  ###
43251222Seric##################################################
43351222SericS4
43451222Seric
43558499SericR$*<@>			$@ $1				handle <> and list:;
43651222Seric
43751222Seric# resolve numeric addresses to name if possible
43851322SericR$* < @ [ $+ ] > $*	$: $1 < @ $[ [$2] $] > $3	lookup numeric internet addr
43951222Seric
44051322Seric# strip trailing dot off possibly canonical name
44151322SericR$* < @ $+ . > $*	$1 < @ $2 > $3
44251322Seric
44351222Seric# externalize local domain info
44451322SericR$* < $+ > $*		$1 $2 $3			defocus
44551322SericR@ $+ : @ $+ : $+	@ $1 , @ $2 : $3		<route-addr> canonical
44651997SericR@ $*			$@ @ $1				... and exit
44751222Seric
44858288Sericifdef(`_NO_UUCP_', `dnl',
44958288Seric`# UUCP must always be presented in old form
45058288SericR$+ @ $- . UUCP		$2!$1				u@h.UUCP => h!u')
45151222Seric
45251222Seric# delete duplicate local names
45351322SericR$+ % $=w @ $=w		$1 @ $j				u%host@host => u@host
45451222Seric
45551222Seric
45651222Seric
45760894Seric##############################################################
45860894Seric###   Ruleset _SET_97_ -- recanonicalize and call ruleset zero   ###
45960894Seric###		   (used for recursive calls)		   ###
46060894Seric##############################################################
46151222Seric
46260894SericS`'_SET_97_
46351222SericR$*			$: $>3 $1
46451222SericR$*			$@ $>0 $1
46551222Seric
46651222Seric
46751222Seric######################################
46851222Seric###   Ruleset 0 -- Parse Address   ###
46951222Seric######################################
47051222Seric
47151222SericS0
47251222Seric
47358562SericR<@>			$#local $: <>			special case error msgs
47459887SericR$*:;<@>		$#error $@ USAGE $: "list:; syntax illegal for recipient addresses"
47558340Seric
47655416Sericifdef(`_MAILER_smtp_',
47755416Seric`# handle numeric address spec
47851322SericR$* < @ [ $+ ] > $*	$: $1 < @ $[ [$2] $] > $3	numeric internet addr
47955416SericR$* < @ [ $+ ] > $*	$#smtp $@ [$2] $: $1 @ [$2] $3	numeric internet spec',
48056785Seric`dnl')
48151222Seric
48251887Seric# now delete the local info -- note $=O to find characters that cause forwarding
48360894SericR$* < @ > $*		$@ $>_SET_97_ $1			user@ => user
48460894SericR< @ $=w . > : $*	$@ $>_SET_97_ $2			@here:... -> ...
48560894SericR$* $=O $* < @ $=w . >	$@ $>_SET_97_ $1 $2 $3			...@here -> ...
48658781Sericifdef(`MAILER_TABLE',
48758781Seric`
48858781Seric# try mailer table lookup
48960540SericR$* <@ $+ > $*		$: < $2 > $1 < @ $2 > $3	extract host name
49061106SericR< $+ . > $*		$: < $1 > $2			strip trailing dot
491*62372SericR< $+ > $*		$: < $(mailertable $1 $) > $3	lookup
49261106SericR< $- : $+ > $*		$# $1 $@ $2 $: $3		check -- resolved?
49361106SericR< $- . $+ > $*		$: $>90 <$2> $3			try domain',
49458781Seric`dnl')
49551222Seric
49651222Seric# short circuit local delivery so forwarded email works
49758516Sericifdef(`_LOCAL_NOT_STICKY_',
49860894Seric`R$=L < @ $=w . >		$#local $: @ $1			special local names
49960894SericR$+ < @ $=w . >		$#local $: $1			dispose directly',
50060894Seric`R$+ < @ $=w . >		$: $1 < @ $2 @ $H >		first try hub
50151992Sericifdef(`_OLD_SENDMAIL_',
50259635Seric`R$+ < $+ @ $-:$+ >	$# $3 $@ $4 $: $1 < $2 >	yep ....
50359635SericR$+ < $+ @ $+ >		$#relay $@ $3 $: $1 < $2 >	yep ....
50457527SericR$+ < $+ @ >		$#local $: $1			nope, local address',
50557527Seric`R$+ < $+ @ $+ >		$#local $: $1			yep ....
50658516SericR$+ < $+ @ >		$#local $: @ $1			nope, local address')')
50751222Sericundivert(3)dnl
50851260Sericundivert(4)dnl
50951260Seric
51061468Sericifdef(`_NO_UUCP_', `dnl',
51161468Seric`# resolve remotely connected UUCP links (if any)
51251285Sericifdef(`_CLASS_V_',
51359635Seric`R$* < @ $=V . UUCP > $*		$#smtp $@ $V $: <@ $V> : $1 @ $2.UUCP $3',
51452044Seric	`dnl')
51551285Sericifdef(`_CLASS_W_',
51659635Seric`R$* < @ $=W . UUCP > $*		$#smtp $@ $W $: <@ $W> : $1 @ $2.UUCP $3',
51752044Seric	`dnl')
51851285Sericifdef(`_CLASS_X_',
51959635Seric`R$* < @ $=X . UUCP > $*		$#smtp $@ $X $: <@ $X> : $1 @ $2.UUCP $3',
52061468Seric	`dnl')')
52151260Seric
52251222Seric# resolve fake top level domains by forwarding to other hosts
52351222Sericifdef(`BITNET_RELAY',
52461468Seric`R$*<@$+.BITNET>$*	$#smtp $@ $B $: $1 <@$2.BITNET> $3	user@host.BITNET',
52551222Seric	`dnl')
52651222Sericifdef(`CSNET_RELAY',
52761468Seric`R$*<@$+.CSNET>$*	$#smtp $@ $C $: $1 <@$2.CSNET> $3	user@host.CSNET',
52851222Seric	`dnl')
52958364Sericifdef(`_MAILER_fax_',
53058364Seric`R$+ < @ $+ .FAX >	$#fax $@ $2 $: $1			user@host.FAX',
53158364Seric`ifdef(`FAX_RELAY',
53261468Seric`R$*<@$+.FAX>$*		$#smtp $@ $F $: $1 <@$2.FAX> $3		user@host.FAX',
53358364Seric	`dnl')')
53451222Seric
53551260Sericifdef(`UUCP_RELAY',
53651260Seric`# forward non-local UUCP traffic to our UUCP relay
53761468SericR$*<@$*.UUCP>$*		$#smtp $@ $Y $: <@ $Y> : $1 @ $2.UUCP $3	uucp mail',
53855416Seric`ifdef(`_MAILER_uucp_',
53951260Seric`# forward other UUCP traffic straight to UUCP
54059604SericR< @ $+ .UUCP > : $+	$#uucp $@ $1 $: $2			@host.UUCP:...
54151322SericR$+ < @ $+ .UUCP >	$#uucp $@ $2 $: $1			user@host.UUCP',
54251260Seric	`dnl')')
54351222Seric
54458070Sericifdef(`_LOCAL_RULES_',
54558070Seric`# figure out what should stay in our local mail system
54658070Sericundivert(1)',
54758070Seric`ifdef(`_MAILER_smtp_',
54855416Seric`# deal with other remote names
54959635SericR$* < @ $* > $*		$#smtp $@ $2 $: $1 < @ $2 > $3		user@host.domain')')
55058070Sericifdef(`SMART_HOST', `
55158070Seric# pass names that still have a host to a smarthost
55258070SericR$* < @ $* > $*		$: < $S > $1 < @ $2 > $3	glue on smarthost name
55359635SericR<$-:$+> $* < @$* > $*	$# $1 $@ $2 $: $3 < @ $4 > $5	if non-null, use it
55459635SericR<$+> $* < @$* > $*	$#suucp $@ $1 $: $2 < @ $3 > $4	if non-null, use it
55558070SericR<> $* < @ $* > $*	$1 < @ $2 > $3			else strip off gunk',
55658070Seric`ifdef(`_LOCAL_RULES_', `
55758070Seric# reject messages that have host names we do not understand
55858070SericR$* < @ $* > $*		$#error $@ NOHOST $: Unrecognized host name $2',
55958070Seric`dnl')')
56058084Sericifdef(`_MAILER_USENET_', `
56158084Seric# addresses sent to net.group.USENET will get forwarded to a newsgroup
56258096SericR$+ . USENET		$# usenet $: $1')
56351222Seric
56451992Sericifdef(`_OLD_SENDMAIL_',
56551887Seric`# forward remaining names to local relay, if any
56652041SericR$=L			$#local $: $1			special local names
56752041SericR$+			$: $1 < @ $R >			append relay
56857527SericR$+ < @ >		$: $1 < @ $H >			no relay, try hub
56957527SericR$+ < @ >		$#local $: $1			no relay or hub: local
57060894SericR$+ < @ $=w  >		$#local $: $1			we are relay/hub: local
57158070SericR$+ < @ $-:$+ >		$# $2 $@ $3 $: $1		deliver to relay/hub
57258771SericR$+ < @ $+ >		$#relay $@ $2 $: $1		deliver to relay/hub',
57358811Seric
57458811Seric`# if this is quoted, strip the quotes and try again
57558811SericR$+			$: $(dequote $1 $)		strip quotes
57660894SericR$* $=O $*		$@ $>_SET_97_ $1 $2 $3			try again
57758811Seric
57858811Seric# handle locally delivered names
57952041SericR$=L			$#local $: @ $1			special local names
58052041SericR$+			$#local $: $1			regular local names
58151222Seric
58255416Seric###########################################################################
58355416Seric###   Ruleset 5 -- special rewriting after aliases have been expanded   ###
58455416Seric###		   (new sendmail only)					###
58555416Seric###########################################################################
58651222Seric
58751322SericS5
58851322Seric
58958808Seric# see if we have a relay or a hub
59058808SericR$+			$: $1 < @ $R >
59157527SericR$+ < @ >		$: $1 < @ $H >			no relay, try hub
59260894SericR$+ < @ $=w >		$@ $1				we are relay/hub: local
59358070SericR$+ < @ $-:$+ >		$# $2 $@ $3 $: $1		send to relay or hub
59458808Sericifdef(`_MAILER_smtp_',
59558808Seric`R$+ < @ $+ >		$#relay $@ $2 $: $1		send to relay or hub')')
59660540Sericifdef(`MAILER_TABLE',
59760540Seric`
59860540Seric
59960540Seric###########################################################################
60060540Seric###  Ruleset 90 -- try domain part of mailertable entry 		###
60160540Seric###		   (new sendmail only)					###
60260540Seric###########################################################################
60360540Seric
60460540SericS90
60561106SericR<$- . $+ > $*		$: < $(mailertable .$2 $) > $3	lookup
60660540SericR<$- : $+ > $*		$# $1 $@ $2 $: $3		check -- resolved?
607*62372SericR< . $+ > $*		$@ $>90 <$1> $2			no -- strip & try again
60860540SericR<$*> $*		$@ $2				no match',
60960540Seric`dnl')
61051222Seric#
61151222Seric######################################################################
61251222Seric######################################################################
61351222Seric#####
61456790Seric`#####			MAILER DEFINITIONS'
61551222Seric#####
61651222Seric######################################################################
61751222Seric######################################################################
61851222Sericundivert(7)dnl
619