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