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