fix problem that was causing the ctladdr of whoever ran the daemon
authorEric Allman <eric@ucbvax.Berkeley.EDU>
Sun, 9 Jan 1994 09:29:23 +0000 (01:29 -0800)
committerEric Allman <eric@ucbvax.Berkeley.EDU>
Sun, 9 Jan 1994 09:29:23 +0000 (01:29 -0800)
(usually root) to own the delivery process

SCCS-vsn: usr.sbin/sendmail/src/main.c 8.45
SCCS-vsn: usr.sbin/sendmail/src/envelope.c 8.27
SCCS-vsn: usr.sbin/sendmail/src/err.c 8.19
SCCS-vsn: usr.sbin/sendmail/src/collect.c 8.8
SCCS-vsn: usr.sbin/sendmail/src/daemon.c 8.30
SCCS-vsn: usr.sbin/sendmail/src/deliver.c 8.61

usr/src/usr.sbin/sendmail/src/collect.c
usr/src/usr.sbin/sendmail/src/daemon.c
usr/src/usr.sbin/sendmail/src/deliver.c
usr/src/usr.sbin/sendmail/src/envelope.c
usr/src/usr.sbin/sendmail/src/err.c
usr/src/usr.sbin/sendmail/src/main.c

index 99823f7..cd63d67 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)collect.c  8.7 (Berkeley) %G%";
+static char sccsid[] = "@(#)collect.c  8.8 (Berkeley) %G%";
 #endif /* not lint */
 
 # include <errno.h>
 #endif /* not lint */
 
 # include <errno.h>
@@ -231,7 +231,8 @@ maketemp(from)
                        break;
 
                /* check for transparent dot */
                        break;
 
                /* check for transparent dot */
-               if (OpMode == MD_SMTP && bp[0] == '.' && bp[1] == '.')
+               if ((OpMode == MD_SMTP || OpMode == MD_DAEMON) &&
+                   bp[0] == '.' && bp[1] == '.')
                        bp++;
 
                /*
                        bp++;
 
                /*
@@ -266,7 +267,7 @@ readerr:
        }
 
        /* An EOF when running SMTP is an error */
        }
 
        /* An EOF when running SMTP is an error */
-       if (inputerr && OpMode == MD_SMTP)
+       if (inputerr && (OpMode == MD_SMTP || OpMode == MD_DAEMON))
        {
                char *host;
                char *problem;
        {
                char *host;
                char *problem;
index e2a841c..80e5e12 100644 (file)
@@ -12,9 +12,9 @@
 
 #ifndef lint
 #ifdef DAEMON
 
 #ifndef lint
 #ifdef DAEMON
-static char sccsid[] = "@(#)daemon.c   8.29 (Berkeley) %G% (with daemon mode)";
+static char sccsid[] = "@(#)daemon.c   8.30 (Berkeley) %G% (with daemon mode)";
 #else
 #else
-static char sccsid[] = "@(#)daemon.c   8.29 (Berkeley) %G% (without daemon mode)";
+static char sccsid[] = "@(#)daemon.c   8.30 (Berkeley) %G% (without daemon mode)";
 #endif
 #endif /* not lint */
 
 #endif
 #endif /* not lint */
 
index 8da31e5..41406aa 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)deliver.c  8.60 (Berkeley) %G%";
+static char sccsid[] = "@(#)deliver.c  8.61 (Berkeley) %G%";
 #endif /* not lint */
 
 #include "sendmail.h"
 #endif /* not lint */
 
 #include "sendmail.h"
@@ -62,7 +62,8 @@ sendall(e, mode)
        **  addresses to be sent.
        */
 
        **  addresses to be sent.
        */
 
-       if (bitset(EF_FATALERRS, e->e_flags) && OpMode == MD_SMTP)
+       if (bitset(EF_FATALERRS, e->e_flags) &&
+           (OpMode == MD_SMTP || OpMode == MD_DAEMON))
        {
                e->e_flags |= EF_CLRQUEUE;
                return;
        {
                e->e_flags |= EF_CLRQUEUE;
                return;
@@ -604,7 +605,8 @@ deliver(e, firstto)
 
 #ifdef NAMED_BIND
        /* unless interactive, try twice, over a minute */
 
 #ifdef NAMED_BIND
        /* unless interactive, try twice, over a minute */
-       if (OpMode == MD_DAEMON || OpMode == MD_SMTP) {
+       if (OpMode == MD_DAEMON || OpMode == MD_SMTP)
+       {
                _res.retrans = 30;
                _res.retry = 2;
        }
                _res.retrans = 30;
                _res.retry = 2;
        }
@@ -1220,7 +1222,7 @@ tryhost:
                                }
                                (void) close(rpvect[1]);
                        }
                                }
                                (void) close(rpvect[1]);
                        }
