more environment problems; limit resource exhaustion; fix incorrect
authorEric Allman <eric@ucbvax.Berkeley.EDU>
Fri, 22 Jan 1993 07:18:58 +0000 (23:18 -0800)
committerEric Allman <eric@ucbvax.Berkeley.EDU>
Fri, 22 Jan 1993 07:18:58 +0000 (23:18 -0800)
name in Connection timed out message; ANSI C fixes; log message sender on
returned mail during queue run; count recipients properly; fix YP code;
diagnose "message timed out" properly

SCCS-vsn: usr.sbin/sendmail/src/headers.c 6.5
SCCS-vsn: usr.sbin/sendmail/src/usersmtp.c 6.3
SCCS-vsn: usr.sbin/sendmail/src/recipient.c 6.3
SCCS-vsn: usr.sbin/sendmail/src/main.c 6.9
SCCS-vsn: usr.sbin/sendmail/src/conf.h 6.4
SCCS-vsn: usr.sbin/sendmail/src/arpadate.c 6.3
SCCS-vsn: usr.sbin/sendmail/src/err.c 6.2
SCCS-vsn: usr.sbin/sendmail/src/collect.c 6.3
SCCS-vsn: usr.sbin/sendmail/src/version.c 6.12
SCCS-vsn: usr.sbin/sendmail/src/savemail.c 6.3
SCCS-vsn: usr.sbin/sendmail/src/srvrsmtp.c 6.3
SCCS-vsn: usr.sbin/sendmail/src/util.c 6.4
SCCS-vsn: usr.sbin/sendmail/src/deliver.c 6.10
SCCS-vsn: usr.sbin/sendmail/src/queue.c 6.5
SCCS-vsn: usr.sbin/sendmail/src/conf.c 6.10
SCCS-vsn: usr.sbin/sendmail/src/map.c 6.2
SCCS-vsn: usr.sbin/sendmail/src/Makefiles/Makefile.dist 6.3

17 files changed:
usr/src/usr.sbin/sendmail/src/Makefiles/Makefile.dist
usr/src/usr.sbin/sendmail/src/arpadate.c
usr/src/usr.sbin/sendmail/src/collect.c
usr/src/usr.sbin/sendmail/src/conf.c
usr/src/usr.sbin/sendmail/src/conf.h
usr/src/usr.sbin/sendmail/src/deliver.c
usr/src/usr.sbin/sendmail/src/err.c
usr/src/usr.sbin/sendmail/src/headers.c
usr/src/usr.sbin/sendmail/src/main.c
usr/src/usr.sbin/sendmail/src/map.c
usr/src/usr.sbin/sendmail/src/queue.c
usr/src/usr.sbin/sendmail/src/recipient.c
usr/src/usr.sbin/sendmail/src/savemail.c
usr/src/usr.sbin/sendmail/src/srvrsmtp.c
usr/src/usr.sbin/sendmail/src/usersmtp.c
usr/src/usr.sbin/sendmail/src/util.c
usr/src/usr.sbin/sendmail/src/version.c

index 8bf8ff2..8c22b60 100644 (file)
@@ -7,7 +7,7 @@
 #
 #  This has been tested on Ultrix.
 #
 #
 #  This has been tested on Ultrix.
 #
-#      @(#)Makefile.dist       6.2 (Berkeley) %G%
+#      @(#)Makefile.dist       6.3 (Berkeley) %G%
 #
 
 # use O=-O (usual) or O=-g (debugging)
 #
 
 # use O=-O (usual) or O=-g (debugging)
@@ -17,7 +17,11 @@ O=   -O
 #      -DNDBM -- use new DBM
 #      -DNEWDB -- use new Berkeley DB
 #      -DNDBM -DNEWDB -- use both new DBM and new Berkeley DB
 #      -DNDBM -- use new DBM
 #      -DNEWDB -- use new Berkeley DB
 #      -DNDBM -DNEWDB -- use both new DBM and new Berkeley DB
+#      -DNDBM -DNEWDB -DYPCOMPAT -- use both plus YP compatility
 # The really old (V7) DBM library is no longer supported.
 # The really old (V7) DBM library is no longer supported.
