Commit | Line | Data |
---|---|---|
f25ecb3d EA |
1 | divert(-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 | # | |
9 | divert(0) | |
10 | ||
71b0c7cb | 11 | VERSIONID(`@(#)proto.m4 8.80 (Berkeley) %G%') |
f25ecb3d | 12 | |
6f403f33 | 13 | MAILER(local)dnl |
f25ecb3d | 14 | |
d4e68feb | 15 | # level 6 config file format |
7ec5e19b EA |
16 | V6/Berkeley |
17 | divert(-1) | |
18 | ||
a9c22d5a EA |
19 | # do some sanity checking |
20 | ifdef(`__OSTYPE__',, | |
21 | `errprint(`*** ERROR: No system type defined (use OSTYPE macro)')') | |
22 | ||
7ec5e19b EA |
23 | # pick our default mailers |
24 | ifdef(`confSMTP_MAILER',, `define(`confSMTP_MAILER', `smtp')') | |
25 | ifdef(`confLOCAL_MAILER',, `define(`confLOCAL_MAILER', `local')') | |
feae130e EA |
26 | ifdef(`confRELAY_MAILER',, |
27 | `define(`confRELAY_MAILER', | |
28 | `ifdef(`_MAILER_smtp_', `relay', | |
7ec5e19b | 29 | `ifdef(`_MAILER_uucp', `suucp', `unknown')')')') |
2c840221 EA |
30 | define(`_SMTP_', `confSMTP_MAILER')dnl for readability only |
31 | define(`_LOCAL_', `confLOCAL_MAILER')dnl for readability only | |
feae130e | 32 | define(`_RELAY_', `confRELAY_MAILER')dnl for readability only |
242270da | 33 | |
7ec5e19b EA |
34 | # back compatibility with old config files |
35 | ifdef(`confDEF_GROUP_ID', | |
36 | `errprint(`*** confDEF_GROUP_ID is obsolete.') | |
37 | errprint(` Use confDEF_USER_ID with a colon in the value instead.')') | |
38 | ifdef(`confREAD_TIMEOUT', | |
39 | `errprint(`*** confREAD_TIMEOUT is obsolete.') | |
40 | errprint(` Use individual confTO_<timeout> parameters instead.')') | |
41 | ifdef(`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)))')') | |
49 | ifdef(`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.... | |
54 | define(`_OPTION', `ifdef(`$2', `O $1=$2', `#O $1`'ifelse($3, `',, `=$3')')')dnl | |
55 | ||
56 | divert(0)dnl | |
57 | ||
f25ecb3d EA |
58 | ################## |
59 | # local info # | |
60 | ################## | |
61 | ||
dacf3c9f | 62 | Cwlocalhost |
5461a68b | 63 | ifdef(`USE_CW_FILE', |
dacf3c9f | 64 | `# file containing names of hosts for which we receive email |
1bdba97e EA |
65 | Fw`'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 |
70 | ifdef(`confDOMAIN_NAME', `Dj`'confDOMAIN_NAME', `#Dj$w.Foo.COM') | |
64100696 | 71 | |
7ec5e19b | 72 | ifdef(`_NULL_CLIENT_ONLY_', `divert(-1)')dnl |
64100696 EA |
73 | |
74 | CP. | |
f25ecb3d EA |
75 | |
76 | ifdef(`UUCP_RELAY', | |
77 | `# UUCP relay host | |
1bdba97e | 78 | DY`'UUCP_RELAY |
7df175c3 | 79 | CPUUCP |
a151c868 | 80 | |
f25ecb3d EA |
81 | ')dnl |
82 | ifdef(`BITNET_RELAY', | |
83 | `# BITNET relay host | |
1bdba97e | 84 | DB`'BITNET_RELAY |
7df175c3 | 85 | CPBITNET |
a151c868 | 86 | |
fb463c52 EA |
87 | ')dnl |
88 | ifdef(`DECNET_RELAY', | |
28cbfc47 | 89 | `define(`_USE_DECNET_SYNTAX_')dnl |
fb463c52 EA |
90 | # DECnet relay host |
91 | DC`'DECNET_RELAY | |
92 | CPDECNET | |
93 | ||
d2e7dfa9 EA |
94 | ')dnl |
95 | ifdef(`FAX_RELAY', | |
96 | `# FAX relay host | |
1bdba97e | 97 | DF`'FAX_RELAY |
7df175c3 | 98 | CPFAX |
d2e7dfa9 | 99 | |
f25ecb3d | 100 | ')dnl |
64100696 EA |
101 | # "Smart" relay host (may be null) |
102 | DS`'ifdef(`SMART_HOST', SMART_HOST) | |
f25ecb3d | 103 | |
efd6da82 EA |
104 | ifdef(`LUSER_RELAY', |
105 | `# place to which unknown users should be forwarded | |
106 | Kuser user -m -a<> | |
107 | DL`'LUSER_RELAY | |
108 | ', `dnl') | |
109 | ||
7ec5e19b EA |
110 | # operators that cannot be in local usernames (i.e., network indicators) |
111 | CO @ % ifdef(`_NO_UUCP_', `', `!') | |
112 | ||
113 | # a class with just dot (for identifying canonical names) | |
114 | C.. | |
115 | ||
8d95d628 EA |
116 | ifdef(`MAILER_TABLE', |
117 | `# Mailer table (overriding domains) | |
118 | Kmailertable MAILER_TABLE | |
119 | ||
e653dde7 EA |
120 | ')dnl |
121 | ifdef(`DOMAIN_TABLE', | |
122 | `# Domain table (adding domains) | |
123 | Kdomaintable DOMAIN_TABLE | |
124 | ||
97dcbde7 | 125 | ')dnl |
f25ecb3d | 126 | # who I send unqualified names to (null means deliver locally) |
1bdba97e | 127 | DR`'ifdef(`LOCAL_RELAY', LOCAL_RELAY) |
f25ecb3d | 128 | |
22bc0471 | 129 | # who gets all local email traffic ($R has precedence for unqualified names) |
1bdba97e | 130 | DH`'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 |
135 | CE root | |
3eb5f759 EA |
136 | undivert(5)dnl |
137 | ||
f22970ed EA |
138 | # dequoting map |
139 | Kdequote dequote | |
f25ecb3d | 140 | |
7ec5e19b EA |
141 | divert(0)dnl |
142 | # who I masquerade as (null for no masquerading) | |
143 | DM`'ifdef(`MASQUERADE_NAME', MASQUERADE_NAME) | |
144 | ||
9863b6e1 EA |
145 | undivert(6)dnl |
146 | ||
a151c868 EA |
147 | ###################### |
148 | # Special macros # | |
149 | ###################### | |
150 | ||
151 | # SMTP initial login message | |
1bdba97e | 152 | De`'confSMTP_LOGIN_MSG |
a151c868 EA |
153 | |
154 | # UNIX initial From header format | |
1bdba97e | 155 | Dl`'confFROM_LINE |
a151c868 EA |
156 | |
157 | # my name for error messages | |
1bdba97e | 158 | Dn`'confMAILER_NAME |
a151c868 EA |
159 | |
160 | # delimiter (operator) characters | |
1bdba97e | 161 | Do`'confOPERATORS |
f25ecb3d | 162 | |
a151c868 | 163 | # format of a total name |
f4d9c9f9 | 164 | Dq`'ifdef(`confFROM_HEADER', confFROM_HEADER, `$?x$x <$g>$|$g$.') |
f25ecb3d | 165 | include(`../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 | 181 | O 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 | 223 | O 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 |
271 | O 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 | 303 | O 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 |
309 | ifelse(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 | ||
377 | Pfirst-class=0 | |
378 | Pspecial-delivery=100 | |
97dcbde7 | 379 | Plist=-30 |
a151c868 EA |
380 | Pbulk=-60 |
381 | Pjunk=-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 |
389 | Troot |
390 | Tdaemon | |
391 | Tuucp | |
392 | ||
393 | ######################### | |
394 | # Format of headers # | |
395 | ######################### | |
396 | ||
e0a38185 | 397 | H?P?Return-Path: $g |
d1c8c981 | 398 | HReceived: confRECEIVED_HEADER |
a151c868 EA |
399 | H?D?Resent-Date: $a |
400 | H?D?Date: $a | |
401 | H?F?Resent-From: $q | |
402 | H?F?From: $q | |
403 | H?x?Full-Name: $x | |
404 | HSubject: | |
405 | # HPosted-Date: $a | |
406 | # H?l?Received-Date: $b | |
407 | H?M?Resent-Message-Id: <$t.$i@$j> | |
408 | H?M?Message-Id: <$t.$i@$j> | |
7ec5e19b EA |
409 | ifdef(`_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 | 421 | undivert(9)dnl |
f25ecb3d EA |
422 | |
423 | ########################################### | |
424 | ### Rulset 3 -- Name Canonicalization ### | |
425 | ########################################### | |
755e2424 | 426 | S3 |
f25ecb3d | 427 | |
d2fe4e9e | 428 | # handle null input (translate to <@> special case) |
66fe2d65 | 429 | R$@ $@ <@> |
77e96a45 | 430 | |
6449d970 EA |
431 | # strip group: syntax (not inside angle brackets!) and trailing semicolon |
432 | R$* $: $1 <@> mark addresses | |
433 | R$* < $* > $* <@> $: $1 < $2 > $3 unmark <addr> | |
fb463c52 | 434 | R$* :: $* <@> $: $1 :: $2 unmark node::addr |
f11ff219 | 435 | R:`include': $* <@> $: :`include': $1 unmark :`include':... |
6449d970 EA |
436 | R$* : $* <@> $: $2 strip colon if marked |
437 | R$* <@> $: $1 unmark | |
438 | R$* ; $: $1 strip trailing semi | |
439 | ||
440 | # null input now results from list:; syntax | |
441 | R$@ $@ :; <@> | |
442 | ||
f25ecb3d | 443 | # basic textual canonicalization -- note RFC733 heuristic here |
0758279f | 444 | R$*<$*>$*<$*>$* $2$3<$4>$5 strip multiple <> <> |
4850f6e1 | 445 | R$*<$*<$+>$*>$* <$3>$5 2-level <> nesting |
66fe2d65 | 446 | R$*<>$* $@ <@> MAIL FROM:<> case |
f25ecb3d EA |
447 | R$*<$+>$* $2 basic RFC821/822 parsing |
448 | ||
449 | # make sure <@a,@b,@c:user@d> syntax is easy to parse -- undone later | |
56ec6f89 | 450 | R@ $+ , $+ @ $1 : $2 change all "," to ":" |
f25ecb3d EA |
451 | |
452 | # localize and dispose of route-based addresses | |
f22970ed | 453 | R@ $+ : $+ $@ $>96 < @$1 > : $2 handle <route-addr> |
f25ecb3d EA |
454 | |
455 | # find focus for list syntax | |
f22970ed | 456 | R $+ : $* ; @ $+ $@ $>96 $1 : $2 ; < @ $3 > list syntax |
56ec6f89 | 457 | R $+ : $* ; $@ $1 : $2; list syntax |
f25ecb3d EA |
458 | |
459 | # find focus for @ syntax addresses | |
56ec6f89 EA |
460 | R$+ @ $+ $: $1 < @ $2 > focus on domain |
461 | R$+ < $+ @ $+ > $1 $2 < @ $3 > move gaze right | |
f22970ed | 462 | R$+ < @ $+ > $@ $>96 $1 < @ $2 > already canonical |
f25ecb3d | 463 | |
d646efc4 EA |
464 | # do some sanity checking |
465 | R$* < @ $* : $* > $* $1 < @ $2 $3 > $4 nix colons in addrs | |
466 | ||
1429c39b EA |
467 | ifdef(`_NO_UUCP_', `dnl', |
468 | `# convert old-style addresses to a domain-based address | |
f22970ed EA |
469 | R$- ! $+ $@ $>96 $2 < @ $1 .UUCP > resolve uucp names |
470 | R$+ . $- ! $+ $@ $>96 $3 < @ $1 . $2 > domain uucps | |
fb463c52 EA |
471 | R$+ ! $+ $@ $>96 $2 < @ $1 .UUCP > uucp subdomains |
472 | ') | |
28cbfc47 | 473 | ifdef(`_USE_DECNET_SYNTAX_', |
fb463c52 EA |
474 | `# convert node::user addresses into a domain-based address |
475 | R$- :: $+ $@ $>96 $2 < @ $1 .DECNET > resolve DECnet names | |
28cbfc47 | 476 | R$- . $- :: $+ $@ $>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 |
480 | R$* % $* $1 @ $2 First make them all @s. |
481 | R$* @ $* @ $* $1 % $2 @ $3 Undo all but the last. | |
f22970ed | 482 | R$* @ $* $@ $>96 $1 < @ $2 > Insert < > and finish |
f25ecb3d EA |
483 | |
484 | # else we must be a local name | |
50eec51e | 485 | R$* $@ $>96 $1 |
f25ecb3d EA |
486 | |
487 | ||
576bbd75 | 488 | ################################################ |
f22970ed | 489 | ### Ruleset 96 -- bottom half of ruleset 3 ### |
576bbd75 | 490 | ################################################ |
f25ecb3d | 491 | |
f22970ed | 492 | S96 |
f25ecb3d EA |
493 | |
494 | # handle special cases for local names | |
89906048 EA |
495 | R$* < @ localhost > $* $: $1 < @ $j . > $2 no domain at all |
496 | R$* < @ localhost . $m > $* $: $1 < @ $j . > $2 local domain | |
497 | ifdef(`_NO_UUCP_', `dnl', | |
498 | `R$* < @ localhost . UUCP > $* $: $1 < @ $j . > $2 .UUCP domain') | |
e1beeb7d EA |
499 | R$* < @ [ $+ ] > $* $: $1 < @@ [ $2 ] > $3 mark [a.b.c.d] |
500 | R$* < @@ $=w > $* $: $1 < @ $j . > $3 self-literal | |
1d9af8b4 | 501 | R$* < @@ $+ > $* $@ $1 < @ $2 > $3 canon IP addr |
e653dde7 | 502 | ifdef(`DOMAIN_TABLE', ` |
4e973900 EA |
503 | # look up domains in the domain table |
504 | R$* < @ $+ > $* $: $1 < @ $(domaintable $2 $) > $3', | |
e653dde7 | 505 | `dnl') |
dacf3c9f | 506 | undivert(2)dnl |
80961747 | 507 | |
f5ade8ff EA |
508 | ifdef(`_NO_UUCP_', `dnl', |
509 | `ifdef(`UUCP_RELAY', | |
1ab66980 | 510 | `# pass UUCP addresses straight through |
9ee2219d | 511 | R$* < @ $+ . UUCP > $* $@ $1 < @ $2 . UUCP . > $3', |
1ab66980 | 512 | `# if really UUCP, handle it immediately |
6f403f33 | 513 | ifdef(`_CLASS_U_', |
9ee2219d | 514 | `R$* < @ $=U . UUCP > $* $@ $1 < @ $2 . UUCP . > $3', `dnl') |
6f403f33 | 515 | ifdef(`_CLASS_V_', |
9ee2219d | 516 | `R$* < @ $=V . UUCP > $* $@ $1 < @ $2 . UUCP . > $3', `dnl') |
6f403f33 | 517 | ifdef(`_CLASS_W_', |
9ee2219d | 518 | `R$* < @ $=W . UUCP > $* $@ $1 < @ $2 . UUCP . > $3', `dnl') |
6f403f33 | 519 | ifdef(`_CLASS_X_', |
9ee2219d | 520 | `R$* < @ $=X . UUCP > $* $@ $1 < @ $2 . UUCP . > $3', `dnl') |
6f403f33 | 521 | ifdef(`_CLASS_Y_', |
9ee2219d | 522 | `R$* < @ $=Y . UUCP > $* $@ $1 < @ $2 . UUCP . > $3', `dnl') |
80961747 EA |
523 | |
524 | # try UUCP traffic as a local address | |
9ee2219d | 525 | R$* < @ $+ . UUCP > $* $: $1 < @ $[ $2 $] . UUCP . > $3 |
f22970ed | 526 | R$* < @ $+ . . UUCP . > $* $@ $1 < @ $2 . > $3') |
f5ade8ff | 527 | ') |
e0fe178c | 528 | ifdef(`_NO_CANONIFY_', `dnl', |
f5ade8ff | 529 | `# pass to name server to make hostname canonical |
ad8d5f97 EA |
530 | R$* < @ $* $~P > $* $: $1 < @ $[ $2 $3 $] > $4') |
531 | ||
e0fe178c EA |
532 | # local host aliases and pseudo-domains are always canonical |
533 | R$* < @ $=w > $* $: $1 < @ $2 . > $3 | |
9ee2219d | 534 | R$* < @ $* $=P > $* $: $1 < @ $2 $3 . > $4 |
e0fe178c | 535 | R$* < @ $* . . > $* $1 < @ $2 . > $3 |
9ee2219d | 536 | |
6f403f33 EA |
537 | # if this is the local hostname, make sure we treat is as canonical |
538 | R$* < @ $j > $* $: $1 < @ $j . > $2 | |
f25ecb3d | 539 | |
f25ecb3d EA |
540 | |
541 | ################################################## | |
542 | ### Ruleset 4 -- Final Output Post-rewriting ### | |
543 | ################################################## | |
544 | S4 | |
545 | ||
bba50baf | 546 | R$* <@> $@ handle <> and list:; |
f25ecb3d | 547 | |
6f403f33 EA |
548 | # strip trailing dot off possibly canonical name |
549 | R$* < @ $+ . > $* $1 < @ $2 > $3 | |
f25ecb3d EA |
550 | |
551 | # externalize local domain info | |
6f403f33 EA |
552 | R$* < $+ > $* $1 $2 $3 defocus |
553 | R@ $+ : @ $+ : $+ @ $1 , @ $2 : $3 <route-addr> canonical | |
9d6b5c00 | 554 | R@ $* $@ @ $1 ... and exit |
f25ecb3d | 555 | |
1429c39b EA |
556 | ifdef(`_NO_UUCP_', `dnl', |
557 | `# UUCP must always be presented in old form | |
558 | R$+ @ $- . UUCP $2!$1 u@h.UUCP => h!u') | |
f25ecb3d | 559 | |
28cbfc47 EA |
560 | ifdef(`_USE_DECNET_SYNTAX_', |
561 | `# put DECnet back in :: form | |
562 | R$+ @ $+ . DECNET $2 :: $1 u@h.DECNET => h::u', | |
563 | `dnl') | |
f25ecb3d | 564 | # delete duplicate local names |
6f403f33 | 565 | R$+ % $=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 | 574 | S`'97 |
f25ecb3d EA |
575 | R$* $: $>3 $1 |
576 | R$* $@ $>0 $1 | |
577 | ||
578 | ||
579 | ###################################### | |
580 | ### Ruleset 0 -- Parse Address ### | |
581 | ###################################### | |
582 | ||
583 | S0 | |
584 | ||
39789777 | 585 | R<@> $#_LOCAL_ $: <@> special case error msgs |
1454a759 EA |
586 | R$* : $* ; <@> $#error $@ 5.1.3 $: "list:; syntax illegal for recipient addresses" |
587 | R<@ $+> $#error $@ 5.1.1 $: "user address required" | |
588 | R$* <$* : $* > $* $#error $@ 5.1.1 $: "colon illegal in host name part" | |
589 | R$* < @ . > $* $#error $@ 5.1.2 $: "invalid host name" | |
89d51ef0 | 590 | |
56ec6f89 EA |
591 | ifdef(`_MAILER_smtp_', |
592 | `# handle numeric address spec | |
f22970ed | 593 | R$* < @ [ $+ ] > $* $: $>98 $1 < @ [ $2 ] > $3 numeric internet spec |
90307086 | 594 | R$* < @ [ $+ ] > $* $#_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 |
598 | R$* < @ > $* $@ $>97 $1 user@ => user |
599 | R< @ $=w . > : $* $@ $>97 $2 @here:... -> ... | |
600 | R$* $=O $* < @ $=w . > $@ $>97 $1 $2 $3 ...@here -> ... | |
194df6ac EA |
601 | |
602 | # handle local hacks | |
f22970ed | 603 | R$* $: $>98 $1 |
f25ecb3d EA |
604 | |
605 | # short circuit local delivery so forwarded email works | |
b5d5721d EA |
606 | ifdef(`_MAILER_usenet_', |
607 | `R$+ . USENET < @ $=w . > $#usenet $: $1 handle usenet specially', | |
608 | `dnl') | |
664ff353 EA |
609 | R$* < @ $=w . > $: < $R @ $H > $1 < @ $2 . > if both relay & hub ... |
610 | R<$+ @ $+ > $* < $+ > $: $>_SET_95_ < $H > $3 < $4 > ... send direct to hub | |
611 | R<$* @ $* > $* < $+ > $: $3 < $4 > | |
efd6da82 EA |
612 | ifdef(`_STICKY_LOCAL_DOMAIN_', |
613 | `R$+ < @ $=w . > $: < $H > $1 < @ $2 . > first try hub | |
31a6de89 | 614 | R< $+ > $+ < $+ > $>95 < $1 > $2 < $3 > yep .... |
29e43b7a | 615 | R< > $+ + $* < $+ > $#_LOCAL_ $: $1 + $2 plussed name? |
efd6da82 | 616 | R< > $+ < $+ > $#_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 | |
619 | R$+ < @ $=w . > $#_LOCAL_ $: @ $1 sticky local names') | |
755e2424 EA |
620 | undivert(4)dnl |
621 | ||
979297f9 EA |
622 | ifdef(`_NO_UUCP_', `dnl', |
623 | `# resolve remotely connected UUCP links (if any) | |
708a514b | 624 | ifdef(`_CLASS_V_', |
7d426e19 | 625 | `R$* < @ $=V . UUCP > $* $#smtp $@ $V $: @ $V : $1 @ $2.UUCP $3', |
47523c33 | 626 | `dnl') |
708a514b | 627 | ifdef(`_CLASS_W_', |
7d426e19 | 628 | `R$* < @ $=W . UUCP > $* $#smtp $@ $W $: @ $W : $1 @ $2.UUCP $3', |
47523c33 | 629 | `dnl') |
708a514b | 630 | ifdef(`_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 |
635 | ifdef(`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 |
639 | ifdef(`_MAILER_pop_', |
640 | `R$+ < @ POP. > $#pop $: $1 user@POP', | |
641 | `dnl') | |
d2e7dfa9 | 642 | ifdef(`_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 |
648 | ifdef(`UUCP_RELAY', |
649 | `# forward non-local UUCP traffic to our UUCP relay | |
7d426e19 | 650 | R$*<@$*.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 | 653 | R$* < @ $+ .UUCP. > $* $#uucp $@ $2 $: $1 < @ $2 .UUCP. > $3 user@host.UUCP', |
755e2424 | 654 | `dnl')') |
194df6ac | 655 | ifdef(`_MAILER_usenet_', ` |
e653dde7 | 656 | # addresses sent to net.group.USENET will get forwarded to a newsgroup |
5adfff4e | 657 | R$+ . USENET $#usenet $: $1', |
3a5030a1 | 658 | `dnl') |
e653dde7 | 659 | |
97dcbde7 EA |
660 | ifdef(`_LOCAL_RULES_', |
661 | `# figure out what should stay in our local mail system | |
7d426e19 | 662 | R$* < @ $* > $* $#smtp $@ $2 $: $1 @ $2 $3 user@host.domain')') |
64100696 | 663 | # pass names that still have a host to a smarthost (if defined) |
f22970ed | 664 | R$* < @ $* > $* $: $>95 < $S > $1 < @ $2 > $3 glue on smarthost name |
e653dde7 | 665 | |
64100696 | 666 | # deal with other remote names |
3bd9528c | 667 | ifdef(`_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 | 672 | R$+ $: $(dequote $1 $) strip quotes |
f22970ed | 673 | R$+ $=O $+ $@ $>97 $1 $2 $3 try again |
ccfcf4aa EA |
674 | |
675 | # handle locally delivered names | |
664ff353 | 676 | R$=L $: $>_SET_95_ < $H > $1 special local names |
2c840221 EA |
677 | R$=L $#_LOCAL_ $: @ $1 special local names |
678 | R$+ $#_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 | 684 | S5 |
f25ecb3d | 685 | |
50eec51e EA |
686 | # deal with plussed users so aliases work nicely |
687 | R$+ + * $#_LOCAL_ $@ $&h $: $1 | |
688 | R$+ + $* $#_LOCAL_ $@ $2 $: $1 + * | |
f4d9c9f9 | 689 | |
efd6da82 EA |
690 | # prepend an empty "forward host" on the front |
691 | R$+ $: <> $1 | |
692 | ||
693 | ifdef(`LUSER_RELAY', | |
694 | `# send unrecognized local users to a relay host | |
0716b180 EA |
695 | R< > $+ + $* $: < $L . > $( user $1 $) + $2 |
696 | R< > $+ $: < $L . > $( user $1 $) look up user | |
697 | R< $* > $+ <> $* $: < > $2 $3 found; strip $L | |
698 | R< $* . > $+ $: < $1 > $2 strip extra dot') | |
699 | ||
700 | # handle plussed local names | |
701 | R< > $+ + $* $#_LOCAL_ $@ $2 $: $1 | |
efd6da82 | 702 | |
32014295 | 703 | # see if we have a relay or a hub |
664ff353 EA |
704 | R$+ $: $>_SET_95_ < $R > $1 try relay |
705 | R$+ $: $>_SET_95_ < $H > $1 try hub') | |
bc09d8d3 EA |
706 | ifdef(`MAILER_TABLE', |
707 | ` | |
708 | ||
d8ebcd49 EA |
709 | ################################################################### |
710 | ### Ruleset 90 -- try domain part of mailertable entry ### | |
d8ebcd49 | 711 | ################################################################### |
bc09d8d3 EA |
712 | |
713 | S90 | |
46977ce0 EA |
714 | R<$*> <$- $+ > $* $: < $1 . $2 > < $3 > $4 |
715 | R<. $+ > $+ $: < $1 > $2 | |
716 | R< $+ > < > $+ $: < $1 > < . > $2 | |
717 | R<$*> < $+ > $* $: <$1> < $(mailertable $2 $@ $1 $) > $3 lookup | |
718 | R<$+> <$- : $+ > $* $# $2 $@ $3 $: $4 check -- resolved? | |
719 | R$* $: $>87 $1 | |
720 | R<$+> < . $+ > $*<$*> $@ $>90 <$1> <$2> $3<$4> no -- strip & try again | |
721 | R$* $: $>88 $1 | |
722 | R<$+> <$*> $* $@ $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 | 729 | S95 |
feae130e EA |
730 | R< > $* $@ $1 strip off null relay |
731 | R< $- : $+ > $* $# $1 $@ $2 $: $3 try qualified mailer | |
732 | R< $=w > $* $@ $2 delete local host | |
733 | R< $+ > $* $#_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 | 739 | S98 |
d8ebcd49 | 740 | undivert(3)dnl |
f25ecb3d EA |
741 | #\f |
742 | ###################################################################### | |
743 | ###################################################################### | |
744 | ##### | |
ec174858 | 745 | `##### MAILER DEFINITIONS' |
f25ecb3d EA |
746 | ##### |
747 | ###################################################################### | |
748 | ###################################################################### | |
f25ecb3d | 749 | undivert(7)dnl |