home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / unix / volume3 / gatech / part02 < prev    next >
Internet Message Format  |  1986-11-30  |  25KB

  1. From: Gene Spafford <genrad!linus!gatech!spaf>
  2. Subject: GaTech Sendmail (Part 2 of 3)
  3. Newsgroups: mod.sources
  4. Approved: jpn@panda.UUCP
  5.  
  6. Mod.sources:  Volume 3, Issue 24
  7. Submitted by: Gene Spafford <ihnp4!gatech!spaf>
  8.  
  9.  
  10. #! /bin/sh
  11.  
  12. # Make a new directory for these sources, cd to it, and run kits 1 thru 3 
  13. # through sh.  When all 3 kits have been run, read README.
  14.  
  15. echo "This is GaTech Sendmail kit 2 (of 3).  If kit 2 is complete, the line"
  16. echo '"'"End of kit 2 (of 3)"'" will echo at the end.'
  17. echo ""
  18. export PATH || (echo "You didn't use sh, you clunch." ; kill $$)
  19. echo Extracting overview.ms
  20. cat >overview.ms <<'!STUFFY!FUNK!'
  21. .TL
  22. Mail Handling at Gatech
  23. .br
  24. Revision II
  25. .AU
  26. Gene Spafford
  27. .AI
  28. School of Information and Computer Science
  29. Georgia Institute of Technology
  30. 23 September 1985
  31. .PP
  32. Site "gatech" is running a "smart" version of sendmail.  I have 
  33. hacked at the sendmail configuration files extensively, and although
  34. they are not yet doing 100% of what I want, they seem to work pretty well
  35. and handle our many (sometimes unusual) mail needs.
  36. What follows are brief descriptions of what happens to various bits of
  37. mail passing through our site. 
  38. .PP
  39. There have been some changes since the last time I circulated this
  40. document.  Most of the changes have been inspired (?) by the changes
  41. to sendmail done at Rutgers which allow "sendmail" to distinguish
  42. the source of incoming mail with mixed syntax addresses (e.g., a!b@c),
  43. and which rewrite the names of Internet hosts into the preferred form
  44. (as given in the /etc/hosts table, derived from NIC data).
  45. .NH 1
  46. Why
  47. .PP
  48. Site "gatech" is directly on the uucp network
  49. (with over 75 contacts and acting as a de facto name server for a
  50. "southeast US domain"), the CSNet, and we serve as gateway for
  51. our local networks.  We also have network traffic with some other
  52. major networks, and we might possibly get BITNET and ARPA access in
  53. the not-too-distant future, from "gatech" or some other campus machines.
  54. We'd like to have as complete and robust
  55. a mailing environment as possible.  At the same time, we'd like
  56. to minimize our current phone bills as they are related to UUCP mail 
  57. traffic.
  58. .NH 1
  59. Routing
  60. .NH 2
  61. Known Domains
  62. .PP
  63. Currently, there is considerable effort going on to identify and
  64. establish domains for mailing.  Some of these domains are already
  65. established, if only in a de facto manner.  Our sendmail
  66. currently recognizes the following well-known domains: ARPA, CSNET,
  67. GOV, EDU, COM, MIL, ORG, NET,
  68. UUCP, BITNET, DEC, and MAILNET.  The following 
  69. are also recognized when used as top-level domains:
  70. GTNET (local to Georgia Tech), OZ (the Australian network),
  71. TEK (recognized internal to Tektronix), and SDC (with sdcrdcf as the gateway).
  72. .PP
  73. There are a number of other "domains" that are recognized when used
  74. in a second-level position within a uucp address.  That is, we
  75. recognize person@site.ATT.UUCP as something that should be
  76. directed to cbosgd via uucp for further resolution.  This recognition
  77. is done by building psuedo-sites into the uucp routing database
  78. based upon the data distributed by the uucp map project.  
  79. Among domains recognized like this are NCAL, SCAL, ATL, ATT, UK, and
  80. so on; the list may change based on updates to the map.
  81. (As an aside, at the time of this writing, "gatech" is one of
  82. the regional repositories of the current map, and we get automatic
  83. updates whenever the "real" map gets changed.)
  84. .PP
  85. In the following descriptions, any of the above can be used in
  86. place of a "DOMAIN" specifier.
  87. .NH 2
  88. user@host[.DOMAIN] -and- user%host[.DOMAIN]
  89. .PP
  90. If mail comes in addressed specifically to one of the known domains,
  91. it is routed as described in the next section without any further
  92. changes.  If the domain is not given, an attempt is made to derive
  93. the domain based on available lists of host names and aliases,
  94. and then routed as described in the next section.  If no host/domain
  95. match can be found, the mail is returned with an error stating this.
  96. .NH 3
  97. Domain Derivation
  98. .PP
  99. Host derivation is attempted in the following order:  First, the
  100. host is checked to see if it is in the GTNET domain.  Next, the
  101. host is checked to see if it is a host one hop away via UUCP.  Next,
  102. the host is checked against all CSNET sites.  Then it is checked
  103. against all Arpa/Internet sites. Next, it is checked against the list of
  104. known MAILNET hosts. Then it is checked against the list of all (other) known
  105. UUCP sites. Then it is checked against the list of
  106. known BITNET hosts.  Finally, it is checked against the list
  107. of known DEC E-net sites.  
  108. .PP
  109. This kind of checking is not 100% accurate because our lists are not
  110. always up-to-date.  In particular, the Arpa list is updated infrequently
  111. due to the fact that we aren't actually on the Arpanet, and there is no
  112. list of DEC net sites available outside of DEC (we make due with
  113. gleaning names from posted news articles and exchanges with other sites
  114. interested in compiling such a list).
  115. .NH 3
  116. Collisions
  117. .PP
  118. If the same hostname exists in more than one domain, the first match
  119. found will be the one used.  Qualification of the address with an
  120. explicit domain specifier will ensure that the mail goes to the
  121. correct host (when routed through gatech).  That is, the domain
  122. is considered to be the specifer for routing and if one is not
  123. explicitly provided (or implicitly, as in the case of "!" notation),
  124. then an attempt to made to guess a domain.
  125. .NH 2
  126. host1!host2!host3...!hostn!user
  127. .PP
  128. Starting with "hostn" and working backwards to "host1" our mailer
  129. will attempt to find a host listed in our master UUCP path database.
  130. This database is generated using pathalias at least weekly based on the latest
  131. version of the uucp maps.  If a match is found at "hostk", then the 
  132. address is rewritten to be "<path to hostk>!hostk!...hostn!user"
  133. and then mailed via UUCP.  Such addresses are NEVER routed over
  134. any other network, unless "hostn" is recognized to be a GTNET
  135. host, in which case our internal transport mechanism is invoked.
  136. .PP
  137. There is NO way at present to force a path on UUCP mail through "gatech".
  138. This is perhaps a "not very good thing" but I can't come up with a good
  139. way to work in explicit paths.  The map data is generally very good
  140. and I have observed very, very few failures since we first started
  141. doing this rewriting about 6 months ago.  If this presents a
  142. major problem for someone, let me know and I'll see what I can work out.
  143. .NH 2
  144. host1!host2!host3...!hostn!user@site[.DOMAIN]
  145. .br
  146. host1!host2!host3...!hostn!user%site[.DOMAIN]
  147. .PP
  148. This one diverges somewhat from the standard (RFC822 et.al.).  
  149. The way these addresses get treated is based on the way the mail
  150. gets into our "sendmail."  If the message originates on any of the
  151. local (GTNET) machines, or if it comes in via PMDF from CSNet, then
  152. the mail is routed to "site" for eventual delivery to host1!...hostn!user.
  153. Mail coming in via a UUCP link with a mixed-mode address like this will
  154. have the mail routed via uucp to hostn for eventual delivery to
  155. user@site.  Thus, if one of our neighbors, such as someone at akgua,
  156. were to send mail to us addressed as seismo!person@ucbvax.ARPA, we would
  157. send the mail to seismo via uucp and present it to their "rmail"
  158. program as "rmail person@ucbvax.ARPA".
  159. .PP
  160. On the other hand, should someone on gitpyr send mail addressed
  161. as seismo!person@ucbvax.ARPA, it would arrive at Gatech via SMTP and
  162. then be sent to CSNet-relay via PMDF for delivery to site "ucbvax" with
  163. a request to be delivered to "seismo!person" relative to that site.
  164. In most cases, depending on the sites involved,
  165. this kind of treatment would result in the mail failing.  The sendmail
  166. configurations I have created for all the local GTNET sites are such
  167. that it should not be required to specify such an address.  Simply
  168. mailing to person@site should see the correct address and network
  169. transport mechanism chosen.  The Usenet "news" programs on most of these
  170. sites have been built to use the Internet-style of address when
  171. mailing replies, so there should be few cases of users even seeing mixed
  172. mode addresses presented to them (mail passing through any of the mailers
  173. gets rewritten to show a consistent format).
  174. .NH 2
  175. user%site1%site2%site3
  176. .PP
  177. Addresses of this format get turned into user%site1%site2@site3,
  178. and an appropriate routing is provided to "site3," if known.
  179. .NH 2
  180. Other network characters
  181. .PP
  182. The ":" delimiter gets turned into "!" symbols in any address
  183. presented to our sendmail.
  184. The "^" delimiter gets turned into "!" also.  Addresses of the
  185. form "site=user" get turned into "user@site.BITNET" by convention.
  186. .NH 1
  187. Errors
  188. .PP
  189. I have tried to trap all possible errors and generate return mail
  190. with meaningful messages.  
  191. If you get errors you don't know how to interpret, please contact me.
  192. .NH 1
  193. Source
  194. .PP
  195. I posted an ancestor of my current sendmail files to "mod.sources" a
  196. few months ago.  If these latest versions appear stable, I will post
  197. them to the same place.  If you'd like a copy right away, let me know.
  198. This includes the sendmail files for all the local GTNET machines, and
  199. the source for my "uumail" program which sits between sendmail and
  200. uux.
  201. !STUFFY!FUNK!
  202. echo Extracting uumail.c
  203. cat >uumail.c <<'!STUFFY!FUNK!'
  204. /* uumail.c --- uucp remailer
  205.  *    EHS 4/2/85
  206.  *      Added rebuild sentinel and better error handling 10/13/85
  207.  *
  208.  * Compile as:
  209.  *    cc -O -s uumail.c -ldbm -o uumail
  210.  *
  211.  *  Usage:
  212.  *    usually called from sendmail in the following form:
  213.  *      uumail -f from addr < message
  214.  *    "from" is the address of the sender, and is passed to "uux"
  215.  *       in case of a remote error
  216.  *    "addr" is an address in the following form:
  217.  *        site!site!site!user
  218.  *     and "user" can take on any form not containing a "!"
  219.  *
  220.  *     If a "-D" is used instead of a "-f", no mail will be sent
  221.  *     and various bits of diagnostic info will be printed to the
  222.  *     standard error output.  Messages that would normally be
  223.  *     printed at the console are also printed to stderr, in this
  224.  *     case.  The body of the message is also dumped to stderr.
  225.  *
  226.  *     At least one "!" MUST be present in the address or else it will 
  227.  *     be considered an error.
  228.  *
  229.  *    The address is rewritten for the first applicable site
  230.  *    found in the database.  If the path cannot be rewritten,
  231.  *    an error code is returned along with a message indicating
  232.  *    the problem.
  233.  *
  234.  *    If the special sentinel value of @@@ is not present in the
  235.  *    database, then it is assumed that the database is being
  236.  *    rebuilt and the requesting process is blocked for TIMEOUT
  237.  *    (default = 180) seconds.  If, after 5 such blocks, the
  238.  *    sentinel is not present, an error message is logged to
  239.  *    the console, and the error code EX_TEMPFAIL is returned.
  240.  *    The same is true if the dbm files cannot be initialized.
  241.  *
  242.  *    Note:
  243.  *     The "uux" flags given below are for 4.3 BSD uucp and
  244.  *    may not exist for your version of uucp.  Note especially
  245.  *     that the "-L" flag may not be present in earlier versions
  246.  *    (meaning to crank up uucico for a local call, otherwise
  247.  *    just queue it).
  248.  *
  249.  *    Special defines:
  250.  *      PATHFILE is the basename of the dbm path database.
  251.  *      LOGF  if defined is where a log of uucp mail is kept
  252.  *      TIMEOUT is the sleep(2) time, in seconds, to wait
  253.  *         if the database is unavailable or incomplete.
  254.  *      CONSOLE is the pathname of the file to report major errors
  255.  *      MYSITE is the site name to be used in reporting errors
  256.  *       via returned mail; if not defined, the sitename is
  257.  *        derived from a call to gethostname(2)
  258.  *    UUX is a sprintf(3) format string used to remotely execute
  259.  *       the rmail command on the next system.
  260.  *      SENTINEL is the special "sitename" to look for in the
  261.  *       path database to indicate a complete database
  262.  */
  263.  
  264. #include <ctype.h>
  265. #include <dbm.h>
  266. #include <stdio.h>
  267. #include <sysexits.h>
  268.  
  269. #ifndef PATHFILE
  270. #define PATHFILE  "/usr/lib/mail/uucp.hosts"
  271. #endif PATHFILE
  272.  
  273. #ifndef CONSOLE
  274. #define CONSOLE   "/dev/console"
  275. #endif CONSOLE
  276. FILE *console;
  277.  
  278. #ifndef TIMEOUT
  279. #define TIMEOUT ((unsigned) 180)
  280. #endif TIMEOUT
  281.  
  282. #ifndef UUX
  283. #define UUX "/usr/bin/uux -p -a%s -L -gM %s!rmail \\(%s\\)\n"
  284. #endif UUX
  285.  
  286. #ifndef SENTINEL
  287. #define SENTINEL "@@@"
  288. #endif SENTINEL
  289.  
  290. extern char *malloc (), *rindex (), *index ();
  291. extern char *strcpy (), *strcat ();
  292. extern int strlen ();
  293. extern  FILE *popen ();
  294.  
  295. datum key, result;
  296. char    workbuf[512];
  297. char   *destination,
  298.        *sender;
  299.  
  300. int     debug;
  301.  
  302. #ifdef LOGF
  303. FILE    *logfile;
  304. #endif LOGF
  305.  
  306.  
  307. main (argc, argv)
  308. int     argc;
  309. char  **argv;
  310. {
  311.     register char  *stp,
  312.                    *rtp;
  313.     int     indx, retval;
  314.     extern  void die (), checkpath ();
  315.  
  316.  
  317.     destination = argv[3];    /* given destination (and user) */
  318.     sender = argv[2];        /* given sender */
  319.  
  320.     if (argc != 4)
  321.     die ("called with incorrect number of arguments.", EX_USAGE);
  322.     debug = (argv[1][1] == 'D');
  323.  
  324.     console = fopen (CONSOLE, "a");
  325.     if ((console == NULL) || debug)
  326.     console = stderr;
  327.  
  328. #ifdef LOGF
  329.     logfile = fopen (LOGF, "a");
  330.     if (logfile == NULL)
  331.     {
  332.     fprintf (console, "\n*** uumail: Unable to open logfile %s\n", LOGF);
  333.     logfile = console;
  334.     }
  335.     fprintf (logfile, "%s\t%s\t", sender, destination);
  336. #endif LOGF
  337.  
  338.     for (indx = 0; indx < 5; indx++)
  339.     {
  340.     if ((retval = dbminit (PATHFILE)) >= 0)
  341.         break;
  342.     
  343.     if (debug)
  344.         fprintf (stderr, "Database unavailable.  Sleeping.\n");
  345.     sleep (TIMEOUT);
  346.     }
  347.  
  348.     if (retval < 0)
  349.     die ("could not open routing database files.", EX_TEMPFAIL);
  350.  
  351.     key.dptr = SENTINEL;
  352.     key.dsize = strlen (SENTINEL) + 1;
  353.     for (indx = 0; indx < 5; indx++)
  354.     {
  355.     result = fetch (key);
  356.     if (result.dsize > 0)
  357.         break;
  358.     
  359.     if (debug)
  360.         fprintf (stderr, "Database incomplete.  Sleeping.\n");
  361.     sleep (TIMEOUT);
  362.     }
  363.     if (result.dsize <= 0)
  364.     die ("routing database files incomplete or truncated.",
  365.         EX_TEMPFAIL);
  366.  
  367.  
  368. /* Now we back up through the address until we find a site we
  369.  * know how to reach.  If we don't find any, it's an error.
  370.  */
  371.  
  372.     strcpy (workbuf, destination);
  373.  
  374.     if (!(rtp = rindex (workbuf, '!')))
  375.     die ("address in improper format.", EX_DATAERR);
  376.  
  377.     *rtp = '\0';
  378.     while (stp = rindex (workbuf, '!'))
  379.     {
  380.     checkpath (rtp + 1, stp + 1, (int) (rtp - stp));
  381.     *rtp = '!';
  382.     rtp = stp;
  383.     *rtp = '\0';
  384.     }
  385.     checkpath (rtp + 1, workbuf, (int) (rtp - workbuf) + 1);
  386.  
  387.  /* If we got to here, we don't have a path */
  388.  
  389.     *rtp = '!';
  390.     die ("Unable to find path to any host in pathname.", EX_NOHOST);
  391. }
  392.  
  393.  
  394. /*  This routine does all the work.  If it finds a path it immediately
  395.  *  will go ahead and do the mailing and exit.
  396.  */
  397.  
  398. void checkpath (user, site, len)
  399. char   *user,
  400.        *site;
  401. int     len;
  402. {
  403.     FILE * pipfd;
  404.     int     comlen;
  405.     char   *address,
  406.            *restol,
  407.            *command;
  408.  
  409.     key.dptr = site;
  410.     key.dsize = len;
  411.     result = fetch (key);
  412.     if (result.dsize <= 0)
  413.     return;       /* result <= 0 implies no match */
  414.  
  415.  /* rewrite here */
  416.     comlen = strlen (user) + result.dsize;
  417.     address = malloc ((unsigned) comlen);
  418.     if (address == NULL)
  419.     die ("malloc cannot get memory for new address.\n", EX_SOFTWARE);
  420.  
  421.     sprintf (address, result.dptr, user);
  422. #ifdef LOGF
  423.     fprintf (logfile, "%s\n", address);
  424. #endif LOGF
  425.     comlen = strlen (address) + strlen (UUX) + 4;
  426.     command = malloc ((unsigned) comlen);
  427.     if (command == NULL)
  428.     die ("malloc cannot get memory for uux command line.\n", EX_SOFTWARE);
  429.  
  430.     if ((restol = index (address, '!')) != NULL)
  431.     *restol++ = '\0';
  432.     sprintf (command, UUX, sender, address, restol);
  433.     if (debug)
  434.     {
  435.     fprintf (stderr, "Command that would be executed: %s\n", command);
  436.     pipfd = stderr;
  437.     }
  438.     else
  439.     {
  440.     pipfd = popen (command, "w");
  441.     if (pipfd == NULL)
  442.         die ("cannot open pipe with popen(3).", EX_SOFTWARE);
  443.     }
  444.  
  445.     while (fgets (workbuf, sizeof (workbuf), stdin))
  446.     fputs (workbuf, pipfd);
  447.  
  448.     comlen = debug == 0 ? pclose (pipfd) : 0;
  449.     if (comlen)
  450.     {
  451.     sprintf (workbuf, "execution of uux returned with error status %d",
  452.         comlen);
  453.     die (workbuf, EX_UNAVAILABLE);
  454.     }
  455.  
  456.     exit (EX_OK);
  457. }
  458.  
  459.  
  460. void die (message, errcode)
  461. char   *message;
  462. int     errcode;
  463. {
  464. #ifdef MYSITE
  465.     char   *mysite = MYSITE;
  466. #else
  467.     char    mysite[64];
  468.     gethostname (mysite, 64);
  469. #endif
  470.  
  471.  
  472. #ifdef LOGF
  473.     fprintf (logfile, "Error: %s\n", message);
  474. #endif LOGF
  475.  
  476.     fprintf (console, "\n\07*** Error in uumail!\n");
  477.     fprintf (console, "    %s\n", message);
  478.     fprintf (console, "    Mail from %s to %s being returned.\n\n", sender,
  479.         destination);
  480.  
  481.     fprintf (stderr, "Mailer at \"%s\": %s\n", mysite, message);
  482.     exit (errcode);
  483. }
  484. !STUFFY!FUNK!
  485. echo Extracting base.m4
  486. cat >base.m4 <<'!STUFFY!FUNK!'
  487. ############################################################
  488. #
  489. #  General configuration information
  490. #
  491. #  This information is basically just "boiler-plate"; it must be
  492. #  there, but is essentially constant.
  493. #
  494. #  Information in this file should be independent of location --
  495. #  i.e., although there are some policy decisions made, they are
  496. #  not specific to Gatech per se.
  497. #
  498. #  $Header: base.m4,v 5.1 85/10/13 20:45:34 spaf Release $
  499. #
  500. ############################################################
  501.  
  502. include(version.m4)
  503.  
  504. ##########################
  505. ###   Special macros   ###
  506. ##########################
  507.  
  508. # my name
  509. DnMAILER-DAEMON
  510. # UNIX header format
  511. DlFrom $g  $d
  512. # delimiter (operator) characters
  513. Do.:%@!^=/[]
  514. # format of a total name
  515. Dq$?x$x $.<$g>
  516. # SMTP login message
  517. De$j Sendmail $v/$V ready at $b
  518.  
  519. ###################
  520. ###   Options   ###
  521. ###################
  522.  
  523. # location of alias file
  524. OA/usr/lib/aliases
  525. # default delivery mode (deliver in background)
  526. Odbackground
  527. # (don't) connect to "expensive" mailers
  528. Oc
  529. # temporary file mode
  530. OF0600
  531. # default GID
  532. Og1
  533. # location of help file
  534. OH/usr/lib/sendmail.hf
  535. # log level
  536. OL2
  537. # default messages to old style
  538. Oo
  539. # queue directory
  540. OQ/usr/spool/mqueue
  541. # read timeout -- violates protocols
  542. Or2h
  543. # status file
  544. OS/usr/lib/sendmail.st
  545. # queue up everything before starting transmission
  546. Os
  547. # Queue when we're busy (x) and refuse SMTP when really busy (X)
  548. Ox15
  549. OX20
  550. # default timeout interval
  551. OT5d
  552. # time zone names (V6 only)
  553. OtEST,EDT
  554. # default UID
  555. Ou1
  556. # wizard's password
  557. OWa/FjIfuGKXyc2
  558.  
  559. ###############################
  560. ###   Message precedences   ###
  561. ###############################
  562.  
  563. Pfirst-class=0
  564. Pspecial-delivery=100
  565. Pjunk=-100
  566.  
  567. #########################
  568. ###   Trusted users   ###
  569. #########################
  570.  
  571. Troot
  572. Tdaemon
  573. Tuucp
  574. Tnetwork
  575.  
  576. #############################
  577. ###   Format of headers   ###
  578. #############################
  579.  
  580. H?P?Return-Path: <$g>
  581. HReceived: $?sfrom $s $.by $j ($v/$V)
  582.     id $i; $b
  583. H?D?Resent-Date: $a
  584. H?D?Date: $a
  585. H?F?Resent-From: $q
  586. H?F?From: $q
  587. H?x?Full-Name: $x
  588. HSubject:
  589. HPosted-Date: $a
  590. # H?l?Received-Date: $b
  591. # H?M?Resent-Message-Id: <$t.$i@$j>
  592. H?M?Message-Id: <$t.$i@$j>
  593.  
  594. ###########################
  595. ###   Rewriting rules   ###
  596. ###########################
  597.  
  598.  
  599. ################################
  600. #  Sender Field Pre-rewriting  #
  601. ################################
  602. S1
  603.  
  604. ###################################
  605. #  Recipient Field Pre-rewriting  #
  606. ###################################
  607. S2
  608.  
  609. #################################
  610. #  Final Output Post-rewriting  #
  611. #################################
  612. S4
  613.  
  614. R@            $@                handle <> error addr
  615.  
  616. # externalize local domain info
  617. R$*<$*LOCAL>$*        $1<$2$D>$3            change local info
  618. R$*<$+>$*        $1$2$3                defocus
  619. R$*$=S:$*        $1$2!$3
  620. R@$+:$+:$+        $@@$1,$2:$3            <route-addr> canonical
  621.  
  622. # delete duplicate local names -- mostly for arpaproto.mc
  623. R$+%$=w@$=w        $1@$3                u%UCB@UCB => u@UCB
  624. R$+%$=w@$=w.$=D        $1@$3.$D            u%UCB@UCB => u@UCB
  625.  
  626. # clean up uucp path expressions (some)
  627. R$*!$*@$*.UUCP        $3!$1!$2
  628.  
  629. ###########################
  630. #  Name Canonicalization  #
  631. ###########################
  632. S3
  633.  
  634. # handle "from:<>" special case
  635. R<>            $@@                turn into magic token
  636. R$*$=S:$=S$*        $1$3$4
  637. R$*$=S!$=S$*        $1$3$4
  638.  
  639. # basic textual canonicalization
  640. R$*<$+>$*        $2                basic RFC821/822 parsing
  641. R$+ at $+        $1@$2                "at" -> "@" for RFC 822
  642. R$*<$*>$*        $1$2$3                in case recursive
  643.  
  644. # make sure <@a,@b,@c:user@d> syntax is easy to parse -- undone later
  645. R@$+,$+            @$1:$2                change all "," to ":"
  646.  
  647. # localize and dispose of domain-based addresses
  648. R@$+:$+            $@$>6<@$1>:$2            handle <route-addr>
  649.  
  650. # more miscellaneous cleanup
  651. R$+            $:$>8$1                host dependent cleanup
  652. R$+:$*;@$+        $@$1:$2;@$3            list syntax
  653.  
  654. # Handle special case of received via uucp
  655. R$-!$*            $:<$&r>$1!$2            check arriving protocol
  656. R$-^$*            $:<$&r>$1!$2            both syntaxes
  657. R<UUCP>$-!$*        $@$>6$2<@$1.UUCP>        if via UUCP, resolve
  658. R<$*>$*            $2                undo kludge
  659. R$+@$+            $:$1<@$2>            focus on domain
  660. R$+<$+@$+>        $1$2<@$3>            move gaze right
  661. R$+<@$+>        $@$>6$1<@$2>            already canonical
  662.  
  663. # convert old-style addresses to a domain-based address
  664. R$+%$+            $:$1<@$2>            user%host
  665. R$+<@$+%$+>        $1%$2<@$3>            fix user%host1%host2
  666. R$+<@$+>        $@$>6$1<@$2>            leave
  667.  
  668. R$-:$+            $@$>6$2<@$1>            host:user
  669. R$-.$+            $@$>6$2<@$1>            host.user
  670. R$+^$+            $1!$2                convert ^ to !
  671. R$-!$+            $@$>6$2<@$1.UUCP>        resolve uucp names
  672. R$-=$+            $@$>6$2<@$1.BITNET>        resolve bitnet names
  673. !STUFFY!FUNK!
  674. echo Extracting MANIFEST
  675. cat >MANIFEST <<'!STUFFY!FUNK!'
  676. After all the sendmail kits are run you should have the following files:
  677.  
  678. Filename    Kit Description
  679. --------    --- -----------
  680. Files            1  Description of auxillary files in /usr/lib/mail
  681. KEY              3  Describes some of the macros and classes we use.
  682. MANIFEST         2  This file: directory of files.
  683. Makefile         3  Processes all our files.
  684. PATCHES          1  Some source code changes for sendmail and rmail
  685. README           1  Description of what files are and what they do.
  686. base.m4          2  "basic" information included with all configurations.
  687. cirrus.mc        3  Master configuration file for gt-cirrus Clouds machine.
  688. csether.m4       3  ICS ethernet definitions.
  689. etherm.m4        3  Actual definition of the Ethernet mail "channel".
  690. gatech.mc        3  Master configuration file for our main relay machine.
  691. gitpyr.mc        3  Master configuration file for ICS/OCS Pyramid.
  692. gt-cmmsr.mc      3  Master configuration file for MMR Vax.
  693. gtbase.m4        3  Specifics for GT mail.
  694. gtqo.mc          3  Master configuration for Physics Sun.
  695. gtss.mc          3  Master configuration for Physics Sun.
  696. localm.m4        3  Actual definition of the "local" mail channel.
  697. nimbus.mc        3  Master configuration for gt-nimbus Clouds machine.
  698. overview.ms      2  A description of mail routing and address munging
  699. pmdfm.m4         2  Definition of the pmdf mail "channel".
  700. short2.m4        3  Short ruleset 0 used by non-ICS sites.
  701. short3.m4        3  Short ruleset 0 used by Physics sites (Suns on ethernet).
  702. shortzero.m4     3  Short ruleset 0 used in ICS department sites.
  703. stratus.mc       3  Master configuration file for gt-stratus Clouds machine.
  704. uucpm.m4         3  Definition of the uucp mail "channel".
  705. uumail.c         2  Source for the uumail program (read the comments at the top)
  706. uumail.m4        3  Definition of the uucp optimizing mailer used on "gatech"
  707. version.m4       3  Define the sendmail version.
  708. zerobase.m4      3  Machine independent preamble for ruleset 0.
  709. !STUFFY!FUNK!
  710. echo Extracting pmdfm.m4
  711. cat >pmdfm.m4 <<'!STUFFY!FUNK!'
  712. ############################################################
  713. ############################################################
  714. #####
  715. #####        PMDF Phonenet Channel Mailer specification
  716. #####
  717. #####    $Header: pmdfm.m4,v 5.1 85/10/13 20:46:01 spaf Release $
  718. #####
  719. ############################################################
  720. ############################################################
  721.  
  722. Mpmdf,    P=/usr/local/lib/pmdf/pmdf-submit,    F=mDsFSn,    S=17, R=17,
  723.     M=65535, A=pmdf-submit -f $g $u
  724. #
  725. #    Notice that the PMDF mailer DOES NOT USE the host field. We
  726. #    set this host field to "CSNET-RELAY" in all instances where
  727. #    we call the PMDF mailer so as to be able to send one copy
  728. #    of a letter with a number of recipients.
  729. #
  730.  
  731. S17
  732.  
  733. # pass <route-addr>'s through
  734. R<@$+>$*        $@<@$1>$2            resolve <route-addr>
  735.  
  736. # map colons to dots everywhere.....
  737. R$*:$*            $1.$2                map colons to dots
  738.  
  739. # handle the simple case....
  740. R$+<@$+.$=K>        $@$>18$1<@$2.$3>        user@host.ARPA
  741. R$+<@$-.CSNET>        $@$1<@$2.CSNET>            user@host.CSNET
  742.  
  743. R$+<@LOCAL>        $@$1<@$R.CSNET>            local names
  744. R$+<@$+.LOCAL>        $@$1%$2<@$R.CSNET>        local notes
  745. R$+<@$*$=S>        $@$1%$2$3<@$R.CSNET>        more local hosts
  746.  
  747. # handle other external cases
  748. R$+<@$=X>        $@$1<@$2.UUCP>
  749. R$+<@$->        $@$1<@$2>    
  750. R$+<@$+.$-.$=T>        $@$1%$2<@$3.$4>            approximate something
  751. R$+<@[$+]>        $@$1<@[$2]>            already ok
  752.  
  753. # convert remaining addresses to old format and externalize appropriately
  754. #  We try to do nifty things to uucp addresses first
  755. R$+<@$-.UUCP>        $2!$1
  756. R$+!$+!$+        $2!$3
  757. R$+!$+            $@$2@$1.UUCP
  758.  
  759. R$-:$+            $@$1.$2<@$A>            convert berk hosts
  760. R$+<@$+>        $@$1%$2<@$A>            pessmize
  761. R$+            $:$1<@$R.CSNET>            tack on our hostname
  762. R$+%$=A<@$A>        $1<@$2>                strip out unneeded relay
  763.  
  764.  
  765. S18
  766.  
  767. R$*<$+>$*        $@$1<$%2>$3
  768. !STUFFY!FUNK!
  769. echo ""
  770. echo "End of kit 2 (of 3)"
  771. cat /dev/null >kit2isdone
  772. config=true
  773. for iskit in 1 2 3; do
  774.     if test -f kit${iskit}isdone; then
  775.     echo "You have run kit ${iskit}."
  776.     else
  777.     echo "You still need to run kit ${iskit}."
  778.     config=false
  779.     fi
  780. done
  781. case $config in
  782.     true)
  783.     echo "You have run all your kits.  Please read README."
  784.     ;;
  785. esac
  786. : I do not append .signature, but someone might mail this.
  787. exit
  788.  
  789.