home *** CD-ROM | disk | FTP | other *** search
/ ftp.disi.unige.it / 2015-02-11.ftp.disi.unige.it.tar / ftp.disi.unige.it / pub / software / unix / sendmail.cf < prev    next >
Text File  |  1997-11-24  |  26KB  |  900 lines

  1. #
  2. # Copyright (c) 1983, 1995 Eric P. Allman
  3. # Copyright (c) 1988, 1993
  4. #    The Regents of the University of California.  All rights reserved.
  5. #
  6. # Redistribution and use in source and binary forms, with or without
  7. # modification, are permitted provided that the following conditions
  8. # are met:
  9. # 1. Redistributions of source code must retain the above copyright
  10. #    notice, this list of conditions and the following disclaimer.
  11. # 2. Redistributions in binary form must reproduce the above copyright
  12. #    notice, this list of conditions and the following disclaimer in the
  13. #    documentation and/or other materials provided with the distribution.
  14. # 3. All advertising materials mentioning features or use of this software
  15. #    must display the following acknowledgement:
  16. #    This product includes software developed by the University of
  17. #    California, Berkeley and its contributors.
  18. # 4. Neither the name of the University nor the names of its contributors
  19. #    may be used to endorse or promote products derived from this software
  20. #    without specific prior written permission.
  21. #
  22. # THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  23. # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  24. # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  25. # ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  26. # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  27. # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  28. # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  29. # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  30. # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  31. # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  32. # SUCH DAMAGE.
  33. #
  34.  
  35. ######################################################################
  36. ######################################################################
  37. #####
  38. #####        SENDMAIL CONFIGURATION FILE
  39. #####
  40. ##### built by alex@mbox on Fri Jul 11 14:01:17 MET DST 1997
  41. ##### in /export/home/staff/alex/sendmail-8.8.6/cf/m4
  42. ##### using ../ as configuration include directory
  43. #####
  44. ######################################################################
  45. ######################################################################
  46.  
  47. #####  @(#)cfhead.m4    8.9 (Berkeley) 1/18/97  #####
  48. #####  @(#)cf.m4    8.24 (Berkeley) 8/16/95  #####
  49. #####  @(#)ULIsse.it.mc    8.8.6 (Berkeley) 7/11/97  #####
  50.  
  51. #####  @(#)solaris2.m4    8.9 (Berkeley) 9/25/96  #####
  52. #
  53.  
  54. #####  @(#)proto.m4    8.149 (Berkeley) 4/30/97  #####
  55.  
  56.  
  57. # level 7 config file format
  58. V7/Berkeley
  59.  
  60. ##################
  61. #   local info   #
  62. ##################
  63.  
  64. Cwlocalhost selene educ educ.disi selene.educ.disi.unige.it educ.disi.unige.it
  65. Fw/etc/mail/sendmail.cw
  66.  
  67. # my official domain name
  68. # ... define this only if sendmail cannot automatically determine your domain
  69. #Dj$w.Foo.COM
  70. Djeduc.disi.unige.it
  71.  
  72.  
  73. CP.
  74.  
  75. # "Smart" relay host (may be null)
  76. DS
  77.  
  78. # place to which unknown users should be forwarded
  79. #Kuser user -m -a<>
  80. #DLname_of_luser_relay
  81.  
  82. # operators that cannot be in local usernames (i.e., network indicators)
  83. CO @ % !
  84.  
  85. # a class with just dot (for identifying canonical names)
  86. C..
  87.  
  88. # a class with just a left bracket (for identifying domain literals)
  89. C[[
  90.  
  91. # Mailer table (overriding domains)
  92. #Kmailertable dbm /etc/mailertable
  93.  
  94. # Domain table (adding domains)
  95. #Kdomaintable dbm /etc/domaintable
  96.  
  97. # Generics table (mapping outgoing addresses)
  98. #Kgenerics dbm /etc/genericstable
  99.  
  100. # Virtual user table (maps incoming users)
  101. #Kvirtuser dbm /etc/virtusertable
  102.  
  103. # who I send unqualified names to (null means deliver locally)
  104. DR
  105.  
  106. # who gets all local email traffic ($R has precedence for unqualified names)
  107. DH
  108.  
  109. # dequoting map
  110. Kdequote dequote
  111.  
  112. # class E: names that should be exposed as from this host, even if we masquerade
  113. # class L: names that should be delivered locally, even if we have a relay
  114. # class M: domains that should be converted to $M
  115. #CL root
  116. CE root
  117.  
  118. # who I masquerade as (null for no masquerading) (see also $=M)
  119. DM
  120.  
  121. # my name for error messages
  122. DnMAILER-DAEMON
  123.  
  124.  
  125. # Configuration version number
  126. DZ8.8.6
  127.  
  128.  
  129. ###############
  130. #   Options   #
  131. ###############
  132.  
  133. # strip message body to 7 bits on input?
  134. O SevenBitInput=False
  135.  
  136. # 8-bit data handling
  137. O EightBitMode=pass8
  138.  
  139.  
  140. # wait for alias file rebuild (default units: minutes)
  141. O AliasWait=1
  142.  
  143. # location of alias file
  144. O AliasFile=/etc/mail/aliases
  145.  
  146. # minimum number of free blocks on filesystem
  147. O MinFreeBlocks=100
  148.  
  149. # maximum message size
  150. O MaxMessageSize=1000000
  151.  
  152. # substitution for space (blank) characters
  153. O BlankSub=.
  154.  
  155. # avoid connecting to "expensive" mailers on initial submission?
  156. O HoldExpensive=True
  157.  
  158. # checkpoint queue runs after every N successful deliveries
  159. #O CheckpointInterval=10
  160.  
  161. # default delivery mode
  162. O DeliveryMode=background
  163.  
  164. # automatically rebuild the alias database?
  165. #O AutoRebuildAliases
  166.  
  167. # error message header/file
  168. #O ErrorHeader=/etc/sendmail.oE
  169.  
  170. # error mode
  171. #O ErrorMode=print
  172.  
  173. # save Unix-style "From_" lines at top of header?
  174. #O SaveFromLine
  175.  
  176. # temporary file mode
  177. O TempFileMode=0600
  178.  
  179. # match recipients against GECOS field?
  180. #O MatchGECOS
  181.  
  182. # maximum hop count
  183. O MaxHopCount=16
  184.  
  185. # location of help file
  186. O HelpFile=/etc/mail/sendmail.hf
  187.  
  188. # ignore dots as terminators in incoming messages?
  189. #O IgnoreDots
  190.  
  191. # name resolver options
  192. #O ResolverOptions=+AAONLY
  193.  
  194. # deliver MIME-encapsulated error messages?
  195. O SendMimeErrors=True
  196.  
  197. # Forward file search path
  198. O ForwardPath=$z/.forward.$w:$z/.forward
  199.  
  200. # open connection cache size
  201. O ConnectionCacheSize=2
  202.  
  203. # open connection cache timeout
  204. O ConnectionCacheTimeout=5m
  205.  
  206. # persistent host status directory
  207. #O HostStatusDirectory=.hoststat
  208.  
  209. # single thread deliveries (requires HostStatusDirectory)?
  210. #O SingleThreadDelivery
  211.  
  212. # use Errors-To: header?
  213. O UseErrorsTo=False
  214.  
  215. # log level
  216. O LogLevel=9
  217.  
  218. # send to me too, even in an alias expansion?
  219. #O MeToo
  220.  
  221. # verify RHS in newaliases?
  222. O CheckAliases=False
  223.  
  224. # default messages to old style headers if no special punctuation?
  225. O OldStyleHeaders=True
  226.  
  227. # SMTP daemon options
  228. #O DaemonPortOptions=Port=esmtp
  229.  
  230. # privacy flags
  231. O PrivacyOptions=authwarnings
  232.  
  233. # who (if anyone) should get extra copies of error messages
  234. O PostMasterCopy=Postmaster
  235.  
  236. # slope of queue-only function
  237. #O QueueFactor=600000
  238.  
  239. # queue directory
  240. O QueueDirectory=/var/spool/mqueue
  241.  
  242. # timeouts (many of these)
  243. #O Timeout.initial=5m
  244. #O Timeout.connect=5m
  245. #O Timeout.iconnect=5m
  246. #O Timeout.helo=5m
  247. #O Timeout.mail=10m
  248. #O Timeout.rcpt=1h
  249. #O Timeout.datainit=5m
  250. #O Timeout.datablock=1h
  251. #O Timeout.datafinal=1h
  252. #O Timeout.rset=5m
  253. #O Timeout.quit=2m
  254. #O Timeout.misc=2m
  255. #O Timeout.command=1h
  256. #O Timeout.ident=30s
  257. #O Timeout.fileopen=60s
  258. O Timeout.queuereturn=3d
  259. #O Timeout.queuereturn.normal=5d
  260. #O Timeout.queuereturn.urgent=2d
  261. #O Timeout.queuereturn.non-urgent=7d
  262. O Timeout.queuewarn=4h
  263. #O Timeout.queuewarn.normal=4h
  264. #O Timeout.queuewarn.urgent=1h
  265. #O Timeout.queuewarn.non-urgent=12h
  266. #O Timeout.hoststatus=30m
  267.  
  268. # should we not prune routes in route-addr syntax addresses?
  269. #O DontPruneRoutes
  270.  
  271. # queue up everything before forking?
  272. O SuperSafe=True
  273.  
  274. # status file
  275. O StatusFile=/etc/mail/sendmail.st
  276.  
  277. # time zone handling:
  278. #  if undefined, use system default
  279. #  if defined but null, use TZ envariable passed in
  280. #  if defined and non-null, use that info
  281. #O TimeZoneSpec=
  282.  
  283. # default UID (can be username or userid:groupid)
  284. O DefaultUser=1:12
  285.  
  286. # list of locations of user database file (null means no lookup)
  287. #O UserDatabaseSpec=/etc/userdb
  288.  
  289. # fallback MX host
  290. #O FallbackMXhost=fall.back.host.net
  291. O FallbackMXhost=disi.unige.it
  292.  
  293. # if we are the best MX host for a site, try it directly instead of config err
  294. #O TryNullMXList
  295.  
  296. # load average at which we just queue messages
  297. O QueueLA=8
  298.  
  299. # load average at which we refuse connections
  300. O RefuseLA=2
  301.  
  302. # maximum number of children we allow at one time
  303. #O MaxDaemonChildren=12
  304.  
  305. # maximum number of new connections per second
  306. #O ConnectionRateThrottle=3
  307.  
  308. # work recipient factor
  309. #O RecipientFactor=30000
  310.  
  311. # deliver each queued job in a separate process?
  312. O ForkEachJob=False
  313.  
  314. # work class factor
  315. #O ClassFactor=1800
  316.  
  317. # work time factor
  318. #O RetryFactor=90000
  319.  
  320. # shall we sort the queue by hostname first?
  321. #O QueueSortOrder=priority
  322. O QueueSortOrder=priority
  323.  
  324. # minimum time in queue before retry
  325. #O MinQueueAge=30m
  326.  
  327. # default character set
  328. #O DefaultCharSet=iso-8859-1
  329.  
  330. # service switch file (ignored on Solaris, Ultrix, OSF/1, others)
  331. #O ServiceSwitchFile=/etc/service.switch
  332.  
  333. # hosts file (normally /etc/hosts)
  334. #O HostsFile=/etc/hosts
  335.  
  336. # dialup line delay on connection failure
  337. #O DialDelay=10s
  338.  
  339. # action to take if there are no recipients in the message
  340. #O NoRecipientAction=add-to-undisclosed
  341.  
  342. # chrooted environment for writing to files
  343. #O SafeFileEnvironment=/arch
  344.  
  345. # are colons OK in addresses?
  346. #O ColonOkInAddr
  347.  
  348. # how many jobs can you process in the queue?
  349. O MaxQueueRunSize=1000
  350.  
  351. # shall I avoid expanding CNAMEs (violates protocols)?
  352. #O DontExpandCnames
  353.  
  354. # SMTP initial login message (old $e macro)
  355. O SmtpGreetingMessage=$j Sendmail $v/$Z; $b
  356.  
  357. # UNIX initial From header format (old $l macro)
  358. #O UnixFromLine=From $g  $d
  359.  
  360. # delimiter (operator) characters (old $o macro)
  361. O OperatorChars=.:%@!^/[]+
  362.  
  363. # shall I avoid calling initgroups(3) because of high NIS costs?
  364. O DontInitGroups=True
  365.  
  366. # are group-writable :include: and .forward files (un)trustworthy?
  367. #O UnsafeGroupWrites
  368.  
  369. # where do errors that occur when sending errors get sent?
  370. #O DoubleBounceAddress
  371.  
  372. # what user id do we assume for the majority of the processing?
  373. #O RunAsUser=sendmail
  374.  
  375. # check protocol for security
  376. Opneedmailhelo,needexpnhelo,needvrfyhelo,noexpn,novrfy,restrictmailq,restrictqrun
  377.  
  378. ###########################
  379. #   Message precedences   #
  380. ###########################
  381.  
  382. Pfirst-class=0
  383. Pspecial-delivery=100
  384. Plist=-30
  385. Pbulk=-60
  386. Pjunk=-100
  387.  
  388. #####################
  389. #   Trusted users   #
  390. #####################
  391.  
  392. # this is equivalent to setting class "t"
  393. #Ft/etc/sendmail.ct
  394. Troot
  395. Tdaemon
  396. Tuucp
  397.  
  398. #########################
  399. #   Format of headers   #
  400. #########################
  401.  
  402. H?P?Return-Path: <$g>
  403. HReceived: $?sfrom $s $.$?_($?s$|from $.$_)
  404.     $.by $j ($v/$Z)$?r with $r$. id $i$?u
  405.     for $u; $|;
  406.     $.$b
  407. H?D?Resent-Date: $d
  408. H?D?Date: $d
  409. H?F?Resent-From: $?x$x <$g>$|$g$.
  410. H?F?From: $?x$x <$g>$|$g$.
  411. H?x?Full-Name: $x
  412. # HPosted-Date: $a
  413. # H?l?Received-Date: $b
  414. H?M?Resent-Message-Id: <$t.$i@$j>
  415. H?M?Message-Id: <$t.$i@$j>
  416. #
  417. ######################################################################
  418. ######################################################################
  419. #####
  420. #####            REWRITING RULES
  421. #####
  422. ######################################################################
  423. ######################################################################
  424.  
  425. ############################################
  426. ###  Ruleset 3 -- Name Canonicalization  ###
  427. ############################################
  428. S3
  429.  
  430. # handle null input (translate to <@> special case)
  431. R$@            $@ <@>
  432.  
  433. # strip group: syntax (not inside angle brackets!) and trailing semicolon
  434. R$*            $: $1 <@>            mark addresses
  435. R$* < $* > $* <@>    $: $1 < $2 > $3            unmark <addr>
  436. R@ $* <@>        $: @ $1                unmark @host:...
  437. R$* :: $* <@>        $: $1 :: $2            unmark node::addr
  438. R:include: $* <@>    $: :include: $1            unmark :include:...
  439. R$* [ $* : $* ] <@>    $: $1 [ $2 : $3 ]        unmark IPv6 addrs
  440. R$* : $* [ $* ]        $: $1 : $2 [ $3 ] <@>        remark if leading colon
  441. R$* : $* <@>        $: $2                strip colon if marked
  442. R$* <@>            $: $1                unmark
  443. R$* ;               $1                strip trailing semi
  444. R$* < $* ; >           $1 < $2 >            bogus bracketed semi
  445.  
  446. # null input now results from list:; syntax
  447. R$@            $@ :; <@>
  448.  
  449. # strip angle brackets -- note RFC733 heuristic to get innermost item
  450. R$*            $: < $1 >            housekeeping <>
  451. R$+ < $* >           < $2 >            strip excess on left
  452. R< $* > $+           < $1 >            strip excess on right
  453. R<>            $@ < @ >            MAIL FROM:<> case
  454. R< $+ >            $: $1                remove housekeeping <>
  455.  
  456. # make sure <@a,@b,@c:user@d> syntax is easy to parse -- undone later
  457. R@ $+ , $+        @ $1 : $2            change all "," to ":"
  458.  
  459. # localize and dispose of route-based addresses
  460. R@ $+ : $+        $@ $>96 < @$1 > : $2        handle <route-addr>
  461.  
  462. # find focus for list syntax
  463. R $+ : $* ; @ $+    $@ $>96 $1 : $2 ; < @ $3 >    list syntax
  464. R $+ : $* ;        $@ $1 : $2;            list syntax
  465.  
  466. # find focus for @ syntax addresses
  467. R$+ @ $+        $: $1 < @ $2 >            focus on domain
  468. R$+ < $+ @ $+ >        $1 $2 < @ $3 >            move gaze right
  469. R$+ < @ $+ >        $@ $>96 $1 < @ $2 >        already canonical
  470.  
  471. # do some sanity checking
  472. R$* < @ $* : $* > $*    $1 < @ $2 $3 > $4        nix colons in addrs
  473.  
  474. # convert old-style addresses to a domain-based address
  475. R$- ! $+        $@ $>96 $2 < @ $1 .UUCP >    resolve uucp names
  476. R$+ . $- ! $+        $@ $>96 $3 < @ $1 . $2 >        domain uucps
  477. R$+ ! $+        $@ $>96 $2 < @ $1 .UUCP >    uucp subdomains
  478.  
  479. # if we have % signs, take the rightmost one
  480. R$* % $*        $1 @ $2                First make them all @s.
  481. R$* @ $* @ $*        $1 % $2 @ $3            Undo all but the last.
  482. R$* @ $*        $@ $>96 $1 < @ $2 >        Insert < > and finish
  483.  
  484. # else we must be a local name
  485. R$*            $@ $>96 $1
  486.  
  487.  
  488. ################################################
  489. ###  Ruleset 96 -- bottom half of ruleset 3  ###
  490. ################################################
  491.  
  492. S96
  493.  
  494. # handle special cases for local names
  495. R$* < @ localhost > $*        $: $1 < @ $j . > $2        no domain at all
  496. R$* < @ localhost . $m > $*    $: $1 < @ $j . > $2        local domain
  497. R$* < @ localhost . UUCP > $*    $: $1 < @ $j . > $2        .UUCP domain
  498. R$* < @ [ $+ ] > $*        $: $1 < @@ [ $2 ] > $3        mark [a.b.c.d]
  499. R$* < @@ $=w > $*        $: $1 < @ $j . > $3        self-literal
  500. R$* < @@ $+ > $*        $@ $1 < @ $2 > $3        canon IP addr
  501.  
  502. # look up domains in the domain table
  503. #R$* < @ $+ > $*         $: $1 < @ $(domaintable $2 $) > $3
  504.  
  505.  
  506. # if really UUCP, handle it immediately
  507.  
  508. # try UUCP traffic as a local address
  509. R$* < @ $+ . UUCP > $*        $: $1 < @ $[ $2 $] . UUCP . > $3
  510. R$* < @ $+ . . UUCP . > $*        $@ $1 < @ $2 . > $3
  511.  
  512. # pass to name server to make hostname canonical
  513. R$* < @ $* $~P > $*        $: $1 < @ $[ $2 $3 $] > $4
  514.  
  515. # local host aliases and pseudo-domains are always canonical
  516. R$* < @ $=w > $*        $: $1 < @ $2 . > $3
  517. R$* < @ $j > $*            $: $1 < @ $j . > $2
  518. R$* < @ $=M > $*        $: $1 < @ $2 . > $3
  519. R$* < @ $* $=P > $*        $: $1 < @ $2 $3 . > $4
  520. R$* < @ $* . . > $*        $1 < @ $2 . > $3
  521.  
  522.  
  523. ##################################################
  524. ###  Ruleset 4 -- Final Output Post-rewriting  ###
  525. ##################################################
  526. S4
  527.  
  528. R$* <@>            $@                handle <> and list:;
  529.  
  530. # strip trailing dot off possibly canonical name
  531. R$* < @ $+ . > $*    $1 < @ $2 > $3
  532.  
  533. # eliminate internal code -- should never get this far!
  534. R$* < @ *LOCAL* > $*    $1 < @ $j > $2
  535.  
  536. # externalize local domain info
  537. R$* < $+ > $*        $1 $2 $3            defocus
  538. R@ $+ : @ $+ : $+    @ $1 , @ $2 : $3        <route-addr> canonical
  539. R@ $*            $@ @ $1                ... and exit
  540.  
  541. # UUCP must always be presented in old form
  542. R$+ @ $- . UUCP        $2!$1                u@h.UUCP => h!u
  543.  
  544. # delete duplicate local names
  545. R$+ % $=w @ $=w        $1 @ $2                u%host@host => u@host
  546.  
  547.  
  548.  
  549. ##############################################################
  550. ###   Ruleset 97 -- recanonicalize and call ruleset zero   ###
  551. ###           (used for recursive calls)           ###
  552. ##############################################################
  553.  
  554. S97
  555. R$*            $: $>3 $1
  556. R$*            $@ $>0 $1
  557.  
  558.  
  559. ######################################
  560. ###   Ruleset 0 -- Parse Address   ###
  561. ######################################
  562.  
  563. S0
  564.  
  565. R$*            $: $>Parse0 $1        initial parsing
  566. R$*            $: $>98 $1        handle local hacks
  567. R$*            $: $>Parse1 $1        final parsing
  568.  
  569. SParse0
  570. R<@>            $#local $: <@>        special case error msgs
  571. R$* : $* ; <@>        $#error $@ 5.1.3 $: "list:; syntax illegal for recipient addresses"
  572. R<@ $+>            $#error $@ 5.1.1 $: "user address required"
  573. R$*            $: <> $1
  574. R<> $* < @ [ $+ ] > $*    $1 < @ [ $2 ] > $3
  575. R<> $* <$* : $* > $*    $#error $@ 5.1.1 $: "colon illegal in host name part"
  576. R<> $*            $1
  577. R$* < @ . $* > $*    $#error $@ 5.1.2 $: "invalid host name"
  578. R$* < @ $* .. $* > $*    $#error $@ 5.1.2 $: "invalid host name"
  579.  
  580. # handle numeric address spec
  581. R$* < @ [ $+ ] > $*    $: $>98 $1 < @ [ $2 ] > $3    numeric internet spec
  582. R$* < @ [ $+ ] > $*    $#esmtp $@ [$2] $: $1 < @ [$2] > $3    still numeric: send
  583.  
  584. # now delete the local info -- note $=O to find characters that cause forwarding
  585. R$* < @ > $*        $@ $>Parse0 $>3 $1        user@ => user
  586. R< @ $=w . > : $*    $@ $>Parse0 $>3 $2        @here:... -> ...
  587. R$- < @ $=w . >        $: $(dequote $1 $) < @ $2 . >    dequote "foo"@here
  588. R< @ $+ >        $#error $@ 5.1.1 $: "user address required"
  589. R$* $=O $* < @ $=w . >    $@ $>Parse0 $>3 $1 $2 $3    ...@here -> ...
  590.  
  591. SParse1
  592. # handle virtual users
  593. #R$+ < @ $=w . >     $: < $(virtuser $1 @ $2 $@ $1 $: @ $) > $1 < @ $2 . >
  594. #R<@> $+ + $* < @ $* . >
  595.             $: < $(virtuser $1 + * @ $3 $@ $1 $: @ $) > $1 + $2 < @ $3 . >
  596. #R<@> $+ + $* < @ $* . >
  597.             $: < $(virtuser $1 @ $3 $@ $1 $: @ $) > $1 + $2 < @ $3 . >
  598. #R<@> $+ < @ $+ . >    $: < $(virtuser @ $2 $@ $1 $: @ $) > $1 < @ $2 . >
  599. #R<@> $+            $: $1
  600. #R< error : $- $+ > $*     $#error $@ $( dequote $1 $) $: $2
  601. #R< $+ > $+ < @ $+ >    $: $>97 $1
  602.  
  603. # short circuit local delivery so forwarded email works
  604. #R$+ . USENET < @ $=w . >    $#usenet $: $1        handle usenet specially
  605. R$=L < @ $=w . >    $#local $: @ $1        special local names
  606. R$+ < @ $=w . >        $#local $: $1            regular local name
  607.  
  608. # not local -- try mailer table lookup
  609. #R$* <@ $+ > $*        $: < $2 > $1 < @ $2 > $3    extract host name
  610. #R< $+ . > $*        $: < $1 > $2            strip trailing dot
  611. #R< $+ > $*        $: < $(mailertable $1 $) > $2    lookup
  612. #R< $~[ : $+ > $*     $>95 < $1 : $2 > $3        check -- resolved?
  613. #R< $+ > $*        $: $>90 <$1> $2            try domain
  614.  
  615. # resolve remotely connected UUCP links (if any)
  616.  
  617. # resolve fake top level domains by forwarding to other hosts
  618.  
  619.  
  620.  
  621. # pass names that still have a host to a smarthost (if defined)
  622. R$* < @ $* > $*        $: $>95 < $S > $1 < @ $2 > $3    glue on smarthost name
  623.  
  624. # deal with other remote names
  625. R$* < @$* > $*        $#esmtp $@ $2 $: $1 < @ $2 > $3        user@host.domain
  626.  
  627. # if this is quoted, strip the quotes and try again
  628. R$+            $: $(dequote $1 $)        strip quotes
  629. R$+ $=O $+        $@ $>97 $1 $2 $3            try again
  630.  
  631. # handle locally delivered names
  632. R$=L            $#local $: @ $1            special local names
  633. R$+            $#local $: $1            regular local names
  634.  
  635. ###########################################################################
  636. ###   Ruleset 5 -- special rewriting after aliases have been expanded   ###
  637. ###########################################################################
  638.  
  639. S5
  640.  
  641. # deal with plussed users so aliases work nicely
  642. R$+ + *            $#local $@ $&h $: $1
  643. R$+ + $*        $#local $@ + $2 $: $1 + *
  644.  
  645. # prepend an empty "forward host" on the front
  646. R$+            $: <> $1
  647.  
  648. # send unrecognized local users to a relay host
  649. #R< > $+         $: < $L . > $( user $1 $)    look up user
  650. #R< $* > $+ <> $*    $: < > $2 $3            found; strip $L
  651. #R< $* . > $+        $: < $1 > $2            strip extra dot
  652.  
  653. # see if we have a relay or a hub
  654. R< > $+            $: < $H > $1            try hub
  655. R< > $+            $: < $R > $1            try relay
  656. R< > $+            $: < > < $1 $(dequote "" $&h $) >    nope, restore +detail
  657. R< > < $+ + $* > $*       < > < $1 > + $2 $3        find the user part
  658. R< > < $+ > + $*    $#local $@ $2 $: @ $1        strip the extra +
  659. R< > < $+ >        $@ $1                no +detail
  660. R$+            $: $1 $(dequote "" $&h $)    add +detail back in
  661. R< local : $* > $*    $: $>95 < local : $1 > $2    no host extension
  662. R< error : $* > $*    $: $>95 < error : $1 > $2    no host extension
  663. R< $- : $+ > $+        $: $>95 < $1 : $2 > $3 < @ $2 >
  664. R< $+ > $+        $@ $>95 < $1 > $2 < @ $1 >
  665.  
  666. ###################################################################
  667. ###  Ruleset 90 -- try domain part of mailertable entry     ###
  668. ###################################################################
  669.  
  670. S90
  671. #R$* <$- . $+ > $*    $: $1$2 < $(mailertable .$3 $@ $1$2 $@ $2 $) > $4
  672. #R$* <$~[ : $+ > $*        $>95 < $2 : $3 > $4    check -- resolved?
  673. #R$* < . $+ > $*         $@ $>90 $1 . <$2> $3    no -- strip & try again
  674. #R$* < $* > $*        $: < $(mailertable . $@ $1$2 $) > $3    try "."
  675. #R< $~[ : $+ > $*        $>95 < $1 : $2 > $3    "." found?
  676. #R< $* > $*            $@ $2            no mailertable match
  677.  
  678. ###################################################################
  679. ###  Ruleset 95 -- canonify mailer:[user@]host syntax to triple    ###
  680. ###################################################################
  681.  
  682. S95
  683. R< > $*                $@ $1            strip off null relay
  684. R< error : $- $+ > $*        $#error $@ $( dequote $1 $) $: $2
  685. R< local : $* > $*        $>CanonLocal < $1 > $2
  686. R< $- : $+ @ $+ > $*<$*>$*    $# $1 $@ $3 $: $2<@$3>    use literal user
  687. R< $- : $+ > $*            $# $1 $@ $2 $: $3    try qualified mailer
  688. R< $=w > $*            $@ $2            delete local host
  689. R< $+ > $*            $#relay $@ $1 $: $2    use unqualified mailer
  690.  
  691. ###################################################################
  692. ###  Ruleset CanonLocal -- canonify local: syntax        ###
  693. ###################################################################
  694.  
  695. SCanonLocal
  696. # strip trailing dot from any host name that may appear
  697. R< $* > $* < @ $* . >        $: < $1 > $2 < @ $3 >
  698.  
  699. # handle local: syntax -- use old user, either with or without host
  700. R< > $* < @ $* > $*        $#local $@ $1@$2 $: $1
  701. R< > $+                $#local $@ $1    $: $1
  702.  
  703. # handle local:user@host syntax -- ignore host part
  704. R< $+ @ $+ > $* < @ $* >    $: < $1 > $3 < @ $4 >
  705.  
  706. # handle local:user syntax
  707. R< $+ > $* <@ $* > $*        $#local $@ $2@$3 $: $1
  708. R< $+ > $*             $#local $@ $2    $: $1
  709.  
  710. ###################################################################
  711. ###  Ruleset 93 -- convert header names to masqueraded form    ###
  712. ###################################################################
  713.  
  714. S93
  715.  
  716. # handle generics database
  717. #R$+ < @ $=G . >     $: < $1@$2 > $1 < @ $2 . > @    mark
  718. #R$+ < @ *LOCAL* >    $: < $1@$j > $1 < @ *LOCAL* > @    mark
  719. #R< $+ > $+ < $* > @    $: < $(generics $1 $: $) > $2 < $3 >
  720. #R< > $+ < @ $+ >     $: < $(generics $1 $: $) > $1 < @ $2 >
  721. #R< $* @ $* > $* < $* >    $@ $>3 $1 @ $2            found qualified
  722. #R< $+ > $* < $* >    $: $>3 $1 @ *LOCAL*        found unqualified
  723. #R< > $*            $: $1                not found
  724.  
  725. # special case the users that should be exposed
  726. R$=E < @ *LOCAL* >    $@ $1 < @ $j . >        leave exposed
  727. R$=E < @ $=M . >    $@ $1 < @ $2 . >
  728. R$=E < @ $=w . >    $@ $1 < @ $2 . >
  729.  
  730. # handle domain-specific masquerading
  731. R$* < @ $=M . > $*    $: $1 < @ $2 . @ $M > $3    convert masqueraded doms
  732. R$* < @ $=w . > $*    $: $1 < @ $2 . @ $M > $3
  733. R$* < @ *LOCAL* > $*    $: $1 < @ $j . @ $M > $2
  734. R$* < @ $+ @ > $*    $: $1 < @ $2 > $3        $M is null
  735. R$* < @ $+ @ $+ > $*    $: $1 < @ $3 . > $4        $M is not null
  736.  
  737. ###################################################################
  738. ###  Ruleset 94 -- convert envelope names to masqueraded form    ###
  739. ###################################################################
  740.  
  741. S94
  742. #R$+            $@ $>93 $1
  743. R$* < @ *LOCAL* > $*    $: $1 < @ $j . > $2
  744.  
  745. ###################################################################
  746. ###  Ruleset 98 -- local part of ruleset zero (can be null)    ###
  747. ###################################################################
  748.  
  749. S98
  750. #
  751. ######################################################################
  752. ######################################################################
  753. #####
  754. #####            MAILER DEFINITIONS
  755. #####
  756. ######################################################################
  757. ######################################################################
  758.  
  759.  
  760. ##################################################
  761. ###   Local and Program Mailer specification   ###
  762. ##################################################
  763.  
  764. #####  @(#)local.m4    8.23 (Berkeley) 5/31/96  #####
  765.  
  766. Mlocal,        P=/bin/mail, F=lsDFMAw5:/|@qSnE9, S=10/30, R=20/40,
  767.         T=DNS/RFC822/X-Unix,
  768.         A=mail -f $g -d $u
  769. Mprog,        P=/bin/sh, F=lsDFMoqeu9, S=10/30, R=20/40, D=$z:/,
  770.         T=X-Unix,
  771.         A=sh -c $u
  772.  
  773. #
  774. #  Envelope sender rewriting
  775. #
  776. S10
  777. R<@>            $n            errors to mailer-daemon
  778. R$+            $: $>50 $1        add local domain if needed
  779. R$*            $: $>94 $1        do masquerading
  780.  
  781. #
  782. #  Envelope recipient rewriting
  783. #
  784. S20
  785. R$+ < @ $* >        $: $1            strip host part
  786.  
  787. #
  788. #  Header sender rewriting
  789. #
  790. S30
  791. R<@>            $n            errors to mailer-daemon
  792. R$+            $: $>50 $1        add local domain if needed
  793. R$*            $: $>93 $1        do masquerading
  794.  
  795. #
  796. #  Header recipient rewriting
  797. #
  798. S40
  799. R$+            $: $>50 $1        add local domain if needed
  800. #R$*            $: $>93 $1        do all-masquerading
  801.  
  802. #
  803. #  Common code to add local domain name (only if always-add-domain)
  804. #
  805. S50
  806. #R$* < @ $* > $*     $@ $1 < @ $2 > $3        already fully qualified
  807. #R$+            $@ $1 < @ *LOCAL* >        add local qualification
  808.  
  809. #####################################
  810. ###   SMTP Mailer specification   ###
  811. #####################################
  812.  
  813. #####  @(#)smtp.m4    8.33 (Berkeley) 7/9/96  #####
  814.  
  815. Msmtp,        P=[IPC], F=mDFMuX, S=11/31, R=21, E=\r\n, L=990,
  816.         T=DNS/RFC822/SMTP,
  817.         A=IPC $h
  818. Mesmtp,        P=[IPC], F=mDFMuXa, S=11/31, R=21, E=\r\n, L=990,
  819.         T=DNS/RFC822/SMTP,
  820.         A=IPC $h
  821. Msmtp8,        P=[IPC], F=mDFMuX8, S=11/31, R=21, E=\r\n, L=990,
  822.         T=DNS/RFC822/SMTP,
  823.         A=IPC $h
  824. Mrelay,        P=[IPC], F=mDFMuXa8, S=11/31, R=61, E=\r\n, L=2040,
  825.         T=DNS/RFC822/SMTP,
  826.         A=IPC $h
  827.  
  828. #
  829. #  envelope sender rewriting
  830. #
  831. S11
  832. R$+            $: $>51 $1            sender/recipient common
  833. R$* :; <@>        $@                list:; special case
  834. R$*            $: $>61 $1            qualify unqual'ed names
  835. R$+            $: $>94 $1            do masquerading
  836.  
  837.  
  838. #
  839. #  envelope recipient rewriting --
  840. #  also header recipient if not masquerading recipients
  841. #
  842. S21
  843. R$+            $: $>51 $1            sender/recipient common
  844. R$+            $: $>61 $1            qualify unqual'ed names
  845.  
  846.  
  847. #
  848. #  header sender and masquerading header recipient rewriting
  849. #
  850. S31
  851. R$+            $: $>51 $1            sender/recipient common
  852. R:; <@>            $@                list:; special case
  853.  
  854. # do special header rewriting
  855. R$* <@> $*        $@ $1 <@> $2            pass null host through
  856. R< @ $* > $*        $@ < @ $1 > $2            pass route-addr through
  857. R$*            $: $>61 $1            qualify unqual'ed names
  858. R$+            $: $>93 $1            do masquerading
  859.  
  860.  
  861. #
  862. #  convert pseudo-domain addresses to real domain addresses
  863. #
  864. S51
  865.  
  866. # pass <route-addr>s through
  867. R< @ $+ > $*        $@ < @ $1 > $2            resolve <route-addr>
  868.  
  869. # output fake domains as user%fake@relay
  870.  
  871. # do UUCP heuristics; note that these are shared with UUCP mailers
  872. R$+ < @ $+ .UUCP. >    $: < $2 ! > $1            convert to UUCP form
  873. R$+ < @ $* > $*        $@ $1 < @ $2 > $3        not UUCP form
  874.  
  875. # leave these in .UUCP form to avoid further tampering
  876. R< $&h ! > $- ! $+    $@ $2 < @ $1 .UUCP. >
  877. R< $&h ! > $-.$+ ! $+    $@ $3 < @ $1.$2 >
  878. R< $&h ! > $+        $@ $1 < @ $&h .UUCP. >
  879. R< $+ ! > $+        $: $1 ! $2 < @ $Y >        use UUCP_RELAY
  880. R$+ < @ $+ : $+ >    $@ $1 < @ $3 >            strip mailer: part
  881. R$+ < @ >        $: $1 < @ *LOCAL* >        if no UUCP_RELAY
  882.  
  883.  
  884. #
  885. #  common sender and masquerading recipient rewriting
  886. #
  887. S61
  888.  
  889. R$* < @ $* > $*        $@ $1 < @ $2 > $3        already fully qualified
  890. R$+            $@ $1 < @ *LOCAL* >        add local qualification
  891.  
  892.  
  893. #
  894. #  relay mailer header masquerading recipient rewriting
  895. #
  896. S71
  897.  
  898. R$+            $: $>61 $1
  899. R$+            $: $>93 $1
  900.