-                       else if (OpMode == MD_SMTP || HoldErrs)
+                       else if (OpMode == MD_SMTP || OpMode == MD_DAEMON || HoldErrs)
                        {
                                /* put mailer output in transcript */
                                if (dup2(fileno(e->e_xfp), STDOUT_FILENO) < 0)
                        {
                                /* put mailer output in transcript */
                                if (dup2(fileno(e->e_xfp), STDOUT_FILENO) < 0)
index cee543b..96fc853 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)envelope.c 8.26 (Berkeley) %G%";
+static char sccsid[] = "@(#)envelope.c 8.27 (Berkeley) %G%";
 #endif /* not lint */
 
 #include "sendmail.h"
 #endif /* not lint */
 
 #include "sendmail.h"
@@ -558,7 +558,8 @@ setsender(from, e, delimptr, internal)
        **      Username can return errno != 0 on non-errors.
        */
 
        **      Username can return errno != 0 on non-errors.
        */
 
-       if (bitset(EF_QUEUERUN, e->e_flags) || OpMode == MD_SMTP)
+       if (bitset(EF_QUEUERUN, e->e_flags) || OpMode == MD_SMTP ||
+           OpMode == MD_DAEMON)
                realname = from;
        if (realname == NULL || realname[0] == '\0')
                realname = username();
                realname = from;
        if (realname == NULL || realname[0] == '\0')
                realname = username();
@@ -692,7 +693,7 @@ setsender(from, e, delimptr, internal)
                if (FullName != NULL && !internal)
                        define('x', FullName, e);
        }
                if (FullName != NULL && !internal)
                        define('x', FullName, e);
        }
-       else if (!internal)
+       else if (!internal && OpMode != MD_DAEMON)
        {
                if (e->e_from.q_home == NULL)
                        e->e_from.q_home = getenv("HOME");
        {
                if (e->e_from.q_home == NULL)
                        e->e_from.q_home = getenv("HOME");
index 860a1c6..506a6d9 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)err.c      8.18 (Berkeley) %G%";
+static char sccsid[] = "@(#)err.c      8.19 (Berkeley) %G%";
 #endif /* not lint */
 
 # include "sendmail.h"
 #endif /* not lint */
 
 # include "sendmail.h"
@@ -259,13 +259,13 @@ putoutmsg(msg, holdmsg)
                msg[0] = '5';
 
        (void) fflush(stdout);
                msg[0] = '5';
 
        (void) fflush(stdout);
-       if (OpMode == MD_SMTP)
+       if (OpMode == MD_SMTP || OpMode == MD_DAEMON)
                fprintf(OutChannel, "%s\r\n", msg);
        else
                fprintf(OutChannel, "%s\n", &msg[4]);
        if (TrafficLogFile != NULL)
                fprintf(TrafficLogFile, "%05d >>> %s\n", getpid(),
                fprintf(OutChannel, "%s\r\n", msg);
        else
                fprintf(OutChannel, "%s\n", &msg[4]);
        if (TrafficLogFile != NULL)
                fprintf(TrafficLogFile, "%05d >>> %s\n", getpid(),
-                       OpMode == MD_SMTP ? msg : &msg[4]);
+                       (OpMode == MD_SMTP || OpMode == MD_DAEMON) ? msg : &msg[4]);
        if (msg[3] == ' ')
                (void) fflush(OutChannel);
        if (!ferror(OutChannel))
        if (msg[3] == ' ')
                (void) fflush(OutChannel);
        if (!ferror(OutChannel))
index 8bf58b7..8e170be 100644 (file)
@@ -13,7 +13,7 @@ static char copyright[] =
 #endif /* not lint */
 
 #ifndef lint
 #endif /* not lint */
 
 #ifndef lint
-static char sccsid[] = "@(#)main.c     8.44 (Berkeley) %G%";
+static char sccsid[] = "@(#)main.c     8.45 (Berkeley) %G%";
 #endif /* not lint */
 
 #define        _DEFINE
 #endif /* not lint */
 
 #define        _DEFINE
@@ -1005,7 +1005,7 @@ main(argc, argv, envp)
        **  commands.  This will never return.
        */
 
        **  commands.  This will never return.
        */
 
-       if (OpMode == MD_SMTP)
+       if (OpMode == MD_SMTP || OpMode == MD_DAEMON)
                smtp(CurEnv);
 # endif /* SMTP */
 
                smtp(CurEnv);
 # endif /* SMTP */