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