put $r into Received: line; ruleset 6 => 96, 7 => 97; fix ruleset
[unix-history] / usr / src / usr.sbin / sendmail / cf / m4 / proto.m4
CommitLineData
f25ecb3d
EA
1divert(-1)
2#
3# Copyright (c) 1983 Eric P. Allman
4# Copyright (c) 1988 The Regents of the University of California.
5# All rights reserved.
6#
7# %sccs.include.redist.sh%
8#
9divert(0)
10
576bbd75 11VERSIONID(`@(#)proto.m4 6.42 (Berkeley) %G%')
f25ecb3d 12
6f403f33 13MAILER(local)dnl
f25ecb3d 14
576bbd75
EA
15ifdef(`_OLD_SENDMAIL_',
16`define(`_SET_96_', 6)dnl
17define(`_SET_97_', 7)dnl',
e46fc989 18`# level 4 config file format
576bbd75
EA
19V4
20define(`_SET_96_', 96)dnl
21define(`_SET_97_', 97)dnl')
242270da 22
f25ecb3d
EA
23##################
24# local info #
25##################
26
7df175c3
EA
27CP.
28
dacf3c9f 29Cwlocalhost
5461a68b 30ifdef(`USE_CW_FILE',
dacf3c9f 31`# file containing names of hosts for which we receive email
a719f50c 32CONCAT(`Fw', confCW_FILE)', `dnl')
f25ecb3d
EA
33
34ifdef(`UUCP_RELAY',
35`# UUCP relay host
8038f5d5 36CONCAT(DY, UUCP_RELAY)
7df175c3 37CPUUCP
a151c868 38
f25ecb3d
EA
39')dnl
40ifdef(`BITNET_RELAY',
41`# BITNET relay host
42CONCAT(DB, BITNET_RELAY)
7df175c3 43CPBITNET
a151c868 44
f25ecb3d
EA
45')dnl
46ifdef(`CSNET_RELAY',
47`# CSNET relay host
48CONCAT(DC, CSNET_RELAY)
7df175c3 49CPCSNET
a151c868 50
d2e7dfa9
EA
51')dnl
52ifdef(`FAX_RELAY',
53`# FAX relay host
54CONCAT(DF, FAX_RELAY)
7df175c3 55CPFAX
d2e7dfa9 56
f25ecb3d 57')dnl
97dcbde7
EA
58ifdef(`SMART_HOST',
59`# "Smart" UUCP relay host
60CONCAT(DS, SMART_HOST)
f25ecb3d 61
8d95d628
EA
62')dnl
63ifdef(`MAILER_TABLE',
64`# Mailer table (overriding domains)
65Kmailertable MAILER_TABLE
66
97dcbde7 67')dnl
f25ecb3d
EA
68# who I send unqualified names to (null means deliver locally)
69CONCAT(DR, ifdef(`LOCAL_RELAY', LOCAL_RELAY))
70
22bc0471
EA
71# who gets all local email traffic ($R has precedence for unqualified names)
72CONCAT(DH, ifdef(`MAIL_HUB', MAIL_HUB))
73
97dcbde7
EA
74# my official hostname ($w or $w.$D)
75CONCAT(Dj$w, ifdef(`NEED_DOMAIN', .$D))
76
77# who I masquerade as (can be $j)
78CONCAT(DM, ifdef(`MASQUERADE_NAME', MASQUERADE_NAME, $j))
79
45eb1b8f
EA
80# class L: names that should be delivered locally, even if we have a relay
81# class E: names that should be exposed as from this host, even if we masquerade
3eb5f759 82CLroot
45eb1b8f 83CEroot
3eb5f759
EA
84undivert(5)dnl
85
f25ecb3d 86# operators that cannot be in local usernames (i.e., network indicators)
1429c39b 87CO @ % ifdef(`_NO_UUCP_', `', `!')
f25ecb3d 88
6f403f33
EA
89# a class with just dot (for identifying canonical names)
90C..
91
32014295
EA
92ifdef(`_OLD_SENDMAIL_', `dnl',
93`# dequoting map
94Kdequote dequote')
f25ecb3d 95
9863b6e1
EA
96undivert(6)dnl
97
a151c868
EA
98######################
99# Special macros #
100######################
101
102# SMTP initial login message
103CONCAT(De, confSMTP_LOGIN_MSG)
104
105# UNIX initial From header format
106CONCAT(Dl, confFROM_LINE)
107
108# my name for error messages
109CONCAT(Dn, confMAILER_NAME)
110
111# delimiter (operator) characters
112CONCAT(Do, confOPERATORS)
f25ecb3d 113
a151c868
EA
114# format of a total name
115CONCAT(Dq, ifdef(`confFROM_HEADER', confFROM_HEADER,
116 ifdef(`_OLD_SENDMAIL_', `$g$?x ($x)$.', `$?x$x <$g>$|$g$.')))
f25ecb3d 117include(`../m4/version.m4')
a151c868
EA
118
119###############
120# Options #
121###############
122
0b8c3ec1
EA
123# strip message body to 7 bits on input?
124CONCAT(O7, confSEVEN_BIT_INPUT)
a151c868
EA
125
126# wait (in minutes) for alias file rebuild
127CONCAT(Oa, confALIAS_WAIT)
128
129# location of alias file
130CONCAT(OA, ifdef(`ALIAS_FILE', ALIAS_FILE, /etc/aliases))
131
63381843
EA
132# minimum number of free blocks on filesystem
133CONCAT(Ob, confMIN_FREE_BLOCKS)
134
a151c868
EA
135# substitution for space (blank) characters
136CONCAT(OB, confBLANK_SUB)
137
138# connect to "expensive" mailers on initial submission?
139CONCAT(Oc, confCON_EXPENSIVE)
140
141# checkpoint queue runs after every N successful deliveries
142CONCAT(OC, confCHECKPOINT_INTERVAL)
143
144# default delivery mode
145CONCAT(Od, confDELIVERY_MODE)
146
147# automatically rebuild the alias database?
148CONCAT(OD, confAUTO_REBUILD)
149
150# error message header/file */
151ifdef(`confERROR_MESSAGE',
152 concat(OE, confERROR_MESSAGE),
153 #OE/etc/sendmail.oE)
154
155# error mode
156ifdef(`confERROR_MODE',
157 concat(Oe, confERROR_MODE),
158 #Oep)
159
160# save Unix-style "From_" lines at top of header?
161CONCAT(Of, confSAVE_FROM_LINES)
162
163# temporary file mode
164CONCAT(OF, confTEMP_FILE_MODE)
165
166# match recipients against GECOS field?
167CONCAT(OG, confMATCH_GECOS)
168
169# default GID
170CONCAT(Og, confDEF_GROUP_ID)
171
172# maximum hop count
173CONCAT(Oh, confMAX_HOP)
174
175# location of help file
176CONCAT(OH, ifdef(`HELP_FILE', HELP_FILE, /usr/lib/sendmail.hf))
177
178# ignore dots as terminators in incoming messages?
179CONCAT(Oi, confIGNORE_DOTS)
180
181# Insist that the BIND name server be running to resolve names
182ifdef(`confBIND_OPTS',
183 CONCAT(OI, confBIND_OPTS),
184 #OI)
185
0b8c3ec1
EA
186# deliver MIME-encapsulated error messages?
187CONCAT(Oj, confMIME_FORMAT_ERRORS)
188
a151c868
EA
189# Forward file search path
190ifdef(`confFORWARD_PATH',
191 CONCAT(OJ, confFORWARD_PATH),
192 #OJ/var/forward/$u:$z/.forward.$w:$z/.forward)
193
194# open connection cache size
195CONCAT(Ok, confMCI_CACHE_SIZE)
196
197# open connection cache timeout
198CONCAT(OK, confMCI_CACHE_TIMEOUT)
199
200# log level
201CONCAT(OL, confLOG_LEVEL)
202
203# send to me too, even in an alias expansion?
204CONCAT(Om, confME_TOO)
205
206# verify RHS in newaliases?
207CONCAT(On, confCHECK_ALIASES)
208
209# default messages to old style headers if no special punctuation?
210CONCAT(Oo, confOLD_STYLE_HEADERS)
211
4c230f32
EA
212# SMTP daemon options
213ifdef(`confDAEMON_OPTIONS',
214 CONCAT(OO, confDAEMON_OPTIONS),
215 #OOPort=esmtp)
216
63381843
EA
217# privacy flags
218CONCAT(Op, confPRIVACY_FLAGS)
219
a151c868
EA
220# who (if anyone) should get extra copies of error messages
221ifdef(`confCOPY_ERRORS_TO',
222 CONCAT(OP, confCOPY_ERRORS_TO),
223 #OPPostmaster)
224
225# slope of queue-only function
226ifdef(`confQUEUE_FACTOR',
227 CONCAT(Oq, confQUEUE_FACTOR),
228 #Oq600000)
229
230# queue directory
231CONCAT(OQ, ifdef(`QUEUE_DIR', QUEUE_DIR, /var/spool/mqueue))
232
233# read timeout -- now OK per RFC 1123 section 5.3.2
e46fc989
EA
234ifdef(`confREAD_TIMEOUT',
235 CONCAT(Or, confREAD_TIMEOUT),
236 #Ordatablock=10m)
a151c868
EA
237
238# queue up everything before forking?
239CONCAT(Os, confSAFE_QUEUE)
240
241# status file
242CONCAT(OS, ifdef(`STATUS_FILE', STATUS_FILE, /etc/sendmail.st))
243
244# default message timeout interval
245CONCAT(OT, confMESSAGE_TIMEOUT)
246
247# time zone handling:
248# if undefined, use system default
249# if defined but null, use TZ envariable passed in
250# if defined and non-null, use that info
251ifelse(confTIME_ZONE, `USE_SYSTEM', `#Ot',
252 confTIME_ZONE, `USE_TZ', `',
253 `CONCAT(Ot, confTIME_ZONE)')
254
255# default UID
256CONCAT(Ou, confDEF_USER_ID)
257
258# list of locations of user database file (null means no lookup)
bd00122c 259OU`'ifdef(`confUSERDB_SPEC', `confUSERDB_SPEC')
a151c868 260
4c230f32
EA
261# fallback MX host
262ifdef(`confFALLBACK_MX',
263 CONCAT(OV, confFALLBACK_MX),
264 #OVfall.back.host.net)
265
a151c868
EA
266# load average at which we just queue messages
267CONCAT(Ox, confQUEUE_LA)
268
269# load average at which we refuse connections
270CONCAT(OX, confREFUSE_LA)
271
272# work recipient factor
273ifdef(`confWORK_RECIPIENT_FACTOR',
274 CONCAT(Oy, confWORK_RECIPIENT_FACTOR),
275 #Oy30000)
276
277# deliver each queued job in a separate process?
278CONCAT(OY, confSEPARATE_PROC)
279
280# work class factor
281ifdef(`confWORK_CLASS_FACTOR',
282 CONCAT(Oz, confWORK_CLASS_FACTOR),
283 #Oz1800)
284
285# work time factor
286ifdef(`confWORK_TIME_FACTOR',
287 CONCAT(OZ, confWORK_TIME_FACTOR),
288 #OZ90000)
289
290###########################
291# Message precedences #
292###########################
293
294Pfirst-class=0
295Pspecial-delivery=100
97dcbde7 296Plist=-30
a151c868
EA
297Pbulk=-60
298Pjunk=-100
299
300#####################
301# Trusted users #
302#####################
303
304Troot
305Tdaemon
306Tuucp
307
308#########################
309# Format of headers #
310#########################
311
e0a38185 312H?P?Return-Path: $g
576bbd75 313HReceived: $?sfrom $s $.$?_($_) $.by $j ($v/$Z)$?r with $r$. id $i; $b
a151c868
EA
314H?D?Resent-Date: $a
315H?D?Date: $a
316H?F?Resent-From: $q
317H?F?From: $q
318H?x?Full-Name: $x
319HSubject:
320# HPosted-Date: $a
321# H?l?Received-Date: $b
322H?M?Resent-Message-Id: <$t.$i@$j>
323H?M?Message-Id: <$t.$i@$j>
f25ecb3d
EA
324#\f
325######################################################################
326######################################################################
327#####
328##### REWRITING RULES
329#####
330######################################################################
331######################################################################
332
da9b1c77 333undivert(9)dnl
f25ecb3d
EA
334
335###########################################
336### Rulset 3 -- Name Canonicalization ###
337###########################################
755e2424 338S3
f25ecb3d 339
66fe2d65
EA
340# handle null input and list syntax (translate to <@> special case)
341R$@ $@ <@>
23ae62a0 342R$*:;$* $@ $1 :; <@>
77e96a45 343
f25ecb3d 344# basic textual canonicalization -- note RFC733 heuristic here
ce25e438 345R$*<$*>$*<$*>$* <$2>$3$4$5 strip multiple <> <>
4850f6e1 346R$*<$*<$+>$*>$* <$3>$5 2-level <> nesting
66fe2d65 347R$*<>$* $@ <@> MAIL FROM:<> case
f25ecb3d
EA
348R$*<$+>$* $2 basic RFC821/822 parsing
349
350# make sure <@a,@b,@c:user@d> syntax is easy to parse -- undone later
56ec6f89 351R@ $+ , $+ @ $1 : $2 change all "," to ":"
f25ecb3d
EA
352
353# localize and dispose of route-based addresses
576bbd75 354R@ $+ : $+ $@ $>_SET_96_ < @$1 > : $2 handle <route-addr>
f25ecb3d
EA
355
356# find focus for list syntax
576bbd75 357R $+ : $* ; @ $+ $@ $>_SET_96_ $1 : $2 ; < @ $3 > list syntax
56ec6f89 358R $+ : $* ; $@ $1 : $2; list syntax
f25ecb3d
EA
359
360# find focus for @ syntax addresses
56ec6f89
EA
361R$+ @ $+ $: $1 < @ $2 > focus on domain
362R$+ < $+ @ $+ > $1 $2 < @ $3 > move gaze right
576bbd75 363R$+ < @ $+ > $@ $>_SET_96_ $1 < @ $2 > already canonical
f25ecb3d 364
1429c39b
EA
365ifdef(`_NO_UUCP_', `dnl',
366`# convert old-style addresses to a domain-based address
576bbd75
EA
367R$- ! $+ $@ $>_SET_96_ $2 < @ $1 .UUCP > resolve uucp names
368R$+ . $- ! $+ $@ $>_SET_96_ $3 < @ $1 . $2 > domain uucps
369R$+ ! $+ $@ $>_SET_96_ $2 < @ $1 .UUCP > uucp subdomains')
f25ecb3d
EA
370
371# if we have % signs, take the rightmost one
56ec6f89
EA
372R$* % $* $1 @ $2 First make them all @s.
373R$* @ $* @ $* $1 % $2 @ $3 Undo all but the last.
576bbd75 374R$* @ $* $@ $>_SET_96_ $1 < @ $2 > Insert < > and finish
f25ecb3d
EA
375
376# else we must be a local name
377
378
576bbd75
EA
379################################################
380### Ruleset _SET_96_ -- bottom half of ruleset 3 ###
381################################################
f25ecb3d 382
45eb1b8f 383# At this point, everything should be in a "local_part<@domain>extra" format.
576bbd75 384S`'_SET_96_
f25ecb3d
EA
385
386# handle special cases for local names
89906048
EA
387R$* < @ localhost > $* $: $1 < @ $j . > $2 no domain at all
388R$* < @ localhost . $m > $* $: $1 < @ $j . > $2 local domain
389ifdef(`_NO_UUCP_', `dnl',
390`R$* < @ localhost . UUCP > $* $: $1 < @ $j . > $2 .UUCP domain')
dacf3c9f 391undivert(2)dnl
80961747 392
f5ade8ff
EA
393ifdef(`_NO_UUCP_', `dnl',
394`ifdef(`UUCP_RELAY',
1ab66980 395`# pass UUCP addresses straight through
56ec6f89 396R$* < @ $+ . UUCP > $* $@ $1 < @ $2 . UUCP > $3',
1ab66980 397`# if really UUCP, handle it immediately
6f403f33 398ifdef(`_CLASS_U_',
56ec6f89 399`R$* < @ $=U . UUCP > $* $@ $1 < @ $2 . UUCP > $3', `dnl')
6f403f33 400ifdef(`_CLASS_V_',
56ec6f89 401`R$* < @ $=V . UUCP > $* $@ $1 < @ $2 . UUCP > $3', `dnl')
6f403f33 402ifdef(`_CLASS_W_',
56ec6f89 403`R$* < @ $=W . UUCP > $* $@ $1 < @ $2 . UUCP > $3', `dnl')
6f403f33 404ifdef(`_CLASS_X_',
56ec6f89 405`R$* < @ $=X . UUCP > $* $@ $1 < @ $2 . UUCP > $3', `dnl')
6f403f33 406ifdef(`_CLASS_Y_',
56ec6f89 407`R$* < @ $=Y . UUCP > $* $@ $1 < @ $2 . UUCP > $3', `dnl')
80961747
EA
408
409# try UUCP traffic as a local address
56ec6f89 410R$* < @ $+ . UUCP > $* $: $1 < @ $[ $2 $] . UUCP > $3
82960e03 411ifdef(`_OLD_SENDMAIL_',
56ec6f89
EA
412`R$* < @ $+ . $+ . UUCP > $* $@ $1 < @ $2 . $3 . > $4',
413`R$* < @ $+ . . UUCP > $* $@ $1 < @ $2 . > $3')')
f5ade8ff
EA
414')
415ifdef(`_NO_CANONIFY_', `dnl',
416`# pass to name server to make hostname canonical
7df175c3 417R$* < @ $* $~P > $* $: $1 < @ $[ $2 $3 $] > $4
f5ade8ff 418')
dacf3c9f
EA
419undivert(8)dnl
420
6f403f33
EA
421# if this is the local hostname, make sure we treat is as canonical
422R$* < @ $j > $* $: $1 < @ $j . > $2
f25ecb3d 423
f25ecb3d
EA
424
425##################################################
426### Ruleset 4 -- Final Output Post-rewriting ###
427##################################################
428S4
429
66fe2d65 430R$*<@> $@ $1 handle <> and list:;
f25ecb3d
EA
431
432# resolve numeric addresses to name if possible
6f403f33
EA
433R$* < @ [ $+ ] > $* $: $1 < @ $[ [$2] $] > $3 lookup numeric internet addr
434
435# strip trailing dot off possibly canonical name
436R$* < @ $+ . > $* $1 < @ $2 > $3
f25ecb3d
EA
437
438# externalize local domain info
6f403f33
EA
439R$* < $+ > $* $1 $2 $3 defocus
440R@ $+ : @ $+ : $+ @ $1 , @ $2 : $3 <route-addr> canonical
9d6b5c00 441R@ $* $@ @ $1 ... and exit
f25ecb3d 442
1429c39b
EA
443ifdef(`_NO_UUCP_', `dnl',
444`# UUCP must always be presented in old form
445R$+ @ $- . UUCP $2!$1 u@h.UUCP => h!u')
f25ecb3d
EA
446
447# delete duplicate local names
6f403f33 448R$+ % $=w @ $=w $1 @ $j u%host@host => u@host
f25ecb3d
EA
449
450
451
576bbd75
EA
452##############################################################
453### Ruleset _SET_97_ -- recanonicalize and call ruleset zero ###
454### (used for recursive calls) ###
455##############################################################
f25ecb3d 456
576bbd75 457S`'_SET_97_
f25ecb3d
EA
458R$* $: $>3 $1
459R$* $@ $>0 $1
460
461
462######################################
463### Ruleset 0 -- Parse Address ###
464######################################
465
466S0
467
00948e88 468R<@> $#local $: <> special case error msgs
0b8c3ec1 469R$*:;<@> $#error $@ USAGE $: "list:; syntax illegal for recipient addresses"
89d51ef0 470
56ec6f89
EA
471ifdef(`_MAILER_smtp_',
472`# handle numeric address spec
6f403f33 473R$* < @ [ $+ ] > $* $: $1 < @ $[ [$2] $] > $3 numeric internet addr
56ec6f89 474R$* < @ [ $+ ] > $* $#smtp $@ [$2] $: $1 @ [$2] $3 numeric internet spec',
6f92b9b3 475`dnl')
f25ecb3d 476
5461a68b 477# now delete the local info -- note $=O to find characters that cause forwarding
576bbd75
EA
478R$* < @ > $* $@ $>_SET_97_ $1 user@ => user
479R< @ $=w . > : $* $@ $>_SET_97_ $2 @here:... -> ...
480R$* $=O $* < @ $=w . > $@ $>_SET_97_ $1 $2 $3 ...@here -> ...
8d95d628
EA
481ifdef(`MAILER_TABLE',
482`
483# try mailer table lookup
7d426e19 484R$* < @ $-:$+ > $* $# $2 $@ $3 $: $1 @ $3 $4 found a match',
8d95d628 485`dnl')
f25ecb3d
EA
486
487# short circuit local delivery so forwarded email works
2664707d 488ifdef(`_LOCAL_NOT_STICKY_',
576bbd75
EA
489`R$=L < @ $=w . > $#local $: @ $1 special local names
490R$+ < @ $=w . > $#local $: $1 dispose directly',
491`R$+ < @ $=w . > $: $1 < @ $2 @ $H > first try hub
82960e03 492ifdef(`_OLD_SENDMAIL_',
7d426e19
EA
493`R$+ < $+ @ $-:$+ > $# $3 $@ $4 $: $1 $2 yep ....
494R$+ < $+ @ $+ > $#relay $@ $3 $: $1 $2 yep ....
22bc0471
EA
495R$+ < $+ @ > $#local $: $1 nope, local address',
496`R$+ < $+ @ $+ > $#local $: $1 yep ....
2664707d 497R$+ < $+ @ > $#local $: @ $1 nope, local address')')
f25ecb3d 498undivert(3)dnl
755e2424
EA
499undivert(4)dnl
500
56ec6f89 501# resolve remotely connected UUCP links (if any)
708a514b 502ifdef(`_CLASS_V_',
7d426e19 503`R$* < @ $=V . UUCP > $* $#smtp $@ $V $: @ $V : $1 @ $2.UUCP $3',
47523c33 504 `dnl')
708a514b 505ifdef(`_CLASS_W_',
7d426e19 506`R$* < @ $=W . UUCP > $* $#smtp $@ $W $: @ $W : $1 @ $2.UUCP $3',
47523c33 507 `dnl')
708a514b 508ifdef(`_CLASS_X_',
7d426e19 509`R$* < @ $=X . UUCP > $* $#smtp $@ $X $: @ $X : $1 @ $2.UUCP $3',
47523c33 510 `dnl')
755e2424 511
f25ecb3d
EA
512# resolve fake top level domains by forwarding to other hosts
513ifdef(`BITNET_RELAY',
7d426e19 514`R$*<@$+.BITNET>$* $#smtp $@ $B $: $1 @ $2 . BITNET $3 user@host.BITNET',
f25ecb3d
EA
515 `dnl')
516ifdef(`CSNET_RELAY',
7d426e19 517`R$*<@$+.CSNET>$* $#smtp $@ $C $: $1 @ $2 . CSNET $3 user@host.CSNET',
f25ecb3d 518 `dnl')
d2e7dfa9
EA
519ifdef(`_MAILER_fax_',
520`R$+ < @ $+ .FAX > $#fax $@ $2 $: $1 user@host.FAX',
521`ifdef(`FAX_RELAY',
7d426e19 522`R$*<@$+.FAX>$* $#smtp $@ $F $: $1 @ $2 . FAX $3 user@host.FAX',
d2e7dfa9 523 `dnl')')
f25ecb3d 524
755e2424
EA
525ifdef(`UUCP_RELAY',
526`# forward non-local UUCP traffic to our UUCP relay
7d426e19 527R$*<@$*.UUCP>$* $#smtp $@ $Y $: @ $Y : $1 @ $2.UUCP $3 uucp mail',
56ec6f89 528`ifdef(`_MAILER_uucp_',
755e2424 529`# forward other UUCP traffic straight to UUCP
7d426e19 530R< @ $+ .UUCP > : $+ $#uucp $@ $1 $: $2 @host.UUCP:...
6f403f33 531R$+ < @ $+ .UUCP > $#uucp $@ $2 $: $1 user@host.UUCP',
755e2424
EA
532 `dnl')')
533
97dcbde7
EA
534ifdef(`_LOCAL_RULES_',
535`# figure out what should stay in our local mail system
536undivert(1)',
537`ifdef(`_MAILER_smtp_',
56ec6f89 538`# deal with other remote names
7d426e19 539R$* < @ $* > $* $#smtp $@ $2 $: $1 @ $2 $3 user@host.domain')')
97dcbde7
EA
540ifdef(`SMART_HOST', `
541# pass names that still have a host to a smarthost
542R$* < @ $* > $* $: < $S > $1 < @ $2 > $3 glue on smarthost name
7d426e19
EA
543R<$-:$+> $* < @$* > $* $# $1 $@ $2 $: $3 @ $4 $5 if non-null, use it
544R<$+> $* < @$* > $* $#suucp $@ $1 $: $2 @ $3 $4 if non-null, use it
97dcbde7
EA
545R<> $* < @ $* > $* $1 < @ $2 > $3 else strip off gunk',
546`ifdef(`_LOCAL_RULES_', `
547# reject messages that have host names we do not understand
548R$* < @ $* > $* $#error $@ NOHOST $: Unrecognized host name $2',
549`dnl')')
63381843
EA
550ifdef(`_MAILER_USENET_', `
551# addresses sent to net.group.USENET will get forwarded to a newsgroup
b7a43487 552R$+ . USENET $# usenet $: $1')
f25ecb3d 553
82960e03 554ifdef(`_OLD_SENDMAIL_',
5461a68b 555`# forward remaining names to local relay, if any
37e8750f
EA
556R$=L $#local $: $1 special local names
557R$+ $: $1 < @ $R > append relay
22bc0471
EA
558R$+ < @ > $: $1 < @ $H > no relay, try hub
559R$+ < @ > $#local $: $1 no relay or hub: local
576bbd75 560R$+ < @ $=w > $#local $: $1 we are relay/hub: local
97dcbde7 561R$+ < @ $-:$+ > $# $2 $@ $3 $: $1 deliver to relay/hub
0d8911b2 562R$+ < @ $+ > $#relay $@ $2 $: $1 deliver to relay/hub',
ccfcf4aa
EA
563
564`# if this is quoted, strip the quotes and try again
565R$+ $: $(dequote $1 $) strip quotes
576bbd75 566R$* $=O $* $@ $>_SET_97_ $1 $2 $3 try again
ccfcf4aa
EA
567
568# handle locally delivered names
37e8750f
EA
569R$=L $#local $: @ $1 special local names
570R$+ $#local $: $1 regular local names
6f403f33 571
56ec6f89
EA
572###########################################################################
573### Ruleset 5 -- special rewriting after aliases have been expanded ###
574### (new sendmail only) ###
575###########################################################################
f25ecb3d 576
6f403f33 577S5
f25ecb3d 578
32014295
EA
579# see if we have a relay or a hub
580R$+ $: $1 < @ $R >
22bc0471 581R$+ < @ > $: $1 < @ $H > no relay, try hub
576bbd75 582R$+ < @ $=w > $@ $1 we are relay/hub: local
97dcbde7 583R$+ < @ $-:$+ > $# $2 $@ $3 $: $1 send to relay or hub
32014295
EA
584ifdef(`_MAILER_smtp_',
585`R$+ < @ $+ > $#relay $@ $2 $: $1 send to relay or hub')')
bc09d8d3
EA
586ifdef(`MAILER_TABLE',
587`
588
589###########################################################################
590### Ruleset 90 -- try domain part of mailertable entry ###
591### (new sendmail only) ###
592###########################################################################
593
594S90
595R<$- . $+ > $* $: < $(mailertable .$2 $: $) > $3 lookup
596R<$- : $+ > $* $# $1 $@ $2 $: $3 check -- resolved?
576bbd75 597R<$- . $+ > $* $@ $>90 <$2> $3 no -- strip & try again
bc09d8d3
EA
598R<$*> $* $@ $2 no match',
599`dnl')
f25ecb3d
EA
600#\f
601######################################################################
602######################################################################
603#####
ec174858 604`##### MAILER DEFINITIONS'
f25ecb3d
EA
605#####
606######################################################################
607######################################################################
f25ecb3d 608undivert(7)dnl