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