+# If YPCOMPAT is defined and /var/yp/Makefile exists, sendmail will build
+#   both the NEWDB and DBM libraries (the DBM just for YP).
+#
 DBMDEF=        -DNDBM -DNEWDB
 
 # define the load average calculation on your system: -DLA_TYPE=LA_INT,
 DBMDEF=        -DNDBM -DNEWDB
 
 # define the load average calculation on your system: -DLA_TYPE=LA_INT,
index 51f0e02..e898598 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)arpadate.c 6.2 (Berkeley) %G%";
+static char sccsid[] = "@(#)arpadate.c 6.3 (Berkeley) %G%";
 #endif /* not lint */
 
 # include "sendmail.h"
 #endif /* not lint */
 
 # include "sendmail.h"
@@ -51,9 +51,6 @@ arpadate(ud)
        time_t t;
        struct tm gmt;
        static char b[40];
        time_t t;
        struct tm gmt;
        static char b[40];
-       extern struct tm *localtime(), *gmtime();
-       extern char *ctime();
-       extern time_t time();
 
        /*
        **  Get current time.
 
        /*
        **  Get current time.
index 7f4ee46..2ccc039 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)collect.c  6.2 (Berkeley) %G%";
+static char sccsid[] = "@(#)collect.c  6.3 (Berkeley) %G%";
 #endif /* not lint */
 
 # include <errno.h>
 #endif /* not lint */
 
 # include <errno.h>
@@ -268,7 +268,7 @@ readerr:
        **      Examples are who is the from person & the date.
        */
 
        **      Examples are who is the from person & the date.
        */
 
-       eatheader(e);
+       eatheader(e, QueueRun);
 
        /*
        **  Add an Apparently-To: line if we have no recipient lines.
 
        /*
        **  Add an Apparently-To: line if we have no recipient lines.
index cde6b78..2c8c75b 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)conf.c     6.9 (Berkeley) %G%";
+static char sccsid[] = "@(#)conf.c     6.10 (Berkeley) %G%";
 #endif /* not lint */
 
 # include <sys/ioctl.h>
 #endif /* not lint */
 
 # include <sys/ioctl.h>
@@ -716,9 +716,13 @@ refuseconnections()
 */
 
 /*VARARGS1*/
 */
 
 /*VARARGS1*/
-setproctitle(fmt VA_ARG_FORMAL)
+#ifdef __STDC__
+setproctitle(char *fmt, ...)
+#else
+setproctitle(fmt, va_alist)
        char *fmt;
        char *fmt;
-       VA_ARG_DECL
+       va_dcl
+#endif
 {
 # ifdef SETPROCTITLE
        register char *p;
 {
 # ifdef SETPROCTITLE
        register char *p;
index 31627f6..41cd3ed 100644 (file)
@@ -5,7 +5,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)conf.h      6.3 (Berkeley) %G%
+ *     @(#)conf.h      6.4 (Berkeley) %G%
  */
 
 /*
  */
 
 /*
@@ -31,6 +31,7 @@
 # define SMTPLINELIM   990             /* maximum SMTP line length */
 # define MAXKEY                128             /* maximum size of a database key */
 # define MEMCHUNKSIZE  1024            /* chunk size for memory allocation */
 # define SMTPLINELIM   990             /* maximum SMTP line length */
 # define MAXKEY                128             /* maximum size of a database key */
 # define MEMCHUNKSIZE  1024            /* chunk size for memory allocation */
+# define MAXUSERENVIRON        100             /* max envariables saved */
 
 # ifndef QUEUESIZE
 # define QUEUESIZE     1000            /* max # of jobs per queue run */
 
 # ifndef QUEUESIZE
 # define QUEUESIZE     1000            /* max # of jobs per queue run */
@@ -98,8 +99,6 @@
 
 # include <stdarg.h>
 
 
 # include <stdarg.h>
 
-# define VA_ARG_FORMAL
-# define VA_ARG_DECL
 # define VA_LOCAL_DECL va_list ap;
 # define VA_START(f)   va_start(ap, f)
 # define VA_END                va_end(ap)
 # define VA_LOCAL_DECL va_list ap;
 # define VA_START(f)   va_start(ap, f)
 # define VA_END                va_end(ap)
 
 # include <varargs.h>
 
 
 # include <varargs.h>
 
-# define VA_ARG_FORMAL ,va_alist
-# define VA_ARG_DECL   va_dcl
 # define VA_LOCAL_DECL va_list ap;
 # define VA_START(f)   va_start(ap)
 # define VA_END                va_end(ap)
 # define VA_LOCAL_DECL va_list ap;
 # define VA_START(f)   va_start(ap)
 # define VA_END                va_end(ap)
@@ -128,3 +125,7 @@ struct utsname
        char nodename[NODE_LENGTH+1];
 };
 #endif /* UNAME */
        char nodename[NODE_LENGTH+1];
 };
 #endif /* UNAME */
