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