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