+
+#ifdef sun
+# include <vfork.h>
+#endif
index 9aa9cca..ee5ffa3 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)deliver.c  6.9 (Berkeley) %G%";
+static char sccsid[] = "@(#)deliver.c  6.10 (Berkeley) %G%";
 #endif /* not lint */
 
 #include "sendmail.h"
 #endif /* not lint */
 
 #include "sendmail.h"
@@ -551,6 +551,7 @@ markfailure(e, q, rcode)
                }
                q->q_flags |= QBADADDR;
                e->e_flags |= EF_TIMEOUT;
                }
                q->q_flags |= QBADADDR;
                e->e_flags |= EF_TIMEOUT;
+               fprintf(e->e_xfp, "421 %s... Message timed out\n", q->q_paddr);
        }
        else
                q->q_flags |= QQUEUEUP;
        }
        else
                q->q_flags |= QQUEUEUP;
index 3343617..5b8ced4 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)err.c      6.1 (Berkeley) %G%";
+static char sccsid[] = "@(#)err.c      6.2 (Berkeley) %G%";
 #endif /* not lint */
 
 # include "sendmail.h"
 #endif /* not lint */
 
 # include "sendmail.h"
@@ -42,9 +42,13 @@ char MsgBuf[BUFSIZ*2];       /* text of most recent message */
 static void fmtmsg();
 
 /*VARARGS1*/
 static void fmtmsg();
 
 /*VARARGS1*/
-syserr(fmt VA_ARG_FORMAL)
+#ifdef __STDC__
+syserr(char *fmt, ...)
+#else
+syserr(fmt, va_alist)
        char *fmt;
        char *fmt;
