xref: /original-bsd/usr.sbin/sendmail/cf/m4/proto.m4 (revision 1c0b669e)
16f4c5567Sericdivert(-1)
26f4c5567Seric#
36f4c5567Seric# Copyright (c) 1983 Eric P. Allman
46f4c5567Seric# Copyright (c) 1988 The Regents of the University of California.
56f4c5567Seric# All rights reserved.
66f4c5567Seric#
76f4c5567Seric# %sccs.include.redist.sh%
86f4c5567Seric#
96f4c5567Sericdivert(0)
106f4c5567Seric
11*1c0b669eSericVERSIONID(`@(#)proto.m4	6.18 (Berkeley) 03/05/93')
126f4c5567Seric
1363eeb308SericMAILER(local)dnl
146f4c5567Seric
15472f2a37Sericifdef(`_OLD_SENDMAIL_', `dnl',
162635e5f8Seric`# level 4 config file format
172635e5f8SericV4')
18472f2a37Seric
196f4c5567Seric##################
206f4c5567Seric#   local info   #
216f4c5567Seric##################
226f4c5567Seric
2331695942SericCwlocalhost
24b1286b66Sericifdef(`USE_CW_FILE',
2531695942Seric`# file containing names of hosts for which we receive email
260bf9a1dbSericCONCAT(`Fw', confCW_FILE)', `dnl')
276f4c5567Seric
286f4c5567Sericifdef(`UUCP_RELAY',
296f4c5567Seric`# UUCP relay host
3013c6b009SericCONCAT(DY, UUCP_RELAY)
310fc742e1Seric
326f4c5567Seric')dnl
336f4c5567Sericifdef(`BITNET_RELAY',
346f4c5567Seric`#  BITNET relay host
356f4c5567SericCONCAT(DB, BITNET_RELAY)
360fc742e1Seric
376f4c5567Seric')dnl
386f4c5567Sericifdef(`CSNET_RELAY',
396f4c5567Seric`# CSNET relay host
406f4c5567SericCONCAT(DC, CSNET_RELAY)
410fc742e1Seric
426f4c5567Seric')dnl
435caa7271Sericifdef(`FAX_RELAY',
445caa7271Seric`# FAX relay host
455caa7271SericCONCAT(DF, FAX_RELAY)
465caa7271Seric
475caa7271Seric')dnl
4885afb57eSericifdef(`SMART_HOST',
4985afb57eSeric`# "Smart" UUCP relay host
5085afb57eSericCONCAT(DS, SMART_HOST)
516f4c5567Seric
5285afb57eSeric')dnl
536f4c5567Seric# who I send unqualified names to (null means deliver locally)
546f4c5567SericCONCAT(DR, ifdef(`LOCAL_RELAY', LOCAL_RELAY))
556f4c5567Seric
56525ff8d9Seric# who gets all local email traffic ($R has precedence for unqualified names)
57525ff8d9SericCONCAT(DH, ifdef(`MAIL_HUB', MAIL_HUB))
58525ff8d9Seric
5985afb57eSeric# my official hostname ($w or $w.$D)
6085afb57eSericCONCAT(Dj$w, ifdef(`NEED_DOMAIN', .$D))
6185afb57eSeric
6285afb57eSeric# who I masquerade as (can be $j)
6385afb57eSericCONCAT(DM, ifdef(`MASQUERADE_NAME', MASQUERADE_NAME, $j))
6485afb57eSeric
6582027dd5Seric# class L: names that should be delivered locally, even if we have a relay
6682027dd5Seric# class E: names that should be exposed as from this host, even if we masquerade
6771dc253dSericCLroot
6882027dd5SericCEroot
6971dc253dSericundivert(5)dnl
7071dc253dSeric
716f4c5567Seric# operators that cannot be in local usernames (i.e., network indicators)
7290caf1e3SericCO @ % ifdef(`_NO_UUCP_', `', `!')
736f4c5567Seric
7463eeb308Seric# a class with just dot (for identifying canonical names)
7563eeb308SericC..
7663eeb308Seric
776f4c5567Seric
780fc742e1Seric######################
790fc742e1Seric#   Special macros   #
800fc742e1Seric######################
816f4c5567Seric
820fc742e1Seric# SMTP initial login message
830fc742e1SericCONCAT(De, confSMTP_LOGIN_MSG)
840fc742e1Seric
850fc742e1Seric# UNIX initial From header format
860fc742e1SericCONCAT(Dl, confFROM_LINE)
870fc742e1Seric
880fc742e1Seric# my name for error messages
890fc742e1SericCONCAT(Dn, confMAILER_NAME)
900fc742e1Seric
910fc742e1Seric# delimiter (operator) characters
920fc742e1SericCONCAT(Do, confOPERATORS)
930fc742e1Seric
940fc742e1Seric# format of a total name
950fc742e1SericCONCAT(Dq, ifdef(`confFROM_HEADER', confFROM_HEADER,
960fc742e1Seric	ifdef(`_OLD_SENDMAIL_', `$g$?x ($x)$.', `$?x$x <$g>$|$g$.')))
976f4c5567Sericinclude(`../m4/version.m4')
980fc742e1Seric
990fc742e1Seric###############
1000fc742e1Seric#   Options   #
1010fc742e1Seric###############
1020fc742e1Seric
1030fc742e1Seric# preserve 8 bits on message body on input?
1040fc742e1SericCONCAT(O8, confEIGHT_BIT_INPUT)
1050fc742e1Seric
1060fc742e1Seric# wait (in minutes) for alias file rebuild
1070fc742e1SericCONCAT(Oa, confALIAS_WAIT)
1080fc742e1Seric
1090fc742e1Seric# location of alias file
1100fc742e1SericCONCAT(OA, ifdef(`ALIAS_FILE', ALIAS_FILE, /etc/aliases))
1110fc742e1Seric
1122188aa70Seric# minimum number of free blocks on filesystem
1132188aa70SericCONCAT(Ob, confMIN_FREE_BLOCKS)
1142188aa70Seric
1150fc742e1Seric# substitution for space (blank) characters
1160fc742e1SericCONCAT(OB, confBLANK_SUB)
1170fc742e1Seric
1180fc742e1Seric# connect to "expensive" mailers on initial submission?
1190fc742e1SericCONCAT(Oc, confCON_EXPENSIVE)
1200fc742e1Seric
1210fc742e1Seric# checkpoint queue runs after every N successful deliveries
1220fc742e1SericCONCAT(OC, confCHECKPOINT_INTERVAL)
1230fc742e1Seric
1240fc742e1Seric# default delivery mode
1250fc742e1SericCONCAT(Od, confDELIVERY_MODE)
1260fc742e1Seric
1270fc742e1Seric# automatically rebuild the alias database?
1280fc742e1SericCONCAT(OD, confAUTO_REBUILD)
1290fc742e1Seric
1300fc742e1Seric# error message header/file */
1310fc742e1Sericifdef(`confERROR_MESSAGE',
1320fc742e1Seric	concat(OE, confERROR_MESSAGE),
1330fc742e1Seric	#OE/etc/sendmail.oE)
1340fc742e1Seric
1350fc742e1Seric# error mode
1360fc742e1Sericifdef(`confERROR_MODE',
1370fc742e1Seric	concat(Oe, confERROR_MODE),
1380fc742e1Seric	#Oep)
1390fc742e1Seric
1400fc742e1Seric# save Unix-style "From_" lines at top of header?
1410fc742e1SericCONCAT(Of, confSAVE_FROM_LINES)
1420fc742e1Seric
1430fc742e1Seric# temporary file mode
1440fc742e1SericCONCAT(OF, confTEMP_FILE_MODE)
1450fc742e1Seric
1460fc742e1Seric# match recipients against GECOS field?
1470fc742e1SericCONCAT(OG, confMATCH_GECOS)
1480fc742e1Seric
1490fc742e1Seric# default GID
1500fc742e1SericCONCAT(Og, confDEF_GROUP_ID)
1510fc742e1Seric
1520fc742e1Seric# maximum hop count
1530fc742e1SericCONCAT(Oh, confMAX_HOP)
1540fc742e1Seric
1550fc742e1Seric# location of help file
1560fc742e1SericCONCAT(OH, ifdef(`HELP_FILE', HELP_FILE, /usr/lib/sendmail.hf))
1570fc742e1Seric
1580fc742e1Seric# ignore dots as terminators in incoming messages?
1590fc742e1SericCONCAT(Oi, confIGNORE_DOTS)
1600fc742e1Seric
1610fc742e1Seric# Insist that the BIND name server be running to resolve names
1620fc742e1Sericifdef(`confBIND_OPTS',
1630fc742e1Seric	CONCAT(OI, confBIND_OPTS),
1640fc742e1Seric	#OI)
1650fc742e1Seric
1660fc742e1Seric# Forward file search path
1670fc742e1Sericifdef(`confFORWARD_PATH',
1680fc742e1Seric	CONCAT(OJ, confFORWARD_PATH),
1690fc742e1Seric	#OJ/var/forward/$u:$z/.forward.$w:$z/.forward)
1700fc742e1Seric
1710fc742e1Seric# open connection cache size
1720fc742e1SericCONCAT(Ok, confMCI_CACHE_SIZE)
1730fc742e1Seric
1740fc742e1Seric# open connection cache timeout
1750fc742e1SericCONCAT(OK, confMCI_CACHE_TIMEOUT)
1760fc742e1Seric
1770fc742e1Seric# log level
1780fc742e1SericCONCAT(OL, confLOG_LEVEL)
1790fc742e1Seric
1800fc742e1Seric# send to me too, even in an alias expansion?
1810fc742e1SericCONCAT(Om, confME_TOO)
1820fc742e1Seric
1830fc742e1Seric# verify RHS in newaliases?
1840fc742e1SericCONCAT(On, confCHECK_ALIASES)
1850fc742e1Seric
1860fc742e1Seric# default messages to old style headers if no special punctuation?
1870fc742e1SericCONCAT(Oo, confOLD_STYLE_HEADERS)
1880fc742e1Seric
1892188aa70Seric# privacy flags
1902188aa70SericCONCAT(Op, confPRIVACY_FLAGS)
1912188aa70Seric
1920fc742e1Seric# who (if anyone) should get extra copies of error messages
1930fc742e1Sericifdef(`confCOPY_ERRORS_TO',
1940fc742e1Seric	CONCAT(OP, confCOPY_ERRORS_TO),
1950fc742e1Seric	#OPPostmaster)
1960fc742e1Seric
1970fc742e1Seric# slope of queue-only function
1980fc742e1Sericifdef(`confQUEUE_FACTOR',
1990fc742e1Seric	CONCAT(Oq, confQUEUE_FACTOR),
2000fc742e1Seric	#Oq600000)
2010fc742e1Seric
2020fc742e1Seric# queue directory
2030fc742e1SericCONCAT(OQ, ifdef(`QUEUE_DIR', QUEUE_DIR, /var/spool/mqueue))
2040fc742e1Seric
2050fc742e1Seric# read timeout -- now OK per RFC 1123 section 5.3.2
2062635e5f8Sericifdef(`confREAD_TIMEOUT',
2072635e5f8Seric	CONCAT(Or, confREAD_TIMEOUT),
2082635e5f8Seric	#Ordatablock=10m)
2090fc742e1Seric
2100fc742e1Seric# queue up everything before forking?
2110fc742e1SericCONCAT(Os, confSAFE_QUEUE)
2120fc742e1Seric
2130fc742e1Seric# status file
2140fc742e1SericCONCAT(OS, ifdef(`STATUS_FILE', STATUS_FILE, /etc/sendmail.st))
2150fc742e1Seric
2160fc742e1Seric# default message timeout interval
2170fc742e1SericCONCAT(OT, confMESSAGE_TIMEOUT)
2180fc742e1Seric
2190fc742e1Seric# time zone handling:
2200fc742e1Seric#  if undefined, use system default
2210fc742e1Seric#  if defined but null, use TZ envariable passed in
2220fc742e1Seric#  if defined and non-null, use that info
2230fc742e1Sericifelse(confTIME_ZONE, `USE_SYSTEM', `#Ot',
2240fc742e1Seric	confTIME_ZONE, `USE_TZ', `',
2250fc742e1Seric	`CONCAT(Ot, confTIME_ZONE)')
2260fc742e1Seric
2270fc742e1Seric# default UID
2280fc742e1SericCONCAT(Ou, confDEF_USER_ID)
2290fc742e1Seric
2300fc742e1Seric# list of locations of user database file (null means no lookup)
2310fc742e1SericCONCAT(OU, ifdef(`USERDB_SPEC', `USERDB_SPEC'))
2320fc742e1Seric
2330fc742e1Seric# load average at which we just queue messages
2340fc742e1SericCONCAT(Ox, confQUEUE_LA)
2350fc742e1Seric
2360fc742e1Seric# load average at which we refuse connections
2370fc742e1SericCONCAT(OX, confREFUSE_LA)
2380fc742e1Seric
2390fc742e1Seric# work recipient factor
2400fc742e1Sericifdef(`confWORK_RECIPIENT_FACTOR',
2410fc742e1Seric	CONCAT(Oy, confWORK_RECIPIENT_FACTOR),
2420fc742e1Seric	#Oy30000)
2430fc742e1Seric
2440fc742e1Seric# deliver each queued job in a separate process?
2450fc742e1SericCONCAT(OY, confSEPARATE_PROC)
2460fc742e1Seric
2470fc742e1Seric# work class factor
2480fc742e1Sericifdef(`confWORK_CLASS_FACTOR',
2490fc742e1Seric	CONCAT(Oz, confWORK_CLASS_FACTOR),
2500fc742e1Seric	#Oz1800)
2510fc742e1Seric
2520fc742e1Seric# work time factor
2530fc742e1Sericifdef(`confWORK_TIME_FACTOR',
2540fc742e1Seric	CONCAT(OZ, confWORK_TIME_FACTOR),
2550fc742e1Seric	#OZ90000)
2560fc742e1Seric
2570fc742e1Seric###########################
2580fc742e1Seric#   Message precedences   #
2590fc742e1Seric###########################
2600fc742e1Seric
2610fc742e1SericPfirst-class=0
2620fc742e1SericPspecial-delivery=100
26385afb57eSericPlist=-30
2640fc742e1SericPbulk=-60
2650fc742e1SericPjunk=-100
2660fc742e1Seric
2670fc742e1Seric#####################
2680fc742e1Seric#   Trusted users   #
2690fc742e1Seric#####################
2700fc742e1Seric
2710fc742e1SericTroot
2720fc742e1SericTdaemon
2730fc742e1SericTuucp
2740fc742e1Seric
2750fc742e1Seric#########################
2760fc742e1Seric#   Format of headers   #
2770fc742e1Seric#########################
2780fc742e1Seric
2790fc742e1SericH?P?Return-Path: <$?<$<$|$g$.>
2800fc742e1SericHReceived: $?sfrom $s $.by $j ($v/$Z) id $i; $b
2810fc742e1SericH?D?Resent-Date: $a
2820fc742e1SericH?D?Date: $a
2830fc742e1SericH?F?Resent-From: $q
2840fc742e1SericH?F?From: $q
2850fc742e1SericH?x?Full-Name: $x
2860fc742e1SericHSubject:
2870fc742e1Seric# HPosted-Date: $a
2880fc742e1Seric# H?l?Received-Date: $b
2890fc742e1SericH?M?Resent-Message-Id: <$t.$i@$j>
2900fc742e1SericH?M?Message-Id: <$t.$i@$j>
291c97ed732Sericundivert(6)dnl
2926f4c5567Seric#
2936f4c5567Seric######################################################################
2946f4c5567Seric######################################################################
2956f4c5567Seric#####
2966f4c5567Seric#####			REWRITING RULES
2976f4c5567Seric#####
2986f4c5567Seric######################################################################
2996f4c5567Seric######################################################################
3006f4c5567Seric
3016f4c5567Seric
3026f4c5567Seric###########################################
3036f4c5567Seric###  Rulset 3 -- Name Canonicalization  ###
3046f4c5567Seric###########################################
30571e1a4d1SericS3
3066f4c5567Seric
307*1c0b669eSeric# handle null input and list syntax (translate to <@> special case)
308*1c0b669eSericR$@			$@ <@>
309*1c0b669eSericR$*:;$*			$@ $1 ;: <@>
310f2ad5decSeric
3116f4c5567Seric# basic textual canonicalization -- note RFC733 heuristic here
3127b2c0d8dSericR$*<$*>$*<$*>$*		<$2>$3$4$5			strip multiple <> <>
31385ebc819SericR$*<$*<$+>$*>$*		<$3>$5				2-level <> nesting
314*1c0b669eSericR$*<>$*			$@ <@>				MAIL FROM:<> case
3156f4c5567SericR$*<$+>$*		$2				basic RFC821/822 parsing
3166f4c5567Seric
3176f4c5567Seric# make sure <@a,@b,@c:user@d> syntax is easy to parse -- undone later
3186f4c5567SericR@ $+ , $+		@ $1 : $2			change all "," to ":"
3196f4c5567Seric
3206f4c5567Seric# localize and dispose of route-based addresses
3216f4c5567SericR@ $+ : $+		$@ $>6 < @$1 > : $2		handle <route-addr>
3226f4c5567Seric
3236f4c5567Seric# find focus for list syntax
3246f4c5567SericR $+ : $* ; @ $+	$@ $>6 $1 : $2 ; < @ $3 >	list syntax
3256f4c5567SericR $+ : $* ;		$@ $1 : $2;			list syntax
3266f4c5567Seric
3276f4c5567Seric# find focus for @ syntax addresses
3286f4c5567SericR$+ @ $+		$: $1 < @ $2 >			focus on domain
3296f4c5567SericR$+ < $+ @ $+ >		$1 $2 < @ $3 >			move gaze right
3306f4c5567SericR$+ < @ $+ >		$@ $>6 $1 < @ $2 >		already canonical
3316f4c5567Seric
33290caf1e3Sericifdef(`_NO_UUCP_', `dnl',
33390caf1e3Seric`# convert old-style addresses to a domain-based address
3346f4c5567SericR$- ! $+		$@ $>6 $2 < @ $1 .UUCP >	resolve uucp names
3356f4c5567SericR$+ . $- ! $+		$@ $>6 $3 < @ $1 . $2 >		domain uucps
33690caf1e3SericR$+ ! $+		$@ $>6 $2 < @ $1 .UUCP >	uucp subdomains')
3376f4c5567Seric
3386f4c5567Seric# if we have % signs, take the rightmost one
3396f4c5567SericR$* % $*		$1 @ $2				First make them all @s.
3406f4c5567SericR$* @ $* @ $*		$1 % $2 @ $3			Undo all but the last.
3416f4c5567SericR$* @ $*		$@ $>6 $1 < @ $2 >		Insert < > and finish
3426f4c5567Seric
3436f4c5567Seric# else we must be a local name
3446f4c5567Seric
3456f4c5567Seric
3466f4c5567Seric###############################################
3476f4c5567Seric###  Ruleset 6 -- bottom half of ruleset 3  ###
3486f4c5567Seric###############################################
3496f4c5567Seric
35082027dd5Seric#  At this point, everything should be in a "local_part<@domain>extra" format.
3516f4c5567SericS6
3526f4c5567Seric
3536f4c5567Seric# handle special cases for local names
35463eeb308SericR$* < @ $=w > $*		$: $1 < @ $j . > $3		no domain at all
35563eeb308SericR$* < @ $=w . UUCP > $*		$: $1 < @ $j . > $3		.UUCP domain
35631695942Sericundivert(2)dnl
3576f4c5567Seric
358788179f5Sericifdef(`UUCP_RELAY',
359788179f5Seric`# pass UUCP addresses straight through
360788179f5SericR$* < @ $+ . UUCP > $*		$@ $1 < @ $2 . UUCP > $3',
361788179f5Seric`# if really UUCP, handle it immediately
36263eeb308Sericifdef(`_CLASS_U_',
36363eeb308Seric`R$* < @ $=U . UUCP > $*	$@ $1 < @ $2 . UUCP > $3', `dnl')
36463eeb308Sericifdef(`_CLASS_V_',
36563eeb308Seric`R$* < @ $=V . UUCP > $*	$@ $1 < @ $2 . UUCP > $3', `dnl')
36663eeb308Sericifdef(`_CLASS_W_',
36763eeb308Seric`R$* < @ $=W . UUCP > $*	$@ $1 < @ $2 . UUCP > $3', `dnl')
36863eeb308Sericifdef(`_CLASS_X_',
36963eeb308Seric`R$* < @ $=X . UUCP > $*	$@ $1 < @ $2 . UUCP > $3', `dnl')
37063eeb308Sericifdef(`_CLASS_Y_',
37163eeb308Seric`R$* < @ $=Y . UUCP > $*	$@ $1 < @ $2 . UUCP > $3', `dnl')
372a027f997Seric
373a027f997Seric# try UUCP traffic as a local address
37463eeb308SericR$* < @ $+ . UUCP > $*		$: $1 < @ $[ $2 $] . UUCP > $3
3754588ece0Sericifdef(`_OLD_SENDMAIL_',
3764cad3747Seric`R$* < @ $+ . $+ . UUCP > $*		$@ $1 < @ $2 . $3 . > $4',
37797777037Seric`R$* < @ $+ . . UUCP > $*		$@ $1 < @ $2 . > $3')')
378a027f997Seric
3796f4c5567Seric# pass to name server to make hostname canonical
38063eeb308SericR$* < @ $* $~. > $*		$: $1 < @ $[ $2 $3 $] > $4
38163eeb308Seric
38231695942Seric# handle possible alternate names
38331695942SericR$* < @ $=w . $m . > $*		$: $1 < @ $j . > $3
38431695942SericR$* < @ $=w . $m > $*		$: $1 < @ $j . > $3
38531695942Sericundivert(8)dnl
38631695942Seric
38763eeb308Seric# if this is the local hostname, make sure we treat is as canonical
38863eeb308SericR$* < @ $j > $*			$: $1 < @ $j . > $2
3896f4c5567Seric
3906f4c5567Seric
3916f4c5567Seric##################################################
3926f4c5567Seric###  Ruleset 4 -- Final Output Post-rewriting  ###
3936f4c5567Seric##################################################
3946f4c5567SericS4
3956f4c5567Seric
396*1c0b669eSericR$*<@>			$@ $1				handle <> and list:;
3976f4c5567Seric
3986f4c5567Seric# resolve numeric addresses to name if possible
3996f4c5567SericR$* < @ [ $+ ] > $*	$: $1 < @ $[ [$2] $] > $3	lookup numeric internet addr
4006f4c5567Seric
40163eeb308Seric# strip trailing dot off possibly canonical name
40263eeb308SericR$* < @ $+ . > $*	$1 < @ $2 > $3
40363eeb308Seric
4046f4c5567Seric# externalize local domain info
4056f4c5567SericR$* < $+ > $*		$1 $2 $3			defocus
4066f4c5567SericR@ $+ : @ $+ : $+	@ $1 , @ $2 : $3		<route-addr> canonical
4071f23b499SericR@ $*			$@ @ $1				... and exit
4086f4c5567Seric
40990caf1e3Sericifdef(`_NO_UUCP_', `dnl',
41090caf1e3Seric`# UUCP must always be presented in old form
41190caf1e3SericR$+ @ $- . UUCP		$2!$1				u@h.UUCP => h!u')
4126f4c5567Seric
4136f4c5567Seric# delete duplicate local names
414b47d0647SericR$+ % $=w @ $=w		$1 @ $j				u%host@host => u@host
4156f4c5567Seric
4166f4c5567Seric
4176f4c5567Seric
4186f4c5567Seric#############################################################
4196f4c5567Seric###   Ruleset 7 -- recanonicalize and call ruleset zero   ###
4206f4c5567Seric###		   (used for recursive calls)		  ###
4216f4c5567Seric#############################################################
4226f4c5567Seric
4236f4c5567SericS7
4246f4c5567SericR$*			$: $>3 $1
4256f4c5567SericR$*			$@ $>0 $1
4266f4c5567Seric
4276f4c5567Seric
4286f4c5567Seric######################################
4296f4c5567Seric###   Ruleset 0 -- Parse Address   ###
4306f4c5567Seric######################################
4316f4c5567Seric
4326f4c5567SericS0
4336f4c5567Seric
4341c5e29abSericR<>			$#local $: <>			special case error msgs
4351c5e29abSeric
4364cad3747Sericifdef(`_MAILER_smtp_',
4374cad3747Seric`# handle numeric address spec
4386f4c5567SericR$* < @ [ $+ ] > $*	$: $1 < @ $[ [$2] $] > $3	numeric internet addr
4394cad3747SericR$* < @ [ $+ ] > $*	$#smtp $@ [$2] $: $1 @ [$2] $3	numeric internet spec',
4403c5c069fSeric`dnl')
4416f4c5567Seric
442b1286b66Seric# now delete the local info -- note $=O to find characters that cause forwarding
44381ce4ccaSericR$* < @ > $*		$@ $>7 $1			user@ => user
44463eeb308SericR< @ $j . > : $*	$@ $>7 $1			@here:... -> ...
44563eeb308SericR$* $=O $* < @ $j . >	$@ $>7 $1 $2 $3			...@here -> ...
4466f4c5567Seric
4476f4c5567Seric# short circuit local delivery so forwarded email works
448525ff8d9SericR$+ < @ $j . >		$: $1 < @ $j @ $H >		first try hub
4494588ece0Sericifdef(`_OLD_SENDMAIL_',
45085afb57eSeric`R$+ < $+ @ $-:$+ >	$# $3 $@ $4 $: $1 < $2 >	yep ....
45185afb57eSericR$+ < $+ @ $+ >		$#smtp $@ $3 $: $1 < $2 >	yep ....
452525ff8d9SericR$+ < $+ @ >		$#local $: $1			nope, local address',
453525ff8d9Seric`R$+ < $+ @ $+ >		$#local $: $1			yep ....
454525ff8d9SericR$+ < $+ @ >		$#local $: @ $1			nope, local address')
4556f4c5567Sericundivert(3)dnl
45671e1a4d1Sericundivert(4)dnl
45771e1a4d1Seric
4584cad3747Seric# resolve remotely connected UUCP links (if any)
459138c6544Sericifdef(`_CLASS_V_',
4606dafc3b0Seric`R$* < @ $=V . UUCP > $*		$#smtp $@ $V $: <@ $V> : $1 @ $2.UUCP $3',
4616dafc3b0Seric	`dnl')
462138c6544Sericifdef(`_CLASS_W_',
4636dafc3b0Seric`R$* < @ $=W . UUCP > $*		$#smtp $@ $W $: <@ $W> : $1 @ $2.UUCP $3',
4646dafc3b0Seric	`dnl')
465138c6544Sericifdef(`_CLASS_X_',
4666dafc3b0Seric`R$* < @ $=X . UUCP > $*		$#smtp $@ $X $: <@ $X> : $1 @ $2.UUCP $3',
4676dafc3b0Seric	`dnl')
46871e1a4d1Seric
4696f4c5567Seric# resolve fake top level domains by forwarding to other hosts
4706f4c5567Sericifdef(`BITNET_RELAY',
4716f4c5567Seric`R$*<@$+.BITNET>$*	$#smtp $@ $B $: $1 <@$2.BITNET> $3	user@host.BITNET',
4726f4c5567Seric	`dnl')
4736f4c5567Sericifdef(`CSNET_RELAY',
4746f4c5567Seric`R$*<@$+.CSNET>$*	$#smtp $@ $C $: $1 <@$2.CSNET> $3	user@host.CSNET',
4756f4c5567Seric	`dnl')
4765caa7271Sericifdef(`_MAILER_fax_',
4775caa7271Seric`R$+ < @ $+ .FAX >	$#fax $@ $2 $: $1			user@host.FAX',
4785caa7271Seric`ifdef(`FAX_RELAY',
4795caa7271Seric`R$*<@$+.FAX>$*		$#smtp $@ $F $: $1 <@$2.FAX> $3		user@host.FAX',
4805caa7271Seric	`dnl')')
4816f4c5567Seric
48271e1a4d1Sericifdef(`UUCP_RELAY',
48371e1a4d1Seric`# forward non-local UUCP traffic to our UUCP relay
4846dafc3b0SericR$*<@$*.UUCP>$*		$#smtp $@ $Y $: <@ $Y> : $1 @ $2.UUCP $3	uucp mail',
4854cad3747Seric`ifdef(`_MAILER_uucp_',
48671e1a4d1Seric`# forward other UUCP traffic straight to UUCP
48771e1a4d1SericR< @ $+ .UUCP > : $+	$#uucp $@ $1 $: $1:$2			@host.UUCP:...
48871e1a4d1SericR$+ < @ $+ .UUCP >	$#uucp $@ $2 $: $1			user@host.UUCP',
48971e1a4d1Seric	`dnl')')
4906f4c5567Seric
49185afb57eSericifdef(`_LOCAL_RULES_',
49285afb57eSeric`# figure out what should stay in our local mail system
49385afb57eSericundivert(1)',
49485afb57eSeric`ifdef(`_MAILER_smtp_',
4954cad3747Seric`# deal with other remote names
49685afb57eSericR$* < @ $* > $*		$#smtp $@ $2 $: $1 < @ $2 > $3		user@host.domain')')
49785afb57eSericifdef(`SMART_HOST', `
49885afb57eSeric# pass names that still have a host to a smarthost
49985afb57eSericR$* < @ $* > $*		$: < $S > $1 < @ $2 > $3	glue on smarthost name
50085afb57eSericR<$-:$+> $* < @$* > $*	$# $1 $@ $2 $: $3 < @ $4 > $5	if non-null, use it
50185afb57eSericR<$+> $* < @$* > $*	$#suucp $@ $1 $: $2 < @ $3 > $4	if non-null, use it
50285afb57eSericR<> $* < @ $* > $*	$1 < @ $2 > $3			else strip off gunk',
50385afb57eSeric`ifdef(`_LOCAL_RULES_', `
50485afb57eSeric# reject messages that have host names we do not understand
50585afb57eSericR$* < @ $* > $*		$#error $@ NOHOST $: Unrecognized host name $2',
50685afb57eSeric`dnl')')
5072188aa70Sericifdef(`_MAILER_USENET_', `
5082188aa70Seric# addresses sent to net.group.USENET will get forwarded to a newsgroup
509a9e49ad1SericR$+ . USENET		$# usenet $: $1')
5106f4c5567Seric
5114588ece0Sericifdef(`_OLD_SENDMAIL_',
512b1286b66Seric`# forward remaining names to local relay, if any
513adca7ddbSericR$=L			$#local $: $1			special local names
514adca7ddbSericR$+			$: $1 < @ $R >			append relay
515525ff8d9SericR$+ < @ >		$: $1 < @ $H >			no relay, try hub
516525ff8d9SericR$+ < @ >		$#local $: $1			no relay or hub: local
517525ff8d9SericR$+ < @ $j  >		$#local $: $1			we are relay/hub: local
51885afb57eSericR$+ < @ $-:$+ >		$# $2 $@ $3 $: $1		deliver to relay/hub
519525ff8d9SericR$+ < @ $+ >		$#smtp $@ $2 $: $1		deliver to relay/hub',
5204588ece0Seric`# handle locally delivered names
5214588ece0SericR$=L			$#local $: @ $1			special local names
522adca7ddbSericR$+			$#local $: $1			regular local names
5236f4c5567Seric
5244cad3747Seric###########################################################################
5254cad3747Seric###   Ruleset 5 -- special rewriting after aliases have been expanded   ###
5264cad3747Seric###		   (new sendmail only)					###
5274cad3747Seric###########################################################################
5286f4c5567Seric
52963eeb308SericS5
53063eeb308Seric
5314cad3747Sericifdef(`_MAILER_smtp_',
5324cad3747Seric`R$+			$: $1 < @ $R >
533525ff8d9SericR$+ < @ >		$: $1 < @ $H >			no relay, try hub
534525ff8d9SericR$+ < @ $j >		$@ $1				we are relay/hub: local
53585afb57eSericR$+ < @ $-:$+ >		$# $2 $@ $3 $: $1		send to relay or hub
536525ff8d9SericR$+ < @ $+ >		$#smtp $@ $2 $: $1		send to relay or hub')')
5376f4c5567Seric#
5386f4c5567Seric######################################################################
5396f4c5567Seric######################################################################
5406f4c5567Seric#####
5411297e20cSeric`#####			MAILER DEFINITIONS'
5426f4c5567Seric#####
5436f4c5567Seric######################################################################
5446f4c5567Seric######################################################################
5456f4c5567Sericundivert(7)dnl
546