home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / unix / volume16 / ida2 / part08 < prev    next >
Text File  |  1988-11-13  |  46KB  |  1,275 lines

  1. Subject:  v16i080:  IDA Sendmail kit, Part08/08
  2. Newsgroups: comp.sources.unix
  3. Sender: sources
  4. Approved: rsalz@uunet.UU.NET
  5.  
  6. Submitted-by: Lennart Lovstrand <lovstran@arisia.xerox.com>
  7. Posting-number: Volume 16, Issue 80
  8. Archive-name: ida2/part08
  9.  
  10. #! /bin/sh
  11. # This is a shell archive.  Remove anything before this line, then unpack
  12. # it by saving it into a file and typing "sh file".  To overwrite existing
  13. # files, type "sh file -c".  You can also feed this as standard input via
  14. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  15. # will see the following message at the end:
  16. #        "End of archive 8 (of 8)."
  17. # Contents:  ida/cf/Sendmail.mc
  18. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  19. if test -f ida/cf/Sendmail.mc -a "${1}" != "-c" ; then 
  20.   echo shar: Will not over-write existing file \"ida/cf/Sendmail.mc\"
  21. else
  22. echo shar: Extracting \"ida/cf/Sendmail.mc\" \(43347 characters\)
  23. sed "s/^X//" >ida/cf/Sendmail.mc <<'END_OF_ida/cf/Sendmail.mc'
  24. X##########################################################################
  25. X###    The IDA Sendmail Master Configuration File    ##################
  26. X##########################################################################
  27. X###    Lennart_Lovstrand.EuroPARC@Xerox.COM                   ###
  28. X###    Rank Xerox EuroPARC, 61 Regent St, Cambridge, England           ###
  29. X###    Copyright (c) 1984-88 -- Use it, abuse it, but don't sell it   ###
  30. X##########################################################################
  31. X# Current version
  32. XDVIDA-1.2.5
  33. Xchangequote({,})
  34. X
  35. X####### INTRODUCTION #####################################################
  36. X#
  37. X#    This is The IDA Sendmail Master Configuration File--a completely
  38. X#    independent development having nothing to do with the version
  39. X#    distributed by Berkeley.  In order to work properly, it requires
  40. X#    a set of new functions implemented by the IDA Sendmail Enhancement
  41. X#    Kit, available from your nearest comp.sources.unix archive.
  42. X#
  43. X#    Get it today, tomorrow they might have a disk crash!
  44. X
  45. X#    IDA is an abbreviation of "Institutionen for Datavetenskap",
  46. X#    which is Swedish for "The Department of Computer and Information
  47. X#    Science".  Under no circumstance should it be confused with the
  48. X#    IDA that stands for the Institute for Defense Analysis, with
  49. X#    which the author has no relationship to nor wish to become
  50. X#    associated with.
  51. X
  52. X
  53. X####### REWRITING STRATEGIES #############################################
  54. X#
  55. X#    Ruleset 3 completely canonicalizes addresses to an internal
  56. X#    format which looks like "user@.domain", including the dot
  57. X#    after the atsign.  The "user" part may end up containing a
  58. X#    route in either standard RFC822 format or using the %-kludge.
  59. X#    The "domain" will be mapped to its full, official domain name
  60. X#    using the TCP/IP name server and a dbm domaintable.  !- and
  61. X#    ::-style paths are rewritten into RFC822 routes internally.
  62. X#    Resonable mixtures of !-, %-, and RFC822 routes are resolved,
  63. X#    either using straight domain preference, or using heuristics.
  64. X#    Some effort is made to repair malformed addresses.
  65. X#
  66. X#    This format is used in all internal rulesets until finally
  67. X#    rewritten by the mailer dependant rules, where they are fully
  68. X#    transformed into the mailer's preferred address syntax.  Three
  69. X#    kinds of mailers currently exist:
  70. X#
  71. X#    [1]  Domain based mailers, for which the official domain names
  72. X#         are used and routes are given in the %-format for header
  73. X#         addresses and envelope recipient addresses, while
  74. X#         envelope return paths are kept in RFC822 route syntax.
  75. X#         Typical examples of this type are the TCP/IP and LOCAL
  76. X#         mailers.
  77. X#
  78. X#    [2]  Domain based mailers with flat node name mappings.  These
  79. X#         use full domain names in header addresses but translate
  80. X#         envelope domains to names relative the actual network's
  81. X#         name space.  Two mailers fit into this category: The DECnet
  82. X#         mailer, which map domain names to DECnet names, and the
  83. X#         UUCP-A/B mailers, which map domains to UUCP node names.
  84. X#         Both the DECnet and the UUCP worlds use flat namespaces.
  85. X#         The DECnet and the UUCP-B mailers essentially uses type I
  86. X#         routes while the UUCP-A mailer uses type III routes (ie,
  87. X#         !-paths).
  88. X#
  89. X#    [3]  UUCP !-path based mailers.  This mailer type rewrites all
  90. X#         addresses into !-paths, both header and envelope addresses.
  91. X#         Header addresses are made relative the remote node by
  92. X#         removing "remote!" from them or prefixing "localhost!" to
  93. X#         them. UUCP nodes with domain names are translated to their
  94. X#         UUCP equivlanents.
  95. X
  96. X
  97. X####### SENDMAIL CONFIGURATION EXTENSIONS ################################
  98. X#
  99. X#    This is a short table describing extensions to the configuration
  100. X#    language.  See the reference guide for a detailed definition.
  101. X#
  102. X#    Option "/" will turn on general envelope/header specific
  103. X#    rewriting.  Mailer specific e/h rulesets are given as in
  104. X#    "R=14/15", where ruleset 14 is used for envelope recipient
  105. X#    addresses and ruleset 15 for header recipients.
  106. X#
  107. X#    The M_FROMPATH (p) flag will work for mailers that use "From_"
  108. X#    line envelopes as well as SMTP mailers.
  109. X#
  110. X#    The M_RELATIVIZE (V) flag has been added, which make all header
  111. X#    lines relative the recipient host by removing "remote!" or
  112. X#    adding "localhost!".
  113. X#
  114. X#    TCP/IP nameserver lookups are extended with a default argument,
  115. X#    as in "$[ hostname $: default $]".  The "default" string will be
  116. X#    returned if the host isn't known to gethostname(3).
  117. X#
  118. X#    General dbm database functions have been added.  The option "K"
  119. X#    will declare a dbm database and associate it with a letter,
  120. X#    which later on is used in constructs like:
  121. X#        "$(x key $@ arg $: default $)"
  122. X#    The "x" is the one-letter name of the database, the "key" is the
  123. X#    lookup string; the optional "arg" is then sprintf(3)'ed through
  124. X#    the result, if found.  The whole expression evaluates to
  125. X#    "default", or "key" if "$: default" is not present, if the "key"
  126. X#    can't be found in the database.  The "@" database is
  127. X#    automatically connected to the aliases(5) file.
  128. X
  129. X
  130. X####### M4 IDENTIFIERS ###################################################
  131. X#
  132. X#    NOTE: Be aware that this is an m4 source where curly braces are
  133. X#    used as quote characters.  You will lose heavily if you care-
  134. X#    lessly mention reserved m4 words or use curly braces where you
  135. X#    shouldn't.
  136. X#
  137. X#    The following is a list of all m4 identifiers used in this file.
  138. X#    All of them are optional.
  139. X#
  140. X#    ALIASES
  141. X#        Name of the aliases file, defaults to sendmail's default.
  142. X#    BANGIMPLIESUUCP
  143. X#        If defined, will assume that all !-paths with leading,
  144. X#        unqualified nodes resides in the UUCP pseudo-domain.
  145. X#        Will otherwise try to qualify node using the name server
  146. X#        and domaintable, retreating to .UUCP if unknown by them.
  147. X#    DECNETNODES
  148. X#        A file containing DECnet host names.  Used in combination
  149. X#        with DECNETXTABLE to determine delivery through the DECnet
  150. X#        mailer and when to expand flatspaced DECnet host names into
  151. X#        domains.
  152. X#    DECNETXTABLE
  153. X#        The DECnet translation table.  Returns a node's DECnet
  154. X#        host name if given its domain name.  (Dbm file, see
  155. X#        ruleset 24 for more info).
  156. X#    DEFAULT_HOST
  157. X#        Explicit host name, replaces automatic definition of $w.
  158. X#    DEFAULT_DOMAIN
  159. X#        The string that (+ ".") will be attached to $w to
  160. X#        form $j, this node's official domain name.  Only define
  161. X#        this if $w doesn't already include your full domain
  162. X#        (ie, as returned by gethostbyname(<yourhost>)).
  163. X#    DOMAINTABLE
  164. X#        Dbm database used for hostname canonicalization, ie.
  165. X#        to find the official domain name for local or otherwise
  166. X#        unqualified hosts.
  167. X#    GENERICFROM
  168. X#        A database mapping actual user names to generic user
  169. X#        names.  Used instead of HIDDENNET in a heterogenous
  170. X#        environment.
  171. X#    HIDDENNET
  172. X#        Points to a file containing a list of host names, one
  173. X#        per line.  Mail from users on any of these hosts will
  174. X#        have the host name substituted for our host, $w.
  175. X#    LIBDIR    
  176. X#        The directory that will hold most data files, including
  177. X#        sendmail.{hf,st}; defaults to /usr/lib/mail.
  178. X#    LIUIDA
  179. X#        Site specific parts for the CIS Dept, U of Linkoping.
  180. X#    PATHTABLE
  181. X#        The heart & soul of this sendmail configuration--the
  182. X#        pathalias routing table in dbm format, as produced by
  183. X#        the pathalias program.  Either you define this or rel(a)y
  184. X#        on RELAY_HOST/RELAY_MAILER.
  185. X#    MAILERTABLE
  186. X#        A dbm table mapping node names to "mailer:host" pairs.
  187. X#        It is used for special cases when the resolving heuristics
  188. X#        of ruleset 26 aren't enough.
  189. X#    NEWALIASES
  190. X#        If defined, will make ruleset 26 return all addresses
  191. X#        as local.  This should be used by the newaliases program
  192. X#        only when parsing the aliases file if you want to be
  193. X#        able to handle non-local aliases (ie aliases of type
  194. X#        "user@host: whatever").  Note that you can't let
  195. X#        sendmail rebuild the database automatically if this is
  196. X#        the case or else those aliases will be thrown away.
  197. X#    PSEUDODOMAINS
  198. X#        A list of well-known top level pseudo domains such as
  199. X#        BITNET, CSNET, UUCP, etc.  Addresses ending with a top
  200. X#        level domain in this class won't be canonicalized using
  201. X#        the resolver to reduce load on the root name servers.
  202. X#        Note that this variable is independent of the T class
  203. X#        below.  Any "well-known" top level domain that is not
  204. X#        part of NIC's registered domains may be put here.
  205. X#    PSEUDONYMS
  206. X#        Additional names that we are known under (in addition
  207. X#        to those returned by gethostbyname()).
  208. X#    RELAY_HOST & RELAY_MAILER
  209. X#        Name of the host and mailer to ship unknown recipient
  210. X#        addresses to.
  211. X#    RSH_SERVER
  212. X#        If defined, do local deliveries by rsh'ing /bin/mail
  213. X#        on the RSH_SERVER host.  Make sure that root is allowed
  214. X#        to remotely login to the server.
  215. X#    SPOOLDIR
  216. X#        Directory for sendmail queue files; defaults to
  217. X#        /usr/spool/mqueue.
  218. X#    STRICTLY822
  219. X#        This flag will guide the interpretation of mixed (hybrid)
  220. X#        !/@ addresses.  If left undefined, we will look at the
  221. X#        protocol used to receive the message and interpret
  222. X#        accordingly (! takes precedence for UUCP; @ for others).
  223. X#        If you define STRICTLY822, all mixed addresses will be
  224. X#        interpreted as path@host.
  225. X#    TCPMAILER
  226. X#        The default TCP mailer to use for SMTP/TCP deliveries.
  227. X#        Defaults to TCP (as opposed to TCP-D or TCP-U, qv).
  228. X#    UUCPMAILER
  229. X#        The default UUCP mailer to use for UUCP deliveries.
  230. X#        Defaults to UUCP (as opposed to UUCP-A or UUCP-B, qv).
  231. X#    UUCPNAME
  232. X#        This node's UUCP host name, if different from $k.
  233. X#    UUCPNODES
  234. X#        A file containing names of directly connectable UUCP nodes.
  235. X#    UUCPPRECEDENCE
  236. X#        This option has been obsoleted by checking the receiving
  237. X#        protocol when resolving mixed !/@ addresses.  Define
  238. X#        STRICTLY822 to disable this.
  239. X#    UUCPRELAYS
  240. X#        Name of file containing names of known (UUCP) relays.
  241. X#        Header addresses containing paths through any of these
  242. X#        will be shortened by having the path to the relay removed.
  243. X#        (It is assumed that paths to each of these are known to
  244. X#        everybody)
  245. X#    UUCPXTABLE
  246. X#        A table mapping domain node names to UUCP node names.
  247. X#        Used in envelope addresses sent using UUCP/rmail.
  248. X#
  249. X#  The following are still experimental:
  250. X#    XEROXGV & XEROXNS
  251. X#        Default gateways for unspecified Xerox Grapevine and XNS
  252. X#        addresses.
  253. X#    XNSDOMAIN
  254. X#        The name of the XNS Gateway domain {from the XNS side}.
  255. X#    XNSMAIL
  256. X#        The name of your XNS Mail Gateway program.
  257. X
  258. X
  259. X####### CLASSES, DEFINITIONS, and DATABASES ##############################
  260. X#
  261. X#    The following classes, macro definitions and keyed databases are
  262. X#    being used:
  263. X#
  264. X#    CA    An atsign (@), used in class membership negations
  265. X#    CD    Known DECnet host names (see DECNETNODES above)
  266. X#    CH    Node names that should be hidden by $w (see HIDDENNET above)
  267. X#    CP    Known top level pseudo domains (see PSEUDODOMAINS above)
  268. X#    CR    Removeable relays from header addresses (see UUCPRELAYS above)
  269. X#    CT    Known top level domains (global + local)
  270. X#    CU    Directly connectable UUCP nodes
  271. X#    CX    A set of chars that delimit the LHS of a domain (@ %)
  272. X#    CY    A set of chars that delimit the RHS of a domain (, : % @)
  273. X#    CZ    RFC822 Source Route punctuation chars (, :)
  274. X#
  275. X#    DV    Configuration version number
  276. X#
  277. X#    OK@    The aliases database (automatically defined; see ALIASES above)
  278. X#    OKD    DECnet domain translation table (see DECNETXTABLE above)
  279. X#    OKG    Generic usernames (see GENERICFROM above)
  280. X#    OKM    Special domain => mailer:host table (see MAILERTABLE above)
  281. X#    OKN    Official name lookup table (see DOMAINTABLE above)
  282. X#    OKP    Pathalias routing database (see PATHTABLE above)
  283. X#    OKU    UUCP domain translation table (see UUCPXTABLE above)
  284. X
  285. X
  286. X##########################################################################
  287. X## Default Definitions ###################################################
  288. X##########################################################################
  289. Xifdef({LIBDIR},,{define(LIBDIR, /usr/lib/mail)})
  290. Xifdef({SPOOLDIR},,{define(SPOOLDIR, /usr/spool/mqueue)})
  291. Xifdef({TCPMAILER},,{define(TCPMAILER, TCP)})
  292. Xifdef({UUCPMAILER},,{define(UUCPMAILER, UUCP)})
  293. Xifdef({UUCPPRECEDENCE},
  294. X    {errprint({Note: UUCPPRECEDENCE is obsolete, please see Sendmail.mc})})
  295. X
  296. X#
  297. X##########################################################################
  298. X## Domain Definitions ####################################################
  299. X##########################################################################
  300. X
  301. X##########################################################################
  302. X#    Universally known top-level domains
  303. X
  304. X#                    Organizational domains
  305. XCTcom edu gov org mil net
  306. X#                    National domains
  307. XCTau ar at be ca cdn ch cl de dk es fi fr ie il irl is it jp kr
  308. XCTmy nl no nz pg se uk us
  309. X#                    Network based domains
  310. XCTarpa bitnet csnet junet mailnet uucp
  311. X
  312. X##########################################################################
  313. X#    Well-known pseudo domains
  314. X#    (that the resolver shouldn't be bothered with)
  315. X
  316. Xifdef({PSEUDODOMAINS},{
  317. X{CP}PSEUDODOMAINS
  318. X})
  319. X
  320. X##########################################################################
  321. X## Misc Definitions ######################################################
  322. X##########################################################################
  323. X
  324. Xifdef({DEFAULT_HOST},
  325. X# This node's local host name
  326. X{Dw}DEFAULT_HOST)
  327. X
  328. X# This node's official domain name
  329. Xifdef({DEFAULT_DOMAIN},
  330. X{Dj$w.}DEFAULT_DOMAIN,
  331. XDj$w)
  332. X
  333. Xifdef({PSEUDONYMS},
  334. X# Other names for this node
  335. X{Cw}PSEUDONYMS)
  336. XCw$k
  337. X
  338. X# my name
  339. XDnMAILER-DAEMON
  340. X
  341. X# UNIX header format
  342. XDlFrom $g $d
  343. X
  344. X# delimiter (operator) characters
  345. XDo".:;%@!=/[]?#^,<>"
  346. X
  347. X# Characters that mark the left (X) & right (Y) hand side of a domain
  348. XCX@ %
  349. XCY, : % @
  350. X
  351. X# Pure RFC822 route punctuation characters
  352. XCZ, :
  353. X
  354. X# The atsign-in-a-class
  355. XCA@
  356. X
  357. X# Format of a total name: Personal Name <user@domain>
  358. XDq$?x$!x <$g>$|$g$.
  359. X
  360. X# SMTP login message
  361. XDeWelcome to IDA Sendmail $v/$V running on $j
  362. X
  363. X
  364. X##########################################################################
  365. X#    Options
  366. X
  367. X#                set default alias file
  368. Xifdef({ALIASES},{OA}ALIASES)
  369. X#                time to look for "@:@" in alias file
  370. XOa15
  371. X#                substitution for blank character
  372. XOB.
  373. X#                don't connect to "expensive" mailers
  374. XOc
  375. X#                delivery mode
  376. XOdb
  377. X#                rebuild alias database as needed
  378. X# OD
  379. X#                set error processing mode
  380. X# Oe
  381. X#                temporary file mode
  382. XOF0600
  383. X#                save Unix-style From lines on front
  384. X# Of
  385. X#                default gid
  386. XOg1
  387. X#                help file
  388. X{OH}LIBDIR/sendmail.hf
  389. X#                ignore dot lines in message
  390. X# Oi
  391. X#                database files
  392. Xifdef({DECNETXTABLE},{OKD}DECNETXTABLE)
  393. Xifdef({GENERICFROM},{OKG}GENERICFROM)
  394. Xifdef({MAILERTABLE},{OKM}MAILERTABLE)
  395. Xifdef({DOMAINTABLE},{OKN}DOMAINTABLE)
  396. Xifdef({PATHTABLE},{OKP}PATHTABLE)
  397. Xifdef({UUCPXTABLE},{OKU}UUCPXTABLE)
  398. X#                log level
  399. XOL9
  400. X#                define macro
  401. X# OM
  402. X#                send to me too
  403. XOm
  404. X#                local network name
  405. Xifdef({DEFAULT_DOMAIN},{ON}DEFAULT_DOMAIN)
  406. X#                assume old style headers
  407. XOo
  408. X#                postmaster copy of returned messages
  409. XOPPostmaster
  410. X#                queue directory
  411. X{OQ}SPOOLDIR
  412. X#                read timeout -- violates protocols
  413. XOr30m
  414. X#                status file
  415. X{OS}LIBDIR/sendmail.st
  416. X#                be super safe, even if expensive
  417. XOs
  418. X#                queue timeout
  419. XOT4d
  420. X#                time zone name
  421. X# OtMET,MET DST
  422. X#                set default uid
  423. XOu1
  424. X#                run in verbose mode
  425. X# Ov
  426. X#                wizard's password
  427. XOW*
  428. X#                load avg at which to auto-queue msgs
  429. XOx3
  430. X#                load avg to auto-reject connections
  431. XOX8
  432. X#                fork when running the queue
  433. X# OY
  434. X#                use separate envelope/header rewriting rulesets
  435. XO/
  436. X
  437. X##########################################################################
  438. X#    Message precedences
  439. X
  440. XPfirst-class=0
  441. XPspecial-delivery=100
  442. XPjunk=-100
  443. X
  444. X##########################################################################
  445. X#    Trusted users
  446. X
  447. XTroot
  448. XTdaemon
  449. XTuucp
  450. X
  451. X##########################################################################
  452. X#    Header Formats
  453. X
  454. X#HReceived: $?sfrom $s $.by $j; $b
  455. XHReceived: $?sfrom $s $.by $j$?r with $r$.
  456. X    ($v/$V) id $i; $b
  457. XH?P?Return-Path: <$g>
  458. XH?D?Date: $a
  459. XH?F?From: $q
  460. XH?x?Full-Name: $x
  461. XH?M?Message-ID: <$t.$i@$j>
  462. X
  463. X
  464. X#
  465. X##########################################################################
  466. X## Mailer Specifications #################################################
  467. X##########################################################################
  468. X
  469. X##########################################################################
  470. X#
  471. X#    Local & Prog mailer definitions
  472. X
  473. X# List of nodes that should be hidden by our name (header senders)
  474. Xifdef({HIDDENNET},{FH}HIDDENNET)
  475. X
  476. Xifdef({RSH_SERVER}, {
  477. XMlocal,    P=/usr/ucb/rsh, F=DFMlmns,    A=RSH_SERVER /bin/mail -d $u
  478. X}, {
  479. XMlocal,    P=/bin/mail, F=DFMSlmnrs,    A=mail -d $u
  480. X})
  481. XMprog,    P=/bin/csh,  F=DFMhlsu,        A=csh -fc $u
  482. X
  483. X
  484. X##########################################################################
  485. X#
  486. X#    TCP/IP mailer specification
  487. X#
  488. X#    The TCP mailer is the normal choice for SMTP/TCP delivery, but a
  489. X#    couple of variations exist for compatibility with mailers that
  490. X#    need special address formatting for indirect UUCP and DECnet
  491. X#    addresses.  Both has to be explicitly mentioned in the mailertable
  492. X#    to be chosen as all normal mail will use the standard TCP mailer.
  493. X#
  494. X#    TCP-D -- will flatten envelope recipient DECnet domains for
  495. X#    messages destinated to our DECnet gateway.   Unfortunately, our
  496. X#    (Linkoping) DECnet gateway is too dumb to do this itself.
  497. X#
  498. X#    TCP-U -- is available for hosts which require hybrid addresses
  499. X#    for deliveries to UUCP destinations.  Eg. "bar!foo@desthost" will
  500. X#    be translated to "foo%bar@desthost", then to "bar!foo@desthost"
  501. X#    [as opposed to just "foo@bar" which is what the standard TCP
  502. X#    mailer would have produced].
  503. X#
  504. X#    Both of the above only touch envelope addresses; header
  505. X#    addresses are still kept in our preferred format.  Change the
  506. X#    R/S settings below if you don't like that.
  507. X
  508. XMTCP,   P=[IPC], F=CDFMXhnmpu, E=\r\n, A=IPC $h
  509. XMTCP-D, P=[IPC], F=CDFMXhnmpu, E=\r\n, R=24/0, A=IPC $h
  510. XMTCP-U, P=[IPC], F=CDFMXhnmpu, E=\r\n, R=13/0, S=13/0, A=IPC $h
  511. X
  512. X# Produce hybrid (brr) addresses for unqualified or .UUCP hosts
  513. XS13
  514. XR$+@.$-            $:$>19 $1@.$2            bangify unqualified
  515. XR$+@.$-.UUCP        $:$>19 $1@.$2.UUCP        bangify .UUCP
  516. XR$+@.$+            $@ $1@.$2            let normal domains pass
  517. XR$+            $@ $1@.$[$&h$]            add rcpt host for paths
  518. X
  519. X
  520. X##########################################################################
  521. X#
  522. X#    (Pseudo)DECnet mailer specification
  523. X#
  524. X#    Send all envelope recipients thru DECnet domain name flattener.
  525. X
  526. X# List of DECnet nodes
  527. Xifdef({DECNETNODES},{FD}DECNETNODES)
  528. X
  529. Xifdef({LIUIDA},{
  530. X# Since we don't have any Unix boxes with DECnet yet, we cheat...
  531. XMDECnet,  P=[IPC], F=CDFMXhnmpu, R=24/0, E=\r\n, A=IPC lisbet.liu.se
  532. X})
  533. X
  534. X
  535. X##########################################################################
  536. X#
  537. X#    UUCP mailer definitions
  538. X
  539. X# Our UUCP name, if other than $w
  540. Xifdef({UUCPNAME},{Dk}UUCPNAME)
  541. X
  542. X# List of known UUCP nodes
  543. Xifdef({UUCPNODES},{FU}UUCPNODES)
  544. XCU$k
  545. X
  546. X# List of UUCP relays that are to be removed from sender paths
  547. Xifdef({UUCPRELAYS},{FR}UUCPRELAYS)
  548. X
  549. XMUUCP,   P=/usr/bin/uux, F=DFMUVShpu, S=19, R=19,    A=uux - -z -r $h!rmail ($u)
  550. XMUUCP-A, P=/usr/bin/uux, F=DFMShmpu, S=19/0, R=15/0, A=uux - -z -r $h!rmail ($u)
  551. XMUUCP-B, P=/usr/bin/uux, F=BDFMSXhmpu, S=0,  R=15/0, A=uux - -z -r $h!bsmtp
  552. X
  553. X# Canonicalize envelope recipient addresses before UUCP-ifying them.
  554. XS14
  555. XR$+            $@ $>19$>3 $1
  556. X
  557. X# UUCP-ify address, then move domain back if not UUCP destination
  558. XS15
  559. XR$+            $: $>19 $1        UUCP-ify
  560. XR$+!$+            $: $1?$2        mark first bang
  561. XR$+.$=T?$+        $@ $3@.$1.$2        restore if real domain
  562. XR$+?$+            $@ $1!$2        just put bang back otherwise
  563. X
  564. X##########################################################################
  565. X#
  566. X#    XNS Mailer -- this is still experimental.
  567. X#
  568. X
  569. XMXNS,  {P=}XNSMAIL, F=CDFMXhnmprsu, R=16/0, S=16/0, A=xnsmail -q -O $u
  570. X
  571. X# Convert address to XNS Object Name.
  572. XS16
  573. XR$+            $: $>4 $1        first externalize
  574. XR{$+@}XEROXNS        $@ $1            this is already an XNS addrs
  575. XR$+            $@ {$1:}XNSDOMAIN    add XNS domain for others
  576. X
  577. X
  578. X#
  579. X##########################################################################
  580. X## Standard Rewriting Rules ##############################################
  581. X##########################################################################
  582. X
  583. X#########################################################################
  584. X#                                    #
  585. X#    Rule Set #0:    Mailer Resolving Ruleset            #
  586. X#                                    #
  587. X#    This is rather straightforward.  The code should say it all.    #
  588. X#                                    #
  589. X#########################################################################
  590. XS0
  591. X
  592. X# Digest routes through ourselves
  593. XR$+@.$+            $:$>29 $1@.$2            remove routed self
  594. X
  595. X# Try immediate delivery
  596. XR$+@.$+            $:$>26 $1@.$2            try to find mailer
  597. XR$#$+            $# $1                found one, return it
  598. X
  599. X# Unknown domain, try to find a pathalias route
  600. XR$+@.$+            $:$>22 $1@.$2            go get route
  601. XR$+@.$+            $:$>29 $1@.$2            remove routed self
  602. XR$+@.$+            $:$>26 $1@.$2            now look for mailer
  603. XR$#$+            $# $1                success, return it
  604. X
  605. Xifdef({RELAY_HOST}, {
  606. X# If we have a RELAY_HOST/RELAY_MAILER, use it
  607. XR$+@.$+            ${#}RELAY_MAILER $@RELAY_HOST $:$1@.$2
  608. X})
  609. X
  610. X# Try TCP/IP otherwise, there might be an MX record for it
  611. X# (there should be a way of checking for this)
  612. XR$+@.$+        {$#}TCPMAILER $@$2 $:$1@.$2
  613. X
  614. X# Undeliverable recipients--complain loudly & return to sender
  615. XR$+@.$-        $#ERROR $:Host $2 not known--please specify domain
  616. XR$+@.$-.$*$=T    $#ERROR $:Host $2 not known within the $3$4 domain
  617. XR$+@.$+.$-    $#ERROR $:Domain $3 not known--please try to route manually
  618. XR@$+        $#ERROR $:"Incomplete Source Route--use <...> format"
  619. XR$*        $#ERROR $:Could not parse $1
  620. X
  621. X
  622. X#########################################################################
  623. X#                                    #
  624. X#    Rule Set #1:    [Envelope] Sender Specific Rewriting        #
  625. X#                                    #
  626. X#    [Currently nothing.]                        #
  627. X#                                    #
  628. X#########################################################################
  629. XS1
  630. X
  631. X
  632. X#########################################################################
  633. X#                                    #
  634. X#    Rule Set #2:    [Envelope] Receiver Specific Rewriting        #
  635. X#                                    #
  636. X#    Turn RFC822 Source Routes into a %-paths since most MTAs    #
  637. X#    don't know about how to handle the former format.        #
  638. X#                                    #
  639. X#########################################################################
  640. XS2
  641. X
  642. XR$+@.$+            $:$>25 $1@.$2        Src Routes => %-routes
  643. X
  644. X
  645. X#########################################################################
  646. X#                                    #
  647. X#    Rule Set #3:    Address Canonicalization            #
  648. X#                                    #
  649. X#    Turns the address into the (internally) canonical format    #
  650. X#    mailbox@.domain.  The `domain' is what you think it is, but    #
  651. X#    the `mailbox' may be either a "real" mailbox in which case    #
  652. X#    no further meaning is associated to it, or a route in either    #
  653. X#    the Source Route format as specified by RFC822 or the (un-    #
  654. X#    documented) Good Ole ARPAnet %-Kludge Format.            #
  655. X#                                    #
  656. X#    Input formats include the standard "mailbox@domain" format,    #
  657. X#    RFC822 Source Routes, RFC822 Group Names, ARPAnet %-Kludges,    #
  658. X#    UUCP !-Paths, the Berknet "host:user" format, the VAX/VMS    #
  659. X#    "host::user" format and resonable mixtures of the above.    #
  660. X#                                    #
  661. X#    The code even tries to clean up after various mistakes that    #
  662. X#    other nodes has done when reformatting the addresses, such    #
  663. X#    as mangled Xerox distribution lists or malformatted RFC822    #
  664. X#    Group Specifications.                        #
  665. X#                                    #
  666. X#########################################################################
  667. XS3
  668. X
  669. X###
  670. X###    First attempt to repair malformed addresses
  671. X###
  672. X
  673. XR$*<$+>$*        $2            turn to essentials
  674. XR$*<>$*            Postmaster        default user
  675. X
  676. X# These are not for us
  677. XR:{include}:$*@$*    $@:{include}:$1@.$2    indirect address
  678. XR:{include}:$*        $@:{include}:$1@.$w    indirect address
  679. XR$*/$*@$*        $@$1/$2@.$3        file name
  680. XR$*/$*            $@$1/$2@.$w        file name
  681. X
  682. X# Fix group names and return them
  683. XR$+:;@$+        $:$1:;            remove host info
  684. XR$+:            $:$1:;            missing semicolon
  685. XR$+!;            $:$1:;            UUCP-style mangled group
  686. XR$+!$+:;        $2:;            remove UUCP host info
  687. XR$+:;            $@$1:;            Finally return group
  688. X
  689. X# Miscellaneous cleanup (sigh)
  690. XR$+!.$+            $1^.$2            fix mangled Xerox dList
  691. XR$+::$+            $1!$2            VAX/VMS relative address
  692. XR$+!:$+@$+        $1!$3!$2        scrambled source route
  693. XR$+!:$+            $1!$2            mangled VAX/VMS address
  694. Xifdef({XEROXNS},,{
  695. XR$-:$-            $1!$2            Berknet style address
  696. X})
  697. XR$+:@$+            $1,@$2            slightly malformed src route
  698. XR$*$~Z@$+@$+        $1$2%$3@$4        fix user@host@relay
  699. Xifdef({LIUIDA},{
  700. XRenea!$+!!$+,!$+    enea!$1!!$2,@$3        brutally beaten src route
  701. XRenea!$+!!$+:$+!$+    $: enea!$1!$2!$4!$3    seriously smashed src route
  702. XRenea!$+!!$+        $: enea!@$2@$1        maddenly messy src route
  703. X})
  704. XR$+@$+.$=T.UUCP        $1@$2.$3        strip UUCP off foo@bar.EDU.UUCP
  705. X
  706. X# Fix %-kludgified RFC822 source routes (double sigh)
  707. XR$+!%$+:$+%$+        $1!%$2:$3@$4        change all %'s into @'s
  708. XR$+!%$+,%$+        $1!%$2,@$3
  709. XR$+!%$+            $1!@$2
  710. X
  711. X###
  712. X###    The address should be in a reasonable format now.
  713. X###    Time to resolve mixed !/@ hybrid addresses and !-paths.
  714. X###
  715. X
  716. XR$+!$+            $:$>18 $1!$2        resolve UUCP address
  717. X
  718. X###
  719. X###    Address should be close to canonical now, give or take
  720. X###    the @domain part.  Make it really internal by adding a
  721. X###    dot before the [direct] domain (if any).  Also qualify
  722. X###    known domain names.
  723. X###
  724. X
  725. X# Add dot and put direct host on back for RFC822 Source Routes
  726. XR$+            $: $1@            make sure address has atsign
  727. XR$+@$+@            $: $1@$2        remove again if already there
  728. XR$*@$+            $: $1@.$2        add dot after [direct] domain
  729. XR@.$+$=Z$+        $: $3@.$1        tack direct domain on end
  730. XR$+@..$+        $: $1@.$2        one dot is enough! (intern fix)
  731. X
  732. X# Routed address (good ol' ARPA version)
  733. XR$+%$+@            $:$1@.$2        replace '%' with '@.'
  734. XR$+@.$+%$+        $1%$2@.$3        move gaze right
  735. X
  736. X# Sometimes users try to send to RFC822 Source Routes without angle
  737. X# brackets.  This will cause the mailer to split the comma-separated
  738. X# domain path into separate phony addresses, which all look like
  739. X# "@domain".  There's not much to do about it here though.
  740. XR@.$+@            $@ @$1            incomplete Source Route
  741. X
  742. X# Automatically route Grapevine and XNS addresses via resp gateways.
  743. X# Note that this assumes that there won't be any local users with dots
  744. X# or colons in their names; nor any such names in aliases.
  745. Xifdef({XEROXGV},{
  746. XR$-.$*@            $: {$1.$2@.}XEROXGV    GW for Grapvine User.registry
  747. X})
  748. Xifdef({XEROXNS},{
  749. XR$+:$*@            $: {$1:$2@.}XEROXNS    XNS User:Domain:Organization
  750. X})
  751. X
  752. X# No domain, attach default
  753. X# (tip: passing it through the domaintable allows us to hide local hosts)
  754. Xifdef({DOMAINTABLE},{
  755. XR$+@            $: $1@.$(N $w $)    no host/domain, attach default
  756. X},{
  757. XR$+@            $: $1@.$w        no host/domain, attach default
  758. X})
  759. X
  760. X# Try to find official name for domain
  761. XR$+@.$*$~P        $: $1@.$[ $2$3 $]    officialize using resolver
  762. Xifdef({DOMAINTABLE},{
  763. XR$+@.$+            $: $1@.$(N $2 $)    officialize using domaintable
  764. X})
  765. X
  766. X
  767. X#########################################################################
  768. X#                                    #
  769. X#    Rule Set #4:    Address PrettyPrinter                #
  770. X#                                    #
  771. X#    Does the final prettyprinting before the address is included    #
  772. X#    in the message.  (This is essentially a trivial reformatting    #
  773. X#    from internal to external format)                #
  774. X#                                    #
  775. X#########################################################################
  776. XS4
  777. X
  778. X# Remove dot and return RFC822 Source Routes
  779. XR@$+@.$+        $@ @$2,@$1
  780. XR$+@$+@.$+        $@ @$3:$1@$2
  781. X
  782. X# Remove dot for normal domain addresses
  783. XR$+@.$+            $@ $1@$2
  784. X
  785. X
  786. X#########################################################################
  787. X#                                    #
  788. X#    Rule Set #5:    [Header] Sender Specific Rewriting        #
  789. X#                                    #
  790. X#    Rewrite RFC822 source routes into %-routes, since most mailer    #
  791. X#    UAs can't handle them.  Compact obvious routes, mostly for    #
  792. X#    aesthetical reasons.  Possibly hide local nodes behind ourself.    #
  793. X#    Substitute generic names for physical senders.            #
  794. X#                                    #
  795. X#########################################################################
  796. XS5
  797. X
  798. XR$+@.$+            $:$>23 $1@.$2            unsourcify & prettify
  799. X
  800. X# Hide these nodes using our own name
  801. XR$+@.$=H        $: $1@.$j
  802. X
  803. Xifdef({GENERICFROM}, {
  804. X# Use (canonicalized) generic names for local users
  805. X# (Assumes that it never will find a $+@.$+ address in the db, ie. with dot)
  806. XR$+@.$+            $: $1@.$2 ? $1@.$2        duplicate
  807. XR$+?$+@.$+.$-        $1 ? $(G $2@$3.$4 $: $2@.$3 $)    search db foreach dom
  808. XR$+?$+@.$-        $: $1 ? $(G $2@$3 $: $2@.   $)    search for last dom
  809. XR$+@.$=w?$+@.        $: $1@.$2 ? $(G $3 $: $3@.  $)    search for locals
  810. XR$+@.$+?$+@.$*        $@ $1@.$2            not found
  811. XR$+?$+            $@ $>3 $2            found, canonicalize
  812. X})
  813. X
  814. X
  815. X#########################################################################
  816. X#                                    #
  817. X#    Rule Set #6:    [Header] Receiver Specific Rewriting        #
  818. X#                                    #
  819. X#    Rewrite RFC822 source routes into %-routes, since most mailer    #
  820. X#    UAs can't handle them.  Compact obvious routes, mostly for    #
  821. X#    aesthetical reasons.                        #
  822. X#                                    #
  823. X#########################################################################
  824. XS6
  825. X
  826. XR$+@.$+            $:$>23 $1@.$2            unsourcify & prettify
  827. X
  828. X
  829. X#
  830. X##########################################################################
  831. X## General Rewriting Rule Subroutines ####################################
  832. X##########################################################################
  833. X
  834. X#########################################################################
  835. X#                                    #
  836. X#    Rule Set #18:    Resolve mixed (hybrid) !/@ addresses        #
  837. X#                                    #
  838. X#    Given an address like a!b@c, resolve it into either a->c->b    #
  839. X#    (UUCP style !-precedence) or c->a->b (others, @-precedence).    #
  840. X#    Pure UUCP !-paths (ie without domain part) are also handled.    #
  841. X#    Used by ruleset 3 *before* the address has been put into    #
  842. X#    into internal canonical format (ie. no dot after atsign).    #
  843. X#                                    #
  844. X#########################################################################
  845. XS18
  846. X
  847. X# Case 0: !-prefixed RFC822 source route--extend to complete source route
  848. XR$+!$+!@$+        $1,@$2!@$3        !-path to ,@-route
  849. XR$+!@$+            $: @$1,@$2        including first & last !-host
  850. X
  851. Xifdef({STRICTLY822},,{
  852. X# Case 1: Let ! take precedence if protocol is UUCP
  853. XR$~A$*!$+@$+        $: $1$2!$3@$4?$&r    attach protocol
  854. XR$~A$*!$+@$+?UUCP    $@$>21 $1$2!$3%$4@    UUCP: ! takes precedence
  855. XR$~A$*!$+@$+?$*        $: $1$2!$3@$4        remove protocol
  856. X})
  857. X
  858. X# Case 2: Let @ take precedence for others
  859. X#     (2a -- !-path on top of %-route on top of @-domain (ugh!))
  860. XR$~A$*!$+%$+@$+        $: $1$2?$3%$4@$5    mark first bang
  861. XR$+?$+!$+%$+        $1!$2?$3%$4        find rightmost
  862. XR$+?$+%$+%$+@$+        $3!$1?$2%$4@$5        move %hosts around
  863. XR$+?$+%$+@$+        $@$>21 $4!$3!$1!$2@    now send it thru unbanger
  864. X#     (2b -- Domain address without %-route)
  865. XR$~A$*!$+@$+        $@$>21 $4!$1$2!$3@    @ takes precedence
  866. X
  867. X# Case 3: Pure UUCP-path
  868. XR$~A$*!$+        $@$>21 $1$2!$3@        pure UUCP style
  869. X
  870. X
  871. X#########################################################################
  872. X#                                    #
  873. X#    Rule Set #19:    Translate domain addresses to UUCP !-paths    #
  874. X#                                    #
  875. X#    Takes an domain style address as input and transforms this    #
  876. X#    into a !-path.  There will be no atsign left in the address    #
  877. X#    after this, but there may(?) still be a percent sign.        #
  878. X#    Routes are specially processed, trying to qualify all non-    #
  879. X#    qualified nodes in the path.  This is to make sure local nodes    #
  880. X#    will have their proper domains properly attached before the    #
  881. X#    messages leavs us.  I'm not sure if this is a good thing or    #
  882. X#    not, since they may not be local at all.  UUCP nodes with    #
  883. X#    domain style names are qualified, anyway.            #
  884. X#                                    #
  885. X#########################################################################
  886. XS19
  887. X
  888. X# Don't touch groups!
  889. XR$+:;            $@ $1:;            return groups
  890. X
  891. X# Translate RFC822 Source Routes FULLY into !-path format
  892. XR$+@$+@.$+        $:$>4 $1@$2@.$3        first externalize
  893. XR@$+            $: ?@$1            mark first node
  894. XR$*?@$+$=Z$+        $1$2!?$4        change prefix path to !
  895. XR$+?$~A$*@$+        $: $1$4!$2$3        turn last pair into ! format 2
  896. XR$*?$*            $: $1$2            remove possible trailing mark
  897. X
  898. X# Translate normal domain addresses
  899. Xifdef({UUCPXTABLE},{
  900. XR$+%$-@.$+        $: $1%$2@.$3 ? $(U $3 $: $)    UUCP node as domain?
  901. XR$+%$-@.$+?$+        $:$>20 $1%$2@.$3    yes, !-ify
  902. XR$+%$-@.$+?        $: $1%$2@.$3        no, remove mark
  903. X})
  904. XR$+%$-@.$+.UUCP        $:$>20 $1%$2@.$3.UUCP    !-ify "obvious" UUCP routes
  905. XR$+%$-@.$+.$-        $: $3.$4!$1%$2        don't know about other domains
  906. XR$+@.$+            $:$>20 $1@.$2        all the rest to the !-ifyer
  907. X
  908. X###
  909. X### Address should be in !-path format now.
  910. X###
  911. X
  912. Xifdef({DOMAINTABLE},{
  913. X# Qualify all nodes that we know of
  914. X# THIS IS DANGEROUS AND WRONG!  But still needed since some nodes out there
  915. X# do heavy path optimizations and our DECnet nodes may lose due to that.
  916. XR$*            $: ?$1            mark start
  917. XR$*?$+!$+        $1$(N $2 $)!?$3        qualify node
  918. XR$*?$*            $: $1$2            remove mark
  919. X})
  920. X
  921. X# Unqualify all UUCP nodes
  922. Xifdef({UUCPXTABLE},{
  923. XR$*            $: ?$1            mark start
  924. XR$*?$+!$+        $1$(U $2 $)!?$3        unqualify node
  925. XR$*?$*            $: $1$2            remove mark
  926. X})
  927. XR$-.UUCP!$+        $: $1!$2        remove first .UUCP
  928. XR$+!$-.UUCP!$+        $1!$2!$3        remove other .UUCP's
  929. X
  930. X
  931. X#########################################################################
  932. X#                                    #
  933. X#    Rule Set #20:    %-Route to !-Path Translator            #
  934. X#                                    #
  935. X#    Translates Good Ol' ARPA %-Routes to UUCP style !-paths.    #
  936. X#    This is done up to, but not beyond, the first non-UUCP        #
  937. X#    domain found in the path.                    #
  938. X#       This ruleset is used strictly for heuristical reasons.    #
  939. X#    Nodes with Real Domain Names are assumed in general not to    #
  940. X#    understand !-paths, but rather prefer %-routes.  This wouldn't    #
  941. X#    have been necessary to do here if all gateways had fully    #
  942. X#    converted all addresses.                    #
  943. X#    Eg.    mbox%a%b%c@.domain    => domain!c!b!a!mbox        #
  944. X#        mbox%a.b%c%d@.domain    => domain!d!c!mbox%a.b        #
  945. X#                                    #
  946. X#########################################################################
  947. XS20
  948. X
  949. Xifdef({UUCPXTABLE},{
  950. XR$+@.$+            $: $(U $2 $)?$1        move translated domain to front
  951. X},{
  952. XR$+@.$+            $: $2?$1        move domain to front
  953. X})
  954. XR$+?$+%$-        $1!$3?$2        prefix host route
  955. Xifdef({UUCPXTABLE},{
  956. XR$+?$+%$+        $: $1?$2%$(U $3 $)    translate UUCP domains to hosts
  957. XR$+?$+%$-        $@$>20 $1?$2%$3        recurse if host found
  958. X})
  959. XR$+?$+%$-.UUCP        $@$>20 $1?$2%$3        recurse if ending in host.UUCP
  960. XR$+?$+            $: $1!$2        get rid of temp !-subst
  961. X
  962. X
  963. X#########################################################################
  964. X#                                    #
  965. X#    Rule Set #21:    Prehost to Posthost Converter            #
  966. X#                                    #
  967. X#    Changes !-paths into RFC822 Source Routes.            #
  968. X#    Eg. a!b!c!d    => a,@b,@c,@d    => @a,@b:d@c            #
  969. X#        a!b!c%d    => a,@b,@c%d    => @a:c%d@b            #
  970. X#        a!b!c@d    => a,@b,@c@d    => @a,@b:c@d)            #
  971. X#                                    #
  972. X#########################################################################
  973. XS21
  974. X
  975. X# Initial canonicalization (get rid of possible '@' as in path!u@h)
  976. XR$+@            $: $1            remove optional trailing '@'
  977. XR$+!$+            $: $1?$2        find the rightmost '!'
  978. XR$+?$+!$+        $1!$2?$3        ..and change it into a '?'
  979. XR$+?$+@$+        $: $1!$3!$2        change last u@h to h!u if any
  980. XR$+?$+            $: $1!$2        just remove '?' otherwise
  981. X
  982. X# The address is now formatted as a!b!..!h!u -- transform it into a,@b,@..?h?u
  983. XR$+!$+            $: ?$1?$2        find last h!u-pair
  984. XR$*?$+?$+!$+        $1,@$2?$3?$4        change all '!'s before to ',@'
  985. XR?$+?$+            $: $2@$1        h!u => u@h
  986. XR,$+?$+?$+        $: $1:$3@$2        ,path..h!u => path:u@h
  987. X
  988. X
  989. X
  990. X# Infer .UUCP domain on first host if it is unqualified and either:
  991. X# (BANGIMPLIESUUCP is defined) OR (DOMAINTABLE is undefined and the host
  992. X# isn't known by the name server) OR (the host isn't known by the domaintable)
  993. X
  994. Xifdef({BANGIMPLIESUUCP},{
  995. X# (BANGIMPLIESUUCP is defined)
  996. XR@$-$=Z$+        $@ @$1.UUCP$2$3            route: add .UUCP
  997. XR$+@$-            $@ $1@$2.UUCP            host: add .UUCP
  998. X},{ifdef({DOMAINTABLE},{
  999. X# (DOMAINTABLE is defined)
  1000. XR@$-$=Z$+        $: @$[ $1 $: $1 $]$2$3        route: try name server
  1001. XR@$-$=Z$+        $@ @$(N $1 $: $1.UUCP $)$2$3    route: try domain table
  1002. XR@$+            $@ @$1                already has domain
  1003. XR$+@$-            $: $1@$[ $2 $: $2 $]        host: try name server
  1004. XR$+@$-            $@ $1@$(N $2 $: $2.UUCP $)    host: try domain table
  1005. X},{
  1006. X# (neither BANGIMPLIESUUCP nor DOMAINTABLE is defined)
  1007. XR@$-$=Z$+        $@ @$[ $1 $: $1.UUCP $]$2$3    route: try name server
  1008. XR$+@$-            $@ $1@$[ $2 $: $2.UUCP $]    host: try name server
  1009. X})})
  1010. X
  1011. X#########################################################################
  1012. X#                                    #
  1013. X#    Rule Set #22:    General Pathalias Router            #
  1014. X#                                    #
  1015. X#    Tries to find a route for an address using the pathalias    #
  1016. X#    database.  It will return the complete (canonicalized)        #
  1017. X#    route if found, or the same address otherwise.            #
  1018. X#                                    #
  1019. X#########################################################################
  1020. XS22
  1021. X
  1022. Xifdef({PATHTABLE},{
  1023. X# Change RFC822 Source Routes into %-path to get rid of multiple atsigns
  1024. XR$+@$+@.$+    $:$>25 $1@$2@.$3            Src Route to %-path
  1025. X
  1026. X# Search pathalias database
  1027. XR$+@.$-.UUCP    $: $(P  $2 $@$1        $:$1@.$2.UUCP $)    0th: UUCP host w/o .UUCP
  1028. XR$+@.$+        $: $(P  $2 $@$1          $:$1@?$2 $)    1st: try full domain
  1029. XR$+@$*?$-.$+    $(P .$3.$4 $@$1%$2.$3.$4 $:$1@$2.$3?$4 $)    2nd: subdomains
  1030. XR$+@.$+?$-    $: $(P .$3 $@$1%$2.$3    $:$1@?$2.$3 $)    3rd: try top domain
  1031. X
  1032. X# Found a route?
  1033. XR$+@?$+        $@ $1@.$2                failure: return
  1034. XR$+%.$+        $1%$2                    success: remove '.'
  1035. X
  1036. X# Yes, canonicalize result
  1037. XR$+@$+        $@$>3 $1@$2                canonicalize domains
  1038. XR$+!$+        $@$>3 $1!$2                canonicalize !-paths
  1039. XR$+%$+        $@$>3 $1%$2                canonicalize %-paths
  1040. XR$+        $@ $1@.$w                canonicalize users
  1041. X})
  1042. X
  1043. X#########################################################################
  1044. X#                                    #
  1045. X#    Rule Set #23:    Route prettyprinter & compressor.        #
  1046. X#                                    #
  1047. X#    This code rewrities RFC822 Source Routes into %-routes, which    #
  1048. X#    most users and mail FEs understand better.  It also comresses    #
  1049. X#    "obvious" routes whenever considered necessary -- mostly just    #
  1050. X#    for aesthetical reasons, though.  If you don't like this, feel    #
  1051. X#    free to disable it.  Sendmail shouldn't break, anyway.  (But    #
  1052. X#    there will probably be others...)
  1053. X#                                    #
  1054. X#########################################################################
  1055. XS23
  1056. X
  1057. X# Turn RFC822 Source Route into %-path
  1058. XR$+@$+@.$+        $:$>25 $1@$2@.$3
  1059. X
  1060. X# Remove route to well-known domain
  1061. XR$+%$+.$=T$=Y$+        $:$>3 $1%$2.$3        known top domain
  1062. X
  1063. X# Strip routes through well-known UUCP relays
  1064. XR$+%$-@.$=R        $:$>3 $2!$1        known UUCP relay
  1065. X
  1066. Xifdef({LIUIDA},{ifdef({DOMAINTABLE},{
  1067. X# LOCAL FIX: Strip header %-routes that paranoid instances of MM produce
  1068. XR$+%aida%$+@.majestix.liu.se    $@ $1@.$(N aida $)    AIDA's MM does this
  1069. XR$+%carmen%$+@.majestix.liu.se    $@ $1@.$(N carmen $)    CARMEN's too
  1070. X})})
  1071. X
  1072. X
  1073. X#########################################################################
  1074. X#                                    #
  1075. X#    Rule Set #24:    Unqualify domains for DECnet nodes        #
  1076. X#                                    #
  1077. X#    This is needed since DECnet has a flat namespace.  All DECnet    #
  1078. X#    nodes that are [externally] known to have a certain domain    #
  1079. X#    name are unqualified to their corresponding DECnet host name.    #
  1080. X#                                    #
  1081. X#########################################################################
  1082. XS24
  1083. X
  1084. Xifdef({DECNETXTABLE}, {
  1085. XR$+            $: ?$1            mark beginning of addrs
  1086. XR$*?$*$=X$+$=Y$*    $1$2$3$(D $4 $)?$5$6    scan & lookup domains
  1087. XR$*?$*@.$+        $1$2@.$(D $3 $)        lookup direct domain
  1088. X})
  1089. Xifdef({LIUIDA},{
  1090. X# LOCAL FIX: The SUNET.SE domain only consists of DECnet nodes.
  1091. XR$*$=X$-.SUNET.SE$=Y$*    $1$2$3$4$5        *.SUNET.SE are on DECnet
  1092. XR$+@.$-.SUNET.SE    $1@.$2            dito
  1093. X})
  1094. X
  1095. X
  1096. X#########################################################################
  1097. X#                                    #
  1098. X#    Rule Set #25:    Translate RFC822 Source Routes into %-Paths    #
  1099. X#                                    #
  1100. X#    This ruleset takes a (perhaps internalized) RFC822 Source    #
  1101. X#    Route and translates it into it's %-kludgified equivalent.    #
  1102. X#    Non-RFC822 Source Routes should pass through unharmed.        #
  1103. X#                                    #
  1104. X#    Eg: [u@h@.a    =>] @a:u@h    => u%h@a            #
  1105. X#        [@b:u@h@.a    =>] @a,@b:u@h    => u%h%b@a            #
  1106. X#      [@c,@b:u@h@.a    =>] @a,@b,@c:u@h => u%h%b%a%c@d            #
  1107. X#                                    #
  1108. X#########################################################################
  1109. XS25
  1110. X
  1111. X# Take care of internal mbox@.domain format
  1112. XR@$+:$+@$+@.$+    $: @$4,@$1:$2@$3        move @.domain to front
  1113. XR$+@$+@.$+    $: @$3:$1@$2            dito
  1114. X
  1115. X# Address is now real RFC822 Source Route--make sure user isn't !-path
  1116. X# (an address like <@a,@b:x!y!z@c> would otherwise be rewritten as
  1117. X# <x!y!z%c%b@a>, which is highly ambiguous--rewrite to <z%y%x%c%b@a> instead)
  1118. XR@$+:$+!$+@$+    $: @$1:$>4$>3 $2!$3@$4.DUMMY    rewrite last user@host
  1119. XR$+.DUMMY$+    $: $1$2                remove host canon inhibitor
  1120. XR@$+:$+:$+@$+    $: @$1,$2:$3@$4            merge possible double Src Route
  1121. X
  1122. X# Finally, the actual translation
  1123. XR@$+:$+@$+    $: @$1:$2%$3?            path:u@.h => path:u%h + mark
  1124. XR@$+:$+@    $: @$1:$2?            path:u@ => path:u + mark
  1125. XR@$+$=Z$+?$*    $3?%$1$4            rotate & concat
  1126. XR$+%$+?$*    $1@.$2$3            instantiate '%' & remove mark
  1127. XR$+@.$+%$+    $1%$2@.$3            move gaze right
  1128. X
  1129. X
  1130. X#########################################################################
  1131. X#                                    #
  1132. X#    Rule Set #26:    Determine Mailer for Address            #
  1133. X#                                    #
  1134. X#    Takes an address in canonical format as input and returns    #
  1135. X#    a complete mailer specification if a mailer is known for    #
  1136. X#    the supplied domain.  Just returns the address otherwise.    #
  1137. X#                                    #
  1138. X#########################################################################
  1139. XS26
  1140. X
  1141. Xifdef({NEWALIASES}, {
  1142. X# Updating aliases database -- return all addresses as local
  1143. XR$+@.$w            $#LOCAL  $@$w $:$1        default host
  1144. XR$+@.$+            $#LOCAL  $@$2 $:$1@.$2        specified host
  1145. X})
  1146. X
  1147. X# Search for possible global alias
  1148. XR$+@.$+            $: $1@.$2 ? $>4$>10$>2 $1@.$2    externalize
  1149. XR$+?$+            $: $1 ? $(@ $2 $:$)        search aliases
  1150. XR$+@.$+?$+        $#LOCAL  $@$2 $:$1@.$2        found it!
  1151. XR$+?            $: $1                not found, remove mark
  1152. X
  1153. X# Deliver to locals right away
  1154. XR$+@.$=w        $#LOCAL  $@$2 $:$1
  1155. X
  1156. Xifdef({MAILERTABLE},{
  1157. X###
  1158. X###    Determine delivery over specific media
  1159. X###
  1160. XR$+@.$+            $: $1@.$2 ? $(M $2 $: $)    search mailer table
  1161. XR$+@.$+?$+:$+        $#$3     $@$4 $:$>28 $1@.$2    relativize & return
  1162. XR$+@.$+?$*        $: $1@.$2            no match, remove mark
  1163. X})
  1164. X
  1165. X###
  1166. X###    Determine delivery over TCP/IP
  1167. X###
  1168. XR$+@.$*$~P        $: $1@.$2$3 ? $[ $2$3 $: $]    ask nameserver
  1169. XR$+@.$+?$+        {$#}TCPMAILER $@$3 $:$>28 $1@.$2    relativize & return
  1170. XR$+@.$+?$*        $: $1@.$2            no match, remove mark
  1171. X
  1172. X###
  1173. X###    Determine delivery over XNS
  1174. X###
  1175. Xifdef({XNSDOMAIN},
  1176. X{R$+@.}XEROXNS        {$#XNS $@xnsmail $:$1@.}XEROXNS
  1177. X)
  1178. X
  1179. X###
  1180. X###    Determine delivery over DECnet
  1181. X###    (Kludge: Should relativize too if we had a real DECnet connection)
  1182. X###
  1183. Xifdef({DECNETXTABLE},{
  1184. XR$+@.$+            $: $1@.$2 ? $(D $2 $: $)    check DECnet table
  1185. XR$+@.$+?$=D        $#DECnet $@$3 $:$1@.$2        only return real ones
  1186. XR$+@.$+?$*        $: $1@.$2            not found, remove mark
  1187. X})
  1188. X
  1189. X###
  1190. X###    Determine delivery over UUCP
  1191. X###    (Can't use ruleset 28 since we need to relativize immediate users)
  1192. X###
  1193. Xifdef({UUCPXTABLE},{
  1194. XR$+@.$+            $: $1@.$2 ? $(U $2 $: $)    check UUCP table
  1195. XR$+@.$+?$=U        $: $1@.$3            replace if found real
  1196. XR$+@.$+?$*        $: $1@.$2            not found, remove mark
  1197. X})
  1198. XR$+@.$=U.UUCP        $: $1@.$2            remove pseudo domain
  1199. XR$+%$+@.$=U        {$#}UUCPMAILER $@$3 $:$>3 $1%$2    (canonicalize routes)
  1200. XR$+@$+@.$=U        {$#}UUCPMAILER $@$3 $:$>3 $1@$2    (canonicalize routes)
  1201. XR$+@.$=U        {$#}UUCPMAILER $@$2 $:$1    (immediate delivery)
  1202. X
  1203. X
  1204. X#########################################################################
  1205. X#                                    #
  1206. X#    Rule Set #27:    Simple %-Path to !-Paths Translator        #
  1207. X#                                    #
  1208. X#    Subroutine of other address translators.  Will change a        #
  1209. X#    "a!b!c%d%e" path into "e!d!a!b!c".  Typically used when        #
  1210. X#    a message have travelled from UUCP-land into Domain land    #
  1211. X#    (and back again).                        #
  1212. X#                                    #
  1213. X#########################################################################
  1214. XS27
  1215. X
  1216. XR$+%$+            $: $1?$2        mark first %
  1217. XR$+?$+%$+        $1%$2?$3        find last %
  1218. XR$+?$+!$+        $@ $1%$2!$3        this is weird--don't change it
  1219. XR$+?$+            $: $2!$>27 $1        put on front and recurse
  1220. X
  1221. X
  1222. X#########################################################################
  1223. X#                                    #
  1224. X#    Rule Set #28:    One-level route stripper            #
  1225. X#                                    #
  1226. X#    Remove immediate host for routed addresses.  Typically used    #
  1227. X#    in ruleset 26 to produce a recipient relative to the immediate    #
  1228. X#    host.  Only to be used for routed full domains.            #
  1229. X#                                    #
  1230. X#########################################################################
  1231. XS28
  1232. X
  1233. XR$+@$+@.$+        $@$>3 $1@$2        relativize & return src route
  1234. XR$+%$+@.$+        $@$>3 $1@$2        relativize & return %-path
  1235. X
  1236. X
  1237. X#########################################################################
  1238. X#                                    #
  1239. X#    Rule Set #29:    Multi-level self route stripper            #
  1240. X#                                    #
  1241. X#    Remove immediate host for routed addresses if it is self.    #
  1242. X#    Typically used in ruleset 0 to remove superfluous routing    #
  1243. X#    info and produce a path relative to this host.            #
  1244. X#                                    #
  1245. X#########################################################################
  1246. XS29
  1247. X
  1248. XR$+@$+@.$=w        $@$>29$>3 $1@$2            RFC822 Src Route
  1249. XR$+%$+@.$=w        $@$>29$>3 $1%$2            %-Path
  1250. END_OF_ida/cf/Sendmail.mc
  1251. if test 43347 -ne `wc -c <ida/cf/Sendmail.mc`; then
  1252.     echo shar: \"ida/cf/Sendmail.mc\" unpacked with wrong size!
  1253. fi
  1254. # end of overwriting check
  1255. fi
  1256. echo shar: End of archive 8 \(of 8\).
  1257. cp /dev/null ark8isdone
  1258. MISSING=""
  1259. for I in 1 2 3 4 5 6 7 8 ; do
  1260.     if test ! -f ark${I}isdone ; then
  1261.     MISSING="${MISSING} ${I}"
  1262.     fi
  1263. done
  1264. if test "${MISSING}" = "" ; then
  1265.     echo You have unpacked all 8 archives.
  1266.     echo "See ida/README and ida/INSTALL for further directions."
  1267.     rm -f ark[1-9]isdone
  1268. else
  1269.     echo You still need to unpack the following archives:
  1270.     echo "        " ${MISSING}
  1271. fi
  1272. ##  End of shell archive.
  1273. exit 0
  1274.  
  1275.