-       VA_ARG_DECL
+       va_dcl
+#endif
 {
        register char *p;
        int olderrno = errno;
 {
        register char *p;
        int olderrno = errno;
@@ -98,9 +102,13 @@ syserr(fmt VA_ARG_FORMAL)
 */
 
 /*VARARGS1*/
 */
 
 /*VARARGS1*/
-usrerr(fmt VA_ARG_FORMAL)
+#ifdef __STDC__
+usrerr(char *fmt, ...)
+#else
+usrerr(fmt, va_alist)
        char *fmt;
        char *fmt;
-       VA_ARG_DECL
+       va_dcl
+#endif
 {
        VA_LOCAL_DECL
        extern char SuprErrs;
 {
        VA_LOCAL_DECL
        extern char SuprErrs;
@@ -142,10 +150,14 @@ usrerr(fmt VA_ARG_FORMAL)
 */
 
 /*VARARGS2*/
 */
 
 /*VARARGS2*/
-message(num, msg VA_ARG_FORMAL)
+#ifdef __STDC__
+message(char *num, char *msg, ...)
+#else
+message(num, msg, va_alist)
        char *num;
        char *msg;
        char *num;
        char *msg;
-       VA_ARG_DECL
+       va_dcl
+#endif
 {
        VA_LOCAL_DECL
 
 {
        VA_LOCAL_DECL
 
@@ -174,10 +186,14 @@ message(num, msg VA_ARG_FORMAL)
 */
 
 /*VARARGS2*/
 */
 
 /*VARARGS2*/
-nmessage(num, msg VA_ARG_FORMAL)
+#ifdef __STDC__
+nmessage(char *num, char *msg, ...)
+#else
+nmessage(num, msg, va_alist)
        char *num;
        char *msg;
        char *num;
        char *msg;
-       VA_ARG_DECL
+       va_dcl
+#endif
 {
        VA_LOCAL_DECL
 
 {
        VA_LOCAL_DECL
 
index 7083971..59bf95b 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)headers.c  6.4 (Berkeley) %G%";
+static char sccsid[] = "@(#)headers.c  6.5 (Berkeley) %G%";
 #endif /* not lint */
 
 # include <errno.h>
 #endif /* not lint */
 
 # include <errno.h>
@@ -274,6 +274,7 @@ isheader(s)
 **
 **     Parameters:
 **             e -- the envelope to process.
 **
 **     Parameters:
 **             e -- the envelope to process.
+**             queuejob -- set if running a queued job.
 **
 **     Returns:
 **             none.
 **
 **     Returns:
 **             none.
@@ -284,8 +285,9 @@ isheader(s)
 **             Aborts the message if the hop count is exceeded.
 */
 
 **             Aborts the message if the hop count is exceeded.
 */
 
-eatheader(e)
+eatheader(e, queuejob)
        register ENVELOPE *e;
        register ENVELOPE *e;
+       bool queuejob;
 {
        register HDR *h;
        register char *p;
 {
        register HDR *h;
        register char *p;
@@ -317,7 +319,7 @@ eatheader(e)
                }
 
                /* save the message-id for logging */
                }
 
                /* save the message-id for logging */
-               if (!QueueRun && h->h_value != NULL &&
+               if (!queuejob && h->h_value != NULL &&
                    strcmp(h->h_field, "message-id") == 0)
                {
                        msgid = h->h_value;
                    strcmp(h->h_field, "message-id") == 0)
                {
                        msgid = h->h_value;
@@ -348,7 +350,7 @@ eatheader(e)
        p = hvalue("precedence", e);
        if (p != NULL)
                e->e_class = priencode(p);
        p = hvalue("precedence", e);
        if (p != NULL)
                e->e_class = priencode(p);
-       if (!QueueRun)
+       if (!queuejob)
                e->e_msgpriority = e->e_msgsize
                                 - e->e_class * WkClassFact
                                 + e->e_nrcpts * WkRecipFact;
                e->e_msgpriority = e->e_msgsize
                                 - e->e_class * WkClassFact
                                 + e->e_nrcpts * WkRecipFact;
@@ -376,7 +378,7 @@ eatheader(e)
        */
 
 # ifdef LOG
        */
 
 # ifdef LOG
-       if (!QueueRun && LogLevel > 1)
+       if (!queuejob && LogLevel > 1)
        {
                char *name;
                char hbuf[MAXNAME];
        {
                char *name;
                char hbuf[MAXNAME];
@@ -709,8 +711,6 @@ putheader(fp, m, e)
 {
        char buf[MAX(MAXLINE,BUFSIZ)];
        register HDR *h;
 {
        char buf[MAX(MAXLINE,BUFSIZ)];
        register HDR *h;
-       extern char *arpadate();
-       extern char *capitalize();
        char obuf[MAXLINE];
 
        for (h = e->e_header; h != NULL; h = h->h_link)
        char obuf[MAXLINE];
 
        for (h = e->e_header; h != NULL; h = h->h_link)
@@ -749,6 +749,7 @@ putheader(fp, m, e)
                {
                        /* vanilla header line */
                        register char *nlp;
                {
                        /* vanilla header line */
                        register char *nlp;
+                       extern char *capitalize();
 
                        (void) sprintf(obuf, "%s: ", capitalize(h->h_field));
                        while ((nlp = strchr(p, '\n')) != NULL)
 
                        (void) sprintf(obuf, "%s: ", capitalize(h->h_field));
                        while ((nlp = strchr(p, '\n')) != NULL)
@@ -796,6 +797,7 @@ commaize(h, p, fp, oldstyle, m, e)
        int opos;
        bool firstone = TRUE;
        char obuf[MAXLINE + 3];
        int opos;
        bool firstone = TRUE;
        char obuf[MAXLINE + 3];
+       extern char *capitalize();
 
        /*
        **  Output the address list translated by the
 
        /*
        **  Output the address list translated by the
index 64689fc..daf66e9 100644 (file)
@@ -13,7 +13,7 @@ char copyright[] =
 #endif /* not lint */
 
 #ifndef lint
 #endif /* not lint */
 
 #ifndef lint
-static char sccsid[] = "@(#)main.c     6.8 (Berkeley) %G%";
+static char sccsid[] = "@(#)main.c     6.9 (Berkeley) %G%";
 #endif /* not lint */
 
 #define        _DEFINE
 #endif /* not lint */
 
 #define        _DEFINE
@@ -70,6 +70,8 @@ ENVELOPE      BlankEnvelope;  /* a "blank" envelope */
 ENVELOPE       MainEnvelope;   /* the envelope around the basic letter */
 ADDRESS                NullAddress =   /* a null address */
                { "", "", NULL, "" };
 ENVELOPE       MainEnvelope;   /* the envelope around the basic letter */
 ADDRESS                NullAddress =   /* a null address */
                { "", "", NULL, "" };
+char           *UserEnviron[MAXUSERENVIRON + 1];
+                               /* saved user environment */
 
 /*
 **  Pointers for setproctitle.
 
 /*
 **  Pointers for setproctitle.
@@ -139,6 +141,7 @@ main(argc, argv, envp)
        extern char **myhostname();
        extern char *arpadate();
        extern char *optarg;
        extern char **myhostname();
        extern char *arpadate();
        extern char *optarg;
+       extern char **environ;
 
        /*
        **  Check to see if we reentered.
 
        /*
        **  Check to see if we reentered.
@@ -248,12 +251,26 @@ main(argc, argv, envp)
                readconfig = !thaw(FreezeFile, argv0);
 
 # ifdef SETPROCTITLE
                readconfig = !thaw(FreezeFile, argv0);
 
 # ifdef SETPROCTITLE
+       /*
+       **  Move the environment so setproctitle can use the space at
+       **  the top of memory.
+       */
+
+       for (i = j = 0; j < MAXUSERENVIRON && (p = envp[i]) != NULL; i++)
+       {
+               if (strncmp(p, "FS=", 3) == 0 || strncmp(p, "LD_", 3) == 0)
+                       continue;
+               UserEnviron[j++] = newstr(p);
+       }
+       UserEnviron[j] = NULL;
+       environ = UserEnviron;
+
        /*
        **  Save start and extent of argv for setproctitle.
        */
 
        Argv = argv;
        /*
        **  Save start and extent of argv for setproctitle.
        */
 
        Argv = argv;
-       if (--i > 0)
+       if (i > 0)
                LastArgv = envp[i - 1] + strlen(envp[i - 1]);
        else
                LastArgv = argv[argc - 1] + strlen(argv[argc - 1]);
                LastArgv = envp[i - 1] + strlen(envp[i - 1]);
        else
                LastArgv = argv[argc - 1] + strlen(argv[argc - 1]);
index 18289e1..9bb8fac 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)map.c      6.1 (Berkeley) %G%";
+static char sccsid[] = "@(#)map.c      6.2 (Berkeley) %G%";
 #endif /* not lint */
 
 #include "sendmail.h"
 #endif /* not lint */
 
 #include "sendmail.h"
@@ -401,7 +401,7 @@ nis_map_lookup(map, buf, bufsiz, av)
        char **av;
 {
        char *vp;
        char **av;
 {
        char *vp;
-       int *vsize;
+       auto int vsize;
 
        if (!bitset(MF_NOFOLDCASE, map->map_flags))
        {
 
        if (!bitset(MF_NOFOLDCASE, map->map_flags))
        {
@@ -411,7 +411,8 @@ nis_map_lookup(map, buf, bufsiz, av)
                        if (isupper(*p))
                                *p = tolower(*p);
        }
                        if (isupper(*p))
                                *p = tolower(*p);
        }
-       if (yp_match(map->map_domain, map->map_file, buf, bufsiz, &vp, &vsize) != 0)
+       if (yp_match(map->map_domain, map->map_file, buf, strlen(buf) + 1,
+                    &vp, &vsize) != 0)
                return NULL;
        if (!bitset(MF_MATCHONLY, map->map_flags))
                map_rewrite(vp, vsize, buf, bufsiz, av);
                return NULL;
        if (!bitset(MF_MATCHONLY, map->map_flags))
                map_rewrite(vp, vsize, buf, bufsiz, av);
index cddbd3c..90697b2 100644 (file)
@@ -10,9 +10,9 @@
 
 #ifndef lint
 #ifdef QUEUE
 
 #ifndef lint
 #ifdef QUEUE
-static char sccsid[] = "@(#)queue.c    6.4 (Berkeley) %G% (with queueing)";
+static char sccsid[] = "@(#)queue.c    6.5 (Berkeley) %G% (with queueing)";
 #else
 #else
-static char sccsid[] = "@(#)queue.c    6.4 (Berkeley) %G% (without queueing)";
+static char sccsid[] = "@(#)queue.c    6.5 (Berkeley) %G% (without queueing)";
 #endif
 #endif /* not lint */
 
 #endif
 #endif /* not lint */
 
@@ -547,6 +547,7 @@ orderq(doall)
        {
                FILE *cf;
                char lbuf[MAXNAME];
        {
                FILE *cf;
                char lbuf[MAXNAME];
+               extern bool shouldqueue();
 
                /* is this an interesting entry? */
                if (d->d_ino == 0)
 
                /* is this an interesting entry? */
                if (d->d_ino == 0)
@@ -758,7 +759,7 @@ dowork(w, e)
                }
 
                e->e_flags |= EF_INQUEUE;
                }
 
                e->e_flags |= EF_INQUEUE;
-               eatheader(e);
+               eatheader(e, TRUE);
 
                /* do the delivery */
                if (!bitset(EF_FATALERRS, e->e_flags))
 
                /* do the delivery */
                if (!bitset(EF_FATALERRS, e->e_flags))
@@ -1274,16 +1275,15 @@ setctluser(user)
                a->q_home = newstr(pw->pw_dir);
                a->q_uid = pw->pw_uid;
                a->q_gid = pw->pw_gid;
                a->q_home = newstr(pw->pw_dir);
                a->q_uid = pw->pw_uid;
                a->q_gid = pw->pw_gid;
-               a->q_ruser = newstr(user);
+               a->q_user = newstr(user);
        }
        else
        {
                a->q_uid = DefUid;
                a->q_gid = DefGid;
        }
        else
        {
                a->q_uid = DefUid;
                a->q_gid = DefGid;
-               a->q_ruser = newstr(DefUser);
+               a->q_user = newstr(DefUser);
        }
 
        }
 
-       a->q_user = a->q_ruser;
        a->q_flags |= QGOODUID;         /* flag as a "ctladdr"  */
        a->q_mailer = LocalMailer;
        return a;
        a->q_flags |= QGOODUID;         /* flag as a "ctladdr"  */
        a->q_mailer = LocalMailer;
        return a;
index 070e9d4..cf47e0e 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)recipient.c        6.2 (Berkeley) %G%";
+static char sccsid[] = "@(#)recipient.c        6.3 (Berkeley) %G%";
 #endif /* not lint */
 
 # include <sys/types.h>
 #endif /* not lint */
 
 # include <sys/types.h>
@@ -296,7 +296,6 @@ recipient(a, sendq, e)
        /* add address on list */
        *pq = a;
        a->q_next = NULL;
        /* add address on list */
        *pq = a;
        a->q_next = NULL;
-       e->e_nrcpts++;
 
        if (a->q_alias == NULL && RcptLogFile != NULL &&
            !bitset(QDONTSEND, a->q_flags))
 
        if (a->q_alias == NULL && RcptLogFile != NULL &&
            !bitset(QDONTSEND, a->q_flags))
@@ -355,10 +354,8 @@ recipient(a, sendq, e)
                        message(Arpa_Info, "including file %s", &a->q_user[9]);
                        (void) include(&a->q_user[9], FALSE, a, sendq, e);
                }
                        message(Arpa_Info, "including file %s", &a->q_user[9]);
                        (void) include(&a->q_user[9], FALSE, a, sendq, e);
                }
-               return (a);
        }
        }
-
-       if (m == FileMailer)
+       else if (m == FileMailer)
        {
                struct stat stb;
                extern bool writable();
        {
                struct stat stb;
                extern bool writable();
@@ -376,11 +373,14 @@ recipient(a, sendq, e)
                        a->q_flags |= QBADADDR;
                        giveresponse(EX_CANTCREAT, m, e);
                }
                        a->q_flags |= QBADADDR;
                        giveresponse(EX_CANTCREAT, m, e);
                }
-               return (a);
        }
 
        if (m != LocalMailer)
        }
 
        if (m != LocalMailer)
+       {
+               if (!bitset(QDONTSEND, a->q_flags))
+                       e->e_nrcpts++;
                return (a);
                return (a);
+       }
 
        /* try aliasing */
        alias(a, sendq, e);
 
        /* try aliasing */
        alias(a, sendq, e);
@@ -402,6 +402,7 @@ recipient(a, sendq, e)
                                        e->e_id);
 # endif
                        message(Arpa_Info, "queued (user database error)");
                                        e->e_id);
 # endif
                        message(Arpa_Info, "queued (user database error)");
+                       e->e_nrcpts++;
                        return (a);
                }
        }
                        return (a);
                }
        }
@@ -478,6 +479,8 @@ recipient(a, sendq, e)
                                forward(a, sendq, e);
                }
        }
                                forward(a, sendq, e);
                }
        }
