home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / mail / sendmail / sendmail-5.65c+IDA-1.4.4.1 / ida / cf / Sendmail.mc < prev    next >
Encoding:
Text File  |  1991-08-11  |  90.1 KB  |  2,200 lines

  1. dnl * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  2. dnl * $Id: Sendmail.mc,v 4.4.0.6 1991/06/26 19:13:08 paul Exp paul $
  3. dnl * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  4. changequote({,})dnl
  5. ifdef({M4COMMENTS},{dnl
  6. ##########################################################################
  7. ###    The IDA-NIU Sendmail Master Configuration File    ##################
  8. ##########################################################################
  9. },{dnl ### M4COMMENTS Not defined ###
  10. ##########################################################################
  11. ###    The IDA-NIU Sendmail Configuration File        ##################
  12. ##########################################################################
  13. ###    The documentation in this file is deliberately minimal.  For   ###
  14. ###    more complete documentation, look at the Master file           ###
  15. ###    (Sendmail.mc), or - define(M4COMMENTS)    in your m4 source    ###
  16. ###    file and recreate the file.                       ###
  17. })dnl ### End of M4COMMENTS ###
  18. ##########################################################################
  19. ###    Lennart_Lovstrand.EuroPARC@Xerox.COM                   ###
  20. ###    Rank Xerox EuroPARC, 61 Regent St, Cambridge, England           ###
  21. ###    Copyright (c) 1984-88 -- Use it, abuse it, but don't sell it   ###
  22. ##########################################################################
  23. ###    Greatly modified, with changed internal canonical forms           ###
  24. ###    by Neil Rickert <rickert@cs.niu.edu>                   ###
  25. ###    Northern Illinois University, DeKalb IL 60115               ###
  26. ##########################################################################
  27. # Current version
  28. DVIDA-1.4.4
  29.  
  30. dnl #####################################################################
  31. dnl # We do some analysis of the binary version of 'sendmail' so    #
  32. dnl # that we can decide whether to use new features.            #
  33. dnl #####################################################################
  34. dnl # syscmd({/usr/lib/sendmail -d0.0 -bt < /dev/null})dnl
  35. define(TMP_FILE, maketemp(/tmp/IDA.XXXXXX))dnl
  36. ifdef({BINARY_VERSION},,{dnl ###
  37. define({GET_BINARY_VERSION}, {dnl
  38. {/usr/lib/sendmail -d0.0 -bt < /dev/null |
  39. sed -n 's/^Version *\(.*\)$/define(BINARY_VERSION, \1)dnl/p'} > TMP_FILE})dnl
  40. syscmd(GET_BINARY_VERSION)dnl
  41. include(TMP_FILE)dnl
  42. })dnl
  43. define({GET_BINARY_VERSION}, {dnl
  44. {echo "}BINARY_VERSION{"|sed -n }dnl
  45. {-e 's/^\([0-9]*\)\.\([0-9][0-9][+a-z]\)/\1.0\2/' }dnl
  46. {-e 's/[+a-i]/0&/' -e 's/[j-s]/1&/' -e 's/[t-z]/2&/' }dnl
  47. {-e 's/^\([.0-9]*[+a-z]\)$/\10/' }dnl
  48. {-e 's/^\([.0-9]*[+a-z]\)[^0-9].*/\10/' }dnl
  49. {-e 's/^\([0-9]*\)\.\([0-9]*[+a-z][0-9]\).*$/\1\2/' }dnl
  50. {-e 's/^[0-9]*[+a-z][0-9]$/SENDMAIL_NUMERIC_VERSION, &/p' }dnl
  51. {| tr +a-z 0-90-90-6 | sed 's/^SEN.*$/define(&)dnl/'}dnl
  52. > TMP_FILE})dnl
  53. undefine({SENDMAIL_NUMERIC_VERSION})dnl
  54. syscmd(GET_BINARY_VERSION)dnl
  55. include(TMP_FILE)dnl
  56. syscmd(rm -f TMP_FILE)dnl
  57. ifdef({SENDMAIL_NUMERIC_VERSION},,{dnl
  58. errprint({Warning: Your sendmail binary version doesn't look like IDA})dnl
  59. define({SENDMAIL_NUMERIC_VERSION},0)})dnl
  60. ifdef({M4COMMENTS},{dnl
  61. ####### INTRODUCTION #####################################################
  62. #
  63. #    This is The IDA Sendmail Master Configuration File--a completely
  64. #    independent development having nothing to do with the version
  65. #    distributed by Berkeley.  In order to work properly, it requires
  66. #    a set of new functions implemented by the IDA Sendmail Enhancement
  67. #    Kit, available from your nearest comp.sources.unix archive.
  68. #
  69. #    Get it today, tomorrow they might have a disk crash!
  70. #
  71. #    IDA is an abbreviation of "Institutionen for Datavetenskap",
  72. #    which is Swedish for "The Department of Computer and Information
  73. #    Science".  Under no circumstance should it be confused with the
  74. #    IDA that stands for the Institute for Defense Analysis, with
  75. #    which the author has no relationship to nor wish to become
  76. #    associated with.
  77.  
  78. })dnl ### End of M4COMMENTS ###
  79. ####### REWRITING STRATEGIES #############################################
  80. #
  81. #    Ruleset 3 completely canonicalizes addresses to an internal
  82. #    format, which looks like a modified RFC822 source route.
  83. #    The internal canonical form is documented in the comments
  84. #    preceding Ruleset #7 which is called internally by Ruleset #3.
  85. #
  86. #    The "domain" will be mapped to its full, official domain name
  87. #    using the TCP/IP name server and a dbm domaintable.  !- and
  88. #    ::-style paths are rewritten into RFC822 routes internally.
  89. #    Resonable mixtures of !-, %-, and RFC822 routes are resolved,
  90. #    either using straight domain preference, or using heuristics.
  91. #    Some effort is made to repair malformed addresses.
  92. #
  93. #    This format is used in all internal rulesets until finally
  94. #    rewritten by the mailer dependent rules or by ruleset #4,
  95. #    where they are fully transformed into the mailer's preferred
  96. #    address syntax.  Three
  97. #    kinds of mailers currently exist:
  98. #
  99. #    [1]  Domain based mailers, for which the official domain names
  100. #         are used and routes are given in the %-format for header
  101. #         addresses and envelope recipient addresses, while
  102. #         envelope return paths are kept in RFC822 route syntax.
  103. #         Typical examples of this type are the TCP/IP and LOCAL
  104. #         mailers.
  105. #
  106. #    [2]  Domain based mailers with flat node name mappings.  These
  107. #         use full domain names in header addresses but translate
  108. #         envelope domains to names relative the actual network's
  109. #         name space.  Two mailers fit into this category: The Dmail
  110. #         mailer, which map domain names to DECnet names, and the
  111. #         UUCP-A/B mailers, which map domains to UUCP node names.
  112. #         Both the DECnet and the UUCP worlds use flat namespaces.
  113. #         The Dmail and the UUCP-B mailers essentially uses type I
  114. #         routes while the UUCP-A mailer uses type III routes (ie,
  115. #         !-paths).
  116. #
  117. #    [3]  UUCP !-path based mailers.  This mailer type rewrites all
  118. #         addresses into !-paths, both header and envelope addresses.
  119. #         Header addresses are made relative the remote node by
  120. #         removing "remote!" from them or prefixing "localhost!" to
  121. #         them. UUCP nodes with domain names are translated to their
  122. #         UUCP equivlanents.
  123.  
  124.  
  125. ####### SENDMAIL CONFIGURATION EXTENSIONS ################################
  126. #
  127. #    This is a short table describing extensions to the configuration
  128. #    language.  See the reference guide for a detailed definition.
  129. #
  130. #    Option "/" will turn on general envelope/header specific
  131. #    rewriting.  Mailer specific e/h rulesets are given as in
  132. #    "R=14/15", where ruleset 14 is used for envelope recipient
  133. #    addresses and ruleset 15 for header recipients.
  134. #
  135. #    The M_FROMPATH (p) flag will work for mailers that use "From_"
  136. #    line envelopes as well as SMTP mailers.
  137. #
  138. #    The M_RELATIVIZE (V) flag has been added, which make all header
  139. #    lines relative the recipient host by removing "remote!" or
  140. #    adding "localhost!".
  141. #
  142. #    TCP/IP nameserver lookups are extended with a default argument,
  143. #    as in "$[ hostname $: default $]".  The "default" string will be
  144. #    returned if the host isn't known to gethostname(3).
  145. #
  146. #    General dbm database functions have been added.  The option "K"
  147. #    will declare a dbm database and associate it with a letter,
  148. #    which later on is used in constructs like:
  149. #        "$(x key $@ arg $: default $)"
  150. #    The "x" is the one-letter name of the database, the "key" is the
  151. #    lookup string; the optional "arg" is then sprintf(3)'ed through
  152. #    the result, if found.  The whole expression evaluates to
  153. #    "default", or "key" if "$: default" is not present, if the "key"
  154. #    can't be found in the database.  The "@" database is
  155. #    automatically connected to the aliases(5) file.
  156.  
  157.  
  158. ifdef({M4COMMENTS},{dnl
  159. ####### M4 IDENTIFIERS ###################################################
  160. #
  161. #    NOTE: Be aware that this is an m4 source where curly braces are
  162. #    used as quote characters.  You will lose heavily if you care-
  163. #    lessly mention reserved m4 words or use curly braces where you
  164. #    shouldn't.
  165. #
  166. #    The following is a list of all m4 identifiers used in this file.
  167. #    All of them are optional.
  168. #
  169. #    ACSNETDELIVERY
  170. #        Defines the ACSNET mailer used by sites in Australia.
  171. #        This would normally be used in association with a
  172. #        MAILERTABLE entry mapping the key '.oz' into the the
  173. #        the mailer/host pair 'ACSNET,%s.oz'.
  174. #    ALIASES
  175. #        Name of the aliases file, defaults to sendmail's default.
  176. #    ALIAS_TOP_DOMAINS
  177. #        Should be defined by hosts not on Internet which use
  178. #        pathalias entries for .EDU .COM etc to handle internet
  179. #        forwarding.
  180. #    ALWAYSADDDOMAIN
  181. #        If defined, local mail will always have the full domain
  182. #        attached to the address.  The default is to retain the
  183. #        domain if already present, but not add it to local addresses
  184. #        without domains.  This only effects the local mailer.
  185. #    ALTERNATENAMES
  186. #        A list of alternate names for which mail is handled on
  187. #        this machine.  This differs from PSEUDONYMS in that
  188. #        mail to a PSEUDONYM is equivalent to mail to the main
  189. #        name of this machine.  But we may also handle final
  190. #        delivery of mail to other names, either with special
  191. #        mailers defined in the mailer table, or with use
  192. #        of the extended aliasing facility.  Used only in
  193. #        ruleset #29 for stripping source routes through us
  194. #        based on both pseudonyms and alternate names.
  195. #    BANGIMPLIESUUCP
  196. #        If defined, will assume that all !-paths with leading,
  197. #        unqualified nodes resides in the UUCP pseudo-domain.
  198. #        Will otherwise try to qualify node using the name server
  199. #        and domaintable, retreating to .UUCP if unknown by them.
  200. #    BANGONLYUUCP
  201. #        If defined, a .UUCP qualification will only be added
  202. #        to an unqualified domain if the domain is delimited
  203. #        with a !.
  204. #    BINARY_VERSION
  205. #        The version (such as 5.65c) of the sendmail binary.  Used
  206. #        for selecting features.  Normally you should not define this
  207. #        unless the version of sendmail installed on the machine
  208. #        where m4 is run is different from the version on the target
  209. #        machine for which the configuration file is being
  210. #        prepared.
  211. })dnl ### End of M4COMMENTS ###
  212. ifdef({M4COMMENTS},{dnl  -Divided this to avoid overflowing m4 buffer.
  213. #    DECNETNAME
  214. #        This node's DECnet name as printed by the nodename command.
  215. #        Define if this host is a DECnet/Internet gateway.  Routes
  216. #        mail sent to host::user and user@host.dnet via mail11v3.
  217. #        Will also route user@host.hepnet, user@host.decnet, and
  218. #        user@host.span if UIUC is defined.  Sendmail must be compiled
  219. #        with #define MAIL11V3 in src/conf.h .
  220. #    DECNETNODES
  221. #        A file containing DECnet host names.  Used in combination
  222. #        with DECNETXTABLE to determine delivery through the Dmail
  223. #        mailer and when to expand flatspaced DECnet host names into
  224. #        domains.  DECNETNODES may be a list of domains, an absolute
  225. #        file path (first char /) or a program (first char |).
  226. #    DECNETXTABLE
  227. #        The DECnet translation table.  Returns a node's DECnet
  228. #        host name if given its domain name.
  229. #    DEFAULT_HOST
  230. #        Explicit host name, replaces automatic definition of $w.
  231. #    DEFAULT_DOMAIN
  232. #        The string that (+ ".") will be attached to $w to
  233. #        form $j, this node's official domain name.  Only define
  234. #        this if $w doesn't already include your full domain
  235. #        (ie, as returned by gethostbyname(<yourhost>)).
  236. #    DOMAINMASTER
  237. #        Obsolescent.  Use ALTERNATENAMES (which see) and a mailer
  238. #        table entry.  Was intended to allow handling mail for a parent
  239. #        domain for which there is no machine.  For example, at
  240. #        uiuc, machine uxc.cso.uiuc.edu can handle mail for uiuc.edu.
  241. #        by sending them to the PH mailer.  But with the extensions to
  242. #        the mailertable, the same effect is achieved by defining an
  243. #        entry:  PH!uxc.cso.uiuc.edu  uiuc.edu
  244. #        in the mailertable source.  An entry for uiuc.edu would still
  245. #        be needed in ALTERNATENAMES to strip source routes.
  246. #    DOMAINTABLE
  247. #        Dbm database used for hostname canonicalization, ie.
  248. #        to find the official domain name for local or otherwise
  249. #        unqualified hosts.
  250. })dnl ### End of M4COMMENTS ###
  251. ifdef({M4COMMENTS},{dnl  -Divided this to avoid overflowing m4 buffer.
  252. #    FORCE_NAMED
  253. #        Set the I flag to force host name lookups to go through the
  254. #        domain name server.  Otherwise if the nameserver isn't
  255. #        running, sendmail will assume that /etc/hosts is complete.
  256. #        You want to use this if you're doing MX forwarding.  You
  257. #        DON'T want to use this if you're not running the nameserver.
  258. #    GENERICFROM
  259. #        A database mapping actual user names to generic user
  260. #        names.  Used instead of HIDDENNET in a heterogenous
  261. #        environment.  This mapping normally applies only to the
  262. #        header sender (From: or Reply-To: header).  However it
  263. #        will also apply to the envelope sender if GENERICENVELOPE
  264. #        is defined, and to the recipient headers (To: and Cc:) if
  265. #        GENERICTO is defined.
  266. #    HIDDENDOMAIN
  267. #        Allows all hosts in some.dom.ain to have their names hidden
  268. #        behind the specified HIDDENDOMAINHOST, or behind the name
  269. #        of the HIDDENDOMAIN itself if no HIDDENDOMAIN host is
  270. #        specified.
  271. #    HIDDENDOMAINHOST
  272. #        The host name to be substituted for hosts in the
  273. #        HIDDENDOMAIN.
  274. #    HIDDENNET
  275. #        Points to a file containing a list of host names, one
  276. #        per line.  Mail from users on any of these hosts will
  277. #        have the host name substituted for our host, $w.
  278. #        HIDDENNET may be a list of domains, an absolute
  279. #        file path (first char /) or a program (first char |).
  280. #    HIDDENNETHOST
  281. #        The fully qualified domain name to use instead of $w with
  282. #        HIDDENNET.
  283. #    LIBDIR    
  284. #        The directory that will hold most data files, including
  285. #        sendmail.{hf,st}; defaults to /usr/lib/mail.
  286. #    LOADAVEQUEUE
  287. #        The load average at which messages will be queued.  Defaults
  288. #        to 11.  Define as 0 to disable the facility.
  289. #    LOADAVEREJ
  290. #        The load average at which connections will be refused.
  291. #        Defaults to 7.  Disable by defining as 0.
  292. })dnl ### End of M4COMMENTS ###
  293. ifdef({M4COMMENTS},{dnl  -Divided this to avoid overflowing m4 buffer.
  294. #    LOCAL_MAILER_DEF
  295. #        Allows selection of the BSD (default) local mailers, or
  296. #        SYSV definitions, or DELIVER, or a filename.  See also
  297. #        UUCP_MAILER_DEF and OTHER_MAILER_DEF
  298. #    LOCAL_MX_HANDLERS
  299. #        A class of hostnames such that MX records directed to these
  300. #        hosts should be treated as local.  If your host has more than
  301. #        one name with an A-record, enter the additional names (those
  302. #        not in $=w) here to avoid accidently connecting to yourself.
  303. #    M4COMMENTS
  304. #        Not intended to be defined.  If not defined, comments
  305. #        which only make sense in the M4 source are excluded from
  306. #        the generated .cf file.
  307. #    MAILNAME
  308. #        The domain name to be used on outbound mail, in place of
  309. #        $w.  This is mostly useful when it is desired to hide all
  310. #        host names in a network, with a common MX name to be on
  311. #        outbound mail.  If most hosts in the network do not run
  312. #        SMTP daemons it is better to not use the real hostname.
  313. #        MAILNAME is only used for local names for which no domain
  314. #        is explicitely specified.  If you wish to hide host names
  315. #        that are explicitely specified, you should also use
  316. #        HIDDENNET.  When MAILNAME is defined it becomes the
  317. #        default value for HIDDENNETHOST.
  318. #    MAILERTABLE
  319. #        A dbm table mapping node names to "mailer:host" pairs.
  320. #        It is used for special cases when the resolving heuristics
  321. #        of ruleset 26 aren't enough.
  322. #        The key may be of the form .subdomain for matching complete
  323. #        subdomain families.  The value mapped to may be of the
  324. #        forms - mailer,host  or  mailer:host  or  mailer!host
  325. #        The standard should be mailer,host .  With mailer!host the
  326. #        destination domain is removed from the recipient address before
  327. #        mailing.  With mailer:host the recipient domain is removed if
  328. #        multi-level routing is present.  An optional form ':' (i.e.
  329. #        missing mailer and host) may be specified to cause mailer
  330. #        selection to fail, and force a PATHTABLE lookup.
  331. #        In the host portion of mailer,host there may be a %s provided
  332. #        that the search key begins with a '.' - the effect is that when
  333. #        a match occurs, the component of the actual domain name which
  334. #        precedes the '.' in the key will replace the %s.
  335. })dnl ### End of M4COMMENTS ###
  336. ifdef({M4COMMENTS},{dnl  -Divided this to avoid overflowing m4 buffer.
  337. #    MAILSERVER
  338. #        The name of a host on which local mail should be delivered.
  339. #        If the mailbox directory is mounted from a remote file server
  340. #        you may wish to specify that local mail be sent to the remote
  341. #        server for local delivery there.  Alternatives are to use
  342. #        the RSH_SERVER.
  343. #        Important note:  If you use the MAILSERVER option, any
  344. #        programmatic aliases should be specified with the '|'
  345. #        outside the quotes.  For example, use
  346. #        msgs:    |"/usr/ucb/msgs -s"
  347. #        Note that the local aliases file is still consulted before
  348. #        a decision is made to forward the mail to the MAILSERVER.
  349. #        It is not currently possible, however, to consult the
  350. #        user's '.forward' file.  Hopefully the MAILSERVER will
  351. #        mount the same home directories, and will itself consult
  352. #        the .forward file.
  353. #        If the aliases file is a YP/NIS alias map, the alias processing
  354. #        is slightly different.  In this case local names are mailed to
  355. #        the MAILSERVER for expansion, unless they are qualified with
  356. #        a domain recognized as local.  Here are some examples.
  357. #        list:    addr1, addr2, addr3 # Lists ALWAYS sent to MAILSERVER.
  358. #        me:    you            # Sent to server for expansion.
  359. #        me:    you@client1.dom.ain # Expanded locally if client1.
  360. #        nobody: /dev/null@localhost # Expanded locally on all clients.
  361. #          (This assumes that 'localhost' is defined as a PSEUDONYM).
  362. #        recnews: recnews-client1@client1.dom.ain
  363. #        recnews-client1: |"recnews"@client1.dom.ain
  364. #         Mail to 'recnews' should be expanded locally on client1,
  365. #        but all other clients will send to MAILSERVER, which will
  366. #        forward to client1 readdressed to recnews-client1, and in
  367. #        turn it will be expanded on client1.
  368. #    NEWALIASES
  369. #        This option is obsolete.  A better method now exists.
  370. #        See below, at the end of the description for this option.
  371. #
  372. #        New approach:  If you want a non-local alias for
  373. #        'user@host', list it in the aliases file as
  374. #        'user%host@localhost'.  This will result in a correct
  375. #        alias entry, since addresses routed through 'localhost'
  376. #        are now automatically sent to the local mailer.  Please note
  377. #        that 'localhost' is to be taken literally, and does not mean
  378. #        your fully qualified domain name.
  379. #
  380. #        The script 'xalparse.sh' generates the correct format
  381. #        aliases file from xaliases.  Better still, install a newly
  382. #        revised version of 'xalparse' and use the '-r' option.
  383. #    NIS_MAILHOST
  384. #        Used in conjunction with NIS_MAILALIASES described below.
  385. #        Note that the NIS_MAILHOST *** MUST NOT *** be this
  386. #        local host, *** NOR *** an MX address for which this local
  387. #        host is the best preference handler.
  388. })dnl ### End of M4COMMENTS ###
  389. ifdef({M4COMMENTS},{dnl  -Divided this to avoid overflowing m4 buffer.
  390. #    NIS_MAILALIASES
  391. #        Use the NIS mail aliases before attempting local
  392. #               delivery.  If a local address is not in the local
  393. #        aliases file, the NIS/YP aliases file is consulted.
  394. #        If an alias exists and specifies a single mailbox
  395. #        address local to this host (domain matches $=w)
  396. #        it is delivered to that alias locally.  Otherwise
  397. #        the mail is forwarded to NIS_MAILHOST via the
  398. #        TCPMAILER for alias expansion and delivery.
  399. #        *** NOTICE *** In order to not interfere with
  400. #        construction of the local alias database rebuilding,
  401. #        this option is implemented in such a way that it
  402. #        only affects addresses used for actual delivery
  403. #        of mail.  Test mode ('sendmail -bt') will usually
  404. #        not reveal how this is processed.  To test this
  405. #        option under test mode, specify:
  406. #            /usr/lib/sendmail -bt -oMfnobody
  407. #    ISOLATED_DOMAINS
  408. #        A list of domains which may use TCP/IP delivery. Any
  409. #        domain not in this list is assumed to need to be sent
  410. #        using RELAY_HOST/RELAY_MAILER. This is useful if a
  411. #        site is using the DNS, but has a policy which does not
  412. #        allow IP connectivity between internal networks and
  413. #        the Internet.
  414. #    OTHER_MAILER_DEF
  415. #        Allows selection of the UIUC (default) extra mailers
  416. #        PH etc, or NONE, or a file containing mailer definitions.
  417. #    PATHTABLE
  418. #        The heart & soul of this sendmail configuration--the
  419. #        pathalias routing table in dbm format, as produced by
  420. #        the pathalias program.  Either you define this or rel(a)y
  421. #        on RELAY_HOST/RELAY_MAILER.
  422. #    POSTMASTERBOUNCE
  423. #        If defined the postmaster gets a copy of bounced mail.
  424. #        Can alternatively be defined to a mailbox name, in which
  425. #        case the copy of bounced mail is sent to this mailbox instead
  426. #        of to the postmaster.
  427. #    PSEUDODOMAINS
  428. #        A list of well-known top level pseudo domains such as
  429. #        BITNET, CSNET, UUCP, etc.  Addresses ending with a top
  430. #        level domain in this class won't be canonicalized using
  431. #        the resolver to reduce load on the root name servers.
  432. #        Note that this variable is independent of the T class
  433. #        below.  Any "well-known" top level domain that is not
  434. #        part of NIC's registered domains may be put here.
  435. #        PSEUDODOMAINS may be a list of domains, an absolute
  436. #        file path (first char /) or a program (first char |).
  437. #    PSEUDONYMS
  438. #        Additional names that we are known under (in addition
  439. #        to those returned by gethostbyname()).
  440. #        PSEUDONYMS may be a list of domains, an absolute
  441. #        file path (first char /) or a program (first char |).
  442. })dnl ### End of M4COMMENTS ###
  443. ifdef({M4COMMENTS},{dnl  -Divided this to avoid overflowing m4 buffer.
  444. #    RELATIVIZE
  445. #        This option has been removed.  It is incompatible with
  446. #        the use of MX addresses.  The SMTP host still needs the
  447. #        full domain name (which may be an MX address) to make its
  448. #        forwarding decisions.  Relativization for specific domains
  449. #        is still possible via mailertable.
  450. #    RELAY_HOST & RELAY_MAILER
  451. #        Name of the host and mailer to ship unknown recipient
  452. #        addresses to.
  453. #    RSH_SERVER
  454. #        If defined, do local deliveries by rsh'ing /bin/mail
  455. #        on the RSH_SERVER host.  Make sure that root is allowed
  456. #        to remotely login to the server.
  457. #    SPOOLDIR
  458. #        Directory for sendmail queue files; defaults to
  459. #        /usr/spool/mqueue.
  460. #    STRICTLY822
  461. #        This is obsolete, and is replaced by a changed UUCPPRECEDENCE
  462. #        (which you should read).  It was used to identify the
  463. #        precedence of !/@.  It former function is now the default
  464. #        except for UUCP nodes identified in UUCPPRECEDENCE.
  465. #    TCPMAILER
  466. #        The default TCP mailer to use for SMTP/TCP deliveries.
  467. #        Defaults to TCP (as opposed to TCP-D or TCP-U, qv).
  468. #    TIMEOUT
  469. #        By default the timeout, the length of time the mail sits
  470. #        in the queue before being returned to the sender, is
  471. #        two days.  By defining TIMEOUT to some other value, you
  472. #        can change this.  For example: define(TIMEOUT, 3d)
  473. #        in your 'm4' source would give a three day timeout before
  474. #        mail is returned as undeliverable.
  475. #    TRUSTEDUSERS
  476. #        Trusted users to be added to users root daemon uucp.
  477. #    UIUC
  478. #        Site specific parts for the University of Illinois at
  479. #        Urbana-Champaign.
  480. #    UUCP_MAILER_DEF
  481. #        Allows a choice in how the UUCP mailers are defined.
  482. #        Specify ZFLAG for the -z flag to be used with uux.  Or
  483. #        NOZFLAG (the default) if you do not want the -z flag,
  484. #        or specify a file name containing your own UUCP mailer
  485. #        definitions to be included instead of the standard
  486. #        mailer definitions.
  487. #    UUCPMAILER
  488. #        The default UUCP mailer to use for UUCP deliveries.
  489. #        Defaults to UUCP (as opposed to UUCP-A or UUCP-B, qv).
  490. #    UUCPNAME
  491. #        This node's UUCP host name.
  492. #    UUCPNODES
  493. #        A file containing names of directly connectable UUCP nodes.
  494. #        UUCPNODES may be a list of domains, an absolute
  495. #        file path (first char /) or a program (first char |).
  496. #    UUCPPRECEDENCE
  497. #        A file containing names of UUCP nodes which generate
  498. #        hybrid !/@ addresses for which the '!' should be given
  499. #        precedence.  Normally 'u!x@d' is parsed as '@d,@u!x' but
  500. #        if 'u' is in the UUCPPRECEDENCE list, and if the
  501. #        mail originates at 'u.UUCP' (must be the same 'u'),
  502. #        then 'u!x@d' is parsed as '@u!@d,x'.
  503. #        UUCPPRECEDENCE may be a list of nodes, an absolute
  504. #        file path (first char /) or a program (first char |).
  505. #        Please note that this functionality is only available
  506. #        if your 'rmail' invokes 'sendmail' with the flags
  507. #        -oMrUUCP -oMsnodename.UUCP
  508. #    UUCPRELAYS
  509. #        Name of file containing names of known (UUCP) relays.
  510. #        Header addresses containing paths through any of these
  511. #        will be shortened by having the path to the relay removed.
  512. #        (It is assumed that paths to each of these are known to
  513. #        everybody)  UUCPRELAYS may be a list of domains, an absolute
  514. #        file path (first char /) or a program (first char |).
  515. #    UUCPXTABLE
  516. #        A table mapping domain node names to UUCP node names.
  517. #        Used in envelope addresses sent using UUCP/rmail.
  518. #
  519. #  The following are still experimental:
  520. #    XEROXGV & XEROXNS
  521. #        Default gateways for unspecified Xerox Grapevine and XNS
  522. #        addresses.
  523. #    XNSDOMAIN
  524. #        The name of the XNS Gateway domain {from the XNS side}.
  525. #    XNSMAIL
  526. #        The name of your XNS Mail Gateway program.
  527.  
  528.  
  529. })dnl ### End of M4COMMENTS ###
  530. ####### CLASSES, DEFINITIONS, and DATABASES ##############################
  531. #
  532. #    The following classes, macro definitions and keyed databases are
  533. #    being used:
  534. #
  535. #    CA    An atsign (@), used in class membership negations
  536. ifdef({DECNETNODES},{dnl
  537. #    CD    Known DECnet host names
  538. })dnl
  539. ifdef({UUCPPRECEDENCE},{dnl
  540. #    CE    UUCP nodes which add 'node!' in front of 'u@d' addresses.
  541. })dnl
  542. ifdef({HIDDENNET},{dnl
  543. #    CH    Node names that should be hidden by $w
  544. })dnl
  545. ifdef({ISOLATED_DOMAINS},{dnl
  546. #    CI    Isolated net names
  547. })dnl
  548. ifdef({ALTERNATENAMES},{dnl
  549. #    CM    A list of alternate mail names for which we make final delivery.
  550. })dnl
  551. ifdef({PSEUDODOMAINS},{dnl
  552. #    CP    Known top level pseudo domains
  553. })dnl
  554. ifdef({UUCPRELAYS},{dnl
  555. #    CR    Paths to these relays removable from headers.
  556. })dnl
  557. #    CT    Known top level domains (global + local)
  558. #    CU    Directly connectable UUCP nodes
  559. #    CX    A set of chars that delimit the LHS of a domain (@ %)
  560. #    CY    A set of chars that delimit the RHS of a domain (, : !)
  561. #    CZ    RFC822 Source Route punctuation chars (, :)
  562. #
  563. #    DV    Configuration version number
  564. #
  565. #    OK@    The aliases database (automatically defined)
  566. ifdef({NIS_MAILALIASES},{dnl
  567. #    OK%    The NIS aliases database
  568. })dnl
  569. ifdef({DECNETXTABLE},{dnl
  570. #    OKD    DECnet domain translation table
  571. })dnl
  572. ifdef({GENERICFROM},{dnl
  573. #    OKG    Generic usernames
  574. })dnl
  575. ifdef({MAILERTABLE},{dnl
  576. #    OKM    Special domain => mailer:host table
  577. })dnl
  578. ifdef({DOMAINTABLE},{dnl
  579. #    OKN    Official name lookup table
  580. })dnl
  581. ifdef({PATHTABLE},{dnl
  582. #    OKP    Pathalias routing database
  583. })dnl
  584. ifdef({UUCPXTABLE},{dnl
  585. #    OKU    UUCP domain translation table
  586. })dnl
  587.  
  588.  
  589. ##########################################################################
  590. ## Default Definitions ###################################################
  591. ##########################################################################
  592. ifdef({LIBDIR},,{define(LIBDIR, /usr/lib/mail)})dnl
  593. ifdef({SPOOLDIR},,{define(SPOOLDIR, /usr/spool/mqueue)})dnl
  594. ifdef({TCPMAILER},,{define(TCPMAILER, TCP)})dnl
  595. ifdef({UUCPMAILER},,{define(UUCPMAILER, UUCP)})dnl
  596. ifdef({DOMAINMASTER},
  597.     {errprint({Note: DOMAINMASTER is obsolescent, see Sendmail.mc})})dnl
  598. ifdef({FACSIMILE},
  599.     {errprint({Note: FACSIMILE is obsolescent, see Sendmail.mc})})dnl
  600. ifdef({LIUIDA},
  601.     {errprint({Note: LIUIDA is obsolete})})dnl
  602. ifdef({NEWALIASES},
  603.     {errprint({Note: NEWALIASES is obsolete, see Sendmail.mc})})dnl
  604. ifdef({RELATIVIZE},
  605.     {errprint({Note: RELATIVIZE is obsolete, see Sendmail.mc})})dnl
  606. ifdef({STRICTLY822},
  607.     {errprint({Note: STRICTLY822 is obsolete, please see Sendmail.mc})})
  608. ifelse(len(UUCPPRECEDENCE),0,
  609.     {errprint({Note: UUCPPRECEDENCE requires a list. See Sendmail.mc})
  610.     undefine({UUCPPRECEDENCE})})dnl
  611. define(CLASS_TYPE,{ifelse(index($1,|),0,{F},index($1,/),0,{F},{C})})
  612. define(SET_CLASS,{CLASS_TYPE($2)}{$1$2})
  613.  
  614. #
  615. ##########################################################################
  616. ## Domain Definitions ####################################################
  617. ##########################################################################
  618.  
  619. ##########################################################################
  620. #    Universally known top-level domains
  621.  
  622. #                    Organizational domains
  623. CTarpa com edu gov int mil nato net org
  624. #                    National domains
  625. CTar at au be bo br ca ch cl cn cr cs de dk ec eg es fi
  626. CTfr gr hk hu ie il in is it jp kr lk mx my na ni nl no
  627. CTnz ph pl pr pt se sg su th tn tr tw uk us uy ve yu za
  628. #                    Network based domains
  629. # NS records don't exist for these
  630. CTbitnet csnet
  631. #CTbitnet csnet uucp
  632. # Removed UUCP.  The address shortening in ruleset 23 should not apply to
  633. # UUCP addresses since the addresses are relative - not absolute.
  634.  
  635. ##########################################################################
  636. #    Well-known pseudo domains
  637. #    (that the resolver shouldn't be bothered with)
  638. ifdef({PSEUDODOMAINS},{dnl
  639. SET_CLASS({P},PSEUDODOMAINS)
  640. },{dnl ### Not PSEUDODOMAINS ###
  641. # CPbitnet uucp
  642. })dnl ### End PSEUDDOMAINS ###
  643.  
  644. ##########################################################################
  645. ## Misc Definitions ######################################################
  646. ##########################################################################
  647.  
  648. ifdef({ISOLATED_DOMAINS},{dnl
  649. # This is the list of nets which may use TCP/IP delivery directly.
  650. SET_CLASS({I},ISOLATED_DOMAINS)})
  651.  
  652. ifdef({UUCPPRECEDENCE},{dnl
  653. # The list of UUCP nodes which erroneously change 'u@d' to 'uuhost!u@d'
  654. # instead of to 'uuhost!d!u'
  655. SET_CLASS({E},UUCPPRECEDENCE)})
  656.  
  657. # This node's local host name
  658. ifdef({DEFAULT_HOST},{dnl
  659. {Dw}DEFAULT_HOST
  660. {Cw}DEFAULT_HOST
  661. },{dnl ### Not DEFAULT_HOST
  662. # DwYourDefaultHostName if not correctly determined by sendmail.
  663. # CwYourDefaultHostName if not correctly determined by sendmail.
  664. })dnl
  665.  
  666. ifdef({PSEUDONYMS},{dnl
  667. # Other names for this node - localhost.your.domain may be needed among these.
  668. SET_CLASS({w},PSEUDONYMS)})
  669. # We always want localhost to be considered local.
  670. Cwlocalhost
  671.  
  672. # This node's official domain name
  673. ifdef({DEFAULT_DOMAIN},
  674. {Dj$w.}DEFAULT_DOMAIN,
  675. Dj$w)
  676. ifdef({LOCAL_MX_HANDLERS},{dnl
  677.  
  678. # Consider MX records to these hosts as if to local host (i.e. don't follow).
  679. SET_CLASS({j},LOCAL_MX_HANDLERS)
  680. })dnl
  681.  
  682. ifdef({ALTERNATENAMES},{
  683. # Other domains through which we must strip all routing.
  684. {CM}ALTERNATENAMES
  685. },{dnl
  686. ifdef({DOMAINMASTER},{dnl
  687. define({ALTERNATENAMES})
  688. {CM}DOMAINMASTER})
  689. ifdef({FACSIMILE},{
  690. {CM}FACSIMILE
  691. })})dnl
  692.  
  693. # Define a quote macro.  This is the only way to put '"' into an address.
  694. # and even then we must use $&Q, not $Q  (Use with caution).
  695. DQ\"
  696.  
  697. # my name
  698. DnMAILER-DAEMON
  699.  
  700. # UNIX header format
  701. DlFrom $g $d
  702.  
  703. # delimiter (operator) characters
  704. Do".:;%@!=/[]?#^,<>"
  705.  
  706. # Characters that mark the left (X) & right (Y) hand side of a domain
  707. CX@ %
  708. CY, : !
  709.  
  710. # Pure RFC822 route punctuation characters
  711. CZ, :
  712.  
  713. # The atsign-in-a-class
  714. CA@
  715.  
  716. # Format of a total name: Personal Name <user@domain>
  717. # - now uses $f in place of the usual $g, to avoid envelope rewriting rules.
  718. Dq$?x$!x <$f>$|$f$.
  719.  
  720. # SMTP login message
  721. De$j $v/$V Sendmail is ready at $b
  722.  
  723.  
  724. ##########################################################################
  725. #    Options
  726.  
  727. #                set default alias file
  728. ifdef({ALIASES},{OA}ALIASES)
  729. #                time to look for "@:@" in alias file
  730. Oa15
  731. #                substitution for blank character
  732. OB.
  733. #                don't connect to "expensive" mailers
  734. Oc
  735. #                delivery mode
  736. Odb
  737. #                rebuild alias database as needed
  738. # OD
  739. #                set error processing mode
  740. # Oe
  741. #                temporary file mode
  742. OF0600
  743. #                save Unix-style From lines on front
  744. # Of
  745. #                default gid
  746. Og1
  747. #                help file
  748. {OH}LIBDIR/sendmail.hf
  749. #                force use of name server
  750. ifdef({FORCE_NAMED},{OI},{# OI})
  751. #                ignore dot lines in message
  752. # Oi
  753. #                database files
  754. ifdef({NIS_MAILALIASES},{dnl
  755. ifdef({NIS_MAILHOST},{OK%%mail.aliases}
  756. ,{dnl ### Not NIS_MAILHOST ###
  757. errprint({**** NIS_MAILALIASES requires that NIS_MAILHOST be defined})dnl
  758. undefine({NIS_MAILALIASES})dnl
  759. })})dnl ### End Not NIS_MAILHOST, NIS_MAILALIASES ###
  760. ifdef({DECNETXTABLE},{OKD}DECNETXTABLE)
  761. ifdef({GENERICFROM},{OKG}GENERICFROM)
  762. ifdef({MAILERTABLE},{OKM}MAILERTABLE)
  763. ifdef({DOMAINTABLE},{OKN}DOMAINTABLE)
  764. ifdef({PATHTABLE},{OKP}PATHTABLE)
  765. ifdef({UUCPXTABLE},{OKU}UUCPXTABLE)
  766. #                log level
  767. OL9
  768. #                define macro
  769. # OM
  770. #                send to me too
  771. Om
  772. #                local network name
  773. ifdef({DEFAULT_DOMAIN},{ON}DEFAULT_DOMAIN,{# ONdefault_domain_name})
  774. #                assume old style headers
  775. Oo
  776. #                postmaster copy of returned messages
  777. ifdef({POSTMASTERBOUNCE},{dnl ### Postmaster gets copy of bounced mail
  778. ifelse(len(POSTMASTERBOUNCE),0,{OPPostmaster},{OP}POSTMASTERBOUNCE)
  779. },{# OPPostmaster
  780. })dnl ### End POSTMASTERBOUNCE
  781. #                queue directory
  782. {OQ}SPOOLDIR
  783. #                read timeout -- violates protocols
  784. Or30m
  785. #                status file
  786. {OS}LIBDIR/sendmail.st
  787. #                be super safe, even if expensive
  788. Os
  789. #                queue timeout
  790. ifdef({TIMEOUT},{OT}TIMEOUT,{OT}2d)
  791. #                time zone name
  792. # OtMET,MET DST
  793. #                set default uid
  794. Ou1
  795. #                run in verbose mode
  796. # Ov
  797. #                wizard's password
  798. OW*
  799. #                load avg at which to auto-queue msgs
  800. ifdef({LOADAVEQUEUE},,{define(LOADAVEQUEUE, 11)})dnl
  801. ifelse(LOADAVEQUEUE,0,{# Ox11},{Ox}LOADAVEQUEUE)
  802. #                load avg to auto-reject connections
  803. ifdef({LOADAVEREJ},,{define(LOADAVEREJ, 7)})dnl
  804. ifelse(LOADAVEREJ,0,{# OX7},{OX}LOADAVEREJ)
  805. #                fork when running the queue
  806. # OY
  807. #                use separate envelope/header rewriting rulesets
  808. O/
  809.  
  810. ##########################################################################
  811. #    Message precedences
  812.  
  813. Pfirst-class=0
  814. Pspecial-delivery=100
  815. Pbulk=-100
  816. Pjunk=-100
  817.  
  818. ##########################################################################
  819. #    Trusted users
  820.  
  821. Troot
  822. Tdaemon
  823. Tuucp
  824. ifdef({TRUSTEDUSERS},{T}TRUSTEDUSERS)
  825.  
  826. ##########################################################################
  827. #    Header Formats
  828.  
  829. #HReceived: $?sfrom $s $.by $j; $b
  830. ifelse(eval(SENDMAIL_NUMERIC_VERSION < 5065030),1,{dnl
  831. HReceived: $?sfrom $s $.by $j$?r with $r$. id $i
  832.   ($v/$V$?u for $u$.); $b
  833. },{dnl
  834. HReceived: $?sfrom $s $.by $j$?r with $r$. id $i
  835.   ($v/$V$?m for $m$.); $b
  836. })dnl
  837. H?P?Return-Path: <$g>
  838. H?D?Date: $a
  839. H?F?From: $q
  840. H?x?Full-Name: $x
  841. H?M?Message-ID: <$t.$i@$j>
  842.  
  843.  
  844. #
  845. ##########################################################################
  846. ## Mailer Specifications #################################################
  847. ##########################################################################
  848.  
  849. ##########################################################################
  850. #
  851. #    Local & Prog mailer definitions
  852.  
  853. ifdef({HIDDENDOMAIN},{ifdef({HIDDENDOMAINHOST},,{dnl
  854. define({HIDDENDOMAINHOST},HIDDENDOMAIN)})})dnl
  855. ifdef({HIDDENNET},{
  856. # List of nodes that should be hidden by our name (header senders)
  857. SET_CLASS({H},HIDDENNET)
  858. ifdef({HIDDENNETHOST},,{ifdef({MAILNAME},{define(HIDDENNETHOST, MAILNAME)})})dnl
  859. })dnl
  860.  
  861. ifdef({RSH_SERVER}, {dnl
  862. ifdef({LOCAL_MAILER_DEF},{dnl
  863. errprint({LOCAL_MAILER_DEF and RSH_SERVER are incompatible})dnl
  864. },{define({LOCAL_MAILER_DEF},{RSHELL})})})dnl
  865. ifdef({LOCAL_MAILER_DEF},,{define({LOCAL_MAILER_DEF},{{BSD}})})dnl
  866. ifelse(LOCAL_MAILER_DEF,{BSD},{dnl ### Standard BSD mailers.
  867. Mlocal,    P=/bin/mail, F=DFMlrmns,    R=25/10, S=10, A=mail -d $u
  868. Mprog,    P=/bin/sh,  F=DFMhlsu, R=10, S=10, A=sh -c $u
  869. },LOCAL_MAILER_DEF,{SYSV},{dnl ### Try this version for System V
  870. # The situation for local delivery on SYSV is unclear.  Mail any comments
  871. # or corrections to: rickert@cs.niu.edu
  872. #
  873. # This reportedly works on a SYSV system where rmail is a link to /bin/mail
  874. Mlocal,    P=/bin/mail, F=DFMlms, S=10, R=25/10, A=rmail $u
  875. # This works on some SYSV binmails.  However the 'From ' line may say root
  876. #Mlocal, P=/bin/mail, F=SDFMPsmnx,    R=25/10, S=10, A=mail -d $u
  877. Mprog,    P=/bin/sh,  F=DFMhlsu, R=10, S=10, A=sh -c $u
  878. },LOCAL_MAILER_DEF,{DELIVER},{dnl ### With Chip Salzenberg's deliver
  879. Mlocal, P=/bin/deliver, F=DFMlmns, R=25/10, S=10, A=deliver -r $g $u
  880. Mprog,    P=/bin/sh,  F=DFMhlsu, R=10, S=10, A=sh -c $u
  881. },LOCAL_MAILER_DEF,{RSHELL},{dnl ### Use a remote shell to deliver on server.
  882. Mlocal,    P=/usr/ucb/rsh, F=DFMlmns, R=25/10, S=10, A=RSH_SERVER /bin/mail -d $u
  883. Mprog,    P=/bin/sh,  F=DFMhlsu, R=10, S=10, A=sh -c $u
  884. },{include(LOCAL_MAILER_DEF)})dnl ### End LOCAL_MAILER_DEF
  885. ifdef({OTHER_MAILER_DEF},,{define({OTHER_MAILER_DEF},{{UIUC}})})dnl
  886. ifelse(OTHER_MAILER_DEF,{UIUC},{dnl ### The UIUC complement of mailers
  887. # Add -p flag to phquery to copy postmaster on error bounces
  888. MPH,    P=LIBDIR/phquery, F=DFMhnmur,    A=phquery $u
  889. MPHF,    P=LIBDIR/phquery, F=DFMhnmur,    A=phquery -R $u
  890. MFAX,    P=LIBDIR/phquery, F=DFMhnmur,    A=phquery -x fax $u
  891. MNOVAM,    P=LIBDIR/novamailer, F=DFMhnmu, A=novamailer $a $g $u
  892. },OTHER_MAILER_DEF,{NONE},{dnl ### Use a remote shell to deliver on server.
  893. },{include(OTHER_MAILER_DEF)})dnl ### End OTHER_MAILER_DEF
  894.  
  895. ##########################################################################
  896. #
  897. #    TCP/IP mailer specification
  898. #
  899. #    The TCP mailer is the normal choice for SMTP/TCP delivery, but a
  900. #    couple of variations exist for compatibility with mailers that
  901. #    need special address formatting for indirect UUCP and DECnet
  902. #    addresses.  Both have to be explicitly mentioned in the mailertable
  903. #    to be chosen as all normal mail will use the standard TCP mailer.
  904. #
  905. #    TCP-A -- make sure address ends with a registered domain, ie.
  906. #    strictly legal within the ARPA Internet.  If it isn't, we'll
  907. #    turn it into a path through ourselves.
  908. #
  909. #    TCP-D -- will flatten envelope recipient DECnet domains for
  910. #    messages destinated to our DECnet gateway.   Unfortunately, our
  911. #    (Linkoping) DECnet gateway is too dumb to do this itself.
  912. #
  913. #    TCP-U -- is available for hosts which require hybrid addresses
  914. #    for deliveries to UUCP destinations.  Eg. "bar!foo@dest.host"
  915. #    will be formatted as bar!foo@dest.host in the output mail,
  916. #    whereas the regular TCP mailer will preserve the address in a
  917. #    format more closely resembling the address it received.
  918. #
  919. #    Both of the above only touch envelope addresses; header
  920. #    addresses are still kept in our preferred format.  Change the
  921. #    R/S settings below if you don't like that.
  922.  
  923. MTCP,   P=[IPC], F=CDFMXhnmu, E=\r\n, R=10/11, S=11, A=IPC $h
  924. MTCP-A, P=[IPC], F=CDFMXhnmu, E=\r\n, R=12, S=12, A=IPC $h
  925. MTCP-D, P=[IPC], F=CDFMXhnmu, E=\r\n, R=24/25, S=0/25, A=IPC $h
  926. MTCP-U, P=[IPC], F=CDFMXhnmu, E=\r\n, R=17/11, S=17/11, A=IPC $h
  927.  
  928. ifdef({ACSNETDELIVERY},{dnl
  929. MACSNET, P=/usr/spool/ACSnet/_lib/netmail, F=mDCFSMhun, R=10/11, S=11,
  930.     A=ACSmail -amailer -s$g -u$u -d$h -n$i
  931.  
  932. })dnl
  933. #########################################################################
  934. #                                    #
  935. #    Rule set #10:  For local mailers (headers only).        #
  936. #                                    #
  937. #    Local recipients without attached domains have the        #
  938. #    default domain stripped off.  Superfluous routing is        #
  939. #    removed.  Otherwise there is an attempt to preserve as        #
  940. #    much of the original formatting as possible, provided        #
  941. #    that the resultant address will be correctly recognized        #
  942. #    if processed again by this mailer configuration.        #
  943. #                                    #
  944. #    Also useful for envelope recipients of mailers such as        #
  945. #    the TCP mailer, where the address will not be local        #
  946. #    anyway.                                #
  947. #                                    #
  948. #########################################################################
  949. S10
  950.  
  951. ifdef({ALWAYSADDDOMAIN},,{dnl ### Don't add local domain to local users.
  952. R<>,$=X$+$=Y$+        <>,$4            Remove default host.
  953. })dnl ### End ALWAYSADDDOMAIN
  954. R<$+>$*$=Y$~A$*        $:<$1>$2$3?$4$5        Mark user portion.
  955. R<$+>$*!$+,$*?$+    <$1>$2!$3!$4?$5        ! is inferior to @
  956. R<$+>$+,$*?$+        <$1>$2:$3?$4        Change src rte to % path
  957. R<$+>:$+        <$1>,$2            Change % to @ for immed. domain
  958. R<$=X$-.UUCP>!?$+    $@<$1$2.UUCP>!$3    Return UUCP
  959. R<$=X$->!?$+        $@<$1$2>!$3        Return unqualified
  960. R<$+>$+?$+        <$1>$2$3        Remove '?'
  961. R<$+.$+>$=Y$+        $@<$1.$2>,$4        Change do user@domain
  962.  
  963. #########################################################################
  964. #                                    #
  965. #    Rule set #11:  General purpose output formatting.        #
  966. #                                    #
  967. #    Uses a heuristic approach based on the input format of the    #
  968. #    address.  A simple address is always formatted as        #
  969. #    user@dom.ain, unless the domain is a UUCP domain.  For        #
  970. #    multi-level paths, uses either a ! path or a % path, or        #
  971. #    perhaps even a hybrid @/! path, depending on the format        #
  972. #    in which the original address is presented.            #
  973. #                                    #
  974. #########################################################################
  975. S11
  976.  
  977. R<>,$=X$+$=Y$+        <$1$2>$3$4        Expand local domains.
  978. R<$+>$+            $:$>21<$1>$2        Provide route to neighbors
  979. R<$+>$*$=Y$~A$*        $:<$1>$2$3?$4$5        Mark user portion.
  980. R<$+>$*!$+,$*?$+    <$1>$2!$3!$4?$5        ! is inferior to @
  981. R<$+>$+,$*?$+        <$1>$2:$3?$4        Change src rte to % path
  982. R<$+>:$+        <$1>,$2            Change % to @ for immed. domain
  983. R<$+>$+?$+        $:<$1>$2$3        Remove mark
  984. R<$=X$-.UUCP>!$+    $@<$1$2.UUCP>!$3    Return UUCP
  985. R<$=X$->!$+        $@<$1$2>!$3        Return unqualified
  986. R<$+>$=Y$+        $:<$1>,$3        Else change do user@domain
  987.  
  988. #########################################################################
  989. #                                    #
  990. #    Rule Set #12:  Make sure all domains RFC822 valid.        #
  991. #                                    #
  992. #    This rule set is actually a compromize.  Recipient        #
  993. #    addresses may not finish up being in a valid domain.        #
  994. #    They may possibly be better known in the receiving        #
  995. #    domain than in ours, so we should not hide them behind        #
  996. #    our domain.  However if the recipients are local UUCP        #
  997. #    links, etc, we do hide behind our name.  This presumes that    #
  998. #    the mailer is never used for such local links, so that any    #
  999. #    locally connected recipient is an alternate header recipient,    #
  1000. #    and not an envelope recipient.                    #
  1001. #                                    #
  1002. #########################################################################
  1003. S12
  1004. R<>,$=X$+$=Y$+        <$1$2>$3$4        Expand local domains.
  1005. # First change to source route format.
  1006. R<$+>$*$=Y$~A$*        $:<$1>$2$3?$4$5        Mark user portion.
  1007. R<$+>$=Y$+        $:<$1>,$3        Make first specifier @.
  1008. R<$+>,@$+!$*?$+        <$1>,@$2,$3?$4        Change all others to @.
  1009. R<$+>,$+:$+,$*?$+    <$1>,$2:$3:$4?$5     but only to first %.
  1010. R<$+>$+?$+        <$1>$2$3        Remove marker.
  1011. # Next try to force address to be official domain name.
  1012. R<@$+>$+        $@$>21<@$1>$2            Route local recipients.
  1013. R<%$+.$=P>$+        $@$>20<%$1.$2>$3        Hide pseudo domain
  1014. R<%$+>$+        $:<%$[ $1 $: $1? $]>$2        Valid by name server?
  1015. ifdef({DOMAINTABLE},{dnl
  1016. ifdef({M4COMMENTS},{dnl
  1017. # Try to validate with name table.  This might be a valid name for which
  1018. # we are the primary MX forwarder.  In this case the $[ .. $] lookup
  1019. # will fail.  By translating to itself in domain table, we can still
  1020. # validate.
  1021. })dnl ### End M4COMMENTS ###
  1022. R<%$+?>$+        $:<%$(N $1 $: $1? $)>$2    Valid in domain tbl?
  1023. ifdef({M4COMMENTS},{dnl
  1024. # The address should have been fully qualified before this ruleset is
  1025. # called.  Thus the domain should already be fully qualified, and will
  1026. # only be recognized by the domaintable if it translates to itself. But
  1027. # just in case, we check again for pseudo domains.
  1028. })dnl ### End M4COMMENTS ###
  1029. R<%$+.$=P>$+        $@$>20<%$1.$2>$3        Hide pseudo domain
  1030. })dnl ### End DOMAINTABLE ###
  1031. R<$+?>$+        $@$>20<$1>$2            Invalid - hide.
  1032.  
  1033. # Produce hybrid (brr) recipient addresses for unqualified or .UUCP hosts
  1034. S17
  1035. R<>,$=X$+$=Y$+        <$1$2>$3$4        Expand local domains.
  1036. R<$+>$+            $:$>19 <$1>$2            bangify.
  1037. # Possibly produce addresses such as b!c!x@foo.bar.edu
  1038. R<$=X$-.$+>!$+        $:<$1$2.$3>,$4        Use @ for qualified.
  1039. R<$=X$-.UUCP>,$+    $:<$1$2.UUCP>!$3    but not for .UUCP
  1040. R<%$+>$+        $:$>21<%$1>$2        Add route for local sender
  1041.  
  1042. ##########################################################################
  1043. #
  1044. #    (Pseudo)DECnet mailer specification
  1045. #
  1046. #    Send all envelope recipients thru DECnet domain name flattener.
  1047.  
  1048. ifdef({DECNETNODES},{
  1049. # List of DECnet nodes
  1050. SET_CLASS({D},DECNETNODES)})
  1051.  
  1052. ifdef({DECNETNAME},{
  1053. # Our DECnet name
  1054. {DB}DECNETNAME
  1055. {Cw}DECNETNAME{.dnet}
  1056.  
  1057. # We are a DECnet gateway.  Don't supply $u as mail11v3 speaks SMTP.
  1058. MDmail,    P=/usr/bin/mail11v3, F=CmnXNH, S=10/14, R=14, A=mail11 $g $x $h
  1059.  
  1060. ############################################################
  1061. #
  1062. #    Mail-11 Mailer
  1063. #
  1064.  
  1065. S14
  1066. R<$=X$=w>$+            $:<$1$B.dnet>$3        Locals get DECNET name
  1067. R<>,$=X$+$=Y$+            <@$B.dnet>$3$4        Unqualifed locals.
  1068. ifdef({DECNETXTABLE},{dnl
  1069. R<$+>$+                ?<$1>$2            Mark for recursion
  1070. R?$*<$=X$+.dnet>$=Y@$+$=Y$+    ?$1$3::<@$5>$6$7    Reformat .dnet.
  1071. R?$*<$=X$+.dnet>$=Y$+        $:$1$3::$5        Reformat .dnet.
  1072. R?$*<$=X$+>$+            $:?$1<$2$(D$3$:$3?$)>$4    Search table.
  1073. R?$*<$+?>$+            $1<$2>$3        Lookup failed - unmark
  1074. R?$*<$+>$+            $@$>14?$1<$2.dnet>$3    Succeeded - recurse
  1075. },{dnl ### DECNETXTABLE Not defined
  1076. R$*<$=X$+.dnet>$=Y@$+$=Y$+    $1$3::<@$5>$6$7        Reformat .dnet.
  1077. R$*<$=X$+.dnet>$=Y$+        $:$1$3::$5        Reformat .dnet.
  1078. })dnl ### End Not DECNETXTABLE
  1079. R<$+>$+                $B::<$1>$2        Route non-dnet thru us
  1080. R$+::<$+>$+            $:$1::?$>4$>25<$2>$3    Format domain addresses
  1081. R$+::?$+            $:$1::?$2?$(@$&Q$2$&Q$)    Quote if any @
  1082. R$+::?$+?$-            $@$1::$3        Success - return.
  1083. R$+::?$+?$*            $1::$2            Else don't quote.
  1084. R$+::$+@$+            $1::$2%$3        but change '@' to '%'.
  1085. })dnl
  1086.  
  1087. ##########################################################################
  1088. #
  1089. #    UUCP mailer definitions
  1090.  
  1091. ifdef({M4COMMENTS},{dnl ### M4COMMENTS defined ###
  1092. # The contorted M4 code that follows has the following explanation:
  1093. #
  1094. # There may be a desire for the same 'newaliases.cf' to be used on
  1095. # many hosts at a site.  Consequently a stripped down M4 source is used,
  1096. # which does not include a UUCPNAME definition.  Hence we should not
  1097. # complain about the missing definition.
  1098. })dnl ### End of M4COMMENTS ###
  1099. # Our UUCP name
  1100. ifdef({UUCPNAME},{dnl
  1101. {Dk}UUCPNAME
  1102. {CU}UUCPNAME
  1103. {Cw}UUCPNAME{.UUCP}
  1104. },{dnl ### Not UUCPNAME ###
  1105. errprint({Warning: UUCPNAME is not defined.})dnl
  1106. # DkYourUUCP-Name if not correctly determined by sendmail.
  1107. # CUYourUUCP-Name
  1108. # CwYourUUCP-Name.UUCP
  1109. })dnl ### End - Not UUCPNAME ###
  1110.  
  1111. # List of known UUCP nodes
  1112. ifdef({UUCPNODES},{
  1113. SET_CLASS({U},UUCPNODES)})
  1114.  
  1115. # Header paths to the following well known UUCP relays should be trimmed.
  1116. ifdef({UUCPRELAYS},{
  1117. SET_CLASS({R},UUCPRELAYS)})
  1118.  
  1119. ifdef({UUCP_MAILER_DEF},,{define({UUCP_MAILER_DEF},{{NOZFLAG}})})dnl
  1120. ifelse(UUCP_MAILER_DEF,{ZFLAG},{dnl ### Use '-z' flag in uux.
  1121. MUUCP, P=/usr/bin/uux, F=DFMUVpu, S=13, R=19/13, A=uux - -z -r $h!rmail ($u)
  1122. MUUCP-A, P=/usr/bin/uux, F=DFMmu, S=15/11, R=15/11, A=uux - -z -r $h!rmail ($u)
  1123. MUUCP-B, P=/usr/bin/uux, F=BDFMXmpu, S=0/11,  R=15/11, A=uux - -z -r $h!bsmtp
  1124. },UUCP_MAILER_DEF,{NOZFLAG},{dnl ### Don't use '-z' flag in uux.
  1125. MUUCP, P=/usr/bin/uux, F=DFMUVpu, S=13, R=19/13, A=uux - -r $h!rmail ($u)
  1126. MUUCP-A, P=/usr/bin/uux, F=DFMmu, S=15/11, R=15/11, A=uux - -r $h!rmail ($u)
  1127. MUUCP-B, P=/usr/bin/uux, F=BDFMXmpu, S=0/11,  R=15/11, A=uux - -r $h!bsmtp
  1128. },{include(UUCP_MAILER_DEF)})dnl ### End UUCP_MAILER_DEF
  1129.  
  1130. #########################################################################
  1131. #                                    #
  1132. #    Rule Set #13:    UUCP Mailer header rules            #
  1133. #                                    #
  1134. #    UUCP addresses are passed to ruleset 19.  But domain        #
  1135. #    addresses are retained in domain format where possible.        #
  1136. #                                    #
  1137. #    Since the V flag in the mailer definition will always        #
  1138. #    add or remove a 'host!' in front of the address, we ourselves    #
  1139. #    add a 'destination!' in front, which should then be removed.    #
  1140. #    If it is not removed, no great harm is usually done, since    #
  1141. #    it is the correct host name for the recipient domain, and    #
  1142. #    should be properly dealt with there.  If we do not do this    #
  1143. #    then user@dom.ain becomes ourselves!dom.ain!user which is    #
  1144. #    unnecessarily superfluous.  dom.ain!user should suffice.    #
  1145. #                                    #
  1146. #########################################################################
  1147. S13
  1148. R<$*>$+            $:$>19<$1>$2            Bangify address.
  1149. R<>,$=X$+!$+        $@<>,$1$k!$3            Our uuname for locals
  1150. R<$=X$=w>$+        $@<$1$k>$3            Our uuname on locals
  1151. R<@$-.UUCP>$+        $@<@$1.UUCP>$2            Return UUCP host.
  1152. ifdef({UUCPXTABLE},{dnl
  1153. R<@$+>$+        $:<@$1>$2?$(U$1$:$)        Is it in uucpxtable.
  1154. R<@$+>$+?$+        $@<@$1>$2            Yes - return.
  1155. R<@$+>$+?        $:<@$1>$2?$&h            Add recipient host.
  1156. },{dnl ### Not UUCPXTABLE ###
  1157. R<@$+>$+        $:<@$1>$2?$&h            Add recipient host.
  1158. })dnl ### End UUCPXTABLE ###
  1159. R<@$+.$=T>$+?$-        $@<@$4>!@$1.$2$3        Add route to domain.
  1160. R<@$+>$+?$*        <@$1>$2                Remove mark.
  1161.  
  1162. #########################################################################
  1163. #                                    #
  1164. #    Rule Set #15:    UUCP-A Mailer envelope rules.            #
  1165. #                                    #
  1166. #    This UUCP-A mailer is designed to give address formats as    #
  1167. #    close to Internet formats as possible.  However robustness    #
  1168. #    requirements, in the face of UUCP transport, place some        #
  1169. #    limitations.                            #
  1170. #                                    #
  1171. #    Sender addresses are always formatted with !, but where the    #
  1172. #    domain has both a fully qualified name and a UUCP name, we    #
  1173. #    use the fully qualified name in the address.            #
  1174. #                                    #
  1175. #    Recipient addresses of the form 'user@fully.qual.domain' are    #
  1176. #    left in that form, but recipient addresses with UUCP origins    #
  1177. #    or with multiple hosts are converted to a '!' path, again    #
  1178. #    preserving the full domain name of the primary host where    #
  1179. #    possible.                            #
  1180. #                                    #
  1181. #########################################################################
  1182. S15
  1183. R<>,$=X$+$=Y$+        <$1$2>$3$4        Expand local domains.
  1184. R<%$+>$+        $:$>21<%$1>$2        Route UUCP senders thru us.
  1185. R<$=X$-.UUCP>$+        $@$>19<$1$2.UUCP>$3    If UUCP, bangify path.
  1186. R<$=X$->$+        $@$>19<$1$2>$3        Bangify unqualified.
  1187. R<>,$=X$+$=Y$+        <$1$2>$3$4        Show local domain.
  1188. R<$+>:$+        <$1>,$2            Change u%d to u@d
  1189. R<@$+>,$~A$*        $@<@$1>,$2$3        Return u@d recipient address.
  1190. # Bangify anything else.
  1191. R<$+>$+            $:$>19<$1>$2
  1192. ifdef({UUCPXTABLE},{dnl
  1193. ### A domain with a fully qualified name may be converted back to its
  1194. ### UUCP name by the UUCPXTABLE lookup.  To avoid this, we first format
  1195. ### the address as 'bang!path@host' then convert the '@' back to a '!'.
  1196. R<$+>!$+        $:?$>4<$1>,$2        Convert to b!c@a and format.
  1197. R?$+@$+            $@$2!$1            Change '@' back to '!'
  1198. })dnl ### End UUCPXTABLE ###
  1199.  
  1200. ifdef({XNSDOMAIN},{dnl
  1201. ##########################################################################
  1202. #
  1203. #    XNS Mailer -- this is still experimental.
  1204. #
  1205.  
  1206. MXNS,  {P=}XNSMAIL, F=CDFMXhnmprsu, R=16/0, S=16/0, A=xnsmail -q -O $u
  1207.  
  1208. # Convert address to XNS Object Name.
  1209. S16
  1210. R<$*>$+            $:$>4$>25<$1>$2        first externalize
  1211. R{$+@}XEROXNS        $@ $1            this is already an XNS addrs
  1212. R$+            $@ {$1:}XNSDOMAIN    add XNS domain for others
  1213.  
  1214. })dnl ### End XNSDOMAIN
  1215. ##########################################################################
  1216. ## Standard Rewriting Rules ##############################################
  1217. ##########################################################################
  1218.  
  1219. #########################################################################
  1220. #                                    #
  1221. #    Rule Set #0:    Mailer Resolving Ruleset            #
  1222. #                                    #
  1223. #    This is rather straightforward.  The code should say it all.    #
  1224. #                                    #
  1225. #    We do make two special cases.  Mail to 'user@localhost'        #
  1226. #    is delivered directly.  This is a way of bypassing the        #
  1227. #    forwarding to a mail server (if that option is in use).        #
  1228. #                                    #
  1229. #    If '$f' is not defined, mail routed through 'localhost' is    #
  1230. #    also sent to the local mailer.  This allows building of an    #
  1231. #    alias file with non-local aliasing, simply by routing the    #
  1232. #    address through 'localhost'.                    #
  1233. #                                    #
  1234. #########################################################################
  1235. S0
  1236.  
  1237. # Force any routing thru localhost to be local.  Used for alias building,
  1238. # and to avoid sending to MAILSERVER.
  1239. ifdef({M4COMMENTS},{dnl
  1240. # NOTE:  If you are stuck with an old version of sendmail+IDA - one which
  1241. #    does not recognize $&x on the LHS of rewrite rules - change the
  1242. #    first rule below to:
  1243. # R<@localhost>,@$+$=Y$+    ?$>29$>8<@$1>$2$3    Relativize
  1244. })dnl ### End of M4COMMENTS ###
  1245. R$&f<@localhost>,@$+$=Y$+    ?$>29$>8<@$2>$3$4    Relativize
  1246. R?<@$=w>$=Y$+        ?<>,$3                Remove local host
  1247. R?<$*>$+        $#LOCAL$@$w$:$>25<$1>$2        and deliver.
  1248. R<@localhost>,$~A$*    $#LOCAL$@$w$:$1$2        Deliver forced local
  1249.  
  1250. R$+            $:$>8$1                Fully qualify.
  1251. # Digest routes through ourselves
  1252. R<@$+>$+        $:$>29 <@$1>$2            remove routed self
  1253.  
  1254. # Try immediate delivery
  1255. R<$*>$+            $:$>26 <$1>$2            try to find mailer
  1256. R$#$+            $# $1                found one, return it
  1257.  
  1258. ifdef({PATHTABLE},{# Unknown domain, try to find a pathalias route
  1259. R<@$+.$+>$+        $:$>22 <@$1.$2>$3        go get route
  1260. R?<$*>$+        $:$>26$>29<$1>$2        go find mailer
  1261. R$#$+            $# $1                success, return it
  1262. })dnl ### End of PATHTABLE ###
  1263.  
  1264. ifdef({RELAY_HOST}, {# If we have a RELAY_HOST/RELAY_MAILER, use it
  1265. R<@$+>$+        ${#}RELAY_MAILER $@RELAY_HOST $:<@$1>$2
  1266. })dnl
  1267.  
  1268. # Try TCP/IP otherwise, there might be an MX record for it
  1269. # (I wish I had a $[..$] for MX records)
  1270. R<@$+.$~P>$+        {$#}TCPMAILER $@$1.$2 $:<@$1.$2>$3
  1271.  
  1272. # Undeliverable recipients--complain loudly & return to sender
  1273. R$*<@>        $1            Remove unparseability marker.
  1274. R<@$->$+    $#ERROR $:Host $1 not known--please specify domain
  1275. R<@$-.$*$=T>$+    $#ERROR $:Host $1 not known within the $2$3 domain
  1276. R<@$-.$*$=P>$+    $#ERROR $:Host $1 not known within the $2$3 domain
  1277. R<@$+.$->$+    $#ERROR $:Domain $2 not known--please try to route manually
  1278. R@$+        $#ERROR $:"Incomplete Source Route--use <...> format"
  1279. R$*        $#ERROR $:Could not parse $1
  1280.  
  1281. #########################################################################
  1282. #                                    #
  1283. #    Rule Set #1:    [Envelope] Sender Specific Rewriting        #
  1284. #                                    #
  1285. #    There is an assumption by some software which may be used    #
  1286. #    as a local mailer, that for a local sender '$f' is the        #
  1287. #    actual sender login name.  Ruleset 1 thus hides the domain    #
  1288. #    of all local senders so that a mailer can easily recognize it    #
  1289. #    as local, and if in the phase of determining a value for '$f'    #
  1290. #    (as determined by '$f' being undefined), the hidden domain    #
  1291. #    is then stripped off.                        #
  1292. #                                    #
  1293. #########################################################################
  1294. S1
  1295.  
  1296. R<@$+>$+        $:<%$1>$2        Indicate a sender address.
  1297. R$+            $:$>23$>8$1        Fully qualify domain.
  1298. R$+<$=X$+>$+        $:$1<>,$2$3$4        Make locals recognizable.
  1299. R$*<$*>$+        $:$1<$2>$3??$&f        Append sender ID.
  1300. R$+<$*>$+??        $@$1            No sender - return bare local.
  1301. R$*<$*>$+??        $@<$2>$3        No sender - return.
  1302. ifdef({GENERICENVELOPE},{ifdef({GENERICFROM},{dnl
  1303. # Use (canonicalized) generic names for local senders
  1304. R$*<$*>$+??$*        $:$1<$2>$3??$>4$>25<$2>$3    Format for table lookup
  1305. R$*<$*>$+??$+        <$2>$3?$(G$4$:?$1$)        Search table.
  1306. })})dnl ### End of GENERICENVELOPE ###
  1307. R$*<$*>$+??$*        $:<$2>$3            Remove unneeded markers.
  1308. ifdef({GENERICENVELOPE},{ifdef({GENERICFROM},{dnl
  1309. R<$*>$+?$+        $:$>8$>3$3            Generic found, reformat.
  1310. R<@$=w>$=Y$~A$*        <>,@$1$2$3$4            Make local recognizable
  1311. })})dnl ### End of GENERICENVELOPE ###
  1312. R$+$=X$-$+        $:$1%$3$4            Mark as sender.
  1313.  
  1314. #########################################################################
  1315. #                                    #
  1316. #    Rule Set #2:    [Envelope] Receiver Specific Rewriting        #
  1317. #                                    #
  1318. #    Currently nothing.                        #
  1319. #                                    #
  1320. #########################################################################
  1321. S2
  1322.  
  1323. R$#$+$:$+        $:$2        Strip mailer/host when debugging.
  1324.  
  1325. #########################################################################
  1326. #                                    #
  1327. #    Rule Set #3:    Address Canonicalization            #
  1328. #                                    #
  1329. #    Turns the address into the (internally) canonical format.    #
  1330. #    See the documentation on ruleset #7 for a description of    #
  1331. #    the internal canonical format.                    #
  1332. #                                    #
  1333. #    Input formats include the standard "mailbox@domain" format,    #
  1334. #    RFC822 Source Routes, RFC822 Group Names, ARPAnet %-Kludges,    #
  1335. #    UUCP !-Paths, the Berknet "host:user" format, the VAX/VMS    #
  1336. #    "host::user" format and resonable mixtures of the above.    #
  1337. #                                    #
  1338. #    The code even tries to clean up after various mistakes that    #
  1339. #    other nodes has done when reformatting the addresses, such    #
  1340. #    as mangled Xerox distribution lists or malformatted RFC822    #
  1341. #    Group Specifications.                        #
  1342. #                                    #
  1343. #########################################################################
  1344. S3
  1345.  
  1346. # The first (experimental) rules deal with addresses processed in code
  1347. # because of the C-mailer flag, and recycled into ruleset 3.
  1348. R<>,$~A$*@$+        $1$2@$3            Clean up recycled address
  1349.  
  1350. # The next four rules come from nahaj@cc.utah.edu.  They are intended
  1351. # to transform "Name" <mailbox> "Phone number" into just mailbox
  1352. # But they must deal with extra level of <brackets> that are sometimes
  1353. # incorrectly added.  They must also deal with the fact that sendmail
  1354. # processes left to right, and becomes unhappy with anything not having
  1355. # <balanced brackets>.
  1356. R$*<$*>$*<$*>$*        <$2>$3$4$5        Remove right branches.
  1357. R$*<$*<$*>$*>$*        <$3>$5            Trim left branches.
  1358. R$*<>$*            $n            default user
  1359. R$*<$*>$*        $2            Last level
  1360.  
  1361. # These are not for us
  1362. #R:{include}:$*@$*    $@<@$2>,:{include}:$1    indirect address
  1363. #R:{include}:$*        $@<@$w>,:{include}:$1    indirect address
  1364. # Above commented out.  Should be covered by the filename handling.
  1365. #R$*/$*@$*        $@<@$3>,$1/$2        file name
  1366. #R$*/$*            $@<@$w>,$1/$2        file name
  1367. # Routes with '/' could be X.400.  Use normal rules.
  1368.  
  1369. # Fix group names and return them
  1370. R$+:;@$+        $:$1:;            remove host info
  1371. R$+:            $:$1:;            missing semicolon
  1372. R$+!;            $:$1:;            UUCP-style mangled group
  1373. R$+!$+:;        $2:;            remove UUCP host info
  1374. R$+:;            $@$1:;<@>        Finally return group
  1375.  
  1376. # Miscellaneous cleanup (sigh)
  1377. R$+!.$+            $1^.$2            fix mangled Xerox dList
  1378. ifdef({DECNETNAME}, {dnl ### Our DECNETNAME is defined ###
  1379. R$+::$B::$+        $B::$2            Shorten decnet route thru us
  1380. })dnl ### End DECNETNAME ###
  1381. R$-::$-            $1::$2?$(@$&Q$2$&Q$)    Is this decnet quoted 822?
  1382. R$-::$-?""$+@$+""    @$1.dnet:$3@$4        Convert quoted to source route.
  1383. R$-::$-?$+        $1::$2            Else restore
  1384. R$+::$+            $1.dnet!$2        Convert DECNET to bang path.
  1385. R$+!:$+@$+        $1!$3!$2        scrambled source route
  1386. R$+!:$+            $1!$2            mangled VAX/VMS address
  1387. ifdef({XEROXNS},,{
  1388. R$-:$-            $1!$2            Berknet style address
  1389. })
  1390. R$+:@$+            $1,@$2            slightly malformed src route
  1391. R$*$~Z@$+@$+        $1$2%$3@$4        fix user@host@relay
  1392. R$+@$+.$=T.UUCP        $1@$2.$3        strip UUCP off foo@bar.EDU.UUCP
  1393. R$+@$+.$=P.UUCP        $1@$2.$3        strip UUCP off foo@bar.DNET.UUCP
  1394.  
  1395. # Fix %-kludgified RFC822 source routes (double sigh)
  1396. R$+!%$+:$+%$+        $1!%$2:$3@$4        change all %'s into @'s
  1397. R$+!%$+,%$+        $1!%$2,@$3
  1398. R$+!%$+            $1!@$2
  1399.  
  1400. R$+            $:$>7$1            Canonicalize address.
  1401.  
  1402. # The address should now be in the format <@domain>,...,user
  1403. # or, if there is no domain, in the format <>,user
  1404. ifdef({XEROXGV},{dnl
  1405.  
  1406. # Automatically route Grapevine addresses.
  1407. # Assumes that there won't be any local user names or aliases with dots.
  1408. R<>,$-.$*        $:{<@}XEROXGV{>,$1.$2}    GW for Grapvine User.registry
  1409. })dnl
  1410. ifdef({XEROXNS},{dnl
  1411.  
  1412. # Automatically route XNS addresses.
  1413. # Assumes that there won't be any local user names or aliases with colons.
  1414. R<>,$+:$*        $:{<@}XEROXNS{>,$1:$2}    XNS User:Domain:Organization
  1415. })dnl
  1416.  
  1417. #########################################################################
  1418. #                                    #
  1419. #    Rule Set #4:    Address PrettyPrinter                #
  1420. #                                    #
  1421. #    Does the final prettyprinting before the address is included    #
  1422. #    in the message.  (This is essentially a reformatting        #
  1423. #    from internal to external format)                #
  1424. #                                    #
  1425. ifdef({M4COMMENTS},{dnl
  1426. #    This rule set passes unchanged any valid address which is    #
  1427. #    full bracketed <address> or any valid address not containing    #
  1428. #    angle brackets.  This is important, as it allows a        #
  1429. #    mailer-specific ruleset to output format the address itself    #
  1430. #    and be sure that S4 does not further alter it.            #
  1431. #                                    #
  1432. #    Addresses resulting from S4 are NEVER enclosed in angle        #
  1433. #    brackets.  DO NOT CHANGE this, as a some mailer-specific    #
  1434. #    rule sets may call S4 internally, and depend on this.        #
  1435. #                                    #
  1436. #    This rule set will output any combination of @/!/%        #
  1437. #    including combinations which do not make sense.  It        #
  1438. #    assumes that the address has been reasonably formatted        #
  1439. #    in previous rule sets.                        #
  1440. #                                    #
  1441. #    The basic algorithm is to first enclose everything in        #
  1442. #    <angle brackets>.  Then each domain is moved out, leaving    #
  1443. #    the unprocessed part treated as the "user" portion still    #
  1444. #    in brackets.  This approach permits a simple recursive        #
  1445. #    definition which is modified somewhat to allow iterative    #
  1446. #    processing where possible, and to handle the complexities    #
  1447. #    of the RFC822 source route format.                #
  1448. #                                    #
  1449. #    WARNING: Make sure the input to S4 presents different        #
  1450. #    formats of address in a reasonable order.  Otherwise S4        #
  1451. #    is quite capable of outputting addresses which are        #
  1452. #    hopelessly ambiguous.                        #
  1453. },{dnl ### Not M4COMMENTS ###
  1454. #    More detailed documentation in the master configuration        #
  1455. #    file.                                #
  1456. })dnl ### End M4COMMENTS ###
  1457. #                                    #
  1458. #    DO NOT ATTEMPT TO CHANGE S4 unless you fully understand it,    #
  1459. #    as it is a critical part of the whole configuration setup.    #
  1460. #                                    #
  1461. #########################################################################
  1462. S4
  1463.  
  1464. R$*<@>            $@$1            Return unparseables.
  1465. # If missing domain, attach local.
  1466. R<>,$=X$+$=Y$+        <@$2>$3$4        No host, add default.
  1467. R<>,$+            $@$1            Plain name, without domain.
  1468.  
  1469. R<$=X$+>$=Y$+        ?<@$2?$3$4>        Insert marker
  1470. # We start with source routes; they are somewhat tricky.
  1471. R?$*<$+?,@$+$=Y$+>$*    $1<?:@$3?$4$5?$2?>$6    Insert several markers
  1472. R$+?:$+?,@$+$=Y$+?$+?$+    $1,$6?:@$3?$4$5?$2?$7    Process source rte
  1473. R$+?:$+?,$+?$+?$+    $:$1,$4?:$3??$2?$5    Process user (no @)
  1474. R$+?:$+?$*?$+?$+    ?$1:?$2$3?$4$5        Remove extra marks
  1475. R?$*<$=Y$*?$+?$+>$*    $:?$1$3<$4>$5$6        Remove extra , or :
  1476. # The separator after "<@domain" cannot now be a comma, except in one case.
  1477. R?$*<$+?,$+>$*        $@$1$3$2$4        Return user@host
  1478. # The <..> part may (no src rte) or may not contain a "?".  Make it consistent.
  1479. R?$+?$+            ?$1$2            Remove extra marks
  1480. R?$*<@$+$=Y$+>$*    $:?$1<@$2?$3$4>$5    Add mark for next step
  1481. # Next process ! paths.  These are more straight forward.
  1482. R?$*<@$+?!$+>$*        $:?$1?!<@$2?!$3>$4    Add mark for later use.
  1483. ifdef({UUCPXTABLE},{dnl
  1484. R?$+<@$+?!@$+$=Y$+>$*    ?$1$(U$2$)!<@$3?$4$5>$6    Move UUCP host out
  1485. R?$+<@$+?!$+>$*        $:?$1$(U$2$)!<$3>$4    host!user
  1486. },{dnl ### Not UUCPXTABLE ###
  1487. R?$+<@$+?!@$+$=Y$+>$*    ?$1$2!<@$3?$4$5>$6    Move UUCP host out
  1488. R?$+<@$+?!$+>$*        $:?$1$2!<$3>$4        host!user
  1489. })dnl ### End UUCPXTABLE ###
  1490. R?$*?$*!$-.UUCP!$+    ?$1?$2!$3!$4        Remove unneeded .UUCP
  1491. R?$*?!$*<$+>$*        ?$1$2<$3>$4        Remove extra markers.
  1492. # The % paths are the easiest.
  1493. R?$*<@$+?:@$+$=Y$+>$*    ?$1<@$3?$4$5>%$2$6    Move %domain out
  1494. R?$*<@$+?:$+>$*        $@$1$3%$2$4        Return user%host
  1495. # There might be more left.
  1496. R?$*<@$+?$=Y$+>$*    $@$>4?$1<@$2?$3$4>$5    Recurse for more
  1497. # Finally, clean up
  1498. R?$+?$+            ?$1$2            Remove extra marks
  1499. R?$*<$+>$*        $:$1$2$3        Remove <brackets>
  1500.  
  1501. #########################################################################
  1502. #                                    #
  1503. #    Rule Set #5:    [Header] Sender Specific Rewriting        #
  1504. #                                    #
  1505. #    Set a flag to indicate that this is a sender address.        #
  1506. ifdef({GENERICFROM},{dnl
  1507. #                                    #
  1508. #    Translate local sender addresses to their generic        #
  1509. #    equivalents.                            #
  1510. })dnl ### End of GENERICFROM ###
  1511. #                                    #
  1512. #    There is an assumption by some mailers (notably ucbMail)    #
  1513. #    that the 'From:' header will not have a domain for        #
  1514. #    local senders.  The sender domain, if local, is therefore    #
  1515. #    squirreled away where the mailer specific ruleset can        #
  1516. #    easily recognize and remove it if desired.            #
  1517. #                                    #
  1518. #########################################################################
  1519. S5
  1520.  
  1521. R<@$+>$+        <%$1>$2                Change mark to '%'.
  1522. R$+            $:$>8$1                Fully qualify domains.
  1523. R<%$+>$+        $:<@$1>$2            Change back to @.
  1524. R<$*>$+            $:$>23<$1>$2            Remove unneeded routing
  1525. R$+<$+>$+        $:$1<>,$2$3            Make local recognizable
  1526. ifdef({GENERICFROM},{dnl
  1527. # Use (canonicalized) generic names for local senders
  1528. R$*<$*>$+        $:$1<$2>$3??$>4$>25<$2>$3    Format for table lookup
  1529. R$*<$*>$+??$+        <$2>$3?$(G$4$:?$1$)        Search table.
  1530. R$+??$*            $:$1                Not found - remove mark
  1531. R<$*>$+?$+        $:$>8$>3$3            Else reformat.
  1532. R<@$=w>$=Y$~A$*        <>,@$1$2$3$4            Make local recognizable
  1533. },{dnl ### Not GENERICFROM
  1534. R$*<$*>$+        $:<$2>$3            Remove local indicator
  1535. })dnl ### End of GENERICFROM ###
  1536. R$+$=X$-$+        $:$1%$3$4            Indicate sender.
  1537.  
  1538. #########################################################################
  1539. #                                    #
  1540. #    Rule Set #6:    [Header] Receiver Specific Rewriting        #
  1541. #                                    #
  1542. #    Fully qualify domain, but shorten route where possible.        #
  1543. #                                    #
  1544. #########################################################################
  1545. S6
  1546.  
  1547. R<@$+>$+        <%$1>$2                Change mark to '%'.
  1548. R$+            $:$>8$1                Fully qualify domains.
  1549. R<%$+>$+        $:<@$1>$2            Change back to @.
  1550. R<$*>$+            $:$>23<$1>$2            Remove unneeded routing
  1551. ifdef({GENERICTO},{ifdef({GENERICFROM},{dnl
  1552. # Use (canonicalized) generic names for local recipients.
  1553. R$*<$*>$+        $:$1<$2>$3??$>4$>25<$2>$3    Format for table lookup
  1554. R$*<$*>$+??$+        <$2>$3?$(G$4$:?$1$)        Search table.
  1555. R$*<$*>$+??$*        $:<$2>$3            Remove unneeded markers.
  1556. R<$*>$+?$+        $:$>8$>3$3            Generic found, reformat.
  1557. })})dnl ### End of GENERICTO ###
  1558. R$*<$*>$+        $:<$2>$3            Remove local user.
  1559.  
  1560. ##########################################################################
  1561. ## General rewriting subroutines #########################################
  1562. ##########################################################################
  1563.  
  1564. #########################################################################
  1565. #                                    #
  1566. #    Rule Set #7: Canonicalize address.                #
  1567. #                                    #
  1568. #    This is a subroutine to S3.  After S3 has done basic        #
  1569. #    repairing of addresses it calls S7 to canonicalize.        #
  1570. #    S7 may also be called to canonicalize internal addresses.    #
  1571. #    DO NOT pass already canonical addresses to S7.  However        #
  1572. #    a semi-canonical address, beginning with @ (NOT %) may        #
  1573. #    be totally enclosed in <> angle brackets and passed to        #
  1574. #    S7 for re-canonicalization, although this should not        #
  1575. #    normally be needed.  Addresses canonicalized by S7        #
  1576. #    are not necessarily fully qualified (see rule set #8).        #
  1577. #                                    #
  1578. #    The general internal form of an address is a modified        #
  1579. #    RFC822 source route.  An address will be converted first    #
  1580. #    to the form:                            #
  1581. #      @host1,@host2,...@hostn,user    (Note the ',' not ':'        #
  1582. #                       which precedes user).    #
  1583. #    However, the ',' may not really be a ','.  It could also be    #
  1584. #    a ':' or a '!'.  The choice of ',',':', or '!' serves to define    #
  1585. #    how the host domain was delimited.  A ',' represents an '@',    #
  1586. #    a ':' represents a '%', and a '!' represents a '!'.        #
  1587. #                                    #
  1588. #    Note also that the modified form ends with just 'user', not    #
  1589. #    with 'user@domain'.  This format is easier to use internally.    #
  1590. #    After turning into a modified route, the immediate host is    #
  1591. #    single out with angle brackets.  This leaves an address of    #
  1592. #    the form <@host1>,@host,....,@hostn,user.            #
  1593. #                                    #
  1594. #    Finally ruleset's 1 and 5 convert the initial '@' into a    #
  1595. #    '%'.  This enables rewriting rules to more easily        #
  1596. #    distinguish between sender addresses (with a %) or        #
  1597. #    recipient addresses (with an @).                #
  1598. #                                    #
  1599. #    Ruleset #7 calls ruleset #9 to isolate the user portion        #
  1600. #    of an address.  Most of #7 deals with addresses for which    #
  1601. #    the user portion is enclosed in <>, and is already        #
  1602. #    canonicalized.  However it is possible to call #7 with the    #
  1603. #    user portion already isolated and canonicalized.        #
  1604. ifdef({PATHTABLE},{dnl ### PATHTABLE is defined ###
  1605. #    This is done in the PATHTABLE routing, where it is necessary    #
  1606. #    to merge two routes.                        #
  1607. })dnl ### End PATHTABLE ###
  1608. #                                    #
  1609. #    When processing an address with the user portion enclosed,    #
  1610. #    ruleset #7 supports the following types of address:        #
  1611. #        <x>%b@a                            #
  1612. #        a!b!<x>%c                        #
  1613. #        @a,@b:<x>%d@c                        #
  1614. #        a!b!@c,@d:<x>%f@e                    #
  1615. #        b!c!<x>%d@a                        #
  1616. #    However it does not support an address of the form        #
  1617. #        @a,@b:d!e!<x>@c                        #
  1618. #                                    #
  1619. #    It should be pointed out that for a complete address with    #
  1620. #    the user portion not yet isolated, there is no such        #
  1621. #    restriction.  In that case, ruleset #9 will convert        #
  1622. #        @a,@b:d!e!x%f@c                        #
  1623. #    into                                #
  1624. #        @a,@b:<d!e!x%f>@c  (except that <d!e!x%f>        #
  1625. #            will be canonicalized.                #
  1626. #    This is now in a form ruleset #7 can handle.            #
  1627. #                                    #
  1628. #########################################################################
  1629. S7
  1630.  
  1631. # We first isolate the user portion of the address.
  1632. R$+            $:$>9$1            Isolate the user part.
  1633. R$*<>$*            $@$1$2<@>        Missing user? give up.
  1634. # Now we must canonicalize the address portion.  Start with some checking.
  1635. R$*%$*<$+>$*        $@$1%$2$3$4<@>        Should be no percent. give up.
  1636. R$*<$+>$*$=Y$*        $@$1$2$3$4$5<@>        No ,:! in domain of user@domain
  1637. R$*$~Y<$+>$*        $@$1$2$3$4<@>        Separator or nothing precede <.
  1638. # Take care of a!b!<user> or even a!b!@c,@d:<user>@domain
  1639. R$~A$*!@$*<$+>$*    @$1$2!@$3<$4>$5        a!source-rte -> @a!source-rte
  1640. R$~A$*!$*<$+>$*@$+    @$6,@$1$2!$3<$4>$5    b!<x>%c@a -> @a,@b!<x>%c
  1641. R$~A$*!$*<$+>$*        @$1$2!$3<$4>$5        domain!<user> -> @domain!<user>
  1642. R$+!$~A$*!$*<$+>$*    $1!@$2$3!$4<$5>$6    @a!b!<u> -> @a!@b!<u>
  1643. R$~A$*<$+>$*        $@$1$2$3$4<@>        Route must begin with @.
  1644. R$+:<$+>$*        $1,<$2>$3        Use , not : for routes
  1645. R$*<$+>$=X$+        $:?$1<$2>$3$4        Add marker.
  1646. R$*?$*<$+>%$+$=X$+    @$4:$1?$2<$3>$5$6    Convert %path to source rte
  1647. R$*?$*<$+>%$+        $:$2@$4:$1<$3>        Convert last '%'.
  1648. R$*?$*<$+>@$+        $:$2@$4,$1<$3>        Convert last '@'.
  1649. R$*<$+>$*        $1$2$3            Remove brackets.
  1650. # We should now have a modified route.  Pick out immediate host.
  1651. R@$+$=Y$+        $@<@$1>$2$3        If a host, select it.
  1652. R$+            $@<>,$1            Else null host.
  1653.  
  1654. #########################################################################
  1655. #                                    #
  1656. #    Rule Set #8: Qualify primary domain.                #
  1657. #                                    #
  1658. #    This rule set is called to fully qualify the domain of        #
  1659. #    the immediate host.                        #
  1660. ifdef({M4COMMENTS},{dnl
  1661. #    DOMAIN NAME REWRITING:                        #
  1662. #    There are several options available for rewriting domain    #
  1663. #    names.  These are MAILNAME, HIDDENNET, HIDDENDOMAIN and        #
  1664. #    DOMAINTABLE.                            #
  1665. #                                    #
  1666. #    The simplest of these is MAILNAME.  This option causes        #
  1667. #    MAILNAME to be added as a domain to all local addresses        #
  1668. #    without domains.  With HIDDENNET you specify a set of        #
  1669. #    hosts whose names will be automatically translated to your    #
  1670. #    hostname (or MAILNAME), or to HIDDENNETHOST, if specified.    #
  1671. #    With HIDDENDOMAIN, you may specify a complete DOMAIN, which    #
  1672. #    need not be your own domain (it could be a domain for which    #
  1673. #    you are relaying mail), and all hosts within that domain are    #
  1674. #    rewritten to the name of the HIDDENDOMAIN, or to        #
  1675. #    HIDDENDOMAINHOST if specified.                    #
  1676. #    The most versatile option is DOMAINTABLE.  With it you specify    #
  1677. #    a dbm lookup table of domain name translations.  The entries    #
  1678. #    can be specific translations of one host name to another, or    #
  1679. #    can refer to a complete subdomain.  In the latter form, the    #
  1680. #    dbm search key begins with a '.' as in '.dom.ain', which will    #
  1681. #    match any domain ending with that name.  The replacement value    #
  1682. #    in this case may contain a '%s' which will be replaced by the    #
  1683. #    portion of the domain name not matched with the key.        #
  1684. #                                    #
  1685. #    Although most of what the other options support can be handled    #
  1686. #    with DOMAINTABLE entries, it is permissible to use any        #
  1687. #    combination of these options.  No domain name will be        #
  1688. #    translated more than once with these options, and the order    #
  1689. #    of processing is with DOMAINTABLE first, next            #
  1690. #    HIDDENNET, next HIDDENDOMAIN.                    #
  1691. })dnl ### End of M4COMMENTS ###
  1692. #                                    #
  1693. #########################################################################
  1694. S8
  1695.  
  1696. # For local users, add a default domain.
  1697. R<>,$~X$*        $@$>20<>,$1$2            Add default domain.
  1698. ifdef({BANGIMPLIESUUCP},{dnl
  1699. R<$=X$->!$+        $:<$1$2.UUCP>!$3        If !, add .UUCP
  1700. })dnl ### End of BANGIMPLIESUUCP ###
  1701. R<$+>$+            ?<$1>$2                Add marker.
  1702. R?<$=X[$+.$+]>$+    <$1[$2.$3]>$4            [1.2.3.4] is ok.
  1703. ifdef({DOMAINTABLE},{dnl
  1704. R?<$=X$+.$=P>$+        <$1$2.$3??>$4            don't resolv pseudomain
  1705. R?<$=X$+>$+        $:<$1$[ $2 $:$2? $]?>$3        First try resolver
  1706. R<$=X$+?$*>$+        $:<$1$(N $2 $:$2$3 $)>$4    Next domain table
  1707. },{dnl ### Not DOMAINTABLE
  1708. R?<$=X$+.$=P>$+        <$1$2.$3?>$4            don't resolv pseudomain
  1709. R?<$=X$+>$+        $:<$1$[ $2 $:$2? $]>$3        First try resolver
  1710. })dnl ### End DOMAINTABLE ###
  1711. R<$=X$w?>$+        <$1$w>$2            Accept official name.
  1712. ifdef({M4COMMENTS},{dnl
  1713. # The next three rules are intended to deal with those improperly configured
  1714. # workstations, which send out addresses of the form <user@unqualified>
  1715. # for sender addresses.  The idea is to check if $s is defined (the sending
  1716. # domain), and route these addresses through that domain.  The assumption is
  1717. # that this address format is understood by the sending domain.
  1718. # The third of those rules guarantees that an unqualified sender address will
  1719. # be properly logged as 'unparseable', even if the UUCP maps contain a host
  1720. # of the same name.  It matches only during setsender() by virtue of the '$&f'.
  1721. })dnl ### End M4COMMENTS ###
  1722. # Caution - next 3 rules MUST NOT apply to envelope recipients (mailing loops).
  1723. R<$=X$-?>$+        $:<$1$2?$&r?$&s>$3        What is sender domain?
  1724. # The $[ $] in next line is a crude fix for the fact that $&s is not tokenized.
  1725. R<%$-?SMTP?$+>$=Y$+    <%$[$2$]>,@$1:$4        Route unqualified.
  1726. R$&f<@$-?SMTP?$+>$=Y$+    <@$2>$4$5            Remove markers.
  1727. R<$=X$-?$+>$+        <$1$2?>$4            Remove extraneous data.
  1728. ifdef({BANGONLYUUCP},{dnl
  1729. ifdef({BANGIMPLIESUUCP},{dnl ### BANGONLYUUCP and BANGIMPLIESUUCP ###
  1730. ifdef({M4COMMENTS},{dnl
  1731. # Only qualify with .UUCP if the domain is delimited with !.
  1732. # But since BANGIMPLIESUUCP is in effect this has already been done.
  1733. # Therefore no extra qualification is required.
  1734. })dnl ### End M4COMMENTS ###
  1735. },{dnl ### BANGONLYUUCP but Not BANGIMPLIESUUCP ###
  1736. R<$=X$=U?>!$+        <$1$2.UUCP>!$3            Local UUCP host?
  1737. ifdef({PATHTABLE},{dnl ### PATHTABLE ###
  1738. R<$=X$-?>!$+        $:<$1$2?$(P $2 $: $)>!$3    Known in pathtable?
  1739. })ifdef({MAILERTABLE},{dnl ### MAILERTABLE ###
  1740. R<$=X$-?>!$+        $:<$1$2?$(M $2.UUCP $: $)>!$3    Known in mailertable?
  1741. R<$+?$+>$+        <$1.UUCP>$3            Add .UUCP if known
  1742. },{ifdef({PATHTABLE},{dnl ### PATHTABLE and MAILERTABLE ###
  1743. R<$+?$+>$+        <$1.UUCP>$3            Add .UUCP if known
  1744. })})dnl ### End of PATHTABLE/MAILERTABLE ###
  1745. })dnl ### End BANGONLYUUCP and Not BANGIMPLIESUUCP ###
  1746. },{dnl ### Not BANGONLYUUCP ###
  1747. R<$=X$=U?>$+        <$1$2.UUCP>$3            Local UUCP host?
  1748. ifdef({PATHTABLE},{dnl ### PATHTABLE ###
  1749. R<$=X$-?>$+        $:<$1$2?$(P $2 $: $)>$3        Known in pathtable?
  1750. })ifdef({MAILERTABLE},{dnl ### MAILERTABLE ###
  1751. R<$=X$-?>$+        $:<$1$2?$(M $2.UUCP $: $)>$3    Known in mailertable?
  1752. R<$+?$+>$+        <$1.UUCP>$3            Add .UUCP if known
  1753. },{ifdef({PATHTABLE},{dnl ### PATHTABLE and MAILERTABLE ###
  1754. R<$+?$+>$+        <$1.UUCP>$3            Add .UUCP if known
  1755. })})dnl ### End of PATHTABLE/MAILERTABLE ###
  1756. })dnl ### End Not BANGONLYUUCP ###
  1757. R<$*?$*>$*        <$1$2>$3            Remove marker
  1758.  
  1759. #########################################################################
  1760. #                                    #
  1761. #    Rule Set #9:    Isolate the user portion of an address        #
  1762. #                                    #
  1763. #    Given an address like a@b return <a>@b.  For a route address    #
  1764. #    of the form @a,@b,@c:x@d  return  @a,@b,@c:<x>@d .  The user    #
  1765. #    portion may contain % and !, but will not contain any @ symbol.    #
  1766. #    An address like a!b!x@c is ambiguous.                #
  1767. ifdef({UUCPPRECEDENCE},{dnl
  1768. #    By default, it is resolved as <a!b!x>@c giving the @        #
  1769. #    priority over the !.  This is the interpretation required    #
  1770. #    by RFC822.  However some UUCP nodes automatically add        #
  1771. #    'nodename!' to every address, even to addresses containing    #
  1772. #    an '@'.  Such nodes are identified by UUCPPRECEDENCE, and    #
  1773. #    these addresses are resolved as a!b!<x@c> giving        #
  1774. #    the ! priority over the @.                    #
  1775. },{dnl ### UUCPPRECEDENCE Not Defined ###
  1776. #    Here it is resolved as <a!b!x>@c giving the @ priority        #
  1777. #    over the !, as required by RFC822.                #
  1778. })dnl ### End of Not UUCPPRECEDENCE ###
  1779. #    After isolating the user portion, that portion is finally    #
  1780. #    converted to internal route form.  Thus                #
  1781. #     x%a%b@c becomes first <x%a%b>@c, and then is reformatted to    #
  1782. #    <@b:@a:x>@c.                            #
  1783. #                                    #
  1784. #########################################################################
  1785. S9
  1786.  
  1787. R$*<$*>$*        $@$1<$2>$3        Already isolated: return
  1788. R$+            $:<$1>            First try user only.
  1789. R$*<$*@$+$=Y$*>        $1$2@$3$4<$5>        Skip past routing.
  1790. R$*<$*$~Y@$+>        $1<$2$3>@$4        user@domain
  1791. R$*<$+>@$+$=X$+        $@$>9$1$2%$3@$5        Fix badly mixed @ and %.
  1792. R$*<$*@$*>$*        $@$1$2@$3$4<>        Shouldn't happen. I give up.
  1793. R$*<$*%$*!$*>$*        $@$1$2%$3!$4$5<>    This shouldn't happen either.
  1794. ifdef({UUCPPRECEDENCE},{dnl
  1795. # Handle bad !/@ mixtures.
  1796. R<$=E!$+>@$+        $:<$1!$2>@$3?$1.UUCP?$&r    Add domain and protocol
  1797. R<$+!$+>@$+?$&s?UUCP    <$1!$2@$3>??        If matched move @domain into <>
  1798. R$*<$+!$+@$+>??        $1$2!<$3@$4>??         and move bang path out.
  1799. R$*<$+>$*?$*        $1<$2>$3        Remove markers.
  1800. })dnl ### End of UUCPPRECEDENCE ###
  1801. # Uncomment the next line to give % higher precedence that ! in c!x%b@a
  1802. #R$*<$+!$+%$+>$+    $1<$2!$3>%$4$5        If @ has precedence, move % out
  1803. R$*<$+>$*        $:$1<?$2?>$3        Add markers to convert %, !
  1804. R$*<?$+@$+?>$*        $:$1<@$3,?$2?>$4    Convert u@d to @d,u
  1805. R$*<$*?$+!$+>$*        $1<$2@$3!?$4>$5        Convert a!b to @a!b.
  1806. R$+?$+%$+?$+        $:$1@?$3?:$2$4        Convert a%b to @b:a
  1807. R$+@?$+%$+?$+        $1@?$3?:@$2$4        Completely convert % path
  1808. R$+?$+            $1$2            Remove markers.
  1809.  
  1810. #########################################################################
  1811. #                                    #
  1812. #    Rule Set #19:    Translate domain addresses to UUCP !-paths    #
  1813. #                                    #
  1814. #    Takes an domain style address as input and transforms this    #
  1815. #    into a !-path.  There will be no atsign left in the address    #
  1816. #    after this, but there may(?) still be a percent sign.        #
  1817. #                                    #
  1818. #########################################################################
  1819. S19
  1820.  
  1821. R<$+>$=Y$+        $:<$1>!$3            Force bang formatting.
  1822. R<>,$=X$+$=Y$+        $:<>,$1$2!$4            Bang format for locals
  1823. R<$+>$*$=Y$~A$*        $:<$1>$2$3?$4$5            Mark user.
  1824. R<$+>$+@$-.UUCP:$*?$+    <$1>$2@$3.UUCP!$4?$5        Change % to ! for .UUCP
  1825. R<$+>$+@$-:$*?$+    <$1>$2@$3!$4?$5            Change to ! for unqual
  1826. R<$+>$+@$+,$*?$+    <$1>$2@$3!$4?$5            Use ! for real domains
  1827. R<$+>$+?$+        <$1>$2$3            Remove user mark.
  1828.  
  1829. #########################################################################
  1830. #                                    #
  1831. #    Rule Set #20:    Route addresses through us.            #
  1832. #                                    #
  1833. #    Route the address through us.  Done where it is necessary    #
  1834. #    for the address to use a registered domain.            #
  1835. #                                    #
  1836. #########################################################################
  1837. S20
  1838.  
  1839. ifdef({MAILNAME},{dnl ### Use our MAILNAME for routing
  1840. R<$=X$=w>$=Y$+        $@<$1{}MAILNAME>,$4        Us? Use preferred name
  1841. R<$=X$+>$+        $@<$1{}MAILNAME>,@$2$3        Else route thru us.
  1842. R<>,$~X$*        $@<>,{@}MAILNAME,$1$2        No domain, use our name
  1843. },{dnl ### MAILNAME not defined
  1844. R<$=X$=w>$=Y$+        $@<$1$w>,$4            Us? Use preferred name
  1845. R<$=X$+>$+        $@<$1$w>,@$2$3            Else route thru us.
  1846. R<>,$~X$*        $@<>,@$w,$1$2            No domain, use our name
  1847. })dnl ### End of Not MAILNAME.
  1848.  
  1849. #########################################################################
  1850. #                                    #
  1851. #    Rule Set #21:  Route local UUCP links, etc through us.        #
  1852. #                                    #
  1853. #    Extend this rule set as needed for locally connected        #
  1854. #    nodes which do not have internet addresses.            #
  1855. #                                    #
  1856. #########################################################################
  1857. S21
  1858.  
  1859. R<$=X$&h.UUCP>$+    $@<$1$2.UUCP>$3        Don't hide destination host
  1860. R<$=X$=U.UUCP>$=Y$+    $@$>20<$1$2.UUCP>!$4    Route local UUCP node thru us
  1861. ifdef({DECNETNODES},{dnl
  1862. R<$=X$=D>$+        $@$>20<$1$2>$3        Route local DecNET node thru us
  1863. })dnl ### End DECNETNODES ###
  1864. ifdef({UIUC},{dnl
  1865. # Provide an explicit gateway for hepnet
  1866. R<$=X$-.hepnet>$=Y$+    $@<$1garcon.cso.uiuc.edu>,@$2.hepnet:$4
  1867. })dnl
  1868.  
  1869. ifdef({PATHTABLE},{dnl
  1870. #########################################################################
  1871. #                                    #
  1872. #    Rule Set #22:    General Pathalias Router            #
  1873. #                                    #
  1874. #    Tries to find a route for an address using the pathalias    #
  1875. #    database.  It will return the complete (canonicalized)        #
  1876. #    route if found, or the same address otherwise.            #
  1877. #                                    #
  1878. #    If a route is found, the returned value is preceded by        #
  1879. #    a '?' to make the success recognizeable.            #
  1880. #                                    #
  1881. #    See the comments in ruleset #7 for the types of addresses    #
  1882. #    that may appear in the pathalias database.            #
  1883. #                                    #
  1884. #    A key such as .EDU in the PATHTABLE will not be matched        #
  1885. #    unless ALIAS_TOP_DOMAINS is defined.  However entries such    #
  1886. #    as .BITNET (pseudomains) or .FOOBAR.EDU will be matched.    #
  1887. #                                    #
  1888. #########################################################################
  1889. S22
  1890.  
  1891. R<@$+>$+        ?<@$1>$2                Insert marker.
  1892. # Search pathalias database
  1893. R?<@$-.UUCP>$=Y$+    $(P$1$@<$3>$:<@?$1.UUCP>$2$3$)        0th: UUCP host.
  1894. R?<@$+>$=Y$+        $(P$1$@<$3>$:<@?$1>$2$3$)        1st: Domain.
  1895. R<@$*?$-.$+>$+    $(P.$2.$3$@<@$1$2.$3$4>$:<@$1$2.?$3>$4$)    2nd: Subdomain
  1896. ifdef({ALIAS_TOP_DOMAINS},,{dnl
  1897. R<@$+?$=P>$+        $:$(P.$2$@<@$1$2$3>$:<@$1$2?>$3$)    nth: Pseudomain
  1898. R<@$+?$=T>$+        $:<@$1$2?>$3                nth: not TOP.
  1899. })dnl
  1900. R<@$+?$->$+        $(P.$2$@<@$1$2$3>$:<@$1$2?>$3$)        nth: Top domain
  1901. # Check the results of our search.
  1902. R$*?$+            $@$1$2                Failed.  Return.
  1903. R$-!$+            $1.UUCP!$2            Qualify !-path w. UUCP
  1904. # We now merge two possible routes, and canonicalize the result.
  1905. R$*<$+>$*        $@?$>7$1<$2>$3            Canonicalize a!b!<user>
  1906. })dnl ### End PATHTABLE ###
  1907.  
  1908. #########################################################################
  1909. #                                    #
  1910. #    Rule Set #23:    Route prettyprinter & compressor.        #
  1911. #                                    #
  1912. #    This code comresses "obvious" routes whenever considered    #
  1913. #    necessary -- mostly just for aesthetical reasons, though.    #
  1914. #    If you don't like this, feel free to disable it.  Sendmail    #
  1915. #    shouldn't break, anyway.  (But there will probably be        #
  1916. #    others...)                            #
  1917. #                                    #
  1918. ifdef({FORCE_NAMED},{dnl
  1919. #    If invoked with an address of the form <%domain>,xxx        #
  1920. #    the address is presumed to be that of an envelope sender    #
  1921. #    so the route stripping is less drastic than for header        #
  1922. #    addresses.  Consistent with RFC1123, superfluous routing is    #
  1923. #    removed from an RFC 822 source route.  UUCP routes through    #
  1924. #    a valid domain address are also eliminated.  This allows a    #
  1925. #    uucp neighbor whose mail leaves with a sender address of    #
  1926. #    'uunode!full.domain.name!user' to leave with a sender address    #
  1927. #    of 'user@full.domain.name' instead of the more complex and    #
  1928. #    unnecessary 'uunode!full.domain.name!user@our.domain.name'    #
  1929. #    The route stripping only occurs if the resulting domain        #
  1930. #    name can be validated either with the name server or        #
  1931. #    with our DOMAINTABLE.                        #
  1932. #                                    #
  1933. })dnl ### End FORCE_NAMED ###
  1934. #########################################################################
  1935. S23
  1936.  
  1937. ifdef({FORCE_NAMED},{dnl
  1938. R<$+>$*$=Y$~A$*        $:<$1?>$2$3?$4$5    Mark user portion of address
  1939. R<%$+>$*:$*?$+        $:<%$1>$2?:$3$4        Move mark back past arpa kludge
  1940. },{dnl ### Not FORCE_NAMED ###
  1941. R<@$+>$*$=Y$~A$*    $:<@$1?>$2$3?$4$5    Mark user portion of address
  1942. })dnl ### End FORCE_NAMED ###
  1943. R<$+?>$+.$=T$=Y$*?$+    <$1$2.$3?>$4$5?$6    Find last top level domain
  1944. ifdef({UUCPRELAYS},{dnl
  1945. R<@$+?>$+@$=R!$*?$+    <@$1$2@$3?>!$4?$5    Last well known UUCP relay
  1946. })dnl ### End UUCPRELAYS ###
  1947. R$*<$+$=Y@$+>$+        $1$2$3<@$4>$5        Find begin of domain
  1948. R@$+<$+?>$*?$+        $:$>29$>8<$2>$3$4    Success - simplify.
  1949. ifdef({FORCE_NAMED},{dnl
  1950. R<%$+?>$*?$+        $:<%$1>$2$3        Failure - remove markers.
  1951. R$+<@$+.$~P?>$+        $:$1<@$[$2.$3$:$2.$3?$]>$4    Known to name server?
  1952. ifdef({DOMAINTABLE},{dnl
  1953. R$+<@$+.$~P?>$+        $:$1<@$(N$2.$3$:$2.$3?$)>$4    Known in domain table?
  1954. })dnl ### End DOMAINTABLE ###
  1955. R$+$=Y$*<$+?>$*?$+    $:<$1>$2$3$4$5$6    Failure - remove markers.
  1956. R%$+<@$+>$*?$+        $:<%$2>$3$4        Success - simplify.
  1957. })dnl ### End FORCE_NAMED ###
  1958. R<$+?>$*?$+        $:$>29<$1>$2$3        Failure - strip local routing.
  1959.  
  1960. R<$=X$+>$+        $:$2?<$1$2>$3        Move domain out front.
  1961. R<>,$=X$+$=Y$+        $:$2?<>,$1$2$3$4    Move out in front here too.
  1962. ifdef({DOMAINTABLE},{dnl
  1963. R$-$*?<$*>$+        $:$(N$1$2$:$1?$2$)<$3>$4    Try full domain.
  1964. R$+?.$-$*<$*>$+        $(N.$2$3$@$1$:$1.$2?$3$)<$4>$5    or partial domains
  1965. })dnl ### End DOMAINTABLE processing
  1966. ifdef({MAILNAME},{dnl
  1967. R$=w?<$*>$+        $:MAILNAME<$2>$3    Use our official name.
  1968. })dnl ### End MAILNAME ###
  1969. ifdef({HIDDENNET},{dnl ### HIDDENNET is defined
  1970. ifdef({HIDDENNETHOST},{dnl ### and there is a HIDDENNETHOST
  1971. R$=H?<$*>$+        $:HIDDENNETHOST<$2>$3    Hide domain?
  1972. },{dnl ### No HIDDENNETHOST
  1973. R$=H?<$*>$+        $:$w<$2>$3        Hide domain behind us?
  1974. })})dnl ### End HIDDENNET
  1975. ifdef({HIDDENDOMAIN},{dnl
  1976. R$+.HIDDENDOMAIN?<$*>$+    $:HIDDENDOMAINHOST<$2>$3    Hide this domain.
  1977. })dnl ### End HIDDENDOMAIN
  1978. R$+?$*<>,$=X$+$=Y$+    $@$6<>,$3$4$5$6        Return with local marked.
  1979. R$+?$*<$=X$+>$+        $:$4<$3$4>$5        Remove marker.
  1980. R$+<>,$=X$+$=Y$+    $@$5<>,$2$1$4$5        Return with remapped domain.
  1981. R$+<$=X$=w>$=Y$~A$*    $@$5$6<$2$1>$4$5$6    Return with remapped domain.
  1982. R$+<$=X$+>$+        $@<$2$1>$4        Non-local with remapped domain
  1983.  
  1984. ifdef({DECNETXTABLE},{dnl
  1985. #########################################################################
  1986. #                                    #
  1987. #    Rule Set #24:    Unqualify domains for DECnet nodes        #
  1988. #                                    #
  1989. #    This is needed since DECnet has a flat namespace.  All DECnet    #
  1990. #    nodes that are [externally] known to have a certain domain    #
  1991. #    name are unqualified to their corresponding DECnet host name.    #
  1992. #                                    #
  1993. #########################################################################
  1994. S24
  1995.  
  1996. R<$=X$+>$=Y$+        $:<$1$(D $2 $)>,?$4    Translate first.
  1997. R<$+>$+?@$+$=Y$+    <$1>$2@$(D $3 $):?$5    Translate other domains.
  1998. R<$+>$+?$+        <$1>$2$3        Remove marker.
  1999. })dnl ### End of DECNETXTABLE ###
  2000.  
  2001. #########################################################################
  2002. #                                    #
  2003. #    Rule Set #25:    Translate RFC822 Source Routes into %-Paths    #
  2004. #                                    #
  2005. #    This ruleset converts an address into a % route.        #
  2006. #                                    #
  2007. #########################################################################
  2008. S25
  2009.  
  2010. R<$+>$*$=Y$~A$*        $:<$1>$2$3?$4$5        Mark start of user field
  2011. R<$+>$=Y$+        $:<$1>,$3        No pure % paths please.
  2012. R<$+>,$+,$*?$+        <$1>,$2:$3?$4        Change source rte to %.
  2013. R<$+>,$+!$*?$+        <$1>,$2:$3?$4        Change ! format to %.
  2014. R<$+>$+?$+        <$1>$2$3        Remove mark.
  2015.  
  2016. #########################################################################
  2017. #                                    #
  2018. #    Rule Set #26:    Determine Mailer for Address            #
  2019. #                                    #
  2020. #    Takes an address in canonical format as input and returns    #
  2021. #    a complete mailer specification if a mailer is known for    #
  2022. #    the supplied domain.  Just returns the address otherwise.    #
  2023. #                                    #
  2024. #########################################################################
  2025. S26
  2026.  
  2027. # Reformat local addresses so easily recognized.
  2028. R<@$=w>$+        <>,@$1$2            Reformat locals
  2029. R<>,@$+$=Y$+        <>,$3                for easy recognition
  2030.  
  2031. # Search for possible global alias
  2032. R<$+>$=Y$~A$*        $:<$1>$2$3$4?$>4$>25<$1>,$3$4    externalize
  2033. R<$+>$+?$+        $:<$1>$2?$3?$(@ $3 $: $)    search aliases
  2034. R<$+>$+?$+?$+        <>,$3                Found, format as local
  2035. ifdef({NIS_MAILALIASES},{
  2036. # Not found, search for possible global alias in NIS mail.aliases map
  2037. R<$+>$+?$+?        $:<$1>$2?$3?$(% $3 $: $)    search NIS map
  2038. R<$+>$+?$+?$+        <>,$3                Found, format as local
  2039. })dnl ### End NIS_MAILALIASES ###
  2040. R$+?$*            $1                not found, remove marks
  2041.  
  2042. ifdef({NIS_MAILALIASES},{dnl
  2043. # We must not look up the aliases file while rebuilding it.  Hence the test
  2044. # on whether '$f' is defined.  If not just directly choose the local mailer.
  2045. # To test NIS mail.aliases expansion, use 'sendmail -bt -oMfnobody'
  2046. R$&f<>,$+        $#LOCAL $@$w $:$2        Build aliases locally.
  2047. # This local delivery may not really be local. Check the NIS mail.aliases map
  2048. R<>,$+            $:<>,$1?$(@ $1 $: ?$1 $)    See if in local aliases.
  2049. R<>,$+??$+        $:<>,$1??$(% $2 $:$)        Not local, check NIS map
  2050. R<>$+??$*,$*        {$#}TCPMAILER{$@}NIS_MAILHOST{$:<>$1}    Forward list.
  2051. R<>$+??$+@$=w        <>,$2                Handle as local.
  2052. R<>$+??$+        {$#}TCPMAILER{$@}NIS_MAILHOST{$:<>$1}    Else forward.
  2053. R<>,$+?$*        $:<>,$1                Not found, remove mark
  2054. })dnl ### End NIS_MAILALIASES
  2055.  
  2056. # Deliver to locals right away
  2057. ifdef({MAILSERVER},{dnl ### Send local mail to a server
  2058. # We must not look up the aliases file while rebuilding it.  Hence the test
  2059. # on whether '$f' is defined.  If not just directly choose the local mailer.
  2060. # To test MAILSERVER expansion, use 'sendmail -bt -oMfnobody'
  2061. R$&f<>,$+        $#LOCAL $@$w $:$2        Build aliases locally.
  2062. R<>,$*/$*        $#LOCAL $@$w $:$1/$2        File alias expansion.
  2063. R<>,|$*            $#LOCAL $@$w $:|$1        Program alias expansion.
  2064. R<>,$+            $:<>,$1?$(@ $1 $: $)        See if in local aliases.
  2065. ifelse(index(ALIASES,%),0,{dnl ### YP aliases in use.
  2066. R<>,$+?$*,$*        $:<>,$1?            Expand list on server.
  2067. R<>,$+?$+@$=w        $#LOCAL $@$w $:$1        Expand locals locally.
  2068. },{dnl ### Local alias file
  2069. R<>,$+?$+        $#LOCAL $@$w $:$1        Yes - deliver locally.
  2070. })dnl ### End YP aliases check.
  2071. R<>,$+?$*        {$#}TCPMAILER{$@}MAILSERVER{$:<@}MAILSERVER{>,$1}
  2072. })dnl ### End MAILSERVER ###
  2073. R<>,$+            $#LOCAL $@$w $:$1        local user
  2074.  
  2075. ifdef({MAILERTABLE},{dnl
  2076. ###
  2077. ###    Determine delivery over specific media
  2078. ###
  2079. R<@$-$*>$+        $:<@$1?$2>$3?$(M$1$2$:$)    search mailer table
  2080. ifdef({M4COMMENTS},{dnl
  2081. #    This way of specifying domains is slightly incompatible with
  2082. #    the method used in the PATHTABLE code in ruleset #22.  Basically
  2083. #    an entry in the mailertable for .niu.edu would define a mailer
  2084. #    for cs.niu.edu, for whatever.cs.niu.edu, etc but it would not
  2085. #    define a mailer for niu.edu.  A separate entry in the 
  2086. #    mailer table would be needed for that.
  2087. #    This approach is chosen because (a) it is more flexible, and
  2088. #    (b) it is consistent with the way wildcard MX records are
  2089. #    interpreted in the domain name server database.
  2090. #
  2091. #    The pathtable code in ruleset #22 interprets an entry for .niu.edu
  2092. #    as also aliasing mail destined for niu.edu.  We have not tried to
  2093. #    change the pathtable code, as it must be consistent with output of
  2094. #    the 'pathalias' command as applied to the uucp map.
  2095. #
  2096. })dnl ### End M4COMMENTS ###
  2097. R<@$+?.$-$*>$+?        <@$1.$2?$3>$4?$(M.$2$3$@$1$:$)    Try partial domains.
  2098. R<@$+?$*>$+?$-:$+    $#$4 $@$5 $:$>28 <@$1$2>$3    relativize & return
  2099. R<@$+?$*>$+?$-,$+    $#$4 $@$5 $:<@$1$2>$3        return no-relativize
  2100. R<$+>$=Y@$+$=Y$+?LOCAL!$+    $@$>26$>8$>7<@$3$4$5>    Strip host from local
  2101. R<$+>$=Y$+?$-!$+    $#$4 $@$5 $:$>7 <$3>        relativize UUCP style
  2102. R<@$+?$*>$+?:$*        $@<@$1$2>$3            Null mailer, return.
  2103. # Hint. Selecting Null mailer from mailertable forces pathalias lookup
  2104. #    even if there is a valid TCP or UUCP route.
  2105. R<@$+?$*>$+?$+        $#ERROR $:$4            Bad entry - error.
  2106. # Hint. Above rule can bounce mail to specific hosts or domains.
  2107. R<@$+?$*>$+?$*        $:<@$1$2>$3            no match, remove mark
  2108.  
  2109. })dnl ### End of MAILERTABLE ###
  2110. ###
  2111. ###    Determine delivery over TCP/IP
  2112. ###
  2113. R<@[$+.$+]>$=Y$+    $#TCP $@[$1.$2] $:$>7 <$4>    Handle numeric IN addr.
  2114. ifdef({ISOLATED_DOMAINS},{
  2115. R<@$*$=I>$+        $:<@$1$2>$3?$[ $1$2 $: $]    ask nameserver
  2116. R<@$+>$+?$+        {$#}TCPMAILER $@$3 $:<@$1>$2    found, return it
  2117. R<@$+>$+?$*        $:<@$1>$2            no match, remove mark
  2118. },{dnl ### Not ISOLATED_DOMAINS ###
  2119. R<@$*$~P>$+        $:<@$1$2>$3?$[ $1$2 $: $]    ask nameserver
  2120. R<@$+>$+?$+        {$#}TCPMAILER $@$3 $:<@$1>$2    found, return it
  2121. R<@$+>$+?$*        $:<@$1>$2            no match, remove mark
  2122. })dnl ### End Not ISOLATED_DOMAINS ###
  2123.  
  2124. ifdef({XNSDOMAIN},{dnl
  2125. ###
  2126. ###    Determine delivery over XNS
  2127. ###
  2128. R<@}XEROXNS{>$+        $#XNS $@xnsmail $:<@}XEROXNS{>$1
  2129. })dnl ### End XNSDOMAIN
  2130. ifdef({DECNETNAME},{dnl
  2131. # handle dnet stuff
  2132. ifdef({DECNETXTABLE},{dnl ### DECNETXTABLE is defined
  2133. R<@$+>$+        $:<@$1>$2?$(D $1 $: $)        check DECnet table
  2134. ifdef({DECNETNODES},{dnl ### DECNETNODES is defined
  2135. R<@$+>$+?$=D        $:<@$3.dnet>$2            found- format as decnet
  2136. },{dnl ### DECNETNODES not defined
  2137. R<@$+>$+?$+        $:<@$3.dnet>$2            found- format as decnet
  2138. })dnl ### End DECNETNODES
  2139. R<@$+>$+?$*        $:<@$1>$2            not found, remove mark
  2140. })dnl ### End DECNETXTABLE
  2141. ifdef({DECNETNODES},{dnl ### DECNETNODES is defined
  2142. R<@$=D.dnet>$+        $#Dmail $@$1 $:<@$1.dnet>$2    dnet user
  2143. },{dnl ### DECNETNODES not defined
  2144. R<@$+.dnet>$+        $#Dmail $@$1 $:<@$1.dnet>$2    dnet user
  2145. })dnl ### End DECNETNODES
  2146. ifdef({UIUC},{dnl
  2147. R<@$+.decnet>$+        $#Dmail $@$1 $:<@$1.dnet>$2    dnet user
  2148. R<@$+.hepnet>$+        $#Dmail $@$1 $:<@$1.dnet>$2    dnet user
  2149. R<@$+.span>$+        $#Dmail $@$1 $:<@$1.dnet>$2    dnet user
  2150. })dnl ### End UIUC ###
  2151.  
  2152. })dnl ### End DECNETNAME ###
  2153. ###
  2154. ###    Determine delivery over UUCP
  2155. ###    (Can't use ruleset 28 since we need to relativize immediate users)
  2156. ###
  2157. ifdef({UUCPXTABLE},{# First try to translate full domain to uucp connection.
  2158. R<@$+>$+        $:<@$1>$2?$(U $1 $: $)        check UUCP table
  2159. R<@$+>$+?$=U        $:<@$3.UUCP>$2            replace if found real
  2160. R<@$+>$+?$*        $:<@$1>$2            not found, remove mark
  2161. })dnl ### End UUCPXTABLE ###
  2162. R<@$=U.UUCP>$=Y$+    {$#}UUCPMAILER $@$1 $:$>7<$3>    relativize & send.
  2163.  
  2164. #########################################################################
  2165. #                                    #
  2166. #    Rule Set #28:    One-level route stripper            #
  2167. #                                    #
  2168. #    Remove immediate host for routed addresses.  Typically used    #
  2169. #    in ruleset 26 to produce a recipient relative to the immediate    #
  2170. #    host.  Only to be used for routed full domains.            #
  2171. #                                    #
  2172. #########################################################################
  2173. S28
  2174.  
  2175. R<$=X$+>$=Y@$+$=Y$+        $:<$1$4>$5$6        relativize & return
  2176.  
  2177. #########################################################################
  2178. #                                    #
  2179. #    Rule Set #29:    Multi-level self route stripper            #
  2180. #                                    #
  2181. #    Remove immediate host for routed addresses if it is self.    #
  2182. #    Typically used in ruleset 0 to remove superfluous routing    #
  2183. #    info and produce a path relative to this host.            #
  2184. #                                    #
  2185. #########################################################################
  2186. S29
  2187.  
  2188. #R$*/$*            $@$1/$2                Don't touch file name.
  2189. R<$=X$=w>$=Y@$+$=Y$+    $>8<$1$4>$5$6            Strip this host.
  2190. ifdef({ALTERNATENAMES},{# Remove superfluous routing through other of our names.
  2191. R<$=X$=M>$=Y@$+$=Y$+    $@$>29$>8 <$1$4>$5$6        Strip domain.
  2192. })dnl
  2193. # Might be us as numeric internet [...] address.  We only consider recipients.
  2194. R<@[$+.$+]>$+        $:<@[$1.$2]>$3?$[ [$1.$2] $]    Might be us numerically
  2195. R<@$+>$=Y@$+$=Y$+?$=w    $@$>29$>8 <@$3>$4$5        Remove routed [self]
  2196. R<@$+>$=Y$+?$=w        $:<>,@$1$2$3            move unrouted [self]
  2197. R<$+>$+?$*        <$1>$2                remove marker.
  2198.  
  2199.