Initial import from FreeBSD RELENG_4:
[dragonfly.git] / contrib / sendmail / cf / cf / submit.cf
1 #
2 # Copyright (c) 1998-2002 Sendmail, Inc. and its suppliers.
3 #       All rights reserved.
4 # Copyright (c) 1983, 1995 Eric P. Allman.  All rights reserved.
5 # Copyright (c) 1988, 1993
6 #       The Regents of the University of California.  All rights reserved.
7 #
8 # By using this file, you agree to the terms and conditions set
9 # forth in the LICENSE file which can be found at the top level of
10 # the sendmail distribution.
11 #
12 #
13
14 ######################################################################
15 ######################################################################
16 #####
17 #####           SENDMAIL CONFIGURATION FILE
18 #####
19 #####
20 ######################################################################
21 #####
22 #####   DO NOT EDIT THIS FILE!  Only edit the source .mc file.
23 #####
24 ######################################################################
25 ######################################################################
26
27 #####  $Id: cfhead.m4,v 8.108.2.2 2003/03/11 21:24:20 ca Exp $  #####
28 #####  $Id: cf.m4,v 8.32 1999/02/07 07:26:14 gshapiro Exp $  #####
29 #####  $Id: submit.mc,v 8.6.2.4 2002/12/29 03:54:34 ca Exp $  #####
30 #####  $Id: msp.m4,v 1.32 2002/03/26 22:02:03 ca Exp $  #####
31
32 #####  $Id: no_default_msa.m4,v 8.2 2001/02/14 05:03:22 gshapiro Exp $  #####
33
34
35 #####  $Id: proto.m4,v 8.649.2.17 2003/03/28 17:20:53 ca Exp $  #####
36
37 # level 10 config file format
38 V10/Berkeley
39
40 # override file safeties - setting this option compromises system security,
41 # addressing the actual file configuration problem is preferred
42 # need to set this before any file actions are encountered in the cf file
43 #O DontBlameSendmail=safe
44
45 # default LDAP map specification
46 # need to set this now before any LDAP maps are defined
47 #O LDAPDefaultSpec=-h localhost
48
49 ##################
50 #   local info   #
51 ##################
52
53 # my LDAP cluster
54 # need to set this before any LDAP lookups are done (including classes)
55 #D{sendmailMTACluster}$m
56
57 Cwlocalhost
58
59 # my official domain name
60 # ... define this only if sendmail cannot automatically determine your domain
61 #Dj$w.Foo.COM
62
63 CP.
64
65 # "Smart" relay host (may be null)
66 DS
67
68
69 # operators that cannot be in local usernames (i.e., network indicators)
70 CO @ % !
71
72 # a class with just dot (for identifying canonical names)
73 C..
74
75 # a class with just a left bracket (for identifying domain literals)
76 C[[
77
78
79 # Resolve map (to check if a host exists in check_mail)
80 Kresolve host -a<OKR> -T<TEMP>
81 C{ResOk}OKR
82
83
84 # Hosts for which relaying is permitted ($=R)
85 FR-o /etc/mail/relay-domains
86
87 # arithmetic map
88 Karith arith
89
90
91
92
93
94 # dequoting map
95 Kdequote dequote
96
97 # class E: names that should be exposed as from this host, even if we masquerade
98 # class L: names that should be delivered locally, even if we have a relay
99 # class M: domains that should be converted to $M
100 # class N: domains that should not be converted to $M
101 #CL root
102
103
104
105 # my name for error messages
106 DnMAILER-DAEMON
107
108
109 D{MTAHost}[127.0.0.1]
110
111
112 # Configuration version number
113 DZ8.12.9/Submit
114
115
116 ###############
117 #   Options   #
118 ###############
119
120 # strip message body to 7 bits on input?
121 O SevenBitInput=False
122
123 # 8-bit data handling
124 #O EightBitMode=pass8
125
126 # wait for alias file rebuild (default units: minutes)
127 O AliasWait=10
128
129 # location of alias file
130 #O AliasFile=/etc/mail/aliases
131
132 # minimum number of free blocks on filesystem
133 O MinFreeBlocks=100
134
135 # maximum message size
136 #O MaxMessageSize=1000000
137
138 # substitution for space (blank) characters
139 O BlankSub=.
140
141 # avoid connecting to "expensive" mailers on initial submission?
142 O HoldExpensive=False
143
144 # checkpoint queue runs after every N successful deliveries
145 #O CheckpointInterval=10
146
147 # default delivery mode
148 O DeliveryMode=i
149
150 # error message header/file
151 #O ErrorHeader=/etc/mail/error-header
152
153 # error mode
154 #O ErrorMode=print
155
156 # save Unix-style "From_" lines at top of header?
157 #O SaveFromLine=False
158
159 # queue file mode (qf files)
160 O QueueFileMode=0660
161
162 # temporary file mode
163 O TempFileMode=0600
164
165 # match recipients against GECOS field?
166 #O MatchGECOS=False
167
168 # maximum hop count
169 #O MaxHopCount=25
170
171 # location of help file
172 O HelpFile=/etc/mail/helpfile
173
174 # ignore dots as terminators in incoming messages?
175 #O IgnoreDots=False
176
177 # name resolver options
178 #O ResolverOptions=+AAONLY
179
180 # deliver MIME-encapsulated error messages?
181 O SendMimeErrors=True
182
183 # Forward file search path
184 O ForwardPath
185
186 # open connection cache size
187 O ConnectionCacheSize=2
188
189 # open connection cache timeout
190 O ConnectionCacheTimeout=5m
191
192 # persistent host status directory
193 #O HostStatusDirectory=.hoststat
194
195 # single thread deliveries (requires HostStatusDirectory)?
196 #O SingleThreadDelivery=False
197
198 # use Errors-To: header?
199 O UseErrorsTo=False
200
201 # log level
202 O LogLevel=9
203
204 # send to me too, even in an alias expansion?
205 #O MeToo=True
206
207 # verify RHS in newaliases?
208 O CheckAliases=False
209
210 # default messages to old style headers if no special punctuation?
211 O OldStyleHeaders=True
212
213 # SMTP daemon options
214
215 O DaemonPortOptions=Name=NoMTA, Addr=127.0.0.1, M=E
216
217 # SMTP client options
218 #O ClientPortOptions=Family=inet, Address=0.0.0.0
219
220 # Modifiers to define {daemon_flags} for direct submissions
221 #O DirectSubmissionModifiers
222
223 # Use as mail submission program? See sendmail/SECURITY
224 O UseMSP=True
225
226 # privacy flags
227 O PrivacyOptions=goaway,noetrn,restrictqrun
228
229 # who (if anyone) should get extra copies of error messages
230 #O PostmasterCopy=Postmaster
231
232 # slope of queue-only function
233 #O QueueFactor=600000
234
235 # limit on number of concurrent queue runners
236 #O MaxQueueChildren
237
238 # maximum number of queue-runners per queue-grouping with multiple queues
239 #O MaxRunnersPerQueue=1
240
241 # priority of queue runners (nice(3))
242 #O NiceQueueRun
243
244 # shall we sort the queue by hostname first?
245 #O QueueSortOrder=priority
246
247 # minimum time in queue before retry
248 #O MinQueueAge=30m
249
250 # how many jobs can you process in the queue?
251 #O MaxQueueRunSize=10000
252
253 # perform initial split of envelope without checking MX records
254 #O FastSplit=1
255
256 # queue directory
257 O QueueDirectory=/var/spool/clientmqueue
258
259 # key for shared memory; 0 to turn off
260 #O SharedMemoryKey=0
261
262
263
264 # timeouts (many of these)
265 #O Timeout.initial=5m
266 #O Timeout.connect=5m
267 #O Timeout.aconnect=0s
268 #O Timeout.iconnect=5m
269 #O Timeout.helo=5m
270 #O Timeout.mail=10m
271 #O Timeout.rcpt=1h
272 #O Timeout.datainit=5m
273 #O Timeout.datablock=1h
274 #O Timeout.datafinal=1h
275 #O Timeout.rset=5m
276 #O Timeout.quit=2m
277 #O Timeout.misc=2m
278 #O Timeout.command=1h
279 #O Timeout.ident=5s
280 #O Timeout.fileopen=60s
281 #O Timeout.control=2m
282 O Timeout.queuereturn=5d
283 #O Timeout.queuereturn.normal=5d
284 #O Timeout.queuereturn.urgent=2d
285 #O Timeout.queuereturn.non-urgent=7d
286
287 O Timeout.queuewarn=4h
288 #O Timeout.queuewarn.normal=4h
289 #O Timeout.queuewarn.urgent=1h
290 #O Timeout.queuewarn.non-urgent=12h
291
292 #O Timeout.hoststatus=30m
293 #O Timeout.resolver.retrans=5s
294 #O Timeout.resolver.retrans.first=5s
295 #O Timeout.resolver.retrans.normal=5s
296 #O Timeout.resolver.retry=4
297 #O Timeout.resolver.retry.first=4
298 #O Timeout.resolver.retry.normal=4
299 #O Timeout.lhlo=2m
300 #O Timeout.auth=10m
301 #O Timeout.starttls=1h
302
303 # time for DeliverBy; extension disabled if less than 0
304 #O DeliverByMin=0
305
306 # should we not prune routes in route-addr syntax addresses?
307 #O DontPruneRoutes=False
308
309 # queue up everything before forking?
310 O SuperSafe=True
311
312 # status file
313 O StatusFile=/var/spool/clientmqueue/sm-client.st
314
315 # time zone handling:
316 #  if undefined, use system default
317 #  if defined but null, use TZ envariable passed in
318 #  if defined and non-null, use that info
319 O TimeZoneSpec=
320
321 # default UID (can be username or userid:groupid)
322 #O DefaultUser=mailnull
323
324 # list of locations of user database file (null means no lookup)
325 #O UserDatabaseSpec=/etc/mail/userdb
326
327 # fallback MX host
328 #O FallbackMXhost=fall.back.host.net
329
330 # if we are the best MX host for a site, try it directly instead of config err
331 #O TryNullMXList=False
332
333 # load average at which we just queue messages
334 #O QueueLA=8
335
336 # load average at which we refuse connections
337 #O RefuseLA=12
338
339 # load average at which we delay connections; 0 means no limit
340 #O DelayLA=0
341
342 # maximum number of children we allow at one time
343 #O MaxDaemonChildren=0
344
345 # maximum number of new connections per second
346 #O ConnectionRateThrottle=0
347
348 # work recipient factor
349 #O RecipientFactor=30000
350
351 # deliver each queued job in a separate process?
352 #O ForkEachJob=False
353
354 # work class factor
355 #O ClassFactor=1800
356
357 # work time factor
358 #O RetryFactor=90000
359
360 # default character set
361 #O DefaultCharSet=iso-8859-1
362
363 # service switch file (name hardwired on Solaris, Ultrix, OSF/1, others)
364 #O ServiceSwitchFile=/etc/mail/service.switch
365
366 # hosts file (normally /etc/hosts)
367 #O HostsFile=/etc/hosts
368
369 # dialup line delay on connection failure
370 #O DialDelay=10s
371
372 # action to take if there are no recipients in the message
373 #O NoRecipientAction=add-to-undisclosed
374
375 # chrooted environment for writing to files
376 #O SafeFileEnvironment=/arch
377
378 # are colons OK in addresses?
379 #O ColonOkInAddr=True
380
381 # shall I avoid expanding CNAMEs (violates protocols)?
382 #O DontExpandCnames=False
383
384 # SMTP initial login message (old $e macro)
385 O SmtpGreetingMessage=$j Sendmail $v/$Z; $b
386
387 # UNIX initial From header format (old $l macro)
388 O UnixFromLine=From $g $d
389
390 # From: lines that have embedded newlines are unwrapped onto one line
391 #O SingleLineFromHeader=False
392
393 # Allow HELO SMTP command that does not include a host name
394 #O AllowBogusHELO=False
395
396 # Characters to be quoted in a full name phrase (@,;:\()[] are automatic)
397 #O MustQuoteChars=.
398
399 # delimiter (operator) characters (old $o macro)
400 O OperatorChars=.:%@!^/[]+
401
402 # shall I avoid calling initgroups(3) because of high NIS costs?
403 O DontInitGroups=True
404
405 # are group-writable :include: and .forward files (un)trustworthy?
406 # True (the default) means they are not trustworthy.
407 #O UnsafeGroupWrites=True
408
409
410 # where do errors that occur when sending errors get sent?
411 #O DoubleBounceAddress=postmaster
412
413 # where to save bounces if all else fails
414 #O DeadLetterDrop=/var/tmp/dead.letter
415
416 # what user id do we assume for the majority of the processing?
417 O RunAsUser=smmsp
418
419 # maximum number of recipients per SMTP envelope
420 #O MaxRecipientsPerMessage=100
421
422 # limit the rate recipients per SMTP envelope are accepted
423 # once the threshold number of recipients have been rejected
424 #O BadRcptThrottle=20
425
426 # shall we get local names from our installed interfaces?
427 O DontProbeInterfaces=True
428
429 # Return-Receipt-To: header implies DSN request
430 #O RrtImpliesDsn=False
431
432 # override connection address (for testing)
433 #O ConnectOnlyTo=0.0.0.0
434
435 # Trusted user for file ownership and starting the daemon
436 O TrustedUser=smmsp
437
438 # Control socket for daemon management
439 #O ControlSocketName=/var/spool/mqueue/.control
440
441 # Maximum MIME header length to protect MUAs
442 #O MaxMimeHeaderLength=2048/1024
443
444 # Maximum length of the sum of all headers
445 #O MaxHeadersLength=32768
446
447 # Maximum depth of alias recursion
448 #O MaxAliasRecursion=10
449
450 # location of pid file
451 O PidFile=/var/spool/clientmqueue/sm-client.pid
452
453 # Prefix string for the process title shown on 'ps' listings
454 #O ProcessTitlePrefix=prefix
455
456 # Data file (df) memory-buffer file maximum size
457 #O DataFileBufferSize=4096
458
459 # Transcript file (xf) memory-buffer file maximum size
460 #O XscriptFileBufferSize=4096
461
462 # lookup type to find information about local mailboxes
463 #O MailboxDatabase=pw
464
465 # list of authentication mechanisms
466 #O AuthMechanisms=EXTERNAL GSSAPI KERBEROS_V4 DIGEST-MD5 CRAM-MD5
467
468 # default authentication information for outgoing connections
469 #O DefaultAuthInfo=/etc/mail/default-auth-info
470
471 # SMTP AUTH flags
472 #O AuthOptions
473
474 # SMTP AUTH maximum encryption strength
475 #O AuthMaxBits
476
477 # SMTP STARTTLS server options
478 #O TLSSrvOptions
479
480 # Input mail filters
481 #O InputMailFilters
482
483
484 # CA directory
485 #O CACertPath
486 # CA file
487 #O CACertFile
488 # Server Cert
489 #O ServerCertFile
490 # Server private key
491 #O ServerKeyFile
492 # Client Cert
493 #O ClientCertFile
494 # Client private key
495 #O ClientKeyFile
496 # DHParameters (only required if DSA/DH is used)
497 #O DHParameters
498 # Random data source (required for systems without /dev/urandom under OpenSSL)
499 #O RandFile
500
501 ############################
502 # QUEUE GROUP DEFINITIONS  #
503 ############################
504
505
506 ###########################
507 #   Message precedences   #
508 ###########################
509
510 Pfirst-class=0
511 Pspecial-delivery=100
512 Plist=-30
513 Pbulk=-60
514 Pjunk=-100
515
516 #####################
517 #   Trusted users   #
518 #####################
519
520 # this is equivalent to setting class "t"
521 #Ft/etc/mail/trusted-users
522 Troot
523 Tdaemon
524 Tuucp
525
526 #########################
527 #   Format of headers   #
528 #########################
529
530 H?P?Return-Path: <$g>
531 HReceived: $?sfrom $s $.$?_($?s$|from $.$_)
532         $.$?{auth_type}(authenticated$?{auth_ssf} bits=${auth_ssf}$.)
533         $.by $j ($v/$Z)$?r with $r$. id $i$?{tls_version}
534         (version=${tls_version} cipher=${cipher} bits=${cipher_bits} verify=${verify})$.$?u
535         for $u; $|;
536         $.$b
537 H?D?Resent-Date: $a
538 H?D?Date: $a
539 H?F?Resent-From: $?x$x <$g>$|$g$.
540 H?F?From: $?x$x <$g>$|$g$.
541 H?x?Full-Name: $x
542 # HPosted-Date: $a
543 # H?l?Received-Date: $b
544 H?M?Resent-Message-Id: <$t.$i@$j>
545 H?M?Message-Id: <$t.$i@$j>
546
547 #\f
548 ######################################################################
549 ######################################################################
550 #####
551 #####                   REWRITING RULES
552 #####
553 ######################################################################
554 ######################################################################
555
556 ############################################
557 ###  Ruleset 3 -- Name Canonicalization  ###
558 ############################################
559 Scanonify=3
560
561 # handle null input (translate to <@> special case)
562 R$@                     $@ <@>
563
564 # strip group: syntax (not inside angle brackets!) and trailing semicolon
565 R$*                     $: $1 <@>                       mark addresses
566 R$* < $* > $* <@>       $: $1 < $2 > $3                 unmark <addr>
567 R@ $* <@>               $: @ $1                         unmark @host:...
568 R$* [ IPv6 : $+ ] <@>   $: $1 [ IPv6 : $2 ]             unmark IPv6 addr
569 R$* :: $* <@>           $: $1 :: $2                     unmark node::addr
570 R:include: $* <@>       $: :include: $1                 unmark :include:...
571 R$* : $* [ $* ]         $: $1 : $2 [ $3 ] <@>           remark if leading colon
572 R$* : $* <@>            $: $2                           strip colon if marked
573 R$* <@>                 $: $1                           unmark
574 R$* ;                      $1                           strip trailing semi
575 R$* < $+ :; > $*        $@ $2 :; <@>                    catch <list:;>
576 R$* < $* ; >               $1 < $2 >                    bogus bracketed semi
577
578 # null input now results from list:; syntax
579 R$@                     $@ :; <@>
580
581 # strip angle brackets -- note RFC733 heuristic to get innermost item
582 R$*                     $: < $1 >                       housekeeping <>
583 R$+ < $* >                 < $2 >                       strip excess on left
584 R< $* > $+                 < $1 >                       strip excess on right
585 R<>                     $@ < @ >                        MAIL FROM:<> case
586 R< $+ >                 $: $1                           remove housekeeping <>
587
588 # strip route address <@a,@b,@c:user@d> -> <user@d>
589 R@ $+ , $+              $2
590 R@ [ $* ] : $+          $2
591 R@ $+ : $+              $2
592
593 # find focus for list syntax
594 R $+ : $* ; @ $+        $@ $>Canonify2 $1 : $2 ; < @ $3 >       list syntax
595 R $+ : $* ;             $@ $1 : $2;                     list syntax
596
597 # find focus for @ syntax addresses
598 R$+ @ $+                $: $1 < @ $2 >                  focus on domain
599 R$+ < $+ @ $+ >         $1 $2 < @ $3 >                  move gaze right
600 R$+ < @ $+ >            $@ $>Canonify2 $1 < @ $2 >      already canonical
601
602
603 # convert old-style addresses to a domain-based address
604 R$- ! $+                $@ $>Canonify2 $2 < @ $1 .UUCP >        resolve uucp names
605 R$+ . $- ! $+           $@ $>Canonify2 $3 < @ $1 . $2 >         domain uucps
606 R$+ ! $+                $@ $>Canonify2 $2 < @ $1 .UUCP >        uucp subdomains
607
608 # convert node::user addresses into a domain-based address
609 R$- :: $+               $@ $>Canonify2 $2 < @ $1 .DECNET >      resolve DECnet names
610 R$- . $- :: $+          $@ $>Canonify2 $3 < @ $1.$2 .DECNET >   numeric DECnet addr
611
612 # if we have % signs, take the rightmost one
613 R$* % $*                $1 @ $2                         First make them all @s.
614 R$* @ $* @ $*           $1 % $2 @ $3                    Undo all but the last.
615 R$* @ $*                $@ $>Canonify2 $1 < @ $2 >      Insert < > and finish
616
617 # else we must be a local name
618 R$*                     $@ $>Canonify2 $1
619
620
621 ################################################
622 ###  Ruleset 96 -- bottom half of ruleset 3  ###
623 ################################################
624
625 SCanonify2=96
626
627 # handle special cases for local names
628 R$* < @ localhost > $*          $: $1 < @ $j . > $2             no domain at all
629 R$* < @ localhost . $m > $*     $: $1 < @ $j . > $2             local domain
630 R$* < @ localhost . UUCP > $*   $: $1 < @ $j . > $2             .UUCP domain
631
632 # check for IPv4/IPv6 domain literal
633 R$* < @ [ $+ ] > $*             $: $1 < @@ [ $2 ] > $3          mark [addr]
634 R$* < @@ $=w > $*               $: $1 < @ $j . > $3             self-literal
635 R$* < @@ $+ > $*                $@ $1 < @ $2 > $3               canon IP addr
636
637
638
639
640
641 # if really UUCP, handle it immediately
642
643 # try UUCP traffic as a local address
644 R$* < @ $+ . UUCP > $*          $: $1 < @ $[ $2 $] . UUCP . > $3
645 R$* < @ $+ . . UUCP . > $*      $@ $1 < @ $2 . > $3
646
647 # hostnames ending in class P are always canonical
648 R$* < @ $* $=P > $*             $: $1 < @ $2 $3 . > $4
649 R$* < @ $* $~P > $*             $: $&{daemon_flags} $| $1 < @ $2 $3 > $4
650 R$* CC $* $| $* < @ $+.$+ > $*  $: $3 < @ $4.$5 . > $6
651 R$* CC $* $| $*                 $: $3
652 # pass to name server to make hostname canonical
653 R$* $| $* < @ $* > $*           $: $2 < @ $[ $3 $] > $4
654 R$* $| $*                       $: $2
655
656 # local host aliases and pseudo-domains are always canonical
657 R$* < @ $=w > $*                $: $1 < @ $2 . > $3
658 R$* < @ $=M > $*                $: $1 < @ $2 . > $3
659 R$* < @ $* . . > $*             $1 < @ $2 . > $3
660
661
662 ##################################################
663 ###  Ruleset 4 -- Final Output Post-rewriting  ###
664 ##################################################
665 Sfinal=4
666
667 R$+ :; <@>              $@ $1 :                         handle <list:;>
668 R$* <@>                 $@                              handle <> and list:;
669
670 # strip trailing dot off possibly canonical name
671 R$* < @ $+ . > $*       $1 < @ $2 > $3
672
673 # eliminate internal code
674 R$* < @ *LOCAL* > $*    $1 < @ $j > $2
675
676 # externalize local domain info
677 R$* < $+ > $*           $1 $2 $3                        defocus
678 R@ $+ : @ $+ : $+       @ $1 , @ $2 : $3                <route-addr> canonical
679 R@ $*                   $@ @ $1                         ... and exit
680
681 # UUCP must always be presented in old form
682 R$+ @ $- . UUCP         $2!$1                           u@h.UUCP => h!u
683
684 # put DECnet back in :: form
685 R$+ @ $+ . DECNET       $2 :: $1                        u@h.DECNET => h::u
686 # delete duplicate local names
687 R$+ % $=w @ $=w         $1 @ $2                         u%host@host => u@host
688
689
690
691 ##############################################################
692 ###   Ruleset 97 -- recanonicalize and call ruleset zero   ###
693 ###                (used for recursive calls)              ###
694 ##############################################################
695
696 SRecurse=97
697 R$*                     $: $>canonify $1
698 R$*                     $@ $>parse $1
699
700
701 ######################################
702 ###   Ruleset 0 -- Parse Address   ###
703 ######################################
704
705 Sparse=0
706
707 R$*                     $: $>Parse0 $1          initial parsing
708 R<@>                    $#local $: <@>          special case error msgs
709 R$*                     $: $>ParseLocal $1      handle local hacks
710 R$*                     $: $>Parse1 $1          final parsing
711
712 #
713 #  Parse0 -- do initial syntax checking and eliminate local addresses.
714 #       This should either return with the (possibly modified) input
715 #       or return with a #error mailer.  It should not return with a
716 #       #mailer other than the #error mailer.
717 #
718
719 SParse0
720 R<@>                    $@ <@>                  special case error msgs
721 R$* : $* ; <@>          $#error $@ 5.1.3 $: "553 List:; syntax illegal for recipient addresses"
722 R@ <@ $* >              < @ $1 >                catch "@@host" bogosity
723 R<@ $+>                 $#error $@ 5.1.3 $: "553 User address required"
724 R$+ <@>                 $#error $@ 5.1.3 $: "553 Hostname required"
725 R$*                     $: <> $1
726 R<> $* < @ [ $* ] : $+ > $*     $1 < @ [ $2 ] : $3 > $4
727 R<> $* < @ [ $* ] , $+ > $*     $1 < @ [ $2 ] , $3 > $4
728 R<> $* < @ [ $* ] $+ > $*       $#error $@ 5.1.2 $: "553 Invalid address"
729 R<> $* < @ [ $+ ] > $*          $1 < @ [ $2 ] > $3
730 R<> $* <$* : $* > $*    $#error $@ 5.1.3 $: "553 Colon illegal in host name part"
731 R<> $*                  $1
732 R$* < @ . $* > $*       $#error $@ 5.1.2 $: "553 Invalid host name"
733 R$* < @ $* .. $* > $*   $#error $@ 5.1.2 $: "553 Invalid host name"
734 R$* < @ $* @ > $*       $#error $@ 5.1.2 $: "553 Invalid route address"
735 R$* @ $* < @ $* > $*    $#error $@ 5.1.3 $: "553 Invalid route address"
736 R$* , $~O $*            $#error $@ 5.1.3 $: "553 Invalid route address"
737
738
739 # now delete the local info -- note $=O to find characters that cause forwarding
740 R$* < @ > $*            $@ $>Parse0 $>canonify $1       user@ => user
741 R< @ $=w . > : $*       $@ $>Parse0 $>canonify $2       @here:... -> ...
742 R$- < @ $=w . >         $: $(dequote $1 $) < @ $2 . >   dequote "foo"@here
743 R< @ $+ >               $#error $@ 5.1.3 $: "553 User address required"
744 R$* $=O $* < @ $=w . >  $@ $>Parse0 $>canonify $1 $2 $3 ...@here -> ...
745 R$-                     $: $(dequote $1 $) < @ *LOCAL* >        dequote "foo"
746 R< @ *LOCAL* >          $#error $@ 5.1.3 $: "553 User address required"
747 R$* $=O $* < @ *LOCAL* >
748                         $@ $>Parse0 $>canonify $1 $2 $3 ...@*LOCAL* -> ...
749 R$* < @ *LOCAL* >       $: $1
750
751 #
752 #  Parse1 -- the bottom half of ruleset 0.
753 #
754
755 SParse1
756
757 # handle numeric address spec
758 R$* < @ [ $+ ] > $*     $: $>ParseLocal $1 < @ [ $2 ] > $3      numeric internet spec
759 R$* < @ [ $+ ] > $*     $: $1 < @ [ $2 ] : $S > $3      Add smart host to path
760 R$* < @ [ $+ ] : > $*           $#esmtp $@ [$2] $: $1 < @ [$2] > $3     no smarthost: send
761 R$* < @ [ $+ ] : $- : $*> $*    $#$3 $@ $4 $: $1 < @ [$2] > $5  smarthost with mailer
762 R$* < @ [ $+ ] : $+ > $*        $#esmtp $@ $3 $: $1 < @ [$2] > $4       smarthost without mailer
763
764
765 # short circuit local delivery so forwarded email works
766
767
768 R$=L < @ $=w . >        $#local $: @ $1                 special local names
769 R$+ < @ $=w . >         $#local $: $1                   regular local name
770
771
772 # resolve remotely connected UUCP links (if any)
773
774 # resolve fake top level domains by forwarding to other hosts
775
776
777
778 # pass names that still have a host to a smarthost (if defined)
779 R$* < @ $* > $*         $: $>MailerToTriple < $S > $1 < @ $2 > $3       glue on smarthost name
780
781 # deal with other remote names
782 R$* < @$* > $*          $#esmtp $@ $2 $: $1 < @ $2 > $3 user@host.domain
783
784 # handle locally delivered names
785 R$=L                    $#local $: @ $1         special local names
786 R$+                     $#local $: $1                   regular local names
787
788 ###########################################################################
789 ###   Ruleset 5 -- special rewriting after aliases have been expanded   ###
790 ###########################################################################
791
792 SLocal_localaddr
793 Slocaladdr=5
794 R$+                     $: $1 $| $>"Local_localaddr" $1
795 R$+ $| $#ok             $@ $1                   no change
796 R$+ $| $#$*             $#$2
797 R$+ $| $*               $: $1
798
799
800
801
802 # deal with plussed users so aliases work nicely
803 R$+ + *                 $#local $@ $&h $: $1
804 R$+ + $*                $#local $@ + $2 $: $1 + *
805
806 # prepend an empty "forward host" on the front
807 R$+                     $: <> $1
808
809
810
811 R< > $+                 $: < > < $1 <> $&h >            nope, restore +detail
812
813 R< > < $+ <> + $* >     $: < > < $1 + $2 >              check whether +detail
814 R< > < $+ <> $* >       $: < > < $1 >                   else discard
815 R< > < $+ + $* > $*        < > < $1 > + $2 $3           find the user part
816 R< > < $+ > + $*        $#local $@ $2 $: @ $1           strip the extra +
817 R< > < $+ >             $@ $1                           no +detail
818 R$+                     $: $1 <> $&h                    add +detail back in
819
820 R$+ <> + $*             $: $1 + $2                      check whether +detail
821 R$+ <> $*               $: $1                           else discard
822 R< local : $* > $*      $: $>MailerToTriple < local : $1 > $2   no host extension
823 R< error : $* > $*      $: $>MailerToTriple < error : $1 > $2   no host extension
824
825 R< $~[ : $+ > $+        $: $>MailerToTriple < $1 : $2 > $3 < @ $2 >
826
827 R< $+ > $+              $@ $>MailerToTriple < $1 > $2 < @ $1 >
828
829
830 ###################################################################
831 ###  Ruleset 95 -- canonify mailer:[user@]host syntax to triple ###
832 ###################################################################
833
834 SMailerToTriple=95
835 R< > $*                         $@ $1                   strip off null relay
836 R< error : $-.$-.$- : $+ > $*   $#error $@ $1.$2.$3 $: $4
837 R< error : $- $+ > $*           $#error $@ $(dequote $1 $) $: $2
838 R< local : $* > $*              $>CanonLocal < $1 > $2
839 R< $~[ : $+ @ $+ > $*<$*>$*     $# $1 $@ $3 $: $2<@$3>  use literal user
840 R< $~[ : $+ > $*                $# $1 $@ $2 $: $3       try qualified mailer
841 R< $=w > $*                     $@ $2                   delete local host
842 R< $+ > $*                      $#relay $@ $1 $: $2     use unqualified mailer
843
844 ###################################################################
845 ###  Ruleset CanonLocal -- canonify local: syntax               ###
846 ###################################################################
847
848 SCanonLocal
849 # strip local host from routed addresses
850 R< $* > < @ $+ > : $+           $@ $>Recurse $3
851 R< $* > $+ $=O $+ < @ $+ >      $@ $>Recurse $2 $3 $4
852
853 # strip trailing dot from any host name that may appear
854 R< $* > $* < @ $* . >           $: < $1 > $2 < @ $3 >
855
856 # handle local: syntax -- use old user, either with or without host
857 R< > $* < @ $* > $*             $#local $@ $1@$2 $: $1
858 R< > $+                         $#local $@ $1    $: $1
859
860 # handle local:user@host syntax -- ignore host part
861 R< $+ @ $+ > $* < @ $* >        $: < $1 > $3 < @ $4 >
862
863 # handle local:user syntax
864 R< $+ > $* <@ $* > $*           $#local $@ $2@$3 $: $1
865 R< $+ > $*                      $#local $@ $2    $: $1
866
867 ###################################################################
868 ###  Ruleset 93 -- convert header names to masqueraded form     ###
869 ###################################################################
870
871 SMasqHdr=93
872
873
874 # do not masquerade anything in class N
875 R$* < @ $* $=N . >      $@ $1 < @ $2 $3 . >
876
877 R$* < @ *LOCAL* >       $@ $1 < @ $j . >
878
879 ###################################################################
880 ###  Ruleset 94 -- convert envelope names to masqueraded form   ###
881 ###################################################################
882
883 SMasqEnv=94
884 R$* < @ *LOCAL* > $*    $: $1 < @ $j . > $2
885
886 ###################################################################
887 ###  Ruleset 98 -- local part of ruleset zero (can be null)     ###
888 ###################################################################
889
890 SParseLocal=98
891
892
893
894
895 ######################################################################
896 ###  CanonAddr --       Convert an address into a standard form for
897 ###                     relay checking.  Route address syntax is
898 ###                     crudely converted into a %-hack address.
899 ###
900 ###     Parameters:
901 ###             $1 -- full recipient address
902 ###
903 ###     Returns:
904 ###             parsed address, not in source route form
905 ######################################################################
906
907 SCanonAddr
908 R$*                     $: $>Parse0 $>canonify $1       make domain canonical
909
910
911 ######################################################################
912 ###  ParseRecipient --  Strip off hosts in $=R as well as possibly
913 ###                     $* $=m or the access database.
914 ###                     Check user portion for host separators.
915 ###
916 ###     Parameters:
917 ###             $1 -- full recipient address
918 ###
919 ###     Returns:
920 ###             parsed, non-local-relaying address
921 ######################################################################
922
923 SParseRecipient
924 R$*                             $: <?> $>CanonAddr $1
925 R<?> $* < @ $* . >              <?> $1 < @ $2 >                 strip trailing dots
926 R<?> $- < @ $* >                $: <?> $(dequote $1 $) < @ $2 > dequote local part
927
928 # if no $=O character, no host in the user portion, we are done
929 R<?> $* $=O $* < @ $* >         $: <NO> $1 $2 $3 < @ $4>
930 R<?> $*                         $@ $1
931
932
933 R<NO> $* < @ $* $=R >           $: <RELAY> $1 < @ $2 $3 >
934
935
936
937 R<RELAY> $* < @ $* >            $@ $>ParseRecipient $1
938 R<$+> $*                        $@ $2
939
940
941 ######################################################################
942 ###  check_relay -- check hostname/address on SMTP startup
943 ######################################################################
944
945 SLocal_check_relay
946 Scheck_relay
947 R$*                     $: $1 $| $>"Local_check_relay" $1
948 R$* $| $* $| $#$*       $#$3
949 R$* $| $* $| $*         $@ $>"Basic_check_relay" $1 $| $2
950
951 SBasic_check_relay
952 # check for deferred delivery mode
953 R$*                     $: < $&{deliveryMode} > $1
954 R< d > $*               $@ deferred
955 R< $* > $*              $: $2
956
957
958
959
960 ######################################################################
961 ###  check_mail -- check SMTP `MAIL FROM:' command argument
962 ######################################################################
963
964 SLocal_check_mail
965 Scheck_mail
966 R$*                     $: $1 $| $>"Local_check_mail" $1
967 R$* $| $#$*             $#$2
968 R$* $| $*               $@ $>"Basic_check_mail" $1
969
970 SBasic_check_mail
971 # check for deferred delivery mode
972 R$*                     $: < $&{deliveryMode} > $1
973 R< d > $*               $@ deferred
974 R< $* > $*              $: $2
975
976 # authenticated?
977 R$*                     $: $1 $| $>"tls_client" $&{verify} $| MAIL
978 R$* $| $#$+             $#$2
979 R$* $| $*               $: $1
980
981 R<>                     $@ <OK>                 we MUST accept <> (RFC 1123)
982 R$+                     $: <?> $1
983 R<?><$+>                $: <@> <$1>
984 R<?>$+                  $: <@> <$1>
985 R$*                     $: $&{daemon_flags} $| $1
986 R$* f $* $| <@> < $* @ $- >     $: < ? $&{client_name} > < $3 @ $4 >
987 R$* u $* $| <@> < $* >  $: <?> < $3 >
988 R$* $| $*               $: $2
989 # handle case of @localhost on address
990 R<@> < $* @ localhost > $: < ? $&{client_name} > < $1 @ localhost >
991 R<@> < $* @ [127.0.0.1] >
992                         $: < ? $&{client_name} > < $1 @ [127.0.0.1] >
993 R<@> < $* @ localhost.$m >
994                         $: < ? $&{client_name} > < $1 @ localhost.$m >
995 R<@> < $* @ localhost.UUCP >
996                         $: < ? $&{client_name} > < $1 @ localhost.UUCP >
997 R<@> $*                 $: $1                   no localhost as domain
998 R<? $=w> $*             $: $2                   local client: ok
999 R<? $+> <$+>            $#error $@ 5.5.4 $: "553 Real domain name required for sender address"
1000 R<?> $*                 $: $1
1001 R$*                     $: <?> $>CanonAddr $1           canonify sender address and mark it
1002 R<?> $* < @ $+ . >      <?> $1 < @ $2 >                 strip trailing dots
1003 # handle non-DNS hostnames (*.bitnet, *.decnet, *.uucp, etc)
1004 R<?> $* < @ $* $=P >    $: <OKR> $1 < @ $2 $3 >
1005 R<?> $* < @ $j >        $: <OKR> $1 < @ $j >
1006 R<?> $* < @ $+ >        $: <? $(resolve $2 $: $2 <PERM> $) > $1 < @ $2 >
1007 R<? $* <$->> $* < @ $+ >
1008                         $: <$2> $3 < @ $4 >
1009
1010
1011 # handle case of no @domain on address
1012 R<?> $*                 $: $&{daemon_flags} $| <?> $1
1013 R$* u $* $| <?> $*      $: <OKR> $3
1014 R$* $| $*               $: $2
1015 R<?> $*                 $: < ? $&{client_addr} > $1
1016 R<?> $*                 $@ <OKR>                        ...local unqualed ok
1017 R<? $+> $*              $#error $@ 5.5.4 $: "553 Domain name required for sender address " $&f
1018                                                         ...remote is not
1019 # check results
1020 R<?> $*                 $: @ $1         mark address: nothing known about it
1021 R<$={ResOk}> $*         $@ <OKR>        domain ok: stop
1022 R<TEMP> $*              $#error $@ 4.1.8 $: "451 Domain of sender address " $&f " does not resolve"
1023 R<PERM> $*              $#error $@ 5.1.8 $: "553 Domain of sender address " $&f " does not exist"
1024
1025 ######################################################################
1026 ###  check_rcpt -- check SMTP `RCPT TO:' command argument
1027 ######################################################################
1028
1029 SLocal_check_rcpt
1030 Scheck_rcpt
1031 R$*                     $: $1 $| $>"Local_check_rcpt" $1
1032 R$* $| $#$*             $#$2
1033 R$* $| $*               $@ $>"Basic_check_rcpt" $1
1034
1035 SBasic_check_rcpt
1036 # empty address?
1037 R<>                     $#error $@ nouser $: "553 User address required"
1038 R$@                     $#error $@ nouser $: "553 User address required"
1039 # check for deferred delivery mode
1040 R$*                     $: < $&{deliveryMode} > $1
1041 R< d > $*               $@ deferred
1042 R< $* > $*              $: $2
1043
1044
1045 ######################################################################
1046 R$*                     $: $1 $| @ $>"Rcpt_ok" $1
1047 R$* $| @ $#TEMP $+      $: $1 $| T $2
1048 R$* $| @ $#$*           $#$2
1049 R$* $| @ RELAY          $@ RELAY
1050 R$* $| @ $*             $: O $| $>"Relay_ok" $1
1051 R$* $| T $+             $: T $2 $| $>"Relay_ok" $1
1052 R$* $| $#TEMP $+        $#error $2
1053 R$* $| $#$*             $#$2
1054 R$* $| RELAY            $@ RELAY
1055 R T $+ $| $*            $#error $1
1056 # anything else is bogus
1057 R$*                     $#error $@ 5.7.1 $: "550 Relaying denied"
1058
1059
1060 ######################################################################
1061 ### Rcpt_ok: is the recipient ok?
1062 ######################################################################
1063 SRcpt_ok
1064 R$*                     $: $>ParseRecipient $1          strip relayable hosts
1065
1066
1067
1068
1069 # authenticated via TLS?
1070 R$*                     $: $1 $| $>RelayTLS     client authenticated?
1071 R$* $| $# $+            $# $2                   error/ok?
1072 R$* $| $*               $: $1                   no
1073
1074 R$*                     $: $1 $| $>"Local_Relay_Auth" $&{auth_type}
1075 R$* $| $# $*            $# $2
1076 R$* $| NO               $: $1
1077 R$* $| $*               $: $1 $| $&{auth_type}
1078 R$* $|                  $: $1
1079 R$* $| $={TrustAuthMech}        $# RELAY
1080 R$* $| $*               $: $1
1081 # anything terminating locally is ok
1082 R$+ < @ $=w >           $@ RELAY
1083 R$+ < @ $* $=R >        $@ RELAY
1084
1085
1086
1087 # check for local user (i.e. unqualified address)
1088 R$*                     $: <?> $1
1089 R<?> $* < @ $+ >        $: <REMOTE> $1 < @ $2 >
1090 # local user is ok
1091 R<?> $+                 $@ RELAY
1092 R<$+> $*                $: $2
1093
1094 ######################################################################
1095 ### Relay_ok: is the relay/sender ok?
1096 ######################################################################
1097 SRelay_ok
1098 # anything originating locally is ok
1099 # check IP address
1100 R$*                     $: $&{client_addr}
1101 R$@                     $@ RELAY                originated locally
1102 R0                      $@ RELAY                originated locally
1103 R127.0.0.1              $@ RELAY                originated locally
1104 RIPv6:::1               $@ RELAY                originated locally
1105 R$=R $*                 $@ RELAY                relayable IP address
1106 R$*                     $: [ $1 ]               put brackets around it...
1107 R$=w                    $@ RELAY                ... and see if it is local
1108
1109
1110 # check client name: first: did it resolve?
1111 R$*                     $: < $&{client_resolve} >
1112 R<TEMP>                 $#TEMP $@ 4.7.1 $: "450 Relaying temporarily denied. Cannot resolve PTR record for " $&{client_addr}
1113 R<FORGED>               $#error $@ 5.7.1 $: "550 Relaying denied. IP name possibly forged " $&{client_name}
1114 R<FAIL>                 $#error $@ 5.7.1 $: "550 Relaying denied. IP name lookup failed " $&{client_name}
1115 R$*                     $: <@> $&{client_name}
1116 # pass to name server to make hostname canonical
1117 R<@> $* $=P             $:<?>  $1 $2
1118 R<@> $+                 $:<?>  $[ $1 $]
1119 R$* .                   $1                      strip trailing dots
1120 R<?> $=w                $@ RELAY
1121 R<?> $* $=R                     $@ RELAY
1122
1123
1124
1125
1126 ######################################################################
1127 ###  trust_auth: is user trusted to authenticate as someone else?
1128 ###
1129 ###     Parameters:
1130 ###             $1: AUTH= parameter from MAIL command
1131 ######################################################################
1132
1133 SLocal_trust_auth
1134 Strust_auth
1135 R$*                     $: $&{auth_type} $| $1
1136 # required by RFC 2554 section 4.
1137 R$@ $| $*               $#error $@ 5.7.1 $: "550 not authenticated"
1138 R$* $| $&{auth_authen}          $@ identical
1139 R$* $| <$&{auth_authen}>        $@ identical
1140 R$* $| $*               $: $1 $| $>"Local_trust_auth" $1
1141 R$* $| $#$*             $#$2
1142 R$*                     $#error $@ 5.7.1 $: "550 " $&{auth_authen} " not allowed to act as " $&{auth_author}
1143
1144 ######################################################################
1145 ###  Relay_Auth: allow relaying based on authentication?
1146 ###
1147 ###     Parameters:
1148 ###             $1: ${auth_type}
1149 ######################################################################
1150 SLocal_Relay_Auth
1151
1152
1153
1154 ######################################################################
1155 ###  tls_client: is connection with client "good" enough?
1156 ###     (done in server)
1157 ###
1158 ###     Parameters:
1159 ###             ${verify} $| (MAIL|STARTTLS)
1160 ######################################################################
1161 Stls_client
1162 R$* $| $*       $@ $>"TLS_connection" $1
1163
1164 ######################################################################
1165 ###  tls_server: is connection with server "good" enough?
1166 ###     (done in client)
1167 ###
1168 ###     Parameter:
1169 ###             ${verify}
1170 ######################################################################
1171 Stls_server
1172 R$*             $@ $>"TLS_connection" $1
1173
1174 ######################################################################
1175 ###  TLS_connection: is TLS connection "good" enough?
1176 ###
1177 ###     Parameters:
1178 ###             ${verify}
1179 ###             Requirement: RHS from access map, may be ? for none.
1180 ######################################################################
1181 STLS_connection
1182 RSOFTWARE       $#error $@ 4.7.0 $: "403 TLS handshake."
1183
1184
1185 ######################################################################
1186 ###  RelayTLS: allow relaying based on TLS authentication
1187 ###
1188 ###     Parameters:
1189 ###             none
1190 ######################################################################
1191 SRelayTLS
1192 # authenticated?
1193
1194 ######################################################################
1195 ###  authinfo: lookup authinfo in the access map
1196 ###
1197 ###     Parameters:
1198 ###             $1: {server_name}
1199 ###             $2: {server_addr}
1200 ######################################################################
1201 Sauthinfo
1202
1203
1204
1205
1206 SLocal_localaddr
1207 R$+                     $: $>ParseRecipient $1
1208 R$* < @ $+ > $*         $#relay $@ ${MTAHost} $: $1 < @ $2 > $3
1209 # DECnet
1210 R$+ :: $+               $#relay $@ ${MTAHost} $: $1 :: $2
1211 R$*                     $#relay $@ ${MTAHost} $: $1 < @ $j >
1212 #\f
1213 ######################################################################
1214 ######################################################################
1215 #####
1216 #####                   MAIL FILTER DEFINITIONS
1217 #####
1218 ######################################################################
1219 ######################################################################
1220
1221 #\f
1222 ######################################################################
1223 ######################################################################
1224 #####
1225 #####                   MAILER DEFINITIONS
1226 #####
1227 ######################################################################
1228 ######################################################################
1229
1230
1231 ##################################################
1232 ###   Local and Program Mailer specification   ###
1233 ##################################################
1234
1235 #####  $Id: local.m4,v 8.58 2000/10/26 01:58:29 ca Exp $  #####
1236
1237 #
1238 #  Envelope sender rewriting
1239 #
1240 SEnvFromL
1241 R<@>                    $n                      errors to mailer-daemon
1242 R@ <@ $*>               $n                      temporarily bypass Sun bogosity
1243 R$+                     $: $>AddDomain $1       add local domain if needed
1244 R$*                     $: $>MasqEnv $1         do masquerading
1245
1246 #
1247 #  Envelope recipient rewriting
1248 #
1249 SEnvToL
1250 R$+ < @ $* >            $: $1                   strip host part
1251 R$+ + $*                $: < $&{addr_type} > $1 + $2    mark with addr type
1252 R<e s> $+ + $*          $: $1                   remove +detail for sender
1253 R< $* > $+              $: $2                   else remove mark
1254
1255 #
1256 #  Header sender rewriting
1257 #
1258 SHdrFromL
1259 R<@>                    $n                      errors to mailer-daemon
1260 R@ <@ $*>               $n                      temporarily bypass Sun bogosity
1261 R$+                     $: $>AddDomain $1       add local domain if needed
1262 R$*                     $: $>MasqHdr $1         do masquerading
1263
1264 #
1265 #  Header recipient rewriting
1266 #
1267 SHdrToL
1268 R$+                     $: $>AddDomain $1       add local domain if needed
1269 R$* < @ *LOCAL* > $*    $: $1 < @ $j . > $2
1270
1271 #
1272 #  Common code to add local domain name (only if always-add-domain)
1273 #
1274 SAddDomain
1275
1276 Mlocal,         P=[IPC], F=lmDFMuXkw5, S=EnvFromL/HdrFromL, R=EnvToL/HdrToL,
1277                 T=DNS/RFC822/SMTP,
1278                 A=TCP $h
1279 Mprog,          P=[IPC], F=lmDFMuXk5, S=EnvFromL/HdrFromL, R=EnvToL/HdrToL, D=$z:/,
1280                 T=X-Unix/X-Unix/X-Unix,
1281                 A=TCP $h
1282
1283 #####################################
1284 ###   SMTP Mailer specification   ###
1285 #####################################
1286
1287 #####  $Id: smtp.m4,v 8.64 2001/04/03 01:52:54 gshapiro Exp $  #####
1288
1289 #
1290 #  common sender and masquerading recipient rewriting
1291 #
1292 SMasqSMTP
1293 R$* < @ $* > $*         $@ $1 < @ $2 > $3               already fully qualified
1294 R$+                     $@ $1 < @ *LOCAL* >             add local qualification
1295
1296 #
1297 #  convert pseudo-domain addresses to real domain addresses
1298 #
1299 SPseudoToReal
1300
1301 # pass <route-addr>s through
1302 R< @ $+ > $*            $@ < @ $1 > $2                  resolve <route-addr>
1303
1304 # output fake domains as user%fake@relay
1305
1306 # do UUCP heuristics; note that these are shared with UUCP mailers
1307 R$+ < @ $+ .UUCP. >     $: < $2 ! > $1                  convert to UUCP form
1308 R$+ < @ $* > $*         $@ $1 < @ $2 > $3               not UUCP form
1309
1310 # leave these in .UUCP form to avoid further tampering
1311 R< $&h ! > $- ! $+      $@ $2 < @ $1 .UUCP. >
1312 R< $&h ! > $-.$+ ! $+   $@ $3 < @ $1.$2 >
1313 R< $&h ! > $+           $@ $1 < @ $&h .UUCP. >
1314 R< $+ ! > $+            $: $1 ! $2 < @ $Y >             use UUCP_RELAY
1315 R$+ < @ $~[ $* : $+ >   $@ $1 < @ $4 >                  strip mailer: part
1316 R$+ < @ >               $: $1 < @ *LOCAL* >             if no UUCP_RELAY
1317
1318
1319 #
1320 #  envelope sender rewriting
1321 #
1322 SEnvFromSMTP
1323 R$+                     $: $>PseudoToReal $1            sender/recipient common
1324 R$* :; <@>              $@                              list:; special case
1325 R$*                     $: $>MasqSMTP $1                qualify unqual'ed names
1326 R$+                     $: $>MasqEnv $1                 do masquerading
1327
1328
1329 #
1330 #  envelope recipient rewriting --
1331 #  also header recipient if not masquerading recipients
1332 #
1333 SEnvToSMTP
1334 R$+                     $: $>PseudoToReal $1            sender/recipient common
1335 R$+                     $: $>MasqSMTP $1                qualify unqual'ed names
1336 R$* < @ *LOCAL* > $*    $: $1 < @ $j . > $2
1337
1338 #
1339 #  header sender and masquerading header recipient rewriting
1340 #
1341 SHdrFromSMTP
1342 R$+                     $: $>PseudoToReal $1            sender/recipient common
1343 R:; <@>                 $@                              list:; special case
1344
1345 # do special header rewriting
1346 R$* <@> $*              $@ $1 <@> $2                    pass null host through
1347 R< @ $* > $*            $@ < @ $1 > $2                  pass route-addr through
1348 R$*                     $: $>MasqSMTP $1                qualify unqual'ed names
1349 R$+                     $: $>MasqHdr $1                 do masquerading
1350
1351
1352 #
1353 #  relay mailer header masquerading recipient rewriting
1354 #
1355 SMasqRelay
1356 R$+                     $: $>MasqSMTP $1
1357 R$+                     $: $>MasqHdr $1
1358
1359 Msmtp,          P=[IPC], F=mDFMuXk5, S=EnvFromSMTP/HdrFromSMTP, R=EnvToSMTP, E=\r\n, L=990,
1360                 T=DNS/RFC822/SMTP,
1361                 A=TCP $h
1362 Mesmtp,         P=[IPC], F=mDFMuXak5, S=EnvFromSMTP/HdrFromSMTP, R=EnvToSMTP, E=\r\n, L=990,
1363                 T=DNS/RFC822/SMTP,
1364                 A=TCP $h
1365 Msmtp8,         P=[IPC], F=mDFMuX8k5, S=EnvFromSMTP/HdrFromSMTP, R=EnvToSMTP, E=\r\n, L=990,
1366                 T=DNS/RFC822/SMTP,
1367                 A=TCP $h
1368 Mdsmtp,         P=[IPC], F=mDFMuXa%k5, S=EnvFromSMTP/HdrFromSMTP, R=EnvToSMTP, E=\r\n, L=990,
1369                 T=DNS/RFC822/SMTP,
1370                 A=TCP $h
1371 Mrelay,         P=[IPC], F=mDFMuXa8k, S=EnvFromSMTP/HdrFromSMTP, R=MasqSMTP, E=\r\n, L=2040,
1372                 T=DNS/RFC822/SMTP,
1373                 A=TCP $h
1374