+       if (!bitset(QDONTSEND, a->q_flags))
+               e->e_nrcpts++;
        return (a);
 
        return (a);
        return (a);
 
        return (a);
index 62f80f7..ea80183 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)savemail.c 6.2 (Berkeley) %G%";
+static char sccsid[] = "@(#)savemail.c 6.3 (Berkeley) %G%";
 #endif /* not lint */
 
 # include <sys/types.h>
 #endif /* not lint */
 
 # include <sys/types.h>
@@ -394,6 +394,12 @@ returntosender(msg, returnq, sendbody, e)
                        addheader("to", q->q_paddr, ee);
        }
 
                        addheader("to", q->q_paddr, ee);
        }
 
+# ifdef LOG
+       if (LogLevel >= 3)
+               syslog(LOG_INFO, "%s: %s: return to sender: %s",
+                       e->e_id, ee->e_id, msg);
+# endif
+
        (void) sprintf(buf, "Returned mail: %s", msg);
        addheader("subject", buf, ee);
 
        (void) sprintf(buf, "Returned mail: %s", msg);
        addheader("subject", buf, ee);
 
@@ -413,7 +419,7 @@ returntosender(msg, returnq, sendbody, e)
        CurEnv = ee;
        define('f', "\001n", ee);
        define('x', "Mail Delivery Subsystem", ee);
        CurEnv = ee;
        define('f', "\001n", ee);
        define('x', "Mail Delivery Subsystem", ee);
