home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume10 / ida / part05 < prev    next >
Encoding:
Internet Message Format  |  1987-06-22  |  38.4 KB

  1. Path: seismo!uunet!rs
  2. From: rs@uunet.UU.NET (Rich Salz)
  3. Newsgroups: comp.sources.unix
  4. Subject: v10i016:  The IDA Sendmail Kit, Part05/07
  5. Message-ID: <428@uunet.UU.NET>
  6. Date: 23 Jun 87 04:42:08 GMT
  7. Organization: UUNET Communications Services, Arlington, VA
  8. Lines: 1107
  9. Approved: rs@uunet.uu.net
  10.  
  11. Mod.sources: Volume 10, Number 16
  12. Submitted by: Lennart Lovstrand <mcvax!ida.liu.se!lel>
  13. Archive-name: ida/Part05
  14.  
  15.  
  16. #! /bin/sh
  17. # This is a shell archive.  Remove anything before this line, then unpack
  18. # it by saving it into a file and typing "sh file".  To overwrite existing
  19. # files, type "sh file -c".  You can also feed this as standard input via
  20. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  21. # will see the following message at the end:
  22. #        "End of archive 5 (of 7)."
  23. # Contents:  ida/cf/Sendmail.mc
  24. # Wrapped by lenlo@prefix on Wed Jun 10 15:39:56 1987
  25. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  26. if test -f ida/cf/Sendmail.mc -a "${1}" != "-c" ; then 
  27.   echo shar: Will not over-write existing file \"ida/cf/Sendmail.mc\"
  28. else
  29. echo shar: Extracting \"ida/cf/Sendmail.mc\" \(36429 characters\)
  30. sed "s/^X//" >ida/cf/Sendmail.mc <<'END_OF_ida/cf/Sendmail.mc'
  31. X##########################################################################
  32. X###    The IDA Sendmail Master Configuration File    ##################
  33. X##########################################################################
  34. X###    Lennart.Lovstrand@IDA.LiU.SE (aka lel@liuida.UUCP)           ###
  35. X###    Dept of Comp and Info Sci, University of Linkoping, Sweden     ###
  36. X###    Copyright (c) 1984-87 -- Use it, abuse it, but don't sell it   ###
  37. X##########################################################################
  38. X# Current version (5.21)
  39. XDVVxxi
  40. Xchangequote({,})
  41. X
  42. X####### INTRODUCTION #####################################################
  43. X#
  44. X#    This is The IDA Sendmail Master Configuration File--a completely
  45. X#    independent development having nothing to do with the version
  46. X#    distributed by Berkeley.  In order to work properly, it requires
  47. X#    a set of new functions implemented by the IDA Sendmail Enhancement
  48. X#    Kit, available from your nearest comp.sources.unix archive.
  49. X#
  50. X#    Get it today, tomorrow they might have a disk crash!
  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#    BSD29
  143. X#        Activates various hacks for usage on BSD 2.9 systems.
  144. X#    BANGIMPLIESUUCP
  145. X#        If defined, will inhibit domaintable lookups for
  146. X#        unqualified nodes first in !-paths and always inter-
  147. X#        preting them to reside in the UUCP pseudo-domain.
  148. X#    DECNETNODES
  149. X#        A file containing DECnet host names.  Used in combination
  150. X#        with DECNETXTABLE to determine delivery through the DECnet
  151. X#        mailer and when to expand flatspaced DECnet host names into
  152. X#        domains.
  153. X#    DECNETXTABLE
  154. X#        The DECnet translation table.  Returns a node's DECnet
  155. X#        host name if given its domain name.  (Dbm file, see
  156. X#        ruleset 24 for more info).
  157. X#    DEFAULT_HOST
  158. X#        Explicit host name, replaces automatic definition of $w.
  159. X#    DEFAULT_DOMAIN
  160. X#        The string that (+ ".") will be attached to $w to
  161. X#        form $j, this node's official domain name.
  162. X#    DOMAINTABLE
  163. X#        Dbm database used for hostname canonicalization, ie.
  164. X#        to find the official domain name for local or otherwise
  165. X#        unqualified hosts.
  166. X#    GENERICFROM
  167. X#        A database mapping actual user names to generic user
  168. X#        names.  Used instead of HIDDENNET in a heterogenous
  169. X#        environment.
  170. X#    HIDDENNET
  171. X#        Points to a file containing a list of host names, one
  172. X#        per line.  Mail from users on any of these hosts will
  173. X#        have the host name substituted for our host, $w.
  174. X#    LIBDIR    
  175. X#        The directory that will hold most data files, including
  176. X#        sendmail.{hf,st}; defaults to /usr/lib/mail.
  177. X#    PATHTABLE
  178. X#        The heart & soul of this sendmail configuration--the
  179. X#        pathalias routing table in dbm format, as produced by
  180. X#        the pathalias program.  Either you define this or rel(a)y
  181. X#        on RELAYHOST/RELAYMAILER.
  182. X#    MAILERTABLE
  183. X#        A dbm table mapping node names to "mailer:host" pairs.
  184. X#        It is used for special cases when the resolving heuristics
  185. X#        of ruleset 26 aren't enough.
  186. X#    NEWALIASES
  187. X#        If defined, will make ruleset 26 return all addresses
  188. X#        as local.  This should be used by the newaliases program
  189. X#        only when parsing the aliases file if you want to handle
  190. X#        non-local aliases as well.
  191. X#    PSEUDONYMS
  192. X#        Additional names that we are known under (in addition
  193. X#        to those returned by gethostbyname()).
  194. X#    RELAY_HOST & RELAY_MAILER
  195. X#        Name of the host and mailer to ship unknown recipient
  196. X#        addresses to.
  197. X#    RSH_SERVER
  198. X#        If defined, do local deliveries by rsh'ing /bin/mail
  199. X#        on the RSH_SERVER host.
  200. X#    SPOOLDIR
  201. X#        Directory for sendmail queue files; defaults to
  202. X#        /usr/spool/mqueue.
  203. X#    UUCPNAME
  204. X#        This node's UUCP host name, if different from $w.
  205. X#    UUCPNODES
  206. X#        A file containing names of directly connectable UUCP nodes.
  207. X#    UUCPPRECEDENCE
  208. X#        If defined, will change the interpretation of mixed
  209. X#        !/@ addresses to use heuristics instead of always
  210. X#        preferring RFC822 style. (NOT FULLY TESTED!)
  211. X#    UUCPRELAYS
  212. X#        Name of file containing names of known (UUCP) relays.
  213. X#        Header addresses containing paths through any of these
  214. X#        will be shortened by having the path to the relay removed.
  215. X#        (It is assumed that paths to each of these are known to
  216. X#        everybody)
  217. X#    UUCPXTABLE
  218. X#        A table mapping domain node names to UUCP node names.
  219. X#        Used in envelope addresses sent using UUCP/rmail.
  220. X
  221. X
  222. X####### CLASSES, DEFINITIONS, and DATABASES ##############################
  223. X#
  224. X#    The following classes, macro definitions and keyed databases are
  225. X#    being used:
  226. X#
  227. X#    CA    An atsign (@), used in class membership negations
  228. X#    CD    Known DECnet host names (see DECNETNODES above)
  229. X#    CH    Node names that should be hidden by $w (see HIDDENNET above)
  230. X#    CR    Removeable relays from header addresses (see UUCPRELAYS above)
  231. X#    CT    Known top level domains (global + local)
  232. X#    CU    Directly connectable UUCP nodes
  233. X#    CX    A set of chars that delimit the LHS of a domain (@ %)
  234. X#    CY    A set of chars that delimit the RHS of a domain (, : % @)
  235. X#    CZ    RFC822 Source Route punctuation chars (, :)
  236. X#
  237. X#    DV    Configuration version number
  238. X#
  239. X#    OK@    The aliases database (automatically defined; see ALIASES above)
  240. X#    OKD    DECnet domain translation table (see DECNETXTABLE above)
  241. X#    OKG    Generic usernames (see GENERICFROM above)
  242. X#    OKM    Special domain => mailer:host table (see MAILERTABLE above)
  243. X#    OKN    Official name lookup table (see DOMAINTABLE above)
  244. X#    OKP    Pathalias routing database (see PATHTABLE above)
  245. X#    OKU    UUCP domain translation table (see UUCPXTABLE above)
  246. X
  247. X
  248. X##########################################################################
  249. X## Default Definitions ###################################################
  250. X##########################################################################
  251. Xifdef({LIBDIR},,{define(LIBDIR, /usr/lib/mail)})
  252. Xifdef({SPOOLDIR},,{define(SPOOLDIR, /usr/spool/mqueue)})
  253. X
  254. X#
  255. X##########################################################################
  256. X## Domain Definitions ####################################################
  257. X##########################################################################
  258. X
  259. X##########################################################################
  260. X#    Universally known top-level domains
  261. X
  262. X#                    Organizational domains
  263. XCTcom edu gov org mil net
  264. X#                    National domains
  265. XCTau ca cdn de fi fr gb il jp kr nl nz oz se uk us
  266. X#                    Network based domains
  267. XCTarpa bitnet csnet junet mailnet uucp
  268. X
  269. X
  270. X##########################################################################
  271. X## Misc Definitions ######################################################
  272. X##########################################################################
  273. X
  274. Xifdef({DEFAULT_HOST},
  275. X# This node's local host name
  276. X{Dw}DEFAULT_HOST)
  277. X
  278. X# This node's official domain name
  279. Xifdef({DEFAULT_DOMAIN},
  280. X{Dj$w.}DEFAULT_DOMAIN,
  281. XDj$w)
  282. X
  283. Xifdef({PSEUDONYMS},
  284. X# Other names for this node
  285. X{Cw}PSEUDONYMS)
  286. XCw$k
  287. X
  288. X# my name
  289. XDnMAILER-DAEMON
  290. X
  291. X# UNIX header format
  292. XDlFrom $g $d
  293. X
  294. X# delimiter (operator) characters
  295. XDo".:;%@!=/[]?#^,<>"
  296. X
  297. X# Characters that mark the left (X) & right (Y) hand side of a domain
  298. XCX@ %
  299. XCY, : % @
  300. X
  301. X# Pure RFC822 route punctuation characters
  302. XCZ, :
  303. X
  304. X# The atsign-in-a-class
  305. XCA@
  306. X
  307. X# Format of a total name: Personal Name <user@domain>
  308. XDq$?x$x <$g>$|$g$.
  309. X
  310. X# SMTP login message
  311. XDeGolly wosh!  Sendmail $v/$V still running on $j
  312. X
  313. X
  314. X##########################################################################
  315. X#    Options
  316. X
  317. X#                set default alias file
  318. Xifdef({ALIASES},{OA}ALIASES)
  319. X#                time to look for "@:@" in alias file
  320. XOa15
  321. X#                substitution for blank character
  322. XOB.
  323. X#                don't connect to "expensive" mailers
  324. XOc
  325. X#                delivery mode
  326. XOdb
  327. X#                rebuild alias database as needed
  328. XOD
  329. X#                set error processing mode
  330. X# Oe
  331. X#                temporary file mode
  332. XOF0660
  333. X#                save Unix-style From lines on front
  334. X# Of
  335. X#                default gid
  336. XOg1
  337. X#                help file
  338. X{OH}LIBDIR/sendmail.hf
  339. X#                ignore dot lines in message
  340. X# Oi
  341. X#                database files
  342. Xifdef({DECNETXTABLE},{OKD}DECNETXTABLE)
  343. Xifdef({GENERICFROM},{OKG}GENERICFROM)
  344. Xifdef({MAILERTABLE},{OKM}MAILERTABLE)
  345. Xifdef({DOMAINTABLE},{OKN}DOMAINTABLE)
  346. Xifdef({PATHTABLE},{OKP}PATHTABLE)
  347. Xifdef({UUCPXTABLE},{OKU}UUCPXTABLE)
  348. X#                log level
  349. XOL9
  350. X#                define macro
  351. X# OM
  352. X#                send to me too
  353. XOm
  354. X#                local network name
  355. Xifdef({DEFAULT_DOMAIN},{ON}DEFAULT_DOMAIN)
  356. X#                assume old style headers
  357. XOo
  358. X#                postmaster copy of returned messages
  359. XOPPostmaster
  360. X#                queue directory
  361. X{OQ}SPOOLDIR
  362. X#                read timeout -- violates protocols
  363. XOr30m
  364. X#                status file
  365. X{OS}LIBDIR/sendmail.st
  366. X#                be super safe, even if expensive
  367. XOs
  368. X#                queue timeout
  369. XOT2w
  370. X#                time zone name
  371. X# OtMET,MET DST
  372. X#                set default uid
  373. XOu1
  374. X#                run in verbose mode
  375. X# Ov
  376. X#                wizard's password
  377. XOWanuZMxS7nTb2U
  378. X#                load avg at which to auto-queue msgs
  379. XOx3
  380. X#                load avg to auto-reject connections
  381. XOX8
  382. X#                fork when running the queue
  383. Xifdef({BSD29},OY)
  384. X#                use separate envelope/header rewriting rulesets
  385. XO/
  386. X
  387. X##########################################################################
  388. X#    Message precedences
  389. X
  390. XPfirst-class=0
  391. XPspecial-delivery=100
  392. XPjunk=-100
  393. X
  394. X##########################################################################
  395. X#    Trusted users
  396. X
  397. XTroot
  398. XTdaemon
  399. XTuucp
  400. XTnetwork
  401. XTlenlo
  402. X
  403. X##########################################################################
  404. X#    Header Formats
  405. X
  406. XHReceived: $?sfrom $s $.by $j; $b
  407. X#HReceived: $?sfrom $s $.by $j$?r with $r$.; $b
  408. XH?P?Return-Path: <$g>
  409. XH?D?Date: $a
  410. XH?F?From: $q
  411. XH?x?Full-Name: $x
  412. XH?M?Message-ID: <$t.$i@$j>
  413. X
  414. X
  415. X#
  416. X##########################################################################
  417. X## Mailer Specifications #################################################
  418. X##########################################################################
  419. X
  420. X##########################################################################
  421. X#    Local & Prog mailer definitions
  422. X
  423. X# List of nodes that should be hidden by our name (header senders)
  424. Xifdef({HIDDENNET},{FH}HIDDENNET)
  425. X
  426. Xifdef({RSH_SERVER}, {
  427. XMlocal,    P=/usr/ucb/rsh, F=DFMlmns,    A=RSH_SERVER /bin/mail -d $u
  428. X}, {
  429. Xifdef({BSD29}, {
  430. XMlocal,    P=/bin/mail, F=DFMSlms,        A=mail $u    }, {
  431. XMlocal,    P=/bin/mail, F=DFMSlmnrs,    A=mail -d $u    })
  432. X})
  433. XMprog,    P=/bin/csh,  F=DFMhlsu,        A=csh -fc $u
  434. X
  435. X
  436. X##########################################################################
  437. X#    TCP/IP mailer specification
  438. X#
  439. X#    Kludge: Flatten envelope recipient DECnet domains.
  440. X#        The message will probably go through our TCP/IP-DECnet
  441. X#        gateway, which can't take care of domains (sigh).
  442. X
  443. XMTCP,  P=[IPC], F=CDFMXhnmpsu, E=\r\n, R=24/0, A=IPC $h
  444. X
  445. X
  446. X##########################################################################
  447. X#    (Pseudo)DECnet mailer specification
  448. X#
  449. X#    Send all envelope recipients thru DECnet domain name flattener.
  450. X
  451. X# List of DECnet nodes
  452. Xifdef({DECNETNODES},{FD}DECNETNODES)
  453. X
  454. X# Since we don't have any Unix boxes with DECnet yet, we cheat...
  455. XMDECnet,  P=[IPC], F=CDFMXhnmpsu, R=24/0, E=\r\n, A=IPC lisbet.liu.se
  456. X
  457. X
  458. X##########################################################################
  459. X#    UUCP mailer definitions
  460. X
  461. X# Our UUCP name, if other than $w
  462. Xifdef({UUCPNAME},{Dk}UUCPNAME)
  463. X
  464. X# List of known UUCP nodes
  465. Xifdef({UUCPNODES},{FU}/usr/lib/uucp/L.sys)
  466. XCU$k
  467. X
  468. X# List of UUCP relays that are to be removed from sender paths
  469. Xifdef({UUCPRELAYS},{FR}UUCPRELAYS)
  470. X
  471. XMUUCP,   P=/usr/bin/uux, F=DFMUVShpsu, S=19, R=19,    A=uux - -z -r $h!rmail (
  472. $u)
  473. XMUUCP-A, P=/usr/bin/uux, F=DFMShmpu,  S=19/0, R=15/0, A=uux - -z -r $h!rmail (
  474. $u)
  475. XMUUCP-B, P=/usr/bin/uux, F=BDFMSXhmpu, S=0,  R=15/0,  A=uux - -z -r $h!bsmtp
  476. X
  477. X# Canonicalize envelope recipient addresses before UUCP-ifying them.
  478. XS14
  479. XR$+            $@ $>19$>3 $1
  480. X
  481. X# UUCP-ify address, then move domain back if not UUCP destination
  482. XS15
  483. XR$+            $: $>19 $1        UUCP-ify
  484. XR$+!$+            $: $1?$2        mark first bang
  485. XR$+.$=T?$+        $@ $3@.$1.$2        restore if real domain
  486. XR$+?$+            $@ $1!$2        just put bang back otherwise
  487. X
  488. X#
  489. X##########################################################################
  490. X## Standard Rewriting Rules ##############################################
  491. X##########################################################################
  492. X
  493. X#########################################################################
  494. X#                                    #
  495. X#    Rule Set #0:    Mailer Resolving Ruleset            #
  496. X#                                    #
  497. X#    This is rather straightforward.  The code should say it all.    #
  498. X#                                    #
  499. X#########################################################################
  500. XS0
  501. X
  502. X# Digest routes through ourself (can't use S28 'cause it only strips one level
  503. )
  504. XR$+@$+@.$=w        $@$>0$>3 $1@$2            RFC822 Src Route
  505. XR$+%$+@.$=w        $@$>0$>3 $1%$2            %-Path
  506. X
  507. X# Try immediate delivery
  508. XR$+@.$+            $:$>26 $1@.$2            try to find mai
  509. ler
  510. XR$#$+            $# $1                found, return it
  511. X
  512. X# Unknown domain, try to find a pathalias route
  513. XR$+@.$+            $:$>26$>22 $1@.$2        go get route & 
  514. mailer
  515. XR$#$+            $# $1                found, return it
  516. X
  517. Xifdef({RELAY_HOST}, {
  518. X# Relay other unknowns through RELAY_HOST/RELAY_MAILER
  519. XR$+@.$+            ${#}RELAY_MAILER $@RELAY_HOST $:$1@.$2
  520. X})
  521. X
  522. X# Undeliverable recepients--complain loudly & return to sender
  523. XR$+@.$-        $#ERROR $:Host $2 not known--please specify domain
  524. XR$+@.$-.$*$=T    $#ERROR $:Host $2 not known within the $3$4 domain
  525. XR$+@.$+.$-    $#ERROR $:Domain $3 not known--please try to route manually
  526. XR@$+        $#ERROR $:"Incomplete Source Route--use <...> format"
  527. XR$*        $#ERROR $:Could not parse $1
  528. X
  529. X
  530. X#########################################################################
  531. X#                                    #
  532. X#    Rule Set #1:    [Envelope] Sender Specific Rewriting        #
  533. X#                                    #
  534. X#    [Currently nothing.]                        #
  535. X#                                    #
  536. X#########################################################################
  537. XS1
  538. X
  539. X
  540. X#########################################################################
  541. X#                                    #
  542. X#    Rule Set #2:    [Envelope] Receiver Specific Rewriting        #
  543. X#                                    #
  544. X#    Turn RFC822 Source Routes into a %-paths since most MTAs    #
  545. X#    don't know about how to handle the former format.        #
  546. X#                                    #
  547. X#########################################################################
  548. XS2
  549. X
  550. XR$+@.$+            $:$>25 $1@.$2        Src Routes => %-routes
  551. X
  552. X
  553. X#########################################################################
  554. X#                                    #
  555. X#    Rule Set #3:    Address Canonicalization            #
  556. X#                                    #
  557. X#    Turns the address into the (internally) canonical format    #
  558. X#    mailbox@.domain.  The `domain' is what you think it is, but    #
  559. X#    the `mailbox' may be either a "real" mailbox in which case    #
  560. X#    no further meaning is associated to it, or a route in either    #
  561. X#    the Source Route format as specified by RFC822 or the (un-    #
  562. X#    documented) Good Ole ARPAnet %-Kludge Format.            #
  563. X#                                    #
  564. X#    Input formats include the standard "mailbox@domain" format,    #
  565. X#    RFC822 Source Routes, RFC822 Group Names, ARPAnet %-Kludges,    #
  566. X#    UUCP !-Paths, the Berknet "host:user" format, the VAX/VMS    #
  567. X#    "host::user" format and resonable mixtures of the above.    #
  568. X#                                    #
  569. X#    The code even tries to clean up after various mistakes that    #
  570. X#    other nodes has done when reformatting the addresses, such    #
  571. X#    as mangled Xerox distribution lists or malformatted RFC822    #
  572. X#    Group Specifications.                        #
  573. X#                                    #
  574. X#########################################################################
  575. XS3
  576. X
  577. XR$*<$+>$*        $2            turn to essentials
  578. XR$*<>$*            Postmaster        default user
  579. X
  580. X# These are not for us
  581. XR:{include}:$*@$*    $@:{include}:$1@.$2    indirect address
  582. XR:{include}:$*        $@:{include}:$1@.$w    indirect address
  583. XR$*/$*@$*        $@$1/$2@.$3        file name
  584. XR$*/$*            $@$1/$2@.$w        file name
  585. X
  586. X# Fix group names and return them
  587. XR$+:;@$+        $:$1:;            remove host info
  588. XR$+:            $:$1:;            missing semicolon
  589. XR$+!;            $:$1:;            UUCP-style mangled group
  590. XR$+!$+:;        $2:;            remove UUCP host info
  591. XR$+:;            $@$1:;            Finally return group
  592. X
  593. X# Miscellaneous cleanup (sigh)
  594. XR$+!.$+            $1^.$2            fix mangled Xerox dList
  595. XR$+::$+            $1!$2            VAX/VMS relative addres
  596. s
  597. XR$+!:$+@$+        $1!$3!$2        scrambled source route
  598. XR$+!:$+            $1!$2            mangled VAX/VMS address
  599. XR$-:$-            $1!$2            Berknet style address
  600. XR$+ at $+        $: $1@$2        "at" -> "@"
  601. XR$+:@$+            $1,@$2            slightly malformed src 
  602. route
  603. XR$*$~Z@$+@$+        $1$2%$3@$4        fix user@host@relay
  604. XRenea!$+!!$+,!$+    enea!$1!!$2,@$3        brutally beaten src route
  605. XRenea!$+!!$+:$+!$+    $: enea!$1!$2!$4!$3    seriously smashed src route
  606. XRenea!$+!!$+        $: enea!@$2@$1        maddenly messy src route
  607. XR$+@$+.$=T.UUCP        $1@$2.$3        strip UUCP off foo@bar.
  608. EDU.UUCP
  609. X
  610. X# Fix %-kludgified RFC822 source routes (double sigh)
  611. XR$+!%$+:$+%$+        $1!%$2:$3@$4        change all %'s into @'s
  612. XR$+!%$+,%$+        $1!%$2,@$3
  613. XR$+!%$+            $1!@$2
  614. X
  615. X###
  616. X###    The address should be in a reasonable format now--time to
  617. X###    resolve mixed !/@ hybrid addresses.
  618. X###
  619. X
  620. X# Case 0: !-prefixed RFC822 source route--extend to complete source route
  621. XR$+!$+!@$+        $1,@$2!@$3        !-path to ,@-route
  622. XR$+!@$+            $: @$1,@$2        including first & last 
  623. !-host
  624. X
  625. Xifdef({UUCPPRECEDENCE}, {
  626. X# Case 1: Unqualified domain--guess UUCP style address
  627. XR$~A$*!$+@$-        $:$>21 $1$2!$3%$4@    guess originally UUCP style
  628. X
  629. X# Case 2: Qualified domain--guess RFC822 style address
  630. XR$~A$*!$+@$+        $:$>21 $4!$1$2!$3@    guess originally domain style
  631. X}, {
  632. X### Always assume RFC822 style
  633. X# Case 1: !-path on top of %-route on top of @-domain (God, why me?!)
  634. XR$~A$*!$+%$+@$+        $: $1$2?$3%$4@$5    mark first bang
  635. XR$+?$+!$+%$+        $1!$2?$3%$4        find rightmost
  636. XR$+?$+%$+%$+@$+        $3!$1?$2%$4@$5        move %hosts around
  637. XR$+?$+%$+@$+        $:$>21 $4!$3!$1!$2@    now send it thru unbanger
  638. X
  639. X# Case 2: Domain address without %-route
  640. XR$~A$*!$+@$+        $:$>21 $4!$1$2!$3@    guess originally domain style
  641. X})
  642. X
  643. X# Case 3: Pure UUCP-path (or not UUCPPRECEDENCE)
  644. XR$~A$*!$+        $:$>21 $1$2!$3@        pure UUCP style
  645. X
  646. X###
  647. X###    Address should be close to canonical now, give or take
  648. X###    the @domain part.  Make it really internal by adding a
  649. X###    dot before the [direct] domain (if any).  Also qualify
  650. X###    some domain names.
  651. X###
  652. X
  653. X# Add dot and put direct host on back for RFC822 Source Routes
  654. XR$+            $: $1@            make sure address has atsign
  655. XR$+@$+@            $: $1@$2        remove again if already
  656.  there
  657. XR$*@$+            $: $1@.$2        add dot after [direct] domain
  658. XR@.$+$=Z$+        $: $3@.$1        tack direct domain on end
  659. XR$+@..$+        $: $1@.$2        one dot is enough! (intern fix)
  660. X
  661. X# Routed address (good ol' ARPA version)
  662. XR$+%$+@            $:$1@.$2        replace '%' with '@.'
  663. XR$+@.$+%$+        $1%$2@.$3        move gaze right
  664. X
  665. X# Sometimes users try to send to RFC822 Source Routes without angle
  666. X# brackets.  This will cause the mailer to split the comma-separated
  667. X# domain path into separate phony addresses, which all look like
  668. X# "@domain".  There's not much to do about it here though.
  669. XR@.$+@            $@ @$1            incomplete Source Route
  670. X
  671. X# No domain, attach default
  672. XR$+@            $: $1@.$w        no host/domain, attach default
  673. X
  674. X# Try to find official name for domain
  675. XR$+@.$+            $: $1@.$[ $2 $]        officialize using TCP/I
  676. P
  677. XR$+@.$+            $: $1@.$(N $2 $)    officialize using domai
  678. ntable
  679. X
  680. X
  681. X#########################################################################
  682. X#                                    #
  683. X#    Rule Set #4:    Address PrettyPrinter                #
  684. X#                                    #
  685. X#    Does the final prettyprinting before the address is included    #
  686. X#    in the message.  (This is essentially a trivial reformatting    #
  687. X#    from internal to external format)                #
  688. X#                                    #
  689. X#########################################################################
  690. XS4
  691. X
  692. X# Remove dot and return RFC822 Source Routes
  693. XR@$+@.$+        $@ @$2,@$1
  694. XR$+@$+@.$+        $@ @$3:$1@$2
  695. X
  696. X# Remove dot for normal domain addresses
  697. XR$+@.$+            $@ $1@$2
  698. X
  699. X
  700. X#########################################################################
  701. X#                                    #
  702. X#    Rule Set #5:    [Header] Sender Specific Rewriting        #
  703. X#                                    #
  704. X#    Rewrite RFC822 source routes into %-routes, since most mailer    #
  705. X#    UAs can't handle them.  Compact obvious routes, mostly for    #
  706. X#    aesthetical reasons.  Possibly hide local nodes behind ourself.    #
  707. X#    Substitute generic names for physical senders.            #
  708. X#                                    #
  709. X#########################################################################
  710. XS5
  711. X
  712. XR$+@.$+            $:$>23 $1@.$2            unsourcify & pr
  713. ettify
  714. X
  715. X# Hide these nodes using our own name
  716. XR$+@.$=H        $: $1@.$j
  717. X
  718. Xifdef({GENERICFROM}, {
  719. X# Use (canonicalized) generic names for local users
  720. X# (Assumes that it never will find a $+@.$+ address in the db, ie. with dot)
  721. XR$+@.$+            $: $1@.$2 ? $1@.$2        duplicate
  722. XR$+?$+@.$+.$-        $1 ? $(G $2@$3.$4 $: $2@.$3 $)    search db foreach dom
  723. XR$+?$+@.$-        $: $1 ? $(G $2@$3 $: $2@.   $)    search for last dom
  724. XR$+@.$=w?$+@.        $: $1@.$2 ? $(G $3 $: $3@.  $)    search for locals
  725. XR$+@.$+?$+@.$*        $@ $1@.$2            not found
  726. XR$+?$+            $@ $>3 $2            found, canonicalize
  727. X})
  728. X
  729. X
  730. X#########################################################################
  731. X#                                    #
  732. X#    Rule Set #6:    [Header] Receiver Specific Rewriting        #
  733. X#                                    #
  734. X#    Rewrite RFC822 source routes into %-routes, since most mailer    #
  735. X#    UAs can't handle them.  Compact obvious routes, mostly for    #
  736. X#    aesthetical reasons.                        #
  737. X#                                    #
  738. X#########################################################################
  739. XS6
  740. X
  741. XR$+@.$+            $:$>23 $1@.$2            unsourcify & pr
  742. ettify
  743. X
  744. X
  745. X#
  746. X##########################################################################
  747. X## General Rewriting Rule Subroutines ####################################
  748. X##########################################################################
  749. X
  750. X#########################################################################
  751. X#                                    #
  752. X#    Rule Set #19:    Translate domain addresses to UUCP !-paths    #
  753. X#                                    #
  754. X#    Takes an domain style address as input and transforms this    #
  755. X#    into a !-path.  There will be no atsign left in the address    #
  756. X#    after this, but there may(?) still be a percent sign.        #
  757. X#    Routes are specially processed, trying to qualify all non-    #
  758. X#    qualified nodes in the path.  This is to make sure local nodes    #
  759. X#    will have their proper domains properly attached before the    #
  760. X#    messages leavs us.  I'm not sure if this is a good thing or    #
  761. X#    not, since they may not be local at all.  UUCP nodes with    #
  762. X#    domain style names are qualified, anyway.            #
  763. X#                                    #
  764. X#########################################################################
  765. XS19
  766. X
  767. X# Don't touch groups!
  768. XR$+:;            $@ $1:;            return groups
  769. X
  770. X# Translate RFC822 Source Routes FULLY into !-path format
  771. XR$+@$+@.$+        $:$>4 $1@$2@.$3        first externalize
  772. XR@$+            $: ?@$1            mark first node
  773. XR$*?@$+$=Z$+        $1$2!?$4        change prefix path to !
  774. XR$+?$~A$*@$+        $: $1$4!$2$3        turn last pair into ! format 2
  775. XR$*?$*            $: $1$2            remove possible trailing mark
  776. X
  777. X# Translate normal domain addresses
  778. Xifdef({UUCPXTABLE},{
  779. XR$+%$-@.$+        $: $1%$2@.$3 ? $(U $3 $: $)    UUCP node as domain?
  780. XR$+%$-@.$+?$+        $:$>20 $1%$2@.$3    yes, !-ify
  781. XR$+%$-@.$+?        $: $1%$2@.$3        no, remove mark
  782. X})
  783. XR$+%$-@.$+.UUCP        $:$>20 $1%$2@.$3.UUCP    !-ify "obvious" UUCP ro
  784. utes
  785. XR$+%$-@.$+.$-        $: $3.$4!$1%$2        don't know about other domains
  786. XR$+@.$+            $:$>20 $1@.$2        all the rest to the !-i
  787. fyer
  788. X
  789. X###
  790. X### Address should be in !-path format now.
  791. X###
  792. X
  793. Xifdef({DOMAINTABLE},{
  794. X# Qualify all nodes that we know of
  795. X# THIS IS DANGEROUS AND WRONG!  But still needed since some nodes out there
  796. X# do heavy path optimizations and our DECnet nodes may lose due to that.
  797. XR$*            $: ?$1            mark start
  798. XR$*?$+!$+        $1$(N $2 $)!?$3        qualify node
  799. XR$*?$*            $: $1$2            remove mark
  800. X})
  801. X
  802. X# Unqualify all UUCP nodes
  803. Xifdef({UUCPXTABLE},{
  804. XR$*            $: ?$1            mark start
  805. XR$*?$+!$+        $1$(U $2 $)!?$3        unqualify node
  806. XR$*?$*            $: $1$2            remove mark
  807. X})
  808. XR$-.UUCP!$+        $: $1!$2        remove first .UUCP
  809. XR$+!$-.UUCP!$+        $1!$2!$3        remove other .UUCP's
  810. X
  811. X
  812. X#########################################################################
  813. X#                                    #
  814. X#    Rule Set #20:    %-Route to !-Path Translator            #
  815. X#                                    #
  816. X#    Translates Good Ol' ARPA %-Routes to UUCP style !-paths.    #
  817. X#    This is done up to, but not beyond, the first non-UUCP        #
  818. X#    domain found in the path.                    #
  819. X#       This ruleset is used strictly for heuristical reasons.    #
  820. X#    Nodes with Real Domain Names are assumed in general not to    #
  821. X#    understand !-paths, but rather prefer %-routes.  This wouldn't    #
  822. X#    have been necessary to do here if all gateways had fully    #
  823. X#    converted all addresses.                    #
  824. X#    Eg.    mbox%a%b%c@.domain    => domain!c!b!a!mbox        #
  825. X#        mbox%a.b%c%d@.domain    => domain!d!c!mbox%a.b        #
  826. X#                                    #
  827. X#########################################################################
  828. XS20
  829. X
  830. Xifdef({UUCPXTABLE},{
  831. XR$+@.$+            $: $(U $2 $)?$1        move translated domain 
  832. to front
  833. X},{
  834. XR$+@.$+            $: $2?$1        move domain to front
  835. X})
  836. XR$+?$+%$-        $1!$3?$2        prefix host route
  837. Xifdef({UUCPXTABLE},{
  838. XR$+?$+%$+        $: $1?$2%$(U $3 $)    translate UUCP domains to hosts
  839. XR$+?$+%$-        $@$>20 $1?$2%$3        recurse if host found
  840. X})
  841. XR$+?$+%$-.UUCP        $@$>20 $1?$2%$3        recurse if ending in host.UUCP
  842. XR$+?$+            $: $1!$2        get rid of temp !-subst
  843. X
  844. X
  845. X#########################################################################
  846. X#                                    #
  847. X#    Rule Set #21:    Prehost to Posthost Converter            #
  848. X#                                    #
  849. X#    Changes !-paths into RFC822 Source Routes.            #
  850. X#    Eg. a!b!c!d    => a,@b,@c,@d    => @a,@b:d@c            #
  851. X#        a!b!c%d    => a,@b,@c%d    => @a:c%d@b            #
  852. X#        a!b!c@d    => a,@b,@c@d    => @a,@b:c@d)            #
  853. X#                                    #
  854. X#########################################################################
  855. XS21
  856. X
  857. X# Initial canonicalization (get rid of possible '@' as in path!u@h)
  858. XR$+@            $: $1            remove optional trailing '@'
  859. XR$+!$+            $: $1?$2        find the rightmost '!'
  860. XR$+?$+!$+        $1!$2?$3        ..and change it into a '?'
  861. XR$+?$+@$+        $: $1!$3!$2        change last u@h to h!u if any
  862. XR$+?$+            $: $1!$2        just remove '?' otherwise
  863. X
  864. X# The address is now formatted as a!b!..!h!u -- transform it into a,@b,@..?h?u
  865. XR$+!$+            $: ?$1?$2        find last h!u-pair
  866. XR$*?$+?$+!$+        $1,@$2?$3?$4        change all '!'s before to ',@'
  867. XR?$+?$+            $: $2@$1        h!u => u@h
  868. XR,$+?$+?$+        $: $1:$3@$2        ,path..h!u => path:u@h
  869. X
  870. Xifdef({DOMAINTABLE},{
  871. X# Infer .UUCP domain on first host if unqualified and not known in domaintable
  872. XR@$-$=Z$+        $@ @$(N $1 $: $1.UUCP $)$2$3    domainify route
  873. XR@$+            $@ @$1                already has domain
  874. XR$+@$-            $@ $1@$(N $2 $: $2.UUCP $)    domainify host
  875. X},{
  876. XR@$-$=Z$+        $@ @$1.UUCP$2$3            assume .UUCP
  877. XR$+@$-            $@ $1@$2.UUCP            dito
  878. X})
  879. X
  880. X#########################################################################
  881. X#                                    #
  882. X#    Rule Set #22:    General Pathalias Router            #
  883. X#                                    #
  884. X#    Tries to find a route for an address using the pathalias    #
  885. X#    database.  It will return the complete (canonicalized)        #
  886. X#    route if found, or the same address otherwise.            #
  887. X#                                    #
  888. X#########################################################################
  889. XS22
  890. X
  891. Xifdef({PATHTABLE},{
  892. X# Change RFC822 Source Routes into %-path to get rid of multiple atsigns
  893. XR$+@$+@.$+    $:$>25 $1@$2@.$3            Src Route to %-path
  894. X
  895. X# Search pathalias database
  896. XR$+@.$+        $: $(P  $2 $@$1          $:$1@?$2 $)    1st: try full d
  897. omain
  898. XR$+@$*?$-.$+    $(P .$3.$4 $@$1%$2.$3.$4 $:$1@$2.$3?$4 $)    2nd: subdomains
  899. XR$+@.$+?$-    $: $(P .$3 $@$1%$2.$3    $:$1@?$2.$3 $)    3rd: try top domain
  900. X
  901. X# Found a route?
  902. XR$+@?$+        $@ $1@.$2                failure: return
  903. XR$+%.$+        $1%$2                    success: remove
  904.  '.'
  905. X
  906. X# Yes, canonicalize result
  907. XR$+@$+        $@$>3 $1@$2                canonicalize domains
  908. XR$+!$+        $@$>3 $1!$2                canonicalize !-paths
  909. XR$+%$+        $@$>3 $1%$2                canonicalize %-paths
  910. XR$+        $@ $1@.$w                canonicalize users
  911. X})
  912. X
  913. X#########################################################################
  914. X#                                    #
  915. X#    Rule Set #23:    Route prettyprinter & compressor.        #
  916. X#                                    #
  917. X#    This code rewrities RFC822 Source Routes into %-routes, which    #
  918. X#    most users and mail FEs understand better.  It also comresses    #
  919. X#    "obvious" routes whenever considered necessary -- mostly just    #
  920. X#    for aesthetical reasons, though.  If you don't like this, feel    #
  921. X#    free to disable it.  Sendmail shouldn't break, anyway.  (But    #
  922. X#    there will probably be others...)
  923. X#                                    #
  924. X#########################################################################
  925. XS23
  926. X
  927. X# Turn RFC822 Source Route into %-path
  928. XR$+@$+@.$+        $:$>25 $1@$2@.$3
  929. X
  930. X# Remove route to well-known domain
  931. XR$+%$+.$=T$=Y$+        $:$>3 $1%$2.$3        known top domain
  932. X
  933. X# Strip routes through well-known UUCP relays
  934. XR$+%$-@.$=R        $:$>3 $2!$1        known UUCP relay
  935. X
  936. X# LOCAL FIX: Strip header %-routes that paranoid instances of MM produce
  937. XR$+%aida%$+@.majestix.liu.se    $@ $1@.$(N aida $)    AIDA's MM does this
  938. XR$+%carmen%$+@.majestix.liu.se    $@ $1@.$(N carmen $)    CARMEN's too
  939. X
  940. X
  941. X#########################################################################
  942. X#                                    #
  943. X#    Rule Set #24:    Unqualify domains for DECnet nodes        #
  944. X#                                    #
  945. X#    This is needed since DECnet has a flat namespace.  All DECnet    #
  946. X#    nodes that are [externally] known to have a certain domain    #
  947. X#    name are unqualified to their corresponding DECnet host name.    #
  948. X#                                    #
  949. X#########################################################################
  950. XS24
  951. X
  952. Xifdef({DECNETXTABLE}, {
  953. XR$+            $: ?$1            mark beginning of addrs
  954. XR$*?$*$=X$+$=Y$*    $1$2$3$(D $4 $)?$5$6    scan & lookup domains
  955. XR$*?$*@.$+        $1$2@.$(D $3 $)        lookup direct domain
  956. X})
  957. X# LOCAL FIX: The SUNET.SE domain only consists of DECnet nodes.
  958. XR$*$=X$-.SUNET.SE$=Y$*    $1$2$3$4$5        *.SUNET.SE are on DECnet
  959. XR$+@.$-.SUNET.SE    $1@.$2            dito
  960. X
  961. X
  962. X#########################################################################
  963. X#                                    #
  964. X#    Rule Set #25:    Translate RFC822 Source Routes into %-Paths    #
  965. X#                                    #
  966. X#    This ruleset takes a (perhaps internalized) RFC822 Source    #
  967. X#    Route and translates it into it's %-kludgified equivalent.    #
  968. X#    Non-RFC822 Source Routes should pass through unharmed.        #
  969. X#                                    #
  970. X#    Eg: [u@h@.a    =>] @a:u@h    => u%h@a            #
  971. X#        [@b:u@h@.a    =>] @a,@b:u@h    => u%h%b@a            #
  972. X#      [@c,@b:u@h@.a    =>] @a,@b,@c:u@h => u%h%b%a%c@d            #
  973. X#                                    #
  974. X#########################################################################
  975. XS25
  976. X
  977. X# Take care of internal mbox@.domain format
  978. XR@$+:$+@$+@.$+    $: @$4,@$1:$2@$3        move @.domain to front
  979. XR$+@$+@.$+    $: @$3:$1@$2            dito
  980. X
  981. X# Address is now real RFC822 Source Route--make sure user isn't !-path
  982. XR$+:$+@$+    $: $1:$>4$>3 $2@$3        canonicalize last user@host
  983. XR$+:$+:$+@$+    $: $1,$2:$3@$4            merge possible double Src Route
  984. X
  985. X# Finally, the actual translation
  986. XR$+:$+@$+    $: $1:$2%$3?            path:u@.h => path:u%h + mark
  987. XR$+:$+@        $: $1:$2?            path:u@ => path:u + mar
  988. k
  989. XR@$+$=Z$+?$*    $3?%$1$4            rotate & concat
  990. XR$+%$+?$*    $1@.$2$3            instantiate '%' & remove mark
  991. XR$+@.$+%$+    $1%$2@.$3            move gaze right
  992. X
  993. X
  994. X#########################################################################
  995. X#                                    #
  996. X#    Rule Set #26:    Determine Mailer for Address            #
  997. X#                                    #
  998. X#    Takes an address in canonical format as input and returns    #
  999. X#    a complete mailer specification if a mailer is known for    #
  1000. X#    the supplied domain.  Just returns the address otherwise.    #
  1001. X#                                    #
  1002. X#########################################################################
  1003. XS26
  1004. X
  1005. Xifdef({NEWALIASES}, {
  1006. X# Updating aliases database -- return all addresses as local
  1007. XR$+@.$w            $#LOCAL  $@$w $:$1        default host
  1008. XR$+@.$+            $#LOCAL  $@$2 $:$1@.$2        specified host
  1009. X})
  1010. X
  1011. X
  1012. X# Search for possible global alias
  1013. XR$+@.$+            $: $1@.$2 ? $>4$>10$>2 $1@.$2    externalize
  1014. XR$+?$+            $: $1 ? $(@ $2 $:$)        search aliases
  1015. XR$+@.$+?$+        $#LOCAL  $@$2 $:$1@.$2        found it!
  1016. XR$+?            $: $1                not found, remove mark
  1017. X
  1018. X# Deliver to locals right away
  1019. XR$+@.$=w        $#LOCAL  $@$2 $:$1
  1020. X
  1021. Xifdef({MAILERTABLE},{
  1022. X###
  1023. X###    Determine delivery over specific media
  1024. X###
  1025. XR$+@.$+            $: $1@.$2 ? $(M $2 $: $)    search mailer t
  1026. able
  1027. XR$+@.$+?$+:$+        $#$3     $@$4 $:$>28 $1@.$2    relativize & return
  1028. XR$+@.$+?$*        $: $1@.$2            no match, remove mark
  1029. X})
  1030. X
  1031. X###
  1032. X###    Determine delivery over TCP/IP
  1033. X###
  1034. XR$+@.$+            $: $1@.$2 ? $[ $2 $: $]        ask nameserver
  1035. XR$+@.$+?$+        $#TCP    $@$3 $:$>28 $1@.$2    relativize & return
  1036. XR$+@.$+?$*        $: $1@.$2            no match, remove mark
  1037. X
  1038. X###
  1039. X###    Determine delivery over DECnet
  1040. X###    (Kludge: Should relativize too if we had a real DECnet connection)
  1041. X###
  1042. XR$+@.$+            $: $1@.$2 ? $(D $2 $: $)    check DECnet ta
  1043. ble
  1044. XR$+@.$+?$=D        $#DECnet $@$3 $:$1@.$2        only return real ones
  1045. XR$+@.$+?$*        $: $1@.$2            not found, remove mark
  1046. X
  1047. X###
  1048. X###    Determine delivery over UUCP
  1049. X###    (Can't use ruleset 28 since we need to relativize immediate users)
  1050. X###
  1051. Xifdef({UUCPXTABLE},{
  1052. XR$+@.$+            $: $1@.$2 ? $(U $2 $: $)    check UUCP tabl
  1053. e
  1054. XR$+@.$+?$=U        $: $1@.$3            replace if found real
  1055. XR$+@.$+?$*        $: $1@.$2            not found, remove mark
  1056. X})
  1057. XR$+@.$=U.UUCP        $: $1@.$2.UUCP            remove pseudo domain
  1058. XR$+%$+@.$=U        $#UUCP   $@$3 $:$>3 $1%$2    (canonicalize routes)
  1059. XR$+@$+@.$=U        $#UUCP   $@$3 $:$>3 $1@$2    (canonicalize routes)
  1060. XR$+@.$=U        $#UUCP   $@$2 $:$1        (immediate delivery)
  1061. X
  1062. X
  1063. X#########################################################################
  1064. X#                                    #
  1065. X#    Rule Set #27:    Simple %-Path to !-Paths Translator        #
  1066. X#                                    #
  1067. X#    Subroutine of other address translators.  Will change a        #
  1068. X#    "a!b!c%d%e" path into "e!d!a!b!c".  Typically used when        #
  1069. X#    a message have travelled from UUCP-land into Domain land    #
  1070. X#    (and back again).                        #
  1071. X#                                    #
  1072. X#########################################################################
  1073. XS27
  1074. X
  1075. XR$+%$+            $: $1?$2        mark first %
  1076. XR$+?$+%$+        $1%$2?$3        find last %
  1077. XR$+?$+!$+        $@ $1%$2!$3        this is weird--don't change it
  1078. XR$+?$+            $: $2!$>27 $1        put on front and recurse
  1079. X
  1080. X
  1081. X#########################################################################
  1082. X#                                    #
  1083. X#    Rule Set #28:    One-level route stripper            #
  1084. X#                                    #
  1085. X#    Remove immediate host for routed addresses.  Typically used    #
  1086. X#    in ruleset 26 to produce a recipient relative to the immediate    #
  1087. X#    host.                                #
  1088. X#                                    #
  1089. X#########################################################################
  1090. XS28
  1091. X
  1092. XR$+@$+@.$+        $@$>3 $1@$2        relativize & return src route
  1093. XR$+%$+@.$+        $@$>3 $1@$2        relativize & return %-path
  1094. END_OF_ida/cf/Sendmail.mc
  1095. if test 36429 -ne `wc -c <ida/cf/Sendmail.mc`; then
  1096.     echo shar: \"ida/cf/Sendmail.mc\" unpacked with wrong size!
  1097. fi
  1098. # end of overwriting check
  1099. fi
  1100. echo shar: End of archive 5 \(of 7\).
  1101. cp /dev/null ark5isdone
  1102. MISSING=""
  1103. for I in 1 2 3 4 5 6 7 ; do
  1104.     if test ! -f ark${I}isdone ; then
  1105.     MISSING="${MISSING} ${I}"
  1106.     fi
  1107. done
  1108. if test "${MISSING}" = "" ; then
  1109.     echo You have unpacked all 7 archives.
  1110.     echo "See ida/README and ida/INSTALL for further instructions."
  1111.     rm -f ark[1-9]isdone
  1112. else
  1113.     echo You still need to unpack the following archives:
  1114.     echo "        " ${MISSING}
  1115. fi
  1116. ##  End of shell archive.
  1117. exit 0
  1118.