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