-       eatheader(ee);
+       eatheader(ee, FALSE);
 
        /* actually deliver the error message */
        sendall(ee, SM_DEFAULT);
 
        /* actually deliver the error message */
        sendall(ee, SM_DEFAULT);
index 803d4a4..f2227da 100644 (file)
@@ -10,9 +10,9 @@
 
 #ifndef lint
 #ifdef SMTP
 
 #ifndef lint
 #ifdef SMTP
-static char sccsid[] = "@(#)srvrsmtp.c 6.2 (Berkeley) %G% (with SMTP)";
+static char sccsid[] = "@(#)srvrsmtp.c 6.3 (Berkeley) %G% (with SMTP)";
 #else
 #else
-static char sccsid[] = "@(#)srvrsmtp.c 6.2 (Berkeley) %G% (without SMTP)";
+static char sccsid[] = "@(#)srvrsmtp.c 6.3 (Berkeley) %G% (without SMTP)";
 #endif
 #endif /* not lint */
 
 #endif
 #endif /* not lint */
 
@@ -108,16 +108,10 @@ smtp(e)
                (void) dup(fileno(OutChannel));
        }
        settime(e);
                (void) dup(fileno(OutChannel));
        }
        settime(e);
-       if (RealHostName != NULL)
-       {
-               CurHostName = RealHostName;
-               setproctitle("srvrsmtp %s", CurHostName);
-       }
-       else
-       {
-               /* this must be us!! */
-               CurHostName = MyHostName;
-       }
+       if (RealHostName == NULL)
+               RealHostName = MyHostName;
+       CurHostName = RealHostName;
+       setproctitle("srvrsmtp %s", CurHostName);
        expand("\001e", inp, &inp[sizeof inp], e);
        message("220", "%s", inp);
        SmtpPhase = "startup";
        expand("\001e", inp, &inp[sizeof inp], e);
        message("220", "%s", inp);
        SmtpPhase = "startup";
