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