add DontExpandCnames option -- IETF seems to be moving in this direction
[unix-history] / usr / src / usr.sbin / sendmail / cf / m4 / proto.m4
CommitLineData
f25ecb3d
EA
1divert(-1)
2#
c9c2d38e 3# Copyright (c) 1983, 1995 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
71b0c7cb 11VERSIONID(`@(#)proto.m4 8.80 (Berkeley) %G%')
f25ecb3d 12
6f403f33 13MAILER(local)dnl
f25ecb3d 14
d4e68feb 15# level 6 config file format
7ec5e19b
EA
16V6/Berkeley
17divert(-1)
18
a9c22d5a
EA
19# do some sanity checking
20ifdef(`__OSTYPE__',,
21 `errprint(`*** ERROR: No system type defined (use OSTYPE macro)')')
22
7ec5e19b
EA
23# pick our default mailers
24ifdef(`confSMTP_MAILER',, `define(`confSMTP_MAILER', `smtp')')
25ifdef(`confLOCAL_MAILER',, `define(`confLOCAL_MAILER', `local')')
feae130e
EA
26ifdef(`confRELAY_MAILER',,
27 `define(`confRELAY_MAILER',
28 `ifdef(`_MAILER_smtp_', `relay',
7ec5e19b 29 `ifdef(`_MAILER_uucp', `suucp', `unknown')')')')
2c840221
EA
30define(`_SMTP_', `confSMTP_MAILER')dnl for readability only
31define(`_LOCAL_', `confLOCAL_MAILER')dnl for readability only
feae130e 32define(`_RELAY_', `confRELAY_MAILER')dnl for readability only
242270da 33
7ec5e19b
EA
34# back compatibility with old config files
35ifdef(`confDEF_GROUP_ID',
36 `errprint(`*** confDEF_GROUP_ID is obsolete.')
37 errprint(` Use confDEF_USER_ID with a colon in the value instead.')')
38ifdef(`confREAD_TIMEOUT',
39 `errprint(`*** confREAD_TIMEOUT is obsolete.')
40 errprint(` Use individual confTO_<timeout> parameters instead.')')
41ifdef(`confMESSAGE_TIMEOUT',
42 `define(`_ARG_', index(confMESSAGE_TIMEOUT, /))
43 ifelse(_ARG_, -1,
44 `define(`confTO_QUEUERETURN', confMESSAGE_TIMEOUT)',
45 `define(`confTO_QUEUERETURN',
46 substr(confMESSAGE_TIMEOUT, 0, _ARG_))
47 define(`confTO_QUEUEWARN',
48 substr(confMESSAGE_TIMEOUT, eval(_ARG_+1)))')')
49ifdef(`confMIN_FREE_BLOCKS', `ifelse(index(confMIN_FREE_BLOCKS, /), -1,,
50 `errprint(`*** compound confMIN_FREE_BLOCKS is obsolete.')
51 errprint(` Use confMAX_MESSAGE_SIZE for the second part of the value.')')')
52
53# clean option definitions below....
54define(`_OPTION', `ifdef(`$2', `O $1=$2', `#O $1`'ifelse($3, `',, `=$3')')')dnl
55
56divert(0)dnl
57
f25ecb3d
EA
58##################
59# local info #
60##################
61
dacf3c9f 62Cwlocalhost
5461a68b 63ifdef(`USE_CW_FILE',
dacf3c9f 64`# file containing names of hosts for which we receive email
1bdba97e
EA
65Fw`'confCW_FILE',
66 `dnl')
7ec5e19b 67
64100696 68# my official domain name
7ec5e19b
EA
69# ... define this only if sendmail cannot automatically determine your domain
70ifdef(`confDOMAIN_NAME', `Dj`'confDOMAIN_NAME', `#Dj$w.Foo.COM')
64100696 71
7ec5e19b 72ifdef(`_NULL_CLIENT_ONLY_', `divert(-1)')dnl
64100696
EA
73
74CP.
f25ecb3d
EA
75
76ifdef(`UUCP_RELAY',
77`# UUCP relay host
1bdba97e 78DY`'UUCP_RELAY
7df175c3 79CPUUCP
a151c868 80
f25ecb3d
EA
81')dnl
82ifdef(`BITNET_RELAY',
83`# BITNET relay host
1bdba97e 84DB`'BITNET_RELAY
7df175c3 85CPBITNET
a151c868 86
fb463c52
EA
87')dnl
88ifdef(`DECNET_RELAY',
28cbfc47 89`define(`_USE_DECNET_SYNTAX_')dnl
fb463c52
EA
90# DECnet relay host
91DC`'DECNET_RELAY
92CPDECNET
93
d2e7dfa9
EA
94')dnl
95ifdef(`FAX_RELAY',
96`# FAX relay host
1bdba97e 97DF`'FAX_RELAY
7df175c3 98CPFAX
d2e7dfa9 99
f25ecb3d 100')dnl
64100696
EA
101# "Smart" relay host (may be null)
102DS`'ifdef(`SMART_HOST', SMART_HOST)
f25ecb3d 103
efd6da82
EA
104ifdef(`LUSER_RELAY',
105`# place to which unknown users should be forwarded
106Kuser user -m -a<>
107DL`'LUSER_RELAY
108', `dnl')
109
7ec5e19b
EA
110# operators that cannot be in local usernames (i.e., network indicators)
111CO @ % ifdef(`_NO_UUCP_', `', `!')
112
113# a class with just dot (for identifying canonical names)
114C..
115
8d95d628
EA
116ifdef(`MAILER_TABLE',
117`# Mailer table (overriding domains)
118Kmailertable MAILER_TABLE
119
e653dde7
EA
120')dnl
121ifdef(`DOMAIN_TABLE',
122`# Domain table (adding domains)
123Kdomaintable DOMAIN_TABLE
124
97dcbde7 125')dnl
f25ecb3d 126# who I send unqualified names to (null means deliver locally)
1bdba97e 127DR`'ifdef(`LOCAL_RELAY', LOCAL_RELAY)
f25ecb3d 128
22bc0471 129# who gets all local email traffic ($R has precedence for unqualified names)
1bdba97e 130DH`'ifdef(`MAIL_HUB', MAIL_HUB)
22bc0471 131
45eb1b8f
EA
132# class L: names that should be delivered locally, even if we have a relay
133# class E: names that should be exposed as from this host, even if we masquerade
f4d9c9f9
EA
134#CL root
135CE root
3eb5f759
EA
136undivert(5)dnl
137
f22970ed
EA
138# dequoting map
139Kdequote dequote
f25ecb3d 140
7ec5e19b
EA
141divert(0)dnl
142# who I masquerade as (null for no masquerading)
143DM`'ifdef(`MASQUERADE_NAME', MASQUERADE_NAME)
144
9863b6e1
EA
145undivert(6)dnl
146
a151c868
EA
147######################
148# Special macros #
149######################
150
151# SMTP initial login message
1bdba97e 152De`'confSMTP_LOGIN_MSG
a151c868
EA
153
154# UNIX initial From header format
1bdba97e 155Dl`'confFROM_LINE
a151c868
EA
156
157# my name for error messages
1bdba97e 158Dn`'confMAILER_NAME
a151c868
EA
159
160# delimiter (operator) characters
1bdba97e 161Do`'confOPERATORS
f25ecb3d 162
a151c868 163# format of a total name
f4d9c9f9 164Dq`'ifdef(`confFROM_HEADER', confFROM_HEADER, `$?x$x <$g>$|$g$.')
f25ecb3d 165include(`../m4/version.m4')
a151c868
EA
166
167###############
168# Options #
169###############
170
0b8c3ec1 171# strip message body to 7 bits on input?
7ec5e19b 172_OPTION(SevenBitInput, `confSEVEN_BIT_INPUT')
a151c868 173
3ffefc8a 174# 8-bit data handling
7ec5e19b 175_OPTION(EightBitMode, `confEIGHT_BIT_HANDLING', adaptive)
3ffefc8a 176
7ec5e19b
EA
177# wait for alias file rebuild (default units: minutes)
178_OPTION(AliasWait, `confALIAS_WAIT', 5m)
a151c868
EA
179
180# location of alias file
7ec5e19b 181O AliasFile=ifdef(`ALIAS_FILE', `ALIAS_FILE', /etc/aliases)
a151c868 182
63381843 183# minimum number of free blocks on filesystem
7ec5e19b
EA
184_OPTION(MinFreeBlocks, `confMIN_FREE_BLOCKS', 100)
185
186# maximum message size
187_OPTION(MaxMessageSize, `confMAX_MESSAGE_SIZE', 1000000)
63381843 188
a151c868 189# substitution for space (blank) characters
7ec5e19b 190_OPTION(BlankSub, `confBLANK_SUB', _)
a151c868 191
82561627 192# avoid connecting to "expensive" mailers on initial submission?
7ec5e19b 193_OPTION(HoldExpensive, `confCON_EXPENSIVE')
a151c868
EA
194
195# checkpoint queue runs after every N successful deliveries
7ec5e19b 196_OPTION(CheckpointInterval, `confCHECKPOINT_INTERVAL', 10)
a151c868
EA
197
198# default delivery mode
7ec5e19b 199_OPTION(DeliveryMode, `confDELIVERY_MODE', background)
a151c868
EA
200
201# automatically rebuild the alias database?
7ec5e19b 202_OPTION(AutoRebuildAliases, `confAUTO_REBUILD')
a151c868 203
1bdba97e 204# error message header/file
7ec5e19b 205_OPTION(ErrorHeader, `confERROR_MESSAGE', /etc/sendmail.oE)
a151c868
EA
206
207# error mode
7ec5e19b 208_OPTION(ErrorMode, `confERROR_MODE', print)
a151c868
EA
209
210# save Unix-style "From_" lines at top of header?
7ec5e19b 211_OPTION(SaveFromLine, `confSAVE_FROM_LINES')
a151c868
EA
212
213# temporary file mode
7ec5e19b 214_OPTION(TempFileMode, `confTEMP_FILE_MODE', 0600)
a151c868
EA
215
216# match recipients against GECOS field?
7ec5e19b 217_OPTION(MatchGECOS, `confMATCH_GECOS')
a151c868
EA
218
219# maximum hop count
7ec5e19b 220_OPTION(MaxHopCount, `confMAX_HOP', 17)
a151c868
EA
221
222# location of help file
7ec5e19b 223O HelpFile=ifdef(`HELP_FILE', HELP_FILE, /usr/lib/sendmail.hf)
a151c868
EA
224
225# ignore dots as terminators in incoming messages?
7ec5e19b 226_OPTION(IgnoreDots, `confIGNORE_DOTS')
a151c868 227
7ec5e19b
EA
228# name resolver options
229_OPTION(ResolverOptions, `confBIND_OPTS', +AAONLY)
a151c868 230
0b8c3ec1 231# deliver MIME-encapsulated error messages?
7ec5e19b 232_OPTION(SendMimeErrors, `confMIME_FORMAT_ERRORS')
0b8c3ec1 233
a151c868 234# Forward file search path
7ec5e19b 235_OPTION(ForwardPath, `confFORWARD_PATH', /var/forward/$u:$z/.forward.$w:$z/.forward)
a151c868
EA
236
237# open connection cache size
7ec5e19b 238_OPTION(ConnectionCacheSize, `confMCI_CACHE_SIZE', 2)
a151c868
EA
239
240# open connection cache timeout
7ec5e19b 241_OPTION(ConnectionCacheTimeout, `confMCI_CACHE_TIMEOUT', 5m)
a151c868 242
b28237e4 243# use Errors-To: header?
7ec5e19b 244_OPTION(UseErrorsTo, `confUSE_ERRORS_TO')
b28237e4 245
a151c868 246# log level
7ec5e19b 247_OPTION(LogLevel, `confLOG_LEVEL', 10)
a151c868
EA
248
249# send to me too, even in an alias expansion?
7ec5e19b 250_OPTION(MeToo, `confME_TOO')
a151c868
EA
251
252# verify RHS in newaliases?
7ec5e19b 253_OPTION(CheckAliases, `confCHECK_ALIASES')
a151c868
EA
254
255# default messages to old style headers if no special punctuation?
7ec5e19b 256_OPTION(OldStyleHeaders, `confOLD_STYLE_HEADERS')
a151c868 257
4c230f32 258# SMTP daemon options
7ec5e19b 259_OPTION(DaemonPortOptions, `confDAEMON_OPTIONS', Port=esmtp)
4c230f32 260
63381843 261# privacy flags
7ec5e19b 262_OPTION(PrivacyOptions, `confPRIVACY_FLAGS', authwarnings)
63381843 263
a151c868 264# who (if anyone) should get extra copies of error messages
7ec5e19b 265_OPTION(PostMasterCopy, `confCOPY_ERRORS_TO', Postmaster)
a151c868
EA
266
267# slope of queue-only function
7ec5e19b 268_OPTION(QueueFactor, `confQUEUE_FACTOR', 600000)
a151c868
EA
269
270# queue directory
7ec5e19b
EA
271O QueueDirectory=ifdef(`QUEUE_DIR', QUEUE_DIR, /var/spool/mqueue)
272
273# timeouts (many of these)
274_OPTION(Timeout.initial, `confTO_INITIAL', 5m)
275_OPTION(Timeout.helo, `confTO_HELO', 5m)
276_OPTION(Timeout.mail, `confTO_MAIL', 10m)
277_OPTION(Timeout.rcpt, `confTO_RCPT', 1h)
278_OPTION(Timeout.datainit, `confTO_DATAINIT', 5m)
279_OPTION(Timeout.datablock, `confTO_DATABLOCK', 1h)
280_OPTION(Timeout.datafinal, `confTO_DATAFINAL', 1h)
281_OPTION(Timeout.rset, `confTO_RSET', 5m)
282_OPTION(Timeout.quit, `confTO_QUIT', 2m)
283_OPTION(Timeout.misc, `confTO_MISC', 2m)
284_OPTION(Timeout.command, `confTO_COMMAND', 1h)
285_OPTION(Timeout.ident, `confTO_IDENT', 30s)
286_OPTION(Timeout.fileopen, `confTO_FILEOPEN', 60s)
287_OPTION(Timeout.queuereturn, `confTO_QUEUERETURN', 5d)
288_OPTION(Timeout.queuereturn.normal, `confTO_QUEUERETURN_NORMAL', 5d)
289_OPTION(Timeout.queuereturn.urgent, `confTO_QUEUERETURN_URGENT', 2d)
290_OPTION(Timeout.queuereturn.non-urgent, `confTO_QUEUERETURN_NONURGENT', 7d)
291_OPTION(Timeout.queuewarn, `confTO_QUEUEWARN', 4h)
292_OPTION(Timeout.queuewarn.normal, `confTO_QUEUEWARN_NORMAL', 4h)
293_OPTION(Timeout.queuewarn.urgent, `confTO_QUEUEWARN_URGENT', 1h)
294_OPTION(Timeout.queuewarn.non-urgent, `confTO_QUEUEWARN_NONURGENT', 12h)
a151c868 295
919277d7 296# should we not prune routes in route-addr syntax addresses?
7ec5e19b 297_OPTION(DontPruneRoutes, `confDONT_PRUNE_ROUTES')
919277d7 298
a151c868 299# queue up everything before forking?
7ec5e19b 300_OPTION(SuperSafe, `confSAFE_QUEUE')
a151c868
EA
301
302# status file
02d92b2b 303O StatusFile=ifdef(`STATUS_FILE', `STATUS_FILE', /etc/sendmail.st)
a151c868
EA
304
305# time zone handling:
306# if undefined, use system default
307# if defined but null, use TZ envariable passed in
308# if defined and non-null, use that info
7ec5e19b
EA
309ifelse(confTIME_ZONE, `USE_SYSTEM', `#O TimeZoneSpec=',
310 confTIME_ZONE, `USE_TZ', `O TimeZoneSpec=',
311 `O TimeZoneSpec=confTIME_ZONE')
a151c868 312
7ec5e19b
EA
313# default UID (can be username or userid:groupid)
314_OPTION(DefaultUser, `confDEF_USER_ID', nobody)
a151c868
EA
315
316# list of locations of user database file (null means no lookup)
7ec5e19b 317_OPTION(UserDatabaseSpec, `confUSERDB_SPEC', /etc/userdb)
a151c868 318
4c230f32 319# fallback MX host
7ec5e19b 320_OPTION(FallbackMXhost, `confFALLBACK_MX', fall.back.host.net)
4c230f32 321
d8ebcd49 322# if we are the best MX host for a site, try it directly instead of config err
7ec5e19b 323_OPTION(TryNullMXList, `confTRY_NULL_MX_LIST')
d8ebcd49 324
a151c868 325# load average at which we just queue messages
7ec5e19b 326_OPTION(QueueLA, `confQUEUE_LA', 8)
a151c868
EA
327
328# load average at which we refuse connections
7ec5e19b 329_OPTION(RefuseLA, `confREFUSE_LA', 12)
a151c868
EA
330
331# work recipient factor
7ec5e19b 332_OPTION(RecipientFactor, `confWORK_RECIPIENT_FACTOR', 30000)
a151c868
EA
333
334# deliver each queued job in a separate process?
7ec5e19b 335_OPTION(ForkEachJob, `confSEPARATE_PROC')
a151c868
EA
336
337# work class factor
7ec5e19b 338_OPTION(ClassFactor, `confWORK_CLASS_FACTOR', 1800)
a151c868
EA
339
340# work time factor
7ec5e19b 341_OPTION(RetryFactor, `confWORK_TIME_FACTOR', 90000)
a151c868 342
26984f4d 343# shall we sort the queue by hostname first?
7ec5e19b
EA
344_OPTION(QueueSortOrder, `confQUEUE_SORT_ORDER', priority)
345
346# minimum time in queue before retry
347_OPTION(MinQueueAge, `confMIN_QUEUE_AGE', 30m)
348
349# default character set
350_OPTION(DefaultCharSet, `confDEF_CHAR_SET', iso-8859-1)
351
352# service switch file (ignored on Solaris, Ultrix, OSF/1, others)
353_OPTION(ServiceSwitchFile, `confSERVICE_SWITCH_FILE', /etc/service.switch)
354
355# dialup line delay on connection failure
356_OPTION(DialDelay, `confDIAL_DELAY', 10s)
357
358# action to take if there are no recipients in the message
359_OPTION(NoRecipientAction, `confNO_RCPT_ACTION', add-to-undisclosed)
360
361# chrooted environment for writing to files
362_OPTION(SafeFileEnvironment, `confSAFE_FILE_ENV', /arch)
26984f4d 363
ef9e3443
EA
364# are colons OK in addresses?
365_OPTION(ColonOkInAddr, `confCOLON_OK_IN_ADDR')
366
a7dce3ac
EA
367# how many jobs can you process in the queue?
368_OPTION(MaxQueueRunSize, `confMAX_QUEUE_RUN_SIZE', 10000)
369
71b0c7cb
EA
370# shall I avoid expanding CNAMEs (violates protocols)?
371_OPTION(DontExpandCnames, `confDONT_EXPAND_CNAMES')
372
a151c868
EA
373###########################
374# Message precedences #
375###########################
376
377Pfirst-class=0
378Pspecial-delivery=100
97dcbde7 379Plist=-30
a151c868
EA
380Pbulk=-60
381Pjunk=-100
382
383#####################
384# Trusted users #
385#####################
386
7ec5e19b
EA
387# this is equivalent to setting class "t"
388#Ft/etc/sendmail.trusted
a151c868
EA
389Troot
390Tdaemon
391Tuucp
392
393#########################
394# Format of headers #
395#########################
396
e0a38185 397H?P?Return-Path: $g
d1c8c981 398HReceived: confRECEIVED_HEADER
a151c868
EA
399H?D?Resent-Date: $a
400H?D?Date: $a
401H?F?Resent-From: $q
402H?F?From: $q
403H?x?Full-Name: $x
404HSubject:
405# HPosted-Date: $a
406# H?l?Received-Date: $b
407H?M?Resent-Message-Id: <$t.$i@$j>
408H?M?Message-Id: <$t.$i@$j>
7ec5e19b
EA
409ifdef(`_NULL_CLIENT_ONLY_',
410 `include(../m4/nullrelay.m4)m4exit',
411 `dnl')
f25ecb3d
EA
412#\f
413######################################################################
414######################################################################
415#####
416##### REWRITING RULES
417#####
418######################################################################
419######################################################################
420
da9b1c77 421undivert(9)dnl
f25ecb3d
EA
422
423###########################################
424### Rulset 3 -- Name Canonicalization ###
425###########################################
755e2424 426S3
f25ecb3d 427
d2fe4e9e 428# handle null input (translate to <@> special case)
66fe2d65 429R$@ $@ <@>
77e96a45 430
6449d970
EA
431# strip group: syntax (not inside angle brackets!) and trailing semicolon
432R$* $: $1 <@> mark addresses
433R$* < $* > $* <@> $: $1 < $2 > $3 unmark <addr>
fb463c52 434R$* :: $* <@> $: $1 :: $2 unmark node::addr
f11ff219 435R:`include': $* <@> $: :`include': $1 unmark :`include':...
6449d970
EA
436R$* : $* <@> $: $2 strip colon if marked
437R$* <@> $: $1 unmark
438R$* ; $: $1 strip trailing semi
439
440# null input now results from list:; syntax
441R$@ $@ :; <@>
442
f25ecb3d 443# basic textual canonicalization -- note RFC733 heuristic here
0758279f 444R$*<$*>$*<$*>$* $2$3<$4>$5 strip multiple <> <>
4850f6e1 445R$*<$*<$+>$*>$* <$3>$5 2-level <> nesting
66fe2d65 446R$*<>$* $@ <@> MAIL FROM:<> case
f25ecb3d
EA
447R$*<$+>$* $2 basic RFC821/822 parsing
448
449# make sure <@a,@b,@c:user@d> syntax is easy to parse -- undone later
56ec6f89 450R@ $+ , $+ @ $1 : $2 change all "," to ":"
f25ecb3d
EA
451
452# localize and dispose of route-based addresses
f22970ed 453R@ $+ : $+ $@ $>96 < @$1 > : $2 handle <route-addr>
f25ecb3d
EA
454
455# find focus for list syntax
f22970ed 456R $+ : $* ; @ $+ $@ $>96 $1 : $2 ; < @ $3 > list syntax
56ec6f89 457R $+ : $* ; $@ $1 : $2; list syntax
f25ecb3d
EA
458
459# find focus for @ syntax addresses
56ec6f89
EA
460R$+ @ $+ $: $1 < @ $2 > focus on domain
461R$+ < $+ @ $+ > $1 $2 < @ $3 > move gaze right
f22970ed 462R$+ < @ $+ > $@ $>96 $1 < @ $2 > already canonical
f25ecb3d 463
d646efc4
EA
464# do some sanity checking
465R$* < @ $* : $* > $* $1 < @ $2 $3 > $4 nix colons in addrs
466
1429c39b
EA
467ifdef(`_NO_UUCP_', `dnl',
468`# convert old-style addresses to a domain-based address
f22970ed
EA
469R$- ! $+ $@ $>96 $2 < @ $1 .UUCP > resolve uucp names
470R$+ . $- ! $+ $@ $>96 $3 < @ $1 . $2 > domain uucps
fb463c52
EA
471R$+ ! $+ $@ $>96 $2 < @ $1 .UUCP > uucp subdomains
472')
28cbfc47 473ifdef(`_USE_DECNET_SYNTAX_',
fb463c52
EA
474`# convert node::user addresses into a domain-based address
475R$- :: $+ $@ $>96 $2 < @ $1 .DECNET > resolve DECnet names
28cbfc47 476R$- . $- :: $+ $@ $>96 $3 < @ $1.$2 .DECNET > numeric DECnet addr
fb463c52
EA
477',
478 `dnl')
f25ecb3d 479# if we have % signs, take the rightmost one
56ec6f89
EA
480R$* % $* $1 @ $2 First make them all @s.
481R$* @ $* @ $* $1 % $2 @ $3 Undo all but the last.
f22970ed 482R$* @ $* $@ $>96 $1 < @ $2 > Insert < > and finish
f25ecb3d
EA
483
484# else we must be a local name
50eec51e 485R$* $@ $>96 $1
f25ecb3d
EA
486
487
576bbd75 488################################################
f22970ed 489### Ruleset 96 -- bottom half of ruleset 3 ###
576bbd75 490################################################
f25ecb3d 491
f22970ed 492S96
f25ecb3d
EA
493
494# handle special cases for local names
89906048
EA
495R$* < @ localhost > $* $: $1 < @ $j . > $2 no domain at all
496R$* < @ localhost . $m > $* $: $1 < @ $j . > $2 local domain
497ifdef(`_NO_UUCP_', `dnl',
498`R$* < @ localhost . UUCP > $* $: $1 < @ $j . > $2 .UUCP domain')
e1beeb7d
EA
499R$* < @ [ $+ ] > $* $: $1 < @@ [ $2 ] > $3 mark [a.b.c.d]
500R$* < @@ $=w > $* $: $1 < @ $j . > $3 self-literal
1d9af8b4 501R$* < @@ $+ > $* $@ $1 < @ $2 > $3 canon IP addr
e653dde7 502ifdef(`DOMAIN_TABLE', `
4e973900
EA
503# look up domains in the domain table
504R$* < @ $+ > $* $: $1 < @ $(domaintable $2 $) > $3',
e653dde7 505`dnl')
dacf3c9f 506undivert(2)dnl
80961747 507
f5ade8ff
EA
508ifdef(`_NO_UUCP_', `dnl',
509`ifdef(`UUCP_RELAY',
1ab66980 510`# pass UUCP addresses straight through
9ee2219d 511R$* < @ $+ . UUCP > $* $@ $1 < @ $2 . UUCP . > $3',
1ab66980 512`# if really UUCP, handle it immediately
6f403f33 513ifdef(`_CLASS_U_',
9ee2219d 514`R$* < @ $=U . UUCP > $* $@ $1 < @ $2 . UUCP . > $3', `dnl')
6f403f33 515ifdef(`_CLASS_V_',
9ee2219d 516`R$* < @ $=V . UUCP > $* $@ $1 < @ $2 . UUCP . > $3', `dnl')
6f403f33 517ifdef(`_CLASS_W_',
9ee2219d 518`R$* < @ $=W . UUCP > $* $@ $1 < @ $2 . UUCP . > $3', `dnl')
6f403f33 519ifdef(`_CLASS_X_',
9ee2219d 520`R$* < @ $=X . UUCP > $* $@ $1 < @ $2 . UUCP . > $3', `dnl')
6f403f33 521ifdef(`_CLASS_Y_',
9ee2219d 522`R$* < @ $=Y . UUCP > $* $@ $1 < @ $2 . UUCP . > $3', `dnl')
80961747
EA
523
524# try UUCP traffic as a local address
9ee2219d 525R$* < @ $+ . UUCP > $* $: $1 < @ $[ $2 $] . UUCP . > $3
f22970ed 526R$* < @ $+ . . UUCP . > $* $@ $1 < @ $2 . > $3')
f5ade8ff 527')
e0fe178c 528ifdef(`_NO_CANONIFY_', `dnl',
f5ade8ff 529`# pass to name server to make hostname canonical
ad8d5f97
EA
530R$* < @ $* $~P > $* $: $1 < @ $[ $2 $3 $] > $4')
531
e0fe178c
EA
532# local host aliases and pseudo-domains are always canonical
533R$* < @ $=w > $* $: $1 < @ $2 . > $3
9ee2219d 534R$* < @ $* $=P > $* $: $1 < @ $2 $3 . > $4
e0fe178c 535R$* < @ $* . . > $* $1 < @ $2 . > $3
9ee2219d 536
6f403f33
EA
537# if this is the local hostname, make sure we treat is as canonical
538R$* < @ $j > $* $: $1 < @ $j . > $2
f25ecb3d 539
f25ecb3d
EA
540
541##################################################
542### Ruleset 4 -- Final Output Post-rewriting ###
543##################################################
544S4
545
bba50baf 546R$* <@> $@ handle <> and list:;
f25ecb3d 547
6f403f33
EA
548# strip trailing dot off possibly canonical name
549R$* < @ $+ . > $* $1 < @ $2 > $3
f25ecb3d
EA
550
551# externalize local domain info
6f403f33
EA
552R$* < $+ > $* $1 $2 $3 defocus
553R@ $+ : @ $+ : $+ @ $1 , @ $2 : $3 <route-addr> canonical
9d6b5c00 554R@ $* $@ @ $1 ... and exit
f25ecb3d 555
1429c39b
EA
556ifdef(`_NO_UUCP_', `dnl',
557`# UUCP must always be presented in old form
558R$+ @ $- . UUCP $2!$1 u@h.UUCP => h!u')
f25ecb3d 559
28cbfc47
EA
560ifdef(`_USE_DECNET_SYNTAX_',
561`# put DECnet back in :: form
562R$+ @ $+ . DECNET $2 :: $1 u@h.DECNET => h::u',
563 `dnl')
f25ecb3d 564# delete duplicate local names
6f403f33 565R$+ % $=w @ $=w $1 @ $j u%host@host => u@host
f25ecb3d
EA
566
567
568
576bbd75 569##############################################################
f22970ed 570### Ruleset 97 -- recanonicalize and call ruleset zero ###
576bbd75
EA
571### (used for recursive calls) ###
572##############################################################
f25ecb3d 573
f22970ed 574S`'97
f25ecb3d
EA
575R$* $: $>3 $1
576R$* $@ $>0 $1
577
578
579######################################
580### Ruleset 0 -- Parse Address ###
581######################################
582
583S0
584
39789777 585R<@> $#_LOCAL_ $: <@> special case error msgs
1454a759
EA
586R$* : $* ; <@> $#error $@ 5.1.3 $: "list:; syntax illegal for recipient addresses"
587R<@ $+> $#error $@ 5.1.1 $: "user address required"
588R$* <$* : $* > $* $#error $@ 5.1.1 $: "colon illegal in host name part"
589R$* < @ . > $* $#error $@ 5.1.2 $: "invalid host name"
89d51ef0 590
56ec6f89
EA
591ifdef(`_MAILER_smtp_',
592`# handle numeric address spec
f22970ed 593R$* < @ [ $+ ] > $* $: $>98 $1 < @ [ $2 ] > $3 numeric internet spec
90307086 594R$* < @ [ $+ ] > $* $#_SMTP_ $@ [$2] $: $1 < @ [$2] > $3 still numeric: send',
d8ebcd49 595 `dnl')
f25ecb3d 596
5461a68b 597# now delete the local info -- note $=O to find characters that cause forwarding
f22970ed
EA
598R$* < @ > $* $@ $>97 $1 user@ => user
599R< @ $=w . > : $* $@ $>97 $2 @here:... -> ...
600R$* $=O $* < @ $=w . > $@ $>97 $1 $2 $3 ...@here -> ...
194df6ac
EA
601
602# handle local hacks
f22970ed 603R$* $: $>98 $1
f25ecb3d
EA
604
605# short circuit local delivery so forwarded email works
b5d5721d
EA
606ifdef(`_MAILER_usenet_',
607`R$+ . USENET < @ $=w . > $#usenet $: $1 handle usenet specially',
608 `dnl')
664ff353
EA
609R$* < @ $=w . > $: < $R @ $H > $1 < @ $2 . > if both relay & hub ...
610R<$+ @ $+ > $* < $+ > $: $>_SET_95_ < $H > $3 < $4 > ... send direct to hub
611R<$* @ $* > $* < $+ > $: $3 < $4 >
efd6da82
EA
612ifdef(`_STICKY_LOCAL_DOMAIN_',
613`R$+ < @ $=w . > $: < $H > $1 < @ $2 . > first try hub
31a6de89 614R< $+ > $+ < $+ > $>95 < $1 > $2 < $3 > yep ....
29e43b7a 615R< > $+ + $* < $+ > $#_LOCAL_ $: $1 + $2 plussed name?
efd6da82 616R< > $+ < $+ > $#_LOCAL_ $: @ $1 nope, local address',
664ff353
EA
617`R$+ < @ $=w . > $#_LOCAL_ $: $1 dispose directly',
618`R$+ < @ $=w . > $: $>_SET_95_ < $H > $1 < @ $2 . > sticky local names
619R$+ < @ $=w . > $#_LOCAL_ $: @ $1 sticky local names')
755e2424
EA
620undivert(4)dnl
621
979297f9
EA
622ifdef(`_NO_UUCP_', `dnl',
623`# resolve remotely connected UUCP links (if any)
708a514b 624ifdef(`_CLASS_V_',
7d426e19 625`R$* < @ $=V . UUCP > $* $#smtp $@ $V $: @ $V : $1 @ $2.UUCP $3',
47523c33 626 `dnl')
708a514b 627ifdef(`_CLASS_W_',
7d426e19 628`R$* < @ $=W . UUCP > $* $#smtp $@ $W $: @ $W : $1 @ $2.UUCP $3',
47523c33 629 `dnl')
708a514b 630ifdef(`_CLASS_X_',
7d426e19 631`R$* < @ $=X . UUCP > $* $#smtp $@ $X $: @ $X : $1 @ $2.UUCP $3',
979297f9 632 `dnl')')
755e2424 633
f25ecb3d
EA
634# resolve fake top level domains by forwarding to other hosts
635ifdef(`BITNET_RELAY',
7d426e19 636`R$*<@$+.BITNET>$* $#smtp $@ $B $: $1 @ $2 . BITNET $3 user@host.BITNET',
7d426e19 637`R$*<@$+.CSNET>$* $#smtp $@ $C $: $1 @ $2 . CSNET $3 user@host.CSNET',
f25ecb3d 638 `dnl')
418602bc
EA
639ifdef(`_MAILER_pop_',
640`R$+ < @ POP. > $#pop $: $1 user@POP',
641 `dnl')
d2e7dfa9 642ifdef(`_MAILER_fax_',
9ee2219d 643`R$+ < @ $+ .FAX. > $#fax $@ $2 $: $1 user@host.FAX',
d2e7dfa9 644`ifdef(`FAX_RELAY',
7d426e19 645`R$*<@$+.FAX>$* $#smtp $@ $F $: $1 @ $2 . FAX $3 user@host.FAX',
d2e7dfa9 646 `dnl')')
f25ecb3d 647
755e2424
EA
648ifdef(`UUCP_RELAY',
649`# forward non-local UUCP traffic to our UUCP relay
7d426e19 650R$*<@$*.UUCP>$* $#smtp $@ $Y $: @ $Y : $1 @ $2.UUCP $3 uucp mail',
56ec6f89 651`ifdef(`_MAILER_uucp_',
755e2424 652`# forward other UUCP traffic straight to UUCP
7aa54c60 653R$* < @ $+ .UUCP. > $* $#uucp $@ $2 $: $1 < @ $2 .UUCP. > $3 user@host.UUCP',
755e2424 654 `dnl')')
194df6ac 655ifdef(`_MAILER_usenet_', `
e653dde7 656# addresses sent to net.group.USENET will get forwarded to a newsgroup
5adfff4e 657R$+ . USENET $#usenet $: $1',
3a5030a1 658 `dnl')
e653dde7 659
97dcbde7
EA
660ifdef(`_LOCAL_RULES_',
661`# figure out what should stay in our local mail system
7d426e19 662R$* < @ $* > $* $#smtp $@ $2 $: $1 @ $2 $3 user@host.domain')')
64100696 663# pass names that still have a host to a smarthost (if defined)
f22970ed 664R$* < @ $* > $* $: $>95 < $S > $1 < @ $2 > $3 glue on smarthost name
e653dde7 665
64100696 666# deal with other remote names
3bd9528c 667ifdef(`_MAILER_smtp_',
2c97939f 668`R$* < @$* > $* $#_SMTP_ $@ $2 $: $1 < @ $2 > $3 user@host.domain',
1454a759 669`R$* < @$* > $* $#error $@ 5.1.2 $: Unrecognized host name $2')
f25ecb3d 670
f22970ed 671# if this is quoted, strip the quotes and try again
ccfcf4aa 672R$+ $: $(dequote $1 $) strip quotes
f22970ed 673R$+ $=O $+ $@ $>97 $1 $2 $3 try again
ccfcf4aa
EA
674
675# handle locally delivered names
664ff353 676R$=L $: $>_SET_95_ < $H > $1 special local names
2c840221
EA
677R$=L $#_LOCAL_ $: @ $1 special local names
678R$+ $#_LOCAL_ $: $1 regular local names
6f403f33 679
56ec6f89
EA
680###########################################################################
681### Ruleset 5 -- special rewriting after aliases have been expanded ###
56ec6f89 682###########################################################################
f25ecb3d 683
6f403f33 684S5
f25ecb3d 685
50eec51e
EA
686# deal with plussed users so aliases work nicely
687R$+ + * $#_LOCAL_ $@ $&h $: $1
688R$+ + $* $#_LOCAL_ $@ $2 $: $1 + *
f4d9c9f9 689
efd6da82
EA
690# prepend an empty "forward host" on the front
691R$+ $: <> $1
692
693ifdef(`LUSER_RELAY',
694`# send unrecognized local users to a relay host
0716b180
EA
695R< > $+ + $* $: < $L . > $( user $1 $) + $2
696R< > $+ $: < $L . > $( user $1 $) look up user
697R< $* > $+ <> $* $: < > $2 $3 found; strip $L
698R< $* . > $+ $: < $1 > $2 strip extra dot')
699
700# handle plussed local names
701R< > $+ + $* $#_LOCAL_ $@ $2 $: $1
efd6da82 702
32014295 703# see if we have a relay or a hub
664ff353
EA
704R$+ $: $>_SET_95_ < $R > $1 try relay
705R$+ $: $>_SET_95_ < $H > $1 try hub')
bc09d8d3
EA
706ifdef(`MAILER_TABLE',
707`
708
d8ebcd49
EA
709###################################################################
710### Ruleset 90 -- try domain part of mailertable entry ###
d8ebcd49 711###################################################################
bc09d8d3
EA
712
713S90
46977ce0
EA
714R<$*> <$- $+ > $* $: < $1 . $2 > < $3 > $4
715R<. $+ > $+ $: < $1 > $2
716R< $+ > < > $+ $: < $1 > < . > $2
717R<$*> < $+ > $* $: <$1> < $(mailertable $2 $@ $1 $) > $3 lookup
718R<$+> <$- : $+ > $* $# $2 $@ $3 $: $4 check -- resolved?
719R$* $: $>87 $1
720R<$+> < . $+ > $*<$*> $@ $>90 <$1> <$2> $3<$4> no -- strip & try again
721R$* $: $>88 $1
722R<$+> <$*> $* $@ $3 no match',
bc09d8d3 723`dnl')
d8ebcd49 724
feae130e 725###################################################################
f22970ed 726### Ruleset 95 -- canonify mailer:host syntax to triple ###
feae130e
EA
727###################################################################
728
f22970ed 729S95
feae130e
EA
730R< > $* $@ $1 strip off null relay
731R< $- : $+ > $* $# $1 $@ $2 $: $3 try qualified mailer
732R< $=w > $* $@ $2 delete local host
733R< $+ > $* $#_RELAY_ $@ $1 $: $2 use unqualified mailer
734
d8ebcd49 735###################################################################
f22970ed 736### Ruleset 98 -- local part of ruleset zero (can be null) ###
d8ebcd49
EA
737###################################################################
738
f22970ed 739S98
d8ebcd49 740undivert(3)dnl
f25ecb3d
EA
741#\f
742######################################################################
743######################################################################
744#####
ec174858 745`##### MAILER DEFINITIONS'
f25ecb3d
EA
746#####
747######################################################################
748######################################################################
f25ecb3d 749undivert(7)dnl