index 186c7f0..124ff51 100644 (file)
@@ -10,9 +10,9 @@
 
 #ifndef lint
 #ifdef SMTP
 
 #ifndef lint
 #ifdef SMTP
-static char sccsid[] = "@(#)usersmtp.c 6.2 (Berkeley) %G% (with SMTP)";
+static char sccsid[] = "@(#)usersmtp.c 6.3 (Berkeley) %G% (with SMTP)";
 #else
 #else
-static char sccsid[] = "@(#)usersmtp.c 6.2 (Berkeley) %G% (without SMTP)";
+static char sccsid[] = "@(#)usersmtp.c 6.3 (Berkeley) %G% (without SMTP)";
 #endif
 #endif /* not lint */
 
 #endif
 #endif /* not lint */
 
@@ -464,7 +464,9 @@ reply(m, mci, e, timeout)
 # endif /* ECONNRESET */
 
                        mci->mci_errno = errno;
 # endif /* ECONNRESET */
 
                        mci->mci_errno = errno;
-                       message(Arpa_TSyserr, "reply: read error from %s",
+                       mci->mci_exitstat = EX_TEMPFAIL;
+                       message(Arpa_TSyserr, "%s: reply: read error from %s",
+                               e->e_id == NULL ? "NOQUEUE" : e->e_id,
                                mci->mci_host);
                        /* if debugging, pause so we can see state */
                        if (tTd(18, 100))
                                mci->mci_host);
                        /* if debugging, pause so we can see state */
                        if (tTd(18, 100))
