home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1995 April / Internet Tools.iso / mail / sendmail / UCB / sendmail.8.6.4.patch.Z / sendmail.8.6.4.patch
Encoding:
Text File  |  1993-10-30  |  52.9 KB  |  2,127 lines

  1. Apply this patch to update an 8.6.3 sendmail to 8.6.4.
  2.  
  3. THIS IS A CRITICAL PATCH!  There were some bugs in 8.6.3 that caused
  4. core dumps and other serious problems.  It also includes some patches
  5. designed to completely thwart a class of security problems that have
  6. been causing a lot of grief recently.
  7.  
  8.  
  9. *** RELEASE_NOTES.OLD    Sun Oct 24 16:55:04 1993
  10. --- RELEASE_NOTES    Sun Oct 31 13:04:54 1993
  11. ***************
  12. *** 1,3 ****
  13. --- 1,51 ----
  14. + 8.6.4/8.6.4    93/10/31
  15. +     Repair core-dump problem (write to read-only memory segment)
  16. +         if you fall back to the return-to-Postmaster case in
  17. +         savemail.  Problem reported by Richard Liu.
  18. +     Immediately diagnose bogus sender addresses in SMTP.  This
  19. +         makes quite certain that crackers can't use this
  20. +         class of attack.
  21. +     Reliability Fix:  check return value from fclose() and fsync()
  22. +         in a few critical places.
  23. +     Minor problem in initsys() that reversed a condition for
  24. +         redirecting the output channel on queue runs.  It's
  25. +         not clear this code even does anything.  From Eric
  26. +         Wassenaar of the Dutch National Institute for Nuclear
  27. +         and High-Energy Physics.
  28. +     Fix some problems that caused queue runs to do "too much work",
  29. +         such as double-reading the Errors-To: header.  From
  30. +         Eric Wassenaar.
  31. +     Error messages on writing the temporary file (including the
  32. +         data file) were getting suppressed in SMTP -- this
  33. +         fix causes them to be properly reported.  From Eric
  34. +         Wassenaar.
  35. +     Some changes to support AF_UNIX sockets -- this will only
  36. +         really become relevant in the next release, but some
  37. +         people need it for local patches.  From Michael
  38. +         Corrigan of UC San Diego.
  39. +     Use dynamically allocated memory (instead of static buffers)
  40. +         for macros defined in initsys() and settime(); since
  41. +         these can have different values depending on which
  42. +         envelope they are in.  From Eric Wassenaar.
  43. +     Improve logging to show ctladdr on to= logging; this tells you
  44. +         what uid/gid processes ran as.
  45. +     Fix a problem that caused error messages to be discarded if
  46. +         the sender address was unparseable for some reason;
  47. +         this was supposed to fall back to the "return to
  48. +         postmaster" case.
  49. +     Improve aliaswait backoff algorithm.
  50. +     Portability patches for Linux (8.6.3 required another header
  51. +         file) (from Karl London) and SCO UNIX.
  52. +     CONFIG: patch prog mailer to not strip host name off of envelope
  53. +         addresses (so that it matches local again).  From
  54. +         Christopher Davis.
  55. +     CONFIG: change uucp-dom mailer so that "<>" translates to $n;
  56. +         this prevents uux from seeing lines with null names like
  57. +         ``From   Sat Oct 30 14:55:31 1993''.  From Motonori
  58. +         Nakamura of Kyoto University.
  59. +     CONFIG: handle <list:;> syntax correctly.  This isn't legal, but
  60. +         it shouldn't fail miserably.  From Motonori Nakamura.
  61.   8.6.3/8.6.3    93/10/24
  62.       IMPORTANT FIX: Fix several problems that caused open files to
  63.           be "lost" during queue runs; this overflowed the open
  64. *** KNOWNBUGS.OLD    Thu Oct 28 09:28:23 1993
  65. --- KNOWNBUGS    Sun Oct 31 11:39:06 1993
  66. ***************
  67. *** 43,51 ****
  68.     hub name.  Some sites might prefer to expose some names such as
  69.     root.  This information is always available in Received: lines.
  70.   
  71.   * If you EXPN a list or user that has a program mailer, the output of
  72.     EXPN will include ``@local.host.name''.  You can't actually mail to
  73.     this address.  It's not clear what the right behaviour is in this
  74.     circumstance.
  75.   
  76. ! (Version 8.8, last updated 10/24/93)
  77. --- 43,59 ----
  78.     hub name.  Some sites might prefer to expose some names such as
  79.     root.  This information is always available in Received: lines.
  80.   
  81. + * $c (hop count) macro improperly set.
  82. +   The $c macro is supposed to contain the current hop count, for use
  83. +   when calling a mailer.  This macro is initialized too early, and
  84. +   is always zero (or the value of the -c command line flag, if any).
  85. +   This macro will probably be removed entirely in a future release;
  86. +   I don't believe there are any mailers left that require it.
  87.   * If you EXPN a list or user that has a program mailer, the output of
  88.     EXPN will include ``@local.host.name''.  You can't actually mail to
  89.     this address.  It's not clear what the right behaviour is in this
  90.     circumstance.
  91.   
  92. ! (Version 8.9, last updated 10/31/93)
  93. *** src/Makefile.Linux.OLD    Wed Oct 27 06:48:26 1993
  94. --- src/Makefile.Linux    Thu Oct 28 07:02:16 1993
  95. ***************
  96. *** 35,53 ****
  97.   LIBS=    -lbsd -ldbm
  98.   
  99.   # location of sendmail binary (usually /usr/sbin or /usr/lib)
  100. ! BINDIR=    ${DESTDIR}/etc/sendmail
  101.   
  102.   # location of sendmail.st file (usually /var/log or /usr/lib)
  103. ! STDIR=    ${DESTDIR}/etc/sendmail
  104.   
  105.   # location of sendmail.hf file (usually /usr/share/misc or /usr/lib)
  106. ! HFDIR=    ${DESTDIR}/etc/sendmail
  107.   
  108.   # additional .o files needed
  109.   OBJADD=
  110.   
  111.   # additional pseudo-sources needed
  112. ! BEFORE=    unistd.h dirent.h
  113.   
  114.   ###################  end of user configuration flags  ######################
  115.   
  116. --- 35,53 ----
  117.   LIBS=    -lbsd -ldbm
  118.   
  119.   # location of sendmail binary (usually /usr/sbin or /usr/lib)
  120. ! BINDIR=    ${DESTDIR}/usr/lib
  121.   
  122.   # location of sendmail.st file (usually /var/log or /usr/lib)
  123. ! STDIR=    ${DESTDIR}/usr/lib
  124.   
  125.   # location of sendmail.hf file (usually /usr/share/misc or /usr/lib)
  126. ! HFDIR=    ${DESTDIR}/usr/lib
  127.   
  128.   # additional .o files needed
  129.   OBJADD=
  130.   
  131.   # additional pseudo-sources needed
  132. ! BEFORE=
  133.   
  134.   ###################  end of user configuration flags  ######################
  135.   
  136. ***************
  137. *** 78,91 ****
  138.       echo "#include <sys/dir.h>" > dirent.h
  139.       echo "#define dirent    direct" >> dirent.h
  140.   
  141.   aliases.0: aliases.5
  142. !     nroff -mandoc aliases.5 > aliases.0
  143.   
  144.   newaliases.0: newaliases.1
  145. !     nroff -mandoc newaliases.1 > newaliases.0
  146.   
  147.   sendmail.0: sendmail.8
  148. !     nroff -mandoc sendmail.8 > sendmail.0
  149.   
  150.   install: install-sendmail install-docs
  151.   
  152. --- 78,93 ----
  153.       echo "#include <sys/dir.h>" > dirent.h
  154.       echo "#define dirent    direct" >> dirent.h
  155.   
  156. + NROFF=    nroff
  157.   aliases.0: aliases.5
  158. !     ${NROFF} -mandoc aliases.5 > aliases.0
  159.   
  160.   newaliases.0: newaliases.1
  161. !     ${NROFF} -mandoc newaliases.1 > newaliases.0
  162.   
  163.   sendmail.0: sendmail.8
  164. !     ${NROFF} -mandoc sendmail.8 > sendmail.0
  165.   
  166.   install: install-sendmail install-docs
  167.   
  168. *** src/Makefile.OSF1.OLD    Mon Oct 25 12:38:03 1993
  169. --- src/Makefile.OSF1    Mon Oct 25 12:39:01 1993
  170. ***************
  171. *** 83,92 ****
  172.   install: install-sendmail install-docs
  173.   
  174.   install-sendmail: sendmail
  175. !     install -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} sendmail ${BINDIR}
  176.       for i in ${LINKS}; do rm -f $$i; ln -s ${BINDIR}/sendmail $$i; done
  177.       cp /dev/null ${STDIR}/sendmail.st
  178. !     chmod ${BINMOD}.${BINGRP} ${STDIR}/sendmail.st
  179.       installbsd -c -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR}
  180.       rm -f /usr/sbin/smtpd
  181.   
  182. --- 83,93 ----
  183.   install: install-sendmail install-docs
  184.   
  185.   install-sendmail: sendmail
  186. !     installbsd -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} sendmail ${BINDIR}
  187.       for i in ${LINKS}; do rm -f $$i; ln -s ${BINDIR}/sendmail $$i; done
  188.       cp /dev/null ${STDIR}/sendmail.st
  189. !     chmod ${BINMOD} ${STDIR}/sendmail.st
  190. !     chown ${BINGRP}.${BINGRP} ${STDIR}/sendmail.st
  191.       installbsd -c -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR}
  192.       rm -f /usr/sbin/smtpd
  193.   
  194. *** src/Makefile.SunOS.OLD    Sun Oct 24 13:39:28 1993
  195. --- src/Makefile.SunOS    Sun Oct 24 13:39:49 1993
  196. ***************
  197. *** 41,47 ****
  198.   BINDIR=    ${DESTDIR}/usr/lib
  199.   
  200.   # location of sendmail.st file (usually /var/log or /usr/lib)
  201. ! STDIR=    ${DESTDIR}/var/log
  202.   
  203.   # location of sendmail.hf file (usually /usr/share/misc or /usr/lib)
  204.   HFDIR=    ${DESTDIR}/usr/lib
  205. --- 41,47 ----
  206.   BINDIR=    ${DESTDIR}/usr/lib
  207.   
  208.   # location of sendmail.st file (usually /var/log or /usr/lib)
  209. ! STDIR=    ${DESTDIR}/etc
  210.   
  211.   # location of sendmail.hf file (usually /usr/share/misc or /usr/lib)
  212.   HFDIR=    ${DESTDIR}/usr/lib
  213. *** src/READ_ME.OLD    Wed Oct 27 08:24:33 1993
  214. --- src/READ_ME    Sun Oct 31 11:33:11 1993
  215. ***************
  216. *** 30,36 ****
  217.   # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  218.   # SUCH DAMAGE.
  219.   #
  220. ! #    @(#)READ_ME    8.30 (Berkeley) 10/24/93
  221.   #
  222.   
  223.   This directory contains the source files for sendmail.
  224. --- 30,36 ----
  225.   # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  226.   # SUCH DAMAGE.
  227.   #
  228. ! #    @(#)READ_ME    8.31 (Berkeley) 10/31/93
  229.   #
  230.   
  231.   This directory contains the source files for sendmail.
  232. ***************
  233. *** 265,270 ****
  234. --- 265,276 ----
  235.       this links in a new version of gethostbyname that does not
  236.       understand NIS, so you must have all of your hosts in DNS.
  237.   
  238. +     Some people have reported problems with the SunOS version of
  239. +     -lresolv and/or in.named, and suggest that you get a newer
  240. +     version.  The symptoms are delays when you connect to the
  241. +     SMTP server on a SunOS machine.  There is a version of BIND
  242. +     version 4.9 on gatekeeper.DEC.COM in pub/BSD/bind/4.9.
  243.       There is substantial disagreement about whether you can make
  244.       this work with resolv+, which allows you to specify a search-path
  245.       of services.  Some people report that it works fine, others
  246. ***************
  247. *** 483,486 ****
  248.   
  249.   Eric Allman
  250.   
  251. ! (Version 8.30, last update 10/24/93 10:39:02)
  252. --- 489,492 ----
  253.   
  254.   Eric Allman
  255.   
  256. ! (Version 8.31, last update 10/31/93 11:32:52)
  257. *** src/alias.c.OLD    Fri Oct 29 07:00:24 1993
  258. --- src/alias.c    Sun Oct 31 11:07:17 1993
  259. ***************
  260. *** 36,42 ****
  261.   # include <pwd.h>
  262.   
  263.   #ifndef lint
  264. ! static char sccsid[] = "@(#)alias.c    8.17 (Berkeley) 10/15/93";
  265.   #endif /* not lint */
  266.   
  267.   
  268. --- 36,42 ----
  269.   # include <pwd.h>
  270.   
  271.   #ifndef lint
  272. ! static char sccsid[] = "@(#)alias.c    8.19 (Berkeley) 10/31/93";
  273.   #endif /* not lint */
  274.   
  275.   
  276. ***************
  277. *** 299,305 ****
  278.       char *ext;
  279.       int isopen;
  280.   {
  281. !     int atcnt;
  282.       time_t mtime;
  283.       struct stat stb;
  284.       char buf[MAXNAME];
  285. --- 299,305 ----
  286.       char *ext;
  287.       int isopen;
  288.   {
  289. !     bool attimeout = FALSE;
  290.       time_t mtime;
  291.       struct stat stb;
  292.       char buf[MAXNAME];
  293. ***************
  294. *** 308,324 ****
  295.           printf("aliaswait(%s:%s)\n",
  296.               map->map_class->map_cname, map->map_file);
  297.       if (bitset(MF_ALIASWAIT, map->map_mflags))
  298. !         return;
  299.       map->map_mflags |= MF_ALIASWAIT;
  300.   
  301. !     atcnt = SafeAlias * 2;
  302. !     if (atcnt > 0)
  303.       {
  304.           auto int st;
  305.   
  306. !         while (isopen && atcnt-- >= 0 &&
  307.                  map->map_class->map_lookup(map, "@", NULL, &st) == NULL)
  308.           {
  309.               /*
  310.               **  Close and re-open the alias database in case
  311.               **  the one is mv'ed instead of cp'ed in.
  312. --- 308,332 ----
  313.           printf("aliaswait(%s:%s)\n",
  314.               map->map_class->map_cname, map->map_file);
  315.       if (bitset(MF_ALIASWAIT, map->map_mflags))
  316. !         return isopen;
  317.       map->map_mflags |= MF_ALIASWAIT;
  318.   
  319. !     if (SafeAlias > 0)
  320.       {
  321.           auto int st;
  322. +         time_t toolong = curtime() + SafeAlias;
  323. +         unsigned int sleeptime = 2;
  324.   
  325. !         while (isopen &&
  326.                  map->map_class->map_lookup(map, "@", NULL, &st) == NULL)
  327.           {
  328. +             if (curtime() > toolong)
  329. +             {
  330. +                 /* we timed out */
  331. +                 attimeout = TRUE;
  332. +                 break;
  333. +             }
  334.               /*
  335.               **  Close and re-open the alias database in case
  336.               **  the one is mv'ed instead of cp'ed in.
  337. ***************
  338. *** 325,334 ****
  339.               */
  340.   
  341.               if (tTd(27, 2))
  342. !                 printf("aliaswait: sleeping\n");
  343.   
  344.               map->map_class->map_close(map);
  345. !             sleep(30);
  346.               isopen = map->map_class->map_open(map, O_RDONLY);
  347.           }
  348.       }
  349. --- 333,346 ----
  350.               */
  351.   
  352.               if (tTd(27, 2))
  353. !                 printf("aliaswait: sleeping for %d seconds\n",
  354. !                     sleeptime);
  355.   
  356.               map->map_class->map_close(map);
  357. !             sleep(sleeptime);
  358. !             sleeptime *= 2;
  359. !             if (sleeptime > 60)
  360. !                 sleeptime = 60;
  361.               isopen = map->map_class->map_open(map, O_RDONLY);
  362.           }
  363.       }
  364. ***************
  365. *** 352,358 ****
  366.       (void) strcpy(buf, map->map_file);
  367.       if (ext != NULL)
  368.           (void) strcat(buf, ext);
  369. !     if (stat(buf, &stb) < 0 || stb.st_mtime < mtime || atcnt < 0)
  370.       {
  371.           /* database is out of date */
  372.           if (AutoRebuild && stb.st_ino != 0 && stb.st_uid == geteuid())
  373. --- 364,370 ----
  374.       (void) strcpy(buf, map->map_file);
  375.       if (ext != NULL)
  376.           (void) strcat(buf, ext);
  377. !     if (stat(buf, &stb) < 0 || stb.st_mtime < mtime || attimeout)
  378.       {
  379.           /* database is out of date */
  380.           if (AutoRebuild && stb.st_ino != 0 && stb.st_uid == geteuid())
  381. ***************
  382. *** 437,443 ****
  383.               (void) lockfile(fileno(af), map->map_file, NULL,
  384.                       LOCK_EX);
  385.           }
  386. !         (void) fclose(af);
  387.           errno = 0;
  388.           return;
  389.       }
  390. --- 449,455 ----
  391.               (void) lockfile(fileno(af), map->map_file, NULL,
  392.                       LOCK_EX);
  393.           }
  394. !         (void) xfclose(af, "rebuildaliases1", map->map_file);
  395.           errno = 0;
  396.           return;
  397.       }
  398. ***************
  399. *** 468,474 ****
  400.       }
  401.   
  402.       /* close the file, thus releasing locks */
  403. !     fclose(af);
  404.   
  405.       /* add distinguished entries and close the database */
  406.       if (bitset(MF_OPEN, map->map_mflags))
  407. --- 480,486 ----
  408.       }
  409.   
  410.       /* close the file, thus releasing locks */
  411. !     xfclose(af, "rebuildaliases2", map->map_file);
  412.   
  413.       /* add distinguished entries and close the database */
  414.       if (bitset(MF_OPEN, map->map_mflags))
  415. *** src/collect.c.OLD    Wed Oct 27 08:30:13 1993
  416. --- src/collect.c    Fri Oct 29 07:04:42 1993
  417. ***************
  418. *** 33,39 ****
  419.    */
  420.   
  421.   #ifndef lint
  422. ! static char sccsid[] = "@(#)collect.c    8.5 (Berkeley) 10/15/93";
  423.   #endif /* not lint */
  424.   
  425.   # include <errno.h>
  426. --- 33,39 ----
  427.    */
  428.   
  429.   #ifndef lint
  430. ! static char sccsid[] = "@(#)collect.c    8.6 (Berkeley) 10/27/93";
  431.   #endif /* not lint */
  432.   
  433.   # include <errno.h>
  434. ***************
  435. *** 283,290 ****
  436.   
  437.       if (fflush(tf) != 0)
  438.           tferror(tf, e);
  439. !     (void) fsync(fileno(tf));
  440. !     (void) fclose(tf);
  441.   
  442.       /* An EOF when running SMTP is an error */
  443.       if (inputerr && OpMode == MD_SMTP)
  444. --- 283,293 ----
  445.   
  446.       if (fflush(tf) != 0)
  447.           tferror(tf, e);
  448. !     if (fsync(fileno(tf)) < 0 || fclose(tf) < 0)
  449. !     {
  450. !         syserr("cannot sync message data to disk (%s)", e->e_df);
  451. !         finis();
  452. !     }
  453.   
  454.       /* An EOF when running SMTP is an error */
  455.       if (inputerr && OpMode == MD_SMTP)
  456. *** src/conf.h.OLD    Thu Oct 28 06:45:24 1993
  457. --- src/conf.h    Fri Oct 29 06:44:30 1993
  458. ***************
  459. *** 31,37 ****
  460.    * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  461.    * SUCH DAMAGE.
  462.    *
  463. !  *    @(#)conf.h    8.42 (Berkeley) 10/21/93
  464.    */
  465.   
  466.   /*
  467. --- 31,37 ----
  468.    * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  469.    * SUCH DAMAGE.
  470.    *
  471. !  *    @(#)conf.h    8.44 (Berkeley) 10/29/93
  472.    */
  473.   
  474.   /*
  475. ***************
  476. *** 382,388 ****
  477.   **    From Karl London <karl@borg.demon.co.uk>.
  478.   */
  479.   
  480. ! #ifdef linux
  481.   # define BSD        1    /* pretend to be BSD based today */
  482.   # undef  NEEDVPRINTF    1    /* need a replacement for vprintf(3) */
  483.   # define NEEDGETOPT    1    /* need a replacement for getopt(3) */
  484. --- 382,388 ----
  485.   **    From Karl London <karl@borg.demon.co.uk>.
  486.   */
  487.   
  488. ! #ifdef __linux__
  489.   # define BSD        1    /* pretend to be BSD based today */
  490.   # undef  NEEDVPRINTF    1    /* need a replacement for vprintf(3) */
  491.   # define NEEDGETOPT    1    /* need a replacement for getopt(3) */
  492. ***************
  493. *** 390,395 ****
  494. --- 390,396 ----
  495.   # ifndef LA_TYPE
  496.   #  define LA_TYPE    LA_FLOAT
  497.   # endif
  498. + # include <sys/sysmacros.h>
  499.   #endif
  500.   
  501.   
  502. *** src/daemon.c.OLD    Sun Oct 24 13:59:30 1993
  503. --- src/daemon.c    Sun Oct 31 11:30:14 1993
  504. ***************
  505. *** 37,45 ****
  506.   
  507.   #ifndef lint
  508.   #ifdef DAEMON
  509. ! static char sccsid[] = "@(#)daemon.c    8.19 (Berkeley) 10/23/93 (with daemon mode)";
  510.   #else
  511. ! static char sccsid[] = "@(#)daemon.c    8.19 (Berkeley) 10/23/93 (without daemon mode)";
  512.   #endif
  513.   #endif /* not lint */
  514.   
  515. --- 37,45 ----
  516.   
  517.   #ifndef lint
  518.   #ifdef DAEMON
  519. ! static char sccsid[] = "@(#)daemon.c    8.21 (Berkeley) 10/31/93 (with daemon mode)";
  520.   #else
  521. ! static char sccsid[] = "@(#)daemon.c    8.21 (Berkeley) 10/31/93 (without daemon mode)";
  522.   #endif
  523.   #endif /* not lint */
  524.   
  525. ***************
  526. *** 1049,1054 ****
  527. --- 1049,1055 ----
  528.       char *cp;
  529.       int i;
  530.       register STAB *s;
  531. +     char *timeoutmsg = "Recipient domain nameserver timed out";
  532.       char hbuf[MAXNAME];
  533.       extern struct hostent *gethostbyaddr();
  534.       extern int h_errno;
  535. ***************
  536. *** 1067,1072 ****
  537. --- 1068,1075 ----
  538.           errno = s->s_namecanon.nc_errno;
  539.           h_errno = s->s_namecanon.nc_herrno;
  540.           *statp = s->s_namecanon.nc_stat;
  541. +         if (CurEnv->e_message == NULL && *statp == EX_TEMPFAIL)
  542. +             CurEnv->e_message = newstr(timeoutmsg);
  543.           return s->s_namecanon.nc_cname;
  544.       }
  545.   
  546. ***************
  547. *** 1106,1116 ****
  548.                 case TRY_AGAIN:
  549.                   if (UseNameServer)
  550.                   {
  551. !                     char *msg = "Recipient domain nameserver timed out";
  552. !                     message(msg);
  553.                       if (CurEnv->e_message == NULL)
  554. !                         CurEnv->e_message = newstr(msg);
  555.                   }
  556.                   *statp = EX_TEMPFAIL;
  557.                   break;
  558. --- 1109,1117 ----
  559.                 case TRY_AGAIN:
  560.                   if (UseNameServer)
  561.                   {
  562. !                     message(timeoutmsg);
  563.                       if (CurEnv->e_message == NULL)
  564. !                         CurEnv->e_message = newstr(timeoutmsg);
  565.                   }
  566.                   *statp = EX_TEMPFAIL;
  567.                   break;
  568. ***************
  569. *** 1200,1207 ****
  570.       {
  571.   #ifdef MAYBENEXTRELEASE        /*** UNTESTED *** UNTESTED *** UNTESTED ***/
  572.         case AF_UNIX:
  573. !           if (sap->sun.sun_path[0] != '\0')
  574. !               sprintf(buf, "[UNIX: %.64s]", sap->sun.sun_path);
  575.             else
  576.                 sprintf(buf, "[UNIX: localhost]");
  577.           return buf;
  578. --- 1201,1208 ----
  579.       {
  580.   #ifdef MAYBENEXTRELEASE        /*** UNTESTED *** UNTESTED *** UNTESTED ***/
  581.         case AF_UNIX:
  582. !           if (sap->sunix.sun_path[0] != '\0')
  583. !               sprintf(buf, "[UNIX: %.64s]", sap->sunix.sun_path);
  584.             else
  585.                 sprintf(buf, "[UNIX: localhost]");
  586.           return buf;
  587. *** src/deliver.c.OLD    Fri Oct 29 09:49:43 1993
  588. --- src/deliver.c    Fri Oct 29 19:24:45 1993
  589. ***************
  590. *** 33,39 ****
  591.    */
  592.   
  593.   #ifndef lint
  594. ! static char sccsid[] = "@(#)deliver.c    8.36 (Berkeley) 10/23/93";
  595.   #endif /* not lint */
  596.   
  597.   #include "sendmail.h"
  598. --- 33,39 ----
  599.    */
  600.   
  601.   #ifndef lint
  602. ! static char sccsid[] = "@(#)deliver.c    8.37 (Berkeley) 10/29/93";
  603.   #endif /* not lint */
  604.   
  605.   #include "sendmail.h"
  606. ***************
  607. *** 636,642 ****
  608.               e->e_to = to->q_paddr;
  609.               message("queued");
  610.               if (LogLevel > 8)
  611. !                 logdelivery(m, NULL, "queued", e);
  612.           }
  613.           e->e_to = NULL;
  614.           return (0);
  615. --- 636,642 ----
  616.               e->e_to = to->q_paddr;
  617.               message("queued");
  618.               if (LogLevel > 8)
  619. !                 logdelivery(m, NULL, "queued", NULL, e);
  620.           }
  621.           e->e_to = NULL;
  622.           return (0);
  623. ***************
  624. *** 780,786 ****
  625.           {
  626.               NoReturn = TRUE;
  627.               usrerr("552 Message is too large; %ld bytes max", m->m_maxsize);
  628. !             giveresponse(EX_UNAVAILABLE, m, NULL, e);
  629.               continue;
  630.           }
  631.           rcode = checkcompat(to, e);
  632. --- 780,786 ----
  633.           {
  634.               NoReturn = TRUE;
  635.               usrerr("552 Message is too large; %ld bytes max", m->m_maxsize);
  636. !             giveresponse(EX_UNAVAILABLE, m, NULL, ctladdr, e);
  637.               continue;
  638.           }
  639.           rcode = checkcompat(to, e);
  640. ***************
  641. *** 787,793 ****
  642.           if (rcode != EX_OK)
  643.           {
  644.               markfailure(e, to, rcode);
  645. !             giveresponse(rcode, m, NULL, e);
  646.               continue;
  647.           }
  648.   
  649. --- 787,793 ----
  650.           if (rcode != EX_OK)
  651.           {
  652.               markfailure(e, to, rcode);
  653. !             giveresponse(rcode, m, NULL, ctladdr, e);
  654.               continue;
  655.           }
  656.   
  657. ***************
  658. *** 831,838 ****
  659.   
  660.           if (m == FileMailer)
  661.           {
  662. !             rcode = mailfile(user, getctladdr(to), e);
  663. !             giveresponse(rcode, m, NULL, e);
  664.               if (rcode == EX_OK)
  665.                   to->q_flags |= QSENT;
  666.               continue;
  667. --- 831,840 ----
  668.   
  669.           if (m == FileMailer)
  670.           {
  671. !             ADDRESS *caddr = getctladdr(to);
  672. !             rcode = mailfile(user, caddr, e);
  673. !             giveresponse(rcode, m, NULL, caddr, e);
  674.               if (rcode == EX_OK)
  675.                   to->q_flags |= QSENT;
  676.               continue;
  677. ***************
  678. *** 1372,1378 ****
  679.                   if ((i = smtprcpt(to, m, mci, e)) != EX_OK)
  680.                   {
  681.                       markfailure(e, to, i);
  682. !                     giveresponse(i, m, mci, e);
  683.                   }
  684.                   else
  685.                   {
  686. --- 1374,1380 ----
  687.                   if ((i = smtprcpt(to, m, mci, e)) != EX_OK)
  688.                   {
  689.                       markfailure(e, to, i);
  690. !                     giveresponse(i, m, mci, ctladdr, e);
  691.                   }
  692.                   else
  693.                   {
  694. ***************
  695. *** 1436,1442 ****
  696.   
  697.     give_up:
  698.       if (tobuf[0] != '\0')
  699. !         giveresponse(rcode, m, mci, e);
  700.       for (to = tochain; to != NULL; to = to->q_tchain)
  701.       {
  702.           if (rcode != EX_OK)
  703. --- 1438,1444 ----
  704.   
  705.     give_up:
  706.       if (tobuf[0] != '\0')
  707. !         giveresponse(rcode, m, mci, ctladdr, e);
  708.       for (to = tochain; to != NULL; to = to->q_tchain)
  709.       {
  710.           if (rcode != EX_OK)
  711. ***************
  712. *** 1586,1591 ****
  713. --- 1588,1595 ----
  714.   **        m -- the mailer info for this mailer.
  715.   **        mci -- the mailer connection info -- can be NULL if the
  716.   **            response is given before the connection is made.
  717. + **        ctladdr -- the controlling address for the recipient
  718. + **            address(es).
  719.   **        e -- the current envelope.
  720.   **
  721.   **    Returns:
  722. ***************
  723. *** 1596,1605 ****
  724.   **        ExitStat may be set.
  725.   */
  726.   
  727. ! giveresponse(stat, m, mci, e)
  728.       int stat;
  729.       register MAILER *m;
  730.       register MCI *mci;
  731.       ENVELOPE *e;
  732.   {
  733.       register const char *statmsg;
  734. --- 1600,1610 ----
  735.   **        ExitStat may be set.
  736.   */
  737.   
  738. ! giveresponse(stat, m, mci, ctladdr, e)
  739.       int stat;
  740.       register MAILER *m;
  741.       register MCI *mci;
  742. +     ADDRESS *ctladdr;
  743.       ENVELOPE *e;
  744.   {
  745.       register const char *statmsg;
  746. ***************
  747. *** 1701,1707 ****
  748.       */
  749.   
  750.       if (LogLevel > ((stat == EX_TEMPFAIL) ? 8 : (stat == EX_OK) ? 7 : 6))
  751. !         logdelivery(m, mci, &statmsg[4], e);
  752.   
  753.       if (stat != EX_TEMPFAIL)
  754.           setstat(stat);
  755. --- 1706,1712 ----
  756.       */
  757.   
  758.       if (LogLevel > ((stat == EX_TEMPFAIL) ? 8 : (stat == EX_OK) ? 7 : 6))
  759. !         logdelivery(m, mci, &statmsg[4], ctladdr, e);
  760.   
  761.       if (stat != EX_TEMPFAIL)
  762.           setstat(stat);
  763. ***************
  764. *** 1724,1729 ****
  765. --- 1729,1735 ----
  766.   **        mci -- the mailer connection info -- can be NULL if the
  767.   **            log is occuring when no connection is active.
  768.   **        stat -- the message to print for the status.
  769. + **        ctladdr -- the controlling address for the to list.
  770.   **        e -- the current envelope.
  771.   **
  772.   **    Returns:
  773. ***************
  774. *** 1733,1753 ****
  775.   **        none
  776.   */
  777.   
  778. ! logdelivery(m, mci, stat, e)
  779.       MAILER *m;
  780.       register MCI *mci;
  781.       char *stat;
  782.       register ENVELOPE *e;
  783.   {
  784.   # ifdef LOG
  785.       char buf[512];
  786.   
  787. !     (void) sprintf(buf, "delay=%s", pintvl(curtime() - e->e_ctime, TRUE));
  788.   
  789.       if (m != NULL)
  790.       {
  791. !         (void) strcat(buf, ", mailer=");
  792. !         (void) strcat(buf, m->m_name);
  793.       }
  794.   
  795.       if (mci != NULL && mci->mci_host != NULL)
  796. --- 1739,1777 ----
  797.   **        none
  798.   */
  799.   
  800. ! logdelivery(m, mci, stat, ctladdr, e)
  801.       MAILER *m;
  802.       register MCI *mci;
  803.       char *stat;
  804. +     ADDRESS *ctladdr;
  805.       register ENVELOPE *e;
  806.   {
  807.   # ifdef LOG
  808. +     register char *bp;
  809.       char buf[512];
  810.   
  811. !     bp = buf;
  812. !     if (ctladdr != NULL)
  813. !     {
  814. !         strcpy(bp, ", ctladdr=");
  815. !         strcat(bp, ctladdr->q_paddr);
  816. !         bp += strlen(bp);
  817. !         if (bitset(QGOODUID, ctladdr->q_flags))
  818. !         {
  819. !             (void) sprintf(bp, " (%d/%d)",
  820. !                     ctladdr->q_uid, ctladdr->q_gid);
  821. !             bp += strlen(bp);
  822. !         }
  823. !     }
  824.   
  825. +     (void) sprintf(bp, ", delay=%s", pintvl(curtime() - e->e_ctime, TRUE));
  826. +     bp += strlen(bp);
  827.       if (m != NULL)
  828.       {
  829. !         (void) strcpy(bp, ", mailer=");
  830. !         (void) strcat(bp, m->m_name);
  831. !         bp += strlen(bp);
  832.       }
  833.   
  834.       if (mci != NULL && mci->mci_host != NULL)
  835. ***************
  836. *** 1756,1768 ****
  837.           extern SOCKADDR CurHostAddr;
  838.   # endif
  839.   
  840. !         (void) strcat(buf, ", relay=");
  841. !         (void) strcat(buf, mci->mci_host);
  842.   
  843.   # ifdef DAEMON
  844. !         (void) strcat(buf, " (");
  845. !         (void) strcat(buf, anynet_ntoa(&CurHostAddr));
  846. !         (void) strcat(buf, ")");
  847.   # endif
  848.       }
  849.       else
  850. --- 1780,1792 ----
  851.           extern SOCKADDR CurHostAddr;
  852.   # endif
  853.   
  854. !         (void) strcpy(bp, ", relay=");
  855. !         (void) strcat(bp, mci->mci_host);
  856.   
  857.   # ifdef DAEMON
  858. !         (void) strcat(bp, " (");
  859. !         (void) strcat(bp, anynet_ntoa(&CurHostAddr));
  860. !         (void) strcat(bp, ")");
  861.   # endif
  862.       }
  863.       else
  864. ***************
  865. *** 1771,1782 ****
  866.   
  867.           if (p != NULL && p[0] != '\0')
  868.           {
  869. !             (void) strcat(buf, ", relay=");
  870. !             (void) strcat(buf, p);
  871.           }
  872.       }
  873.           
  874. !     syslog(LOG_INFO, "%s: to=%s, %s, stat=%s",
  875.              e->e_id, e->e_to, buf, stat);
  876.   # endif /* LOG */
  877.   }
  878. --- 1795,1806 ----
  879.   
  880.           if (p != NULL && p[0] != '\0')
  881.           {
  882. !             (void) strcpy(bp, ", relay=");
  883. !             (void) strcat(bp, p);
  884.           }
  885.       }
  886.           
  887. !     syslog(LOG_INFO, "%s: to=%s%s, stat=%s",
  888.              e->e_id, e->e_to, buf, stat);
  889.   # endif /* LOG */
  890.   }
  891. *** src/envelope.c.OLD    Sun Oct 24 14:28:51 1993
  892. --- src/envelope.c    Sun Oct 31 10:19:05 1993
  893. ***************
  894. *** 33,39 ****
  895.    */
  896.   
  897.   #ifndef lint
  898. ! static char sccsid[] = "@(#)envelope.c    8.13 (Berkeley) 10/23/93";
  899.   #endif /* not lint */
  900.   
  901.   #include "sendmail.h"
  902. --- 33,39 ----
  903.    */
  904.   
  905.   #ifndef lint
  906. ! static char sccsid[] = "@(#)envelope.c    8.17 (Berkeley) 10/31/93";
  907.   #endif /* not lint */
  908.   
  909.   #include "sendmail.h"
  910. ***************
  911. *** 350,357 ****
  912.   initsys(e)
  913.       register ENVELOPE *e;
  914.   {
  915. !     static char cbuf[5];            /* holds hop count */
  916. !     static char pbuf[10];            /* holds pid */
  917.   #ifdef TTYNAME
  918.       static char ybuf[60];            /* holds tty id */
  919.       register char *p;
  920. --- 350,357 ----
  921.   initsys(e)
  922.       register ENVELOPE *e;
  923.   {
  924. !     char cbuf[5];                /* holds hop count */
  925. !     char pbuf[10];                /* holds pid */
  926.   #ifdef TTYNAME
  927.       static char ybuf[60];            /* holds tty id */
  928.       register char *p;
  929. ***************
  930. *** 375,381 ****
  931.       **    tucked away in the transcript).
  932.       */
  933.   
  934. !     if (OpMode == MD_DAEMON && !bitset(EF_QUEUERUN, e->e_flags) &&
  935.           e->e_xfp != NULL)
  936.           OutChannel = e->e_xfp;
  937.   
  938. --- 375,381 ----
  939.       **    tucked away in the transcript).
  940.       */
  941.   
  942. !     if (OpMode == MD_DAEMON && bitset(EF_QUEUERUN, e->e_flags) &&
  943.           e->e_xfp != NULL)
  944.           OutChannel = e->e_xfp;
  945.   
  946. ***************
  947. *** 385,395 ****
  948.   
  949.       /* process id */
  950.       (void) sprintf(pbuf, "%d", getpid());
  951. !     define('p', pbuf, e);
  952.   
  953.       /* hop count */
  954.       (void) sprintf(cbuf, "%d", e->e_hopcount);
  955. !     define('c', cbuf, e);
  956.   
  957.       /* time as integer, unix time, arpa time */
  958.       settime(e);
  959. --- 385,395 ----
  960.   
  961.       /* process id */
  962.       (void) sprintf(pbuf, "%d", getpid());
  963. !     define('p', newstr(pbuf), e);
  964.   
  965.       /* hop count */
  966.       (void) sprintf(cbuf, "%d", e->e_hopcount);
  967. !     define('c', newstr(cbuf), e);
  968.   
  969.       /* time as integer, unix time, arpa time */
  970.       settime(e);
  971. ***************
  972. *** 428,435 ****
  973.   {
  974.       register char *p;
  975.       auto time_t now;
  976. !     static char tbuf[20];            /* holds "current" time */
  977. !     static char dbuf[30];            /* holds ctime(tbuf) */
  978.       register struct tm *tm;
  979.       extern char *arpadate();
  980.       extern struct tm *gmtime();
  981. --- 428,435 ----
  982.   {
  983.       register char *p;
  984.       auto time_t now;
  985. !     char tbuf[20];                /* holds "current" time */
  986. !     char dbuf[30];                /* holds ctime(tbuf) */
  987.       register struct tm *tm;
  988.       extern char *arpadate();
  989.       extern struct tm *gmtime();
  990. ***************
  991. *** 438,449 ****
  992.       tm = gmtime(&now);
  993.       (void) sprintf(tbuf, "%04d%02d%02d%02d%02d", tm->tm_year + 1900,
  994.               tm->tm_mon+1, tm->tm_mday, tm->tm_hour, tm->tm_min);
  995. !     define('t', tbuf, e);
  996.       (void) strcpy(dbuf, ctime(&now));
  997.       p = strchr(dbuf, '\n');
  998.       if (p != NULL)
  999.           *p = '\0';
  1000. !     define('d', dbuf, e);
  1001.       p = arpadate(dbuf);
  1002.       p = newstr(p);
  1003.       if (macvalue('a', e) == NULL)
  1004. --- 438,449 ----
  1005.       tm = gmtime(&now);
  1006.       (void) sprintf(tbuf, "%04d%02d%02d%02d%02d", tm->tm_year + 1900,
  1007.               tm->tm_mon+1, tm->tm_mday, tm->tm_hour, tm->tm_min);
  1008. !     define('t', newstr(tbuf), e);
  1009.       (void) strcpy(dbuf, ctime(&now));
  1010.       p = strchr(dbuf, '\n');
  1011.       if (p != NULL)
  1012.           *p = '\0';
  1013. !     define('d', newstr(dbuf), e);
  1014.       p = arpadate(dbuf);
  1015.       p = newstr(p);
  1016.       if (macvalue('a', e) == NULL)
  1017. ***************
  1018. *** 592,600 ****
  1019.           SuprErrs = TRUE;
  1020.   
  1021.       delimchar = internal ? '\0' : ' ';
  1022.       if (from == NULL ||
  1023.           parseaddr(from, &e->e_from, RF_COPYALL|RF_SENDERADDR,
  1024. !               delimchar, delimptr, e) == NULL)
  1025.       {
  1026.           /* log garbage addresses for traceback */
  1027.   # ifdef LOG
  1028. --- 592,605 ----
  1029.           SuprErrs = TRUE;
  1030.   
  1031.       delimchar = internal ? '\0' : ' ';
  1032. +     e->e_from.q_flags = QBADADDR;
  1033.       if (from == NULL ||
  1034.           parseaddr(from, &e->e_from, RF_COPYALL|RF_SENDERADDR,
  1035. !               delimchar, delimptr, e) == NULL ||
  1036. !         bitset(QBADADDR, e->e_from.q_flags) ||
  1037. !         e->e_from.q_mailer == ProgMailer ||
  1038. !         e->e_from.q_mailer == FileMailer ||
  1039. !         e->e_from.q_mailer == InclMailer)
  1040.       {
  1041.           /* log garbage addresses for traceback */
  1042.   # ifdef LOG
  1043. ***************
  1044. *** 613,631 ****
  1045.                   p = ebuf;
  1046.               }
  1047.               syslog(LOG_NOTICE,
  1048. !                 "from=%s unparseable, received from %s",
  1049.                   from, p);
  1050.           }
  1051.   # endif /* LOG */
  1052.           if (from != NULL)
  1053.               SuprErrs = TRUE;
  1054.           if (from == realname ||
  1055.               parseaddr(from = newstr(realname), &e->e_from,
  1056.                     RF_COPYALL|RF_SENDERADDR, ' ', NULL, e) == NULL)
  1057.           {
  1058.               SuprErrs = TRUE;
  1059. !             if (parseaddr("postmaster", &e->e_from, RF_COPYALL,
  1060. !                       ' ', NULL, e) == NULL)
  1061.                   syserr("553 setsender: can't even parse postmaster!");
  1062.           }
  1063.       }
  1064. --- 618,648 ----
  1065.                   p = ebuf;
  1066.               }
  1067.               syslog(LOG_NOTICE,
  1068. !                 "setsender: %s: invalid or unparseable, received from %s",
  1069.                   from, p);
  1070.           }
  1071.   # endif /* LOG */
  1072.           if (from != NULL)
  1073. +         {
  1074. +             if (!bitset(QBADADDR, e->e_from.q_flags))
  1075. +             {
  1076. +                 /* it was a bogus mailer in the from addr */
  1077. +                 usrerr("553 Invalid sender address");
  1078. +             }
  1079.               SuprErrs = TRUE;
  1080. +         }
  1081.           if (from == realname ||
  1082.               parseaddr(from = newstr(realname), &e->e_from,
  1083.                     RF_COPYALL|RF_SENDERADDR, ' ', NULL, e) == NULL)
  1084.           {
  1085. +             char nbuf[100];
  1086.               SuprErrs = TRUE;
  1087. !             expand("\201n", nbuf, &nbuf[sizeof nbuf], e);
  1088. !             if (parseaddr(from = newstr(nbuf), &e->e_from,
  1089. !                       RF_COPYALL, ' ', NULL, e) == NULL &&
  1090. !                 parseaddr(from = "postmaster", &e->e_from,
  1091. !                           RF_COPYALL, ' ', NULL, e) == NULL)
  1092.                   syserr("553 setsender: can't even parse postmaster!");
  1093.           }
  1094.       }
  1095. *** src/err.c.OLD    Thu Oct 28 18:01:18 1993
  1096. --- src/err.c    Fri Oct 29 20:19:28 1993
  1097. ***************
  1098. *** 33,39 ****
  1099.    */
  1100.   
  1101.   #ifndef lint
  1102. ! static char sccsid[] = "@(#)err.c    8.12 (Berkeley) 10/21/93";
  1103.   #endif /* not lint */
  1104.   
  1105.   # include "sendmail.h"
  1106. --- 33,39 ----
  1107.    */
  1108.   
  1109.   #ifndef lint
  1110. ! static char sccsid[] = "@(#)err.c    8.14 (Berkeley) 10/29/93";
  1111.   #endif /* not lint */
  1112.   
  1113.   # include "sendmail.h"
  1114. ***************
  1115. *** 341,356 ****
  1116.       putoutmsg(msg, HoldErrs);
  1117.   
  1118.       /* signal the error */
  1119.       if (msgcode == '6')
  1120.       {
  1121.           /* notify the postmaster */
  1122.           CurEnv->e_flags |= EF_PM_NOTIFY;
  1123.       }
  1124. !     else
  1125.       {
  1126. !         Errors++;
  1127. !         if (msgcode == '5' && bitset(EF_GLOBALERRS, CurEnv->e_flags))
  1128. !             CurEnv->e_flags |= EF_FATALERRS;
  1129.       }
  1130.   }
  1131.    /*
  1132. --- 341,356 ----
  1133.       putoutmsg(msg, HoldErrs);
  1134.   
  1135.       /* signal the error */
  1136. +     Errors++;
  1137.       if (msgcode == '6')
  1138.       {
  1139.           /* notify the postmaster */
  1140.           CurEnv->e_flags |= EF_PM_NOTIFY;
  1141.       }
  1142. !     else if (msgcode == '5' && bitset(EF_GLOBALERRS, CurEnv->e_flags))
  1143.       {
  1144. !         /* mark long-term fatal errors */
  1145. !         CurEnv->e_flags |= EF_FATALERRS;
  1146.       }
  1147.   }
  1148.    /*
  1149. *** src/parseaddr.c.OLD    Wed Oct 27 16:06:40 1993
  1150. --- src/parseaddr.c    Sun Oct 31 10:18:01 1993
  1151. ***************
  1152. *** 33,39 ****
  1153.    */
  1154.   
  1155.   #ifndef lint
  1156. ! static char sccsid[] = "@(#)parseaddr.c    8.14 (Berkeley) 10/22/93";
  1157.   #endif /* not lint */
  1158.   
  1159.   # include "sendmail.h"
  1160. --- 33,39 ----
  1161.    */
  1162.   
  1163.   #ifndef lint
  1164. ! static char sccsid[] = "@(#)parseaddr.c    8.17 (Berkeley) 10/31/93";
  1165.   #endif /* not lint */
  1166.   
  1167.   # include "sendmail.h"
  1168. ***************
  1169. *** 211,225 ****
  1170.       char savedelim;
  1171.   
  1172.       if (delimptr != NULL)
  1173.           savedelim = *delimptr;
  1174.   #if 0
  1175.       /* for testing.... */
  1176.       if (strcmp(addr, "INvalidADDR") == 0)
  1177.       {
  1178.           usrerr("553 INvalid ADDRess");
  1179. !         if (delimptr != NULL)
  1180. !             *delimptr = savedelim;
  1181. !         return TRUE;
  1182.       }
  1183.   #endif
  1184.       for (; *addr != '\0'; addr++)
  1185. --- 211,227 ----
  1186.       char savedelim;
  1187.   
  1188.       if (delimptr != NULL)
  1189. +     {
  1190.           savedelim = *delimptr;
  1191. +         if (savedelim != '\0')
  1192. +             *delimptr = '\0';
  1193. +     }
  1194.   #if 0
  1195.       /* for testing.... */
  1196.       if (strcmp(addr, "INvalidADDR") == 0)
  1197.       {
  1198.           usrerr("553 INvalid ADDRess");
  1199. !         goto addrfailure;
  1200.       }
  1201.   #endif
  1202.       for (; *addr != '\0'; addr++)
  1203. ***************
  1204. *** 227,238 ****
  1205.           if ((*addr & 0340) == 0200)
  1206.               break;
  1207.       }
  1208. -     if (delimptr != NULL)
  1209. -         *delimptr = savedelim;
  1210.       if (*addr == '\0')
  1211.           return FALSE;
  1212.       setstat(EX_USAGE);
  1213.       usrerr("553 Address contained invalid control characters");
  1214.       return TRUE;
  1215.   }
  1216.    /*
  1217. --- 229,245 ----
  1218.           if ((*addr & 0340) == 0200)
  1219.               break;
  1220.       }
  1221.       if (*addr == '\0')
  1222. +     {
  1223. +         if (savedelim != '\0' && delimptr != NULL)
  1224. +             *delimptr = savedelim;
  1225.           return FALSE;
  1226. +     }
  1227.       setstat(EX_USAGE);
  1228.       usrerr("553 Address contained invalid control characters");
  1229. +   addrfailure:
  1230. +     if (savedelim != '\0' && delimptr != NULL)
  1231. +         *delimptr = savedelim;
  1232.       return TRUE;
  1233.   }
  1234.    /*
  1235. ***************
  1236. *** 406,423 ****
  1237.                   /* diagnose and patch up bad syntax */
  1238.                   if (state == QST)
  1239.                   {
  1240. !                     usrerr("653 Unbalanced '\"' (fixed)");
  1241.                       c = '"';
  1242.                   }
  1243.                   else if (cmntcnt > 0)
  1244.                   {
  1245. !                     usrerr("653 Unbalanced '(' (fixed)");
  1246.                       c = ')';
  1247.                   }
  1248.                   else if (anglecnt > 0)
  1249.                   {
  1250.                       c = '>';
  1251. !                     usrerr("653 Unbalanced '<' (fixed)");
  1252.                   }
  1253.                   else
  1254.                       break;
  1255. --- 413,430 ----
  1256.                   /* diagnose and patch up bad syntax */
  1257.                   if (state == QST)
  1258.                   {
  1259. !                     usrerr("653 Unbalanced '\"'");
  1260.                       c = '"';
  1261.                   }
  1262.                   else if (cmntcnt > 0)
  1263.                   {
  1264. !                     usrerr("653 Unbalanced '('");
  1265.                       c = ')';
  1266.                   }
  1267.                   else if (anglecnt > 0)
  1268.                   {
  1269.                       c = '>';
  1270. !                     usrerr("653 Unbalanced '<'");
  1271.                   }
  1272.                   else
  1273.                       break;
  1274. ***************
  1275. *** 467,473 ****
  1276.               {
  1277.                   if (cmntcnt <= 0)
  1278.                   {
  1279. !                     usrerr("653 Unbalanced ')' (fixed)");
  1280.                       c = NOCHAR;
  1281.                   }
  1282.                   else
  1283. --- 474,480 ----
  1284.               {
  1285.                   if (cmntcnt <= 0)
  1286.                   {
  1287. !                     usrerr("653 Unbalanced ')'");
  1288.                       c = NOCHAR;
  1289.                   }
  1290.                   else
  1291. ***************
  1292. *** 481,487 ****
  1293.               {
  1294.                   if (anglecnt <= 0)
  1295.                   {
  1296. !                     usrerr("653 Unbalanced '>' (fixed)");
  1297.                       c = NOCHAR;
  1298.                   }
  1299.                   else
  1300. --- 488,494 ----
  1301.               {
  1302.                   if (anglecnt <= 0)
  1303.                   {
  1304. !                     usrerr("653 Unbalanced '>'");
  1305.                       c = NOCHAR;
  1306.                   }
  1307.                   else
  1308. ***************
  1309. *** 1231,1236 ****
  1310. --- 1238,1249 ----
  1311.       static MAILER errormailer;
  1312.       static char *errorargv[] = { "ERROR", NULL };
  1313.       static char buf[MAXNAME];
  1314. +     if (tTd(24, 5))
  1315. +     {
  1316. +         printf("buildaddr, flags=%o, tv=", flags);
  1317. +         printav(tv);
  1318. +     }
  1319.   
  1320.       if (a == NULL)
  1321.           a = (ADDRESS *) xalloc(sizeof *a);
  1322. *** src/queue.c.OLD    Wed Oct 27 08:30:26 1993
  1323. --- src/queue.c    Fri Oct 29 19:24:47 1993
  1324. ***************
  1325. *** 36,44 ****
  1326.   
  1327.   #ifndef lint
  1328.   #ifdef QUEUE
  1329. ! static char sccsid[] = "@(#)queue.c    8.24 (Berkeley) 10/23/93 (with queueing)";
  1330.   #else
  1331. ! static char sccsid[] = "@(#)queue.c    8.24 (Berkeley) 10/23/93 (without queueing)";
  1332.   #endif
  1333.   #endif /* not lint */
  1334.   
  1335. --- 36,44 ----
  1336.   
  1337.   #ifndef lint
  1338.   #ifdef QUEUE
  1339. ! static char sccsid[] = "@(#)queue.c    8.27 (Berkeley) 10/29/93 (with queueing)";
  1340.   #else
  1341. ! static char sccsid[] = "@(#)queue.c    8.27 (Berkeley) 10/29/93 (without queueing)";
  1342.   #endif
  1343.   #endif /* not lint */
  1344.   
  1345. ***************
  1346. *** 249,255 ****
  1347.                   e->e_to = q->q_paddr;
  1348.                   message("queued");
  1349.                   if (LogLevel > 8)
  1350. !                     logdelivery(NULL, NULL, "queued", e);
  1351.                   e->e_to = NULL;
  1352.               }
  1353.               if (tTd(40, 1))
  1354. --- 249,255 ----
  1355.                   e->e_to = q->q_paddr;
  1356.                   message("queued");
  1357.                   if (LogLevel > 8)
  1358. !                     logdelivery(NULL, NULL, "queued", NULL, e);
  1359.                   e->e_to = NULL;
  1360.               }
  1361.               if (tTd(40, 1))
  1362. ***************
  1363. *** 332,340 ****
  1364.       **  Clean up.
  1365.       */
  1366.   
  1367. !     fflush(tfp);
  1368. !     fsync(fileno(tfp));
  1369. !     if (ferror(tfp))
  1370.       {
  1371.           if (newid)
  1372.               syserr("!552 Error writing control file %s", tf);
  1373. --- 332,338 ----
  1374.       **  Clean up.
  1375.       */
  1376.   
  1377. !     if (fflush(tfp) < 0 || fsync(fileno(tfp)) < 0 || ferror(tfp))
  1378.       {
  1379.           if (newid)
  1380.               syserr("!552 Error writing control file %s", tf);
  1381. ***************
  1382. *** 874,880 ****
  1383.           e->e_flags |= EF_QUEUERUN|EF_GLOBALERRS;
  1384.           e->e_errormode = EM_MAIL;
  1385.           e->e_id = id;
  1386. !         GrabTo = FALSE;
  1387.           if (forkflag)
  1388.           {
  1389.               disconnect(1, e);
  1390. --- 872,878 ----
  1391.           e->e_flags |= EF_QUEUERUN|EF_GLOBALERRS;
  1392.           e->e_errormode = EM_MAIL;
  1393.           e->e_id = id;
  1394. !         GrabTo = UseErrorsTo = FALSE;
  1395.           if (forkflag)
  1396.           {
  1397.               disconnect(1, e);
  1398. *** src/readcf.c.OLD    Sun Oct 31 10:53:41 1993
  1399. --- src/readcf.c    Sun Oct 31 11:29:49 1993
  1400. ***************
  1401. *** 33,39 ****
  1402.    */
  1403.   
  1404.   #ifndef lint
  1405. ! static char sccsid[] = "@(#)readcf.c    8.13 (Berkeley) 10/15/93";
  1406.   #endif /* not lint */
  1407.   
  1408.   # include "sendmail.h"
  1409. --- 33,39 ----
  1410.    */
  1411.   
  1412.   #ifndef lint
  1413. ! static char sccsid[] = "@(#)readcf.c    8.14 (Berkeley) 10/31/93";
  1414.   #endif /* not lint */
  1415.   
  1416.   # include "sendmail.h"
  1417. ***************
  1418. *** 1093,1101 ****
  1419.   
  1420.         case 'a':        /* look N minutes for "@:@" in alias file */
  1421.           if (val[0] == '\0')
  1422. !             SafeAlias = 5;
  1423.           else
  1424. !             SafeAlias = atoi(val);
  1425.           break;
  1426.   
  1427.         case 'B':        /* substitution for blank character */
  1428. --- 1093,1101 ----
  1429.   
  1430.         case 'a':        /* look N minutes for "@:@" in alias file */
  1431.           if (val[0] == '\0')
  1432. !             SafeAlias = 5 * 60;        /* five minutes */
  1433.           else
  1434. !             SafeAlias = convtime(val, 'm');
  1435.           break;
  1436.   
  1437.         case 'B':        /* substitution for blank character */
  1438. *** src/recipient.c.OLD    Mon Oct 25 20:15:14 1993
  1439. --- src/recipient.c    Fri Oct 29 19:24:46 1993
  1440. ***************
  1441. *** 33,39 ****
  1442.    */
  1443.   
  1444.   #ifndef lint
  1445. ! static char sccsid[] = "@(#)recipient.c    8.19 (Berkeley) 9/29/93";
  1446.   #endif /* not lint */
  1447.   
  1448.   # include "sendmail.h"
  1449. --- 33,39 ----
  1450.    */
  1451.   
  1452.   #ifndef lint
  1453. ! static char sccsid[] = "@(#)recipient.c    8.21 (Berkeley) 10/29/93";
  1454.   #endif /* not lint */
  1455.   
  1456.   # include "sendmail.h"
  1457. ***************
  1458. *** 222,229 ****
  1459.       stripquotes(buf);
  1460.   
  1461.       /* check for direct mailing to restricted mailers */
  1462. !     if (a->q_alias == NULL && m == ProgMailer &&
  1463. !         !bitset(EF_QUEUERUN, e->e_flags))
  1464.       {
  1465.           a->q_flags |= QBADADDR;
  1466.           usrerr("550 Cannot mail directly to programs");
  1467. --- 222,228 ----
  1468.       stripquotes(buf);
  1469.   
  1470.       /* check for direct mailing to restricted mailers */
  1471. !     if (a->q_alias == NULL && m == ProgMailer)
  1472.       {
  1473.           a->q_flags |= QBADADDR;
  1474.           usrerr("550 Cannot mail directly to programs");
  1475. ***************
  1476. *** 276,282 ****
  1477.       if (m == InclMailer)
  1478.       {
  1479.           a->q_flags |= QDONTSEND;
  1480. !         if (a->q_alias == NULL && !bitset(EF_QUEUERUN, e->e_flags))
  1481.           {
  1482.               a->q_flags |= QBADADDR;
  1483.               usrerr("550 Cannot mail directly to :include:s");
  1484. --- 275,281 ----
  1485.       if (m == InclMailer)
  1486.       {
  1487.           a->q_flags |= QDONTSEND;
  1488. !         if (a->q_alias == NULL)
  1489.           {
  1490.               a->q_flags |= QBADADDR;
  1491.               usrerr("550 Cannot mail directly to :include:s");
  1492. ***************
  1493. *** 313,319 ****
  1494.   
  1495.           p = strrchr(buf, '/');
  1496.           /* check if writable or creatable */
  1497. !         if (a->q_alias == NULL && !bitset(EF_QUEUERUN, e->e_flags))
  1498.           {
  1499.               a->q_flags |= QBADADDR;
  1500.               usrerr("550 Cannot mail directly to files");
  1501. --- 312,318 ----
  1502.   
  1503.           p = strrchr(buf, '/');
  1504.           /* check if writable or creatable */
  1505. !         if (a->q_alias == NULL)
  1506.           {
  1507.               a->q_flags |= QBADADDR;
  1508.               usrerr("550 Cannot mail directly to files");
  1509. ***************
  1510. *** 322,328 ****
  1511.               (*p = '\0', safefile(buf, RealUid, RealGid, NULL, TRUE, S_IWRITE|S_IEXEC) != 0))
  1512.           {
  1513.               a->q_flags |= QBADADDR;
  1514. !             giveresponse(EX_CANTCREAT, m, NULL, e);
  1515.           }
  1516.       }
  1517.   
  1518. --- 321,327 ----
  1519.               (*p = '\0', safefile(buf, RealUid, RealGid, NULL, TRUE, S_IWRITE|S_IEXEC) != 0))
  1520.           {
  1521.               a->q_flags |= QBADADDR;
  1522. !             giveresponse(EX_CANTCREAT, m, NULL, a->q_alias, e);
  1523.           }
  1524.       }
  1525.   
  1526. ***************
  1527. *** 400,406 ****
  1528.           if (pw == NULL)
  1529.           {
  1530.               a->q_flags |= QBADADDR;
  1531. !             giveresponse(EX_NOUSER, m, NULL, e);
  1532.           }
  1533.           else
  1534.           {
  1535. --- 399,405 ----
  1536.           if (pw == NULL)
  1537.           {
  1538.               a->q_flags |= QBADADDR;
  1539. !             giveresponse(EX_NOUSER, m, NULL, a->q_alias, e);
  1540.           }
  1541.           else
  1542.           {
  1543. *** src/savemail.c.OLD    Sun Oct 31 08:19:50 1993
  1544. --- src/savemail.c    Sun Oct 31 10:18:15 1993
  1545. ***************
  1546. *** 33,39 ****
  1547.    */
  1548.   
  1549.   #ifndef lint
  1550. ! static char sccsid[] = "@(#)savemail.c    8.16 (Berkeley) 10/21/93";
  1551.   #endif /* not lint */
  1552.   
  1553.   # include "sendmail.h"
  1554. --- 33,39 ----
  1555.    */
  1556.   
  1557.   #ifndef lint
  1558. ! static char sccsid[] = "@(#)savemail.c    8.17 (Berkeley) 10/31/93";
  1559.   #endif /* not lint */
  1560.   
  1561.   # include "sendmail.h"
  1562. ***************
  1563. *** 267,273 ****
  1564.   
  1565.               e->e_flags |= EF_PM_NOTIFY;
  1566.   
  1567. !             q = e->e_errorqueue;
  1568.               if (q == NULL)
  1569.               {
  1570.                   /* this is an error-error */
  1571. --- 267,276 ----
  1572.   
  1573.               e->e_flags |= EF_PM_NOTIFY;
  1574.   
  1575. !             /* check to see if there are any good addresses */
  1576. !             for (q = e->e_errorqueue; q != NULL; q = q->q_next)
  1577. !                 if (!bitset(QBADADDR|QDONTSEND, q->q_flags))
  1578. !                     break;
  1579.               if (q == NULL)
  1580.               {
  1581.                   /* this is an error-error */
  1582. *** src/sendmail.h.OLD    Sun Oct 24 13:49:09 1993
  1583. --- src/sendmail.h    Sun Oct 31 11:22:57 1993
  1584. ***************
  1585. *** 31,37 ****
  1586.    * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  1587.    * SUCH DAMAGE.
  1588.    *
  1589. !  *    @(#)sendmail.h    8.24 (Berkeley) 10/15/93
  1590.    */
  1591.   
  1592.   /*
  1593. --- 31,37 ----
  1594.    * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  1595.    * SUCH DAMAGE.
  1596.    *
  1597. !  *    @(#)sendmail.h    8.26 (Berkeley) 10/31/93
  1598.    */
  1599.   
  1600.   /*
  1601. ***************
  1602. *** 41,47 ****
  1603.   # ifdef _DEFINE
  1604.   # define EXTERN
  1605.   # ifndef lint
  1606. ! static char SmailSccsId[] =    "@(#)sendmail.h    8.24        10/15/93";
  1607.   # endif
  1608.   # else /*  _DEFINE */
  1609.   # define EXTERN extern
  1610. --- 41,47 ----
  1611.   # ifdef _DEFINE
  1612.   # define EXTERN
  1613.   # ifndef lint
  1614. ! static char SmailSccsId[] =    "@(#)sendmail.h    8.26        10/31/93";
  1615.   # endif
  1616.   # else /*  _DEFINE */
  1617.   # define EXTERN extern
  1618. ***************
  1619. *** 57,62 ****
  1620. --- 57,63 ----
  1621.   # include <string.h>
  1622.   # include <time.h>
  1623.   # include <errno.h>
  1624. + # include <sys/un.h>
  1625.   
  1626.   # include "conf.h"
  1627.   # include "useful.h"
  1628. ***************
  1629. *** 729,734 ****
  1630. --- 730,736 ----
  1631.   union bigsockaddr
  1632.   {
  1633.       struct sockaddr        sa;    /* general version */
  1634. +     struct sockaddr_un    sunix;    /* UNIX family */
  1635.   #ifdef NETINET
  1636.       struct sockaddr_in    sin;    /* INET family */
  1637.   #endif
  1638. ***************
  1639. *** 765,771 ****
  1640.   EXTERN bool    NoAlias;    /* suppress aliasing */
  1641.   EXTERN bool    UseNameServer;    /* use internet domain name server */
  1642.   EXTERN bool    SevenBit;    /* force 7-bit data */
  1643. ! EXTERN int    SafeAlias;    /* minutes to wait until @:@ in alias file */
  1644.   EXTERN FILE    *InChannel;    /* input connection */
  1645.   EXTERN FILE    *OutChannel;    /* output connection */
  1646.   EXTERN uid_t    RealUid;    /* when Daemon, real uid of caller */
  1647. --- 767,773 ----
  1648.   EXTERN bool    NoAlias;    /* suppress aliasing */
  1649.   EXTERN bool    UseNameServer;    /* use internet domain name server */
  1650.   EXTERN bool    SevenBit;    /* force 7-bit data */
  1651. ! EXTERN time_t    SafeAlias;    /* interval to wait until @:@ in alias file */
  1652.   EXTERN FILE    *InChannel;    /* input connection */
  1653.   EXTERN FILE    *OutChannel;    /* output connection */
  1654.   EXTERN uid_t    RealUid;    /* when Daemon, real uid of caller */
  1655. *** src/srvrsmtp.c.OLD    Thu Oct 28 17:51:54 1993
  1656. --- src/srvrsmtp.c    Thu Oct 28 19:38:21 1993
  1657. ***************
  1658. *** 36,44 ****
  1659.   
  1660.   #ifndef lint
  1661.   #ifdef SMTP
  1662. ! static char sccsid[] = "@(#)srvrsmtp.c    8.17 (Berkeley) 10/15/93 (with SMTP)";
  1663.   #else
  1664. ! static char sccsid[] = "@(#)srvrsmtp.c    8.17 (Berkeley) 10/15/93 (without SMTP)";
  1665.   #endif
  1666.   #endif /* not lint */
  1667.   
  1668. --- 36,44 ----
  1669.   
  1670.   #ifndef lint
  1671.   #ifdef SMTP
  1672. ! static char sccsid[] = "@(#)srvrsmtp.c    8.18 (Berkeley) 10/28/93 (with SMTP)";
  1673.   #else
  1674. ! static char sccsid[] = "@(#)srvrsmtp.c    8.18 (Berkeley) 10/28/93 (without SMTP)";
  1675.   #endif
  1676.   #endif /* not lint */
  1677.   
  1678. ***************
  1679. *** 531,538 ****
  1680.   
  1681.               /* collect the text of the message */
  1682.               SmtpPhase = "collect";
  1683. -             HoldErrs = TRUE;
  1684.               collect(TRUE, doublequeue, e);
  1685.   
  1686.               /*
  1687.               **  Arrange to send to everyone.
  1688. --- 531,540 ----
  1689.   
  1690.               /* collect the text of the message */
  1691.               SmtpPhase = "collect";
  1692.               collect(TRUE, doublequeue, e);
  1693. +             if (Errors != 0)
  1694. +                 goto abortmessage;
  1695. +             HoldErrs = TRUE;
  1696.   
  1697.               /*
  1698.               **  Arrange to send to everyone.
  1699. *** src/util.c.OLD    Sun Oct 31 13:03:51 1993
  1700. --- src/util.c    Sun Oct 31 13:05:26 1993
  1701. ***************
  1702. *** 33,39 ****
  1703.    */
  1704.   
  1705.   #ifndef lint
  1706. ! static char sccsid[] = "@(#)util.c    8.14 (Berkeley) 10/23/93";
  1707.   #endif /* not lint */
  1708.   
  1709.   # include "sendmail.h"
  1710. --- 33,39 ----
  1711.    */
  1712.   
  1713.   #ifndef lint
  1714. ! static char sccsid[] = "@(#)util.c    8.15 (Berkeley) 10/31/93";
  1715.   #endif /* not lint */
  1716.   
  1717.   # include "sendmail.h"
  1718. ***************
  1719. *** 1241,1246 ****
  1720. --- 1241,1247 ----
  1721.       p += strlen(p);
  1722.       switch (st.st_mode & S_IFMT)
  1723.       {
  1724. + #ifdef S_IFSOCK
  1725.         case S_IFSOCK:
  1726.           sprintf(p, "SOCK ");
  1727.           p += strlen(p);
  1728. ***************
  1729. *** 1266,1271 ****
  1730. --- 1267,1273 ----
  1731.                              : hp->h_name, ntohs(sin.sin_port));
  1732.           }
  1733.           break;
  1734. + #endif
  1735.   
  1736.         case S_IFCHR:
  1737.           sprintf(p, "CHR: ");
  1738. *** src/version.c.OLD    Sun Oct 31 13:09:46 1993
  1739. --- src/version.c    Sun Oct 31 11:34:48 1993
  1740. ***************
  1741. *** 33,39 ****
  1742.    */
  1743.   
  1744.   #ifndef lint
  1745. ! static char sccsid[] = "@(#)version.c    8.6.1.3 (Berkeley) 10/24/93";
  1746.   #endif /* not lint */
  1747.   
  1748. ! char    Version[] = "8.6.3";
  1749. --- 33,39 ----
  1750.    */
  1751.   
  1752.   #ifndef lint
  1753. ! static char sccsid[] = "@(#)version.c    8.6.1.4 (Berkeley) 10/31/93";
  1754.   #endif /* not lint */
  1755.   
  1756. ! char    Version[] = "8.6.4";
  1757. *** cf/README.OLD    Sun Oct 31 07:17:52 1993
  1758. --- cf/README    Sun Oct 31 11:35:24 1993
  1759. ***************
  1760. *** 4,10 ****
  1761.   
  1762.           Eric Allman <eric@CS.Berkeley.EDU>
  1763.   
  1764. !         @(#)README    8.14 (Berkeley) 9/19/93
  1765.   
  1766.   
  1767.   This document describes the sendmail configuration files being used
  1768. --- 4,10 ----
  1769.   
  1770.           Eric Allman <eric@CS.Berkeley.EDU>
  1771.   
  1772. !         @(#)README    8.15 (Berkeley) 10/31/93
  1773.   
  1774.   
  1775.   This document describes the sendmail configuration files being used
  1776. ***************
  1777. *** 1004,1009 ****
  1778. --- 1004,1015 ----
  1779.      5 *    Local address rewrite (after aliasing)
  1780.     1x    mailer rules (sender qualification)
  1781.     2x    mailer rules (recipient qualification)
  1782. +   3x    mailer rules (sender header qualification)
  1783. +   4x    mailer rules (recipient header qualification)
  1784. +   5x    mailer subroutines (general)
  1785. +   6x    mailer subroutines (general)
  1786. +   7x    mailer subroutines (general)
  1787. +   8x    reserved
  1788.     90    Mailertable host stripping
  1789.     96    Bottom half of Ruleset 3 (ruleset 6 in old sendmail)
  1790.     97    Hook for recursive ruleset 0 call (ruleset 7 in old sendmail)
  1791. *** cf/m4/proto.m4.OLD    Sun Oct 31 07:23:08 1993
  1792. --- cf/m4/proto.m4    Sun Oct 31 11:35:58 1993
  1793. ***************
  1794. *** 34,40 ****
  1795.   #
  1796.   divert(0)
  1797.   
  1798. ! VERSIONID(`@(#)proto.m4    8.19 (Berkeley) 10/15/93')
  1799.   
  1800.   MAILER(local)dnl
  1801.   
  1802. --- 34,40 ----
  1803.   #
  1804.   divert(0)
  1805.   
  1806. ! VERSIONID(`@(#)proto.m4    8.20 (Berkeley) 10/31/93')
  1807.   
  1808.   MAILER(local)dnl
  1809.   
  1810. ***************
  1811. *** 393,401 ****
  1812.   ###########################################
  1813.   S3
  1814.   
  1815. ! # handle null input and list syntax (translate to <@> special case)
  1816.   R$@            $@ <@>
  1817. - R$*:;$*            $@ $1 :; <@>
  1818.   
  1819.   # basic textual canonicalization -- note RFC733 heuristic here
  1820.   R$*<$*>$*<$*>$*        $2$3<$4>$5            strip multiple <> <>
  1821. --- 393,400 ----
  1822.   ###########################################
  1823.   S3
  1824.   
  1825. ! # handle null input (translate to <@> special case)
  1826.   R$@            $@ <@>
  1827.   
  1828.   # basic textual canonicalization -- note RFC733 heuristic here
  1829.   R$*<$*>$*<$*>$*        $2$3<$4>$5            strip multiple <> <>
  1830. ***************
  1831. *** 402,407 ****
  1832. --- 401,409 ----
  1833.   R$*<$*<$+>$*>$*        <$3>$5                2-level <> nesting
  1834.   R$*<>$*            $@ <@>                MAIL FROM:<> case
  1835.   R$*<$+>$*        $2                basic RFC821/822 parsing
  1836. + # handle list:; syntax as special case
  1837. + R$*:;$*            $@ $1 :; <@>
  1838.   
  1839.   # make sure <@a,@b,@c:user@d> syntax is easy to parse -- undone later
  1840.   R@ $+ , $+        @ $1 : $2            change all "," to ":"
  1841. *** cf/m4/version.m4.OLD    Sun Oct 31 12:35:27 1993
  1842. --- cf/m4/version.m4    Sun Oct 31 12:35:42 1993
  1843. ***************
  1844. *** 32,39 ****
  1845.   # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  1846.   # SUCH DAMAGE.
  1847.   #
  1848. ! VERSIONID(`@(#)version.m4    8.6.1.3 (Berkeley) 10/24/93')
  1849.   #
  1850.   divert(0)
  1851.   # Configuration version number
  1852. ! DZ8.6.3
  1853. --- 32,39 ----
  1854.   # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  1855.   # SUCH DAMAGE.
  1856.   #
  1857. ! VERSIONID(`@(#)version.m4    8.6.1.4 (Berkeley) 10/31/93')
  1858.   #
  1859.   divert(0)
  1860.   # Configuration version number
  1861. ! DZ8.6.4
  1862. *** cf/mailer/local.m4.OLD    Sun Oct 24 14:57:03 1993
  1863. --- cf/mailer/local.m4    Sun Oct 24 16:27:18 1993
  1864. ***************
  1865. *** 44,54 ****
  1866.   ###   Local and Program Mailer specification   ###
  1867.   ##################################################
  1868.   
  1869. ! VERSIONID(`@(#)local.m4    8.5 (Berkeley) 10/23/93')
  1870.   
  1871.   Mlocal,        P=LOCAL_MAILER_PATH, F=CONCAT(`lsDFM', LOCAL_MAILER_FLAGS), S=10, R=20/40,
  1872.           A=LOCAL_MAILER_ARGS
  1873. ! Mprog,        P=LOCAL_SHELL_PATH, F=CONCAT(`lsDFM', LOCAL_SHELL_FLAGS), S=10, R=20, D=$z:/,
  1874.           A=LOCAL_SHELL_ARGS
  1875.   
  1876.   S10
  1877. --- 44,54 ----
  1878.   ###   Local and Program Mailer specification   ###
  1879.   ##################################################
  1880.   
  1881. ! VERSIONID(`@(#)local.m4    8.6 (Berkeley) 10/24/93')
  1882.   
  1883.   Mlocal,        P=LOCAL_MAILER_PATH, F=CONCAT(`lsDFM', LOCAL_MAILER_FLAGS), S=10, R=20/40,
  1884.           A=LOCAL_MAILER_ARGS
  1885. ! Mprog,        P=LOCAL_SHELL_PATH, F=CONCAT(`lsDFM', LOCAL_SHELL_FLAGS), S=10, R=20/40, D=$z:/,
  1886.           A=LOCAL_SHELL_ARGS
  1887.   
  1888.   S10
  1889. *** cf/mailer/smtp.m4.OLD    Sun Oct 31 07:19:59 1993
  1890. --- cf/mailer/smtp.m4    Sun Oct 31 11:38:08 1993
  1891. ***************
  1892. *** 40,52 ****
  1893.   ###   SMTP Mailer specification   ###
  1894.   #####################################
  1895.   
  1896. ! VERSIONID(`@(#)smtp.m4    8.6 (Berkeley) 10/23/93')
  1897.   
  1898.   Msmtp,        P=[IPC], F=CONCAT(mDFMuX, SMTP_MAILER_FLAGS), S=11/31, R=ifdef(`_ALL_MASQUERADE_', `11/31', `21'), E=\r\n,
  1899.           ifdef(`_OLD_SENDMAIL_',, `L=990, ')A=IPC $h
  1900.   Mesmtp,        P=[IPC], F=CONCAT(mDFMuXa, SMTP_MAILER_FLAGS), S=11/31, R=ifdef(`_ALL_MASQUERADE_', `11/31', `21'), E=\r\n,
  1901.           ifdef(`_OLD_SENDMAIL_',, `L=990, ')A=IPC $h
  1902. ! Mrelay,        P=[IPC], F=CONCAT(mDFMuXa, SMTP_MAILER_FLAGS), S=11/31, R=19, E=\r\n,
  1903.           ifdef(`_OLD_SENDMAIL_',, `L=2040, ')A=IPC $h
  1904.   
  1905.   #
  1906. --- 40,52 ----
  1907.   ###   SMTP Mailer specification   ###
  1908.   #####################################
  1909.   
  1910. ! VERSIONID(`@(#)smtp.m4    8.7 (Berkeley) 10/31/93')
  1911.   
  1912.   Msmtp,        P=[IPC], F=CONCAT(mDFMuX, SMTP_MAILER_FLAGS), S=11/31, R=ifdef(`_ALL_MASQUERADE_', `11/31', `21'), E=\r\n,
  1913.           ifdef(`_OLD_SENDMAIL_',, `L=990, ')A=IPC $h
  1914.   Mesmtp,        P=[IPC], F=CONCAT(mDFMuXa, SMTP_MAILER_FLAGS), S=11/31, R=ifdef(`_ALL_MASQUERADE_', `11/31', `21'), E=\r\n,
  1915.           ifdef(`_OLD_SENDMAIL_',, `L=990, ')A=IPC $h
  1916. ! Mrelay,        P=[IPC], F=CONCAT(mDFMuXa, SMTP_MAILER_FLAGS), S=11/31, R=51, E=\r\n,
  1917.           ifdef(`_OLD_SENDMAIL_',, `L=2040, ')A=IPC $h
  1918.   
  1919.   #
  1920. ***************
  1921. *** 53,64 ****
  1922.   #  envelope sender and masquerading recipient rewriting
  1923.   #
  1924.   S11
  1925. ! R$+            $: $>19 $1            sender/recipient common
  1926.   R$* :; <@>        $@ $1 :;            list:; special case
  1927.   
  1928.   # handle unqualified names
  1929.   R$* < @ $* > $*        $@ $1 < @ $2 > $3        already qualified
  1930. ! R$*            $@ $>29 $1
  1931.   
  1932.   
  1933.   #
  1934. --- 53,64 ----
  1935.   #  envelope sender and masquerading recipient rewriting
  1936.   #
  1937.   S11
  1938. ! R$+            $: $>51 $1            sender/recipient common
  1939.   R$* :; <@>        $@ $1 :;            list:; special case
  1940.   
  1941.   # handle unqualified names
  1942.   R$* < @ $* > $*        $@ $1 < @ $2 > $3        already qualified
  1943. ! R$*            $@ $>61 $1
  1944.   
  1945.   
  1946.   #
  1947. ***************
  1948. *** 67,73 ****
  1949.   S21
  1950.   
  1951.   # do sender/recipient common rewriting
  1952. ! R$+            $: $>19 $1
  1953.   
  1954.   # unqualified names (e.g., "eric") are qualified by local host
  1955.   R$* < @ $* > $*        $@ $1 < @ $2 > $3        already qualified
  1956. --- 67,73 ----
  1957.   S21
  1958.   
  1959.   # do sender/recipient common rewriting
  1960. ! R$+            $: $>51 $1
  1961.   
  1962.   # unqualified names (e.g., "eric") are qualified by local host
  1963.   R$* < @ $* > $*        $@ $1 < @ $2 > $3        already qualified
  1964. ***************
  1965. *** 78,84 ****
  1966.   #  header sender and masquerading recipient rewriting
  1967.   #
  1968.   S31
  1969. ! R$+            $: $>19 $1            sender/recipient common
  1970.   R$* :; <@>        $@ $1 :;            list:; special case
  1971.   
  1972.   # do special header rewriting
  1973. --- 78,84 ----
  1974.   #  header sender and masquerading recipient rewriting
  1975.   #
  1976.   S31
  1977. ! R$+            $: $>51 $1            sender/recipient common
  1978.   R$* :; <@>        $@ $1 :;            list:; special case
  1979.   
  1980.   # do special header rewriting
  1981. ***************
  1982. *** 90,102 ****
  1983.   
  1984.   # handle unqualified names
  1985.   R$* < @ $* > $*        $@ $1 < @ $2 > $3        already qualified
  1986. ! R$*            $@ $>29 $1
  1987.   
  1988.   
  1989.   #
  1990.   #  common rewriting for all SMTP addresses
  1991.   #
  1992. ! S19
  1993.   
  1994.   # pass <route-addr>s through
  1995.   R< @ $+ > $*        $@ < @ $1 > $2            resolve <route-addr>
  1996. --- 90,102 ----
  1997.   
  1998.   # handle unqualified names
  1999.   R$* < @ $* > $*        $@ $1 < @ $2 > $3        already qualified
  2000. ! R$*            $@ $>61 $1
  2001.   
  2002.   
  2003.   #
  2004.   #  common rewriting for all SMTP addresses
  2005.   #
  2006. ! S51
  2007.   
  2008.   # pass <route-addr>s through
  2009.   R< @ $+ > $*        $@ < @ $1 > $2            resolve <route-addr>
  2010. ***************
  2011. *** 117,123 ****
  2012.   #
  2013.   #  common sender and masquerading recipient rewriting
  2014.   #
  2015. ! S29
  2016.   R$=E            $@ $1 < @ $j>            show exposed names
  2017.   R$+            $: $1 < @ $M >            user w/o host
  2018.   R$+ <@>            $: $1 < @ $j >            in case $M undefined
  2019. --- 117,124 ----
  2020.   #
  2021.   #  common sender and masquerading recipient rewriting
  2022.   #
  2023. ! S61
  2024.   R$=E            $@ $1 < @ $j>            show exposed names
  2025.   R$+            $: $1 < @ $M >            user w/o host
  2026.   R$+ <@>            $: $1 < @ $j >            in case $M undefined
  2027. *** cf/mailer/uucp.m4.OLD    Sun Oct 31 07:04:26 1993
  2028. --- cf/mailer/uucp.m4    Sun Oct 31 11:38:35 1993
  2029. ***************
  2030. *** 42,48 ****
  2031.   ###   UUCP Mailer specification   ###
  2032.   #####################################
  2033.   
  2034. ! VERSIONID(`@(#)uucp.m4    8.5 (Berkeley) 7/28/93')
  2035.   
  2036.   # old UUCP mailer
  2037.   Muucp,        P=UUCP_MAILER_PATH, F=CONCAT(DFMhuU, UUCP_MAILER_FLAGS), S=12, R=22, M=UUCP_MAX_SIZE,
  2038. --- 42,48 ----
  2039.   ###   UUCP Mailer specification   ###
  2040.   #####################################
  2041.   
  2042. ! VERSIONID(`@(#)uucp.m4    8.6 (Berkeley) 10/31/93')
  2043.   
  2044.   # old UUCP mailer
  2045.   Muucp,        P=UUCP_MAILER_PATH, F=CONCAT(DFMhuU, UUCP_MAILER_FLAGS), S=12, R=22, M=UUCP_MAX_SIZE,
  2046. ***************
  2047. *** 54,64 ****
  2048.   
  2049.   ifdef(`_MAILER_smtp_',
  2050.   `# domain-ized UUCP mailer
  2051. ! Muucp-dom,    P=UUCP_MAILER_PATH, F=CONCAT(mDFMhu, UUCP_MAILER_FLAGS), S=11, R=21, M=UUCP_MAX_SIZE,
  2052.           A=UUCP_MAILER_ARGS')
  2053.   
  2054.   
  2055. ! # sender rewriting
  2056.   S12
  2057.   
  2058.   # handle error address as a special case
  2059. --- 54,66 ----
  2060.   
  2061.   ifdef(`_MAILER_smtp_',
  2062.   `# domain-ized UUCP mailer
  2063. ! Muucp-dom,    P=UUCP_MAILER_PATH, F=CONCAT(mDFMhu, UUCP_MAILER_FLAGS), S=52/31, R=ifdef(`_ALL_MASQUERADE_', `11/31', `21'), M=UUCP_MAX_SIZE,
  2064.           A=UUCP_MAILER_ARGS')
  2065.   
  2066.   
  2067. ! #
  2068. ! #  envelope and header sender rewriting
  2069. ! #
  2070.   S12
  2071.   
  2072.   # handle error address as a special case
  2073. ***************
  2074. *** 73,79 ****
  2075.   R$* < @ $+ >            $2 ! $1            convert to UUCP format
  2076.   R$+                $: $U ! $1        prepend our name
  2077.   
  2078. ! # recipient rewriting
  2079.   S22
  2080.   
  2081.   # don't touch list:; syntax
  2082. --- 75,83 ----
  2083.   R$* < @ $+ >            $2 ! $1            convert to UUCP format
  2084.   R$+                $: $U ! $1        prepend our name
  2085.   
  2086. ! #
  2087. ! #  envelope and header recipient rewriting
  2088. ! #
  2089.   S22
  2090.   
  2091.   # don't touch list:; syntax
  2092. ***************
  2093. *** 83,88 ****
  2094. --- 87,105 ----
  2095.   R$* < @ $j >            $1            strip local name
  2096.   R$* < @ $- . UUCP >        $2 ! $1            convert to UUCP format
  2097.   R$* < @ $+ >            $2 ! $1            convert to UUCP format
  2098. + #
  2099. + #  envelope sender rewriting for uucp-dom mailer
  2100. + #
  2101. + S52
  2102. + # handle error address as a special case
  2103. + R<@>                $n            errors to mailer-daemon
  2104. + # pass everything to standard SMTP mailer rewriting
  2105. + R$*                $@ $>11 $1
  2106.   
  2107.   PUSHDIVERT(4)
  2108.   # resolve locally connected UUCP links
  2109.