@@ -536,11 +538,15 @@ reply(m, mci, e, timeout)
 */
 
 /*VARARGS1*/
 */
 
 /*VARARGS1*/
-smtpmessage(f, m, mci VA_ARG_FORMAL)
+#ifdef __STDC__
+smtpmessage(char *f, MAILER *m, MCI *mci, ...)
+#else
+smtpmessage(f, m, mci, va_alist)
        char *f;
        MAILER *m;
        MCI *mci;
        char *f;
        MAILER *m;
        MCI *mci;
-       VA_ARG_DECL
+       va_dcl
+#endif
 {
        VA_LOCAL_DECL
 
 {
        VA_LOCAL_DECL
 
index 7044d1f..25ba0dc 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)util.c     6.3 (Berkeley) %G%";
+static char sccsid[] = "@(#)util.c     6.4 (Berkeley) %G%";
 #endif /* not lint */
 
 # include <stdio.h>
 #endif /* not lint */
 
 # include <stdio.h>
@@ -256,7 +256,7 @@ xputs(s)
                        putchar('$');
                        continue;
                }
                        putchar('$');
                        continue;
                }
-               for (mp = MetaMacros; mp->metaname != NULL; mp++)
+               for (mp = MetaMacros; mp->metaname != '\0'; mp++)
                {
                        if (mp->metaval == c)
                        {
                {
                        if (mp->metaval == c)
                        {
@@ -613,7 +613,7 @@ sfgets(buf, siz, fp, timeout)
 # ifdef LOG
                        syslog(LOG_NOTICE,
                            "timeout waiting for input from %s\n",
 # ifdef LOG
                        syslog(LOG_NOTICE,
                            "timeout waiting for input from %s\n",
-                           RealHostName? RealHostName: "local");
+                           CurHostName? CurHostName: "local");
 # endif
                        errno = 0;
                        usrerr("451 timeout waiting for input");
 # endif
                        errno = 0;
                        usrerr("451 timeout waiting for input");
index b40c8af..50f90ba 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)version.c  6.11 (Berkeley) %G%";
+static char sccsid[] = "@(#)version.c  6.12 (Berkeley) %G%";
 #endif /* not lint */
 
 #endif /* not lint */
 
-char   Version[] = "ALPHA-6.11";
+char   Version[] = "ALPHA-6.12";