multiple glitches in 8.6.10 -- see ../RELEASE_NOTES for details
authorEric Allman <eric@ucbvax.Berkeley.EDU>
Wed, 1 Mar 1995 02:58:58 +0000 (18:58 -0800)
committerEric Allman <eric@ucbvax.Berkeley.EDU>
Wed, 1 Mar 1995 02:58:58 +0000 (18:58 -0800)
SCCS-vsn: usr.sbin/sendmail/src/recipient.c 8.44.1.5
SCCS-vsn: usr.sbin/sendmail/src/main.c 8.55.1.4
SCCS-vsn: usr.sbin/sendmail/src/daemon.c 8.48.1.3
SCCS-vsn: usr.sbin/sendmail/src/util.c 8.39.1.3
SCCS-vsn: usr.sbin/sendmail/src/queue.c 8.41.1.2
SCCS-vsn: usr.sbin/sendmail/src/conf.c 8.89.1.1

usr/src/usr.sbin/sendmail/src/conf.c
usr/src/usr.sbin/sendmail/src/daemon.c
usr/src/usr.sbin/sendmail/src/main.c
usr/src/usr.sbin/sendmail/src/queue.c
usr/src/usr.sbin/sendmail/src/recipient.c
usr/src/usr.sbin/sendmail/src/util.c

index 90ef350..b51c0e9 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)conf.c     8.134 (Berkeley) %G%";
+static char sccsid[] = "@(#)conf.c     8.89.1.1 (Berkeley) %G%";
 #endif /* not lint */
 
 # include "sendmail.h"
 #endif /* not lint */
 
 # include "sendmail.h"
@@ -2002,6 +2002,9 @@ usershellok(shell)
        register char *p;
        extern char *getusershell();
 
        register char *p;
        extern char *getusershell();
 
+       if (shell == NULL || shell[0] == '\0')
+               return TRUE;
+
        setusershell();
        while ((p = getusershell()) != NULL)
                if (strcmp(p, shell) == 0 || strcmp(p, WILDCARD_SHELL) == 0)
        setusershell();
        while ((p = getusershell()) != NULL)
                if (strcmp(p, shell) == 0 || strcmp(p, WILDCARD_SHELL) == 0)
@@ -2012,6 +2015,9 @@ usershellok(shell)
        register FILE *shellf;
        char buf[MAXLINE];
 
        register FILE *shellf;
        char buf[MAXLINE];
 
+       if (shell == NULL || shell[0] == '\0')
+               return TRUE;
+
        shellf = fopen(_PATH_SHELLS, "r");
        if (shellf == NULL)
        {
        shellf = fopen(_PATH_SHELLS, "r");
        if (shellf == NULL)
        {
index 9fc3076..6f2f420 100644 (file)
@@ -12,9 +12,9 @@
 
 #ifndef lint
 #ifdef DAEMON
 
 #ifndef lint
 #ifdef DAEMON
-static char sccsid[] = "@(#)daemon.c   8.70 (Berkeley) %G% (with daemon mode)";
+static char sccsid[] = "@(#)daemon.c   8.48.1.3 (Berkeley) %G% (with daemon mode)";
 #else
 #else
-static char sccsid[] = "@(#)daemon.c   8.70 (Berkeley) %G% (without daemon mode)";
+static char sccsid[] = "@(#)daemon.c   8.48.1.3 (Berkeley) %G% (without daemon mode)";
 #endif
 #endif /* not lint */
 
 #endif
 #endif /* not lint */
 
@@ -573,6 +573,7 @@ getauthinfo(fd)
        int i;
        EVENT *ev;
        int nleft;
        int i;
        EVENT *ev;
        int nleft;
+       int ibuf[MAXNAME + 1];
        static char hbuf[MAXNAME * 2 + 2];
        extern char *hostnamebyanyaddr();
        extern char RealUserName[];                     /* main.c */
        static char hbuf[MAXNAME * 2 + 2];
        extern char *hostnamebyanyaddr();
        extern char RealUserName[];                     /* main.c */
@@ -606,7 +607,7 @@ getauthinfo(fd)
        }
 
        /* create ident query */
        }
 
        /* create ident query */
-       (void) sprintf(hbuf, "%d,%d\r\n",
+       (void) sprintf(ibuf, "%d,%d\r\n",
                ntohs(RealHostAddr.sin.sin_port), ntohs(la.sin.sin_port));
 
        /* create local address */
                ntohs(RealHostAddr.sin.sin_port), ntohs(la.sin.sin_port));
 
        /* create local address */
@@ -644,15 +645,15 @@ getauthinfo(fd)
        }
 
        if (tTd(9, 10))
        }
 
        if (tTd(9, 10))
-               printf("getauthinfo: sent %s", hbuf);
+               printf("getauthinfo: sent %s", ibuf);
 
        /* send query */
 
        /* send query */
-       if (write(s, hbuf, strlen(hbuf)) < 0)
+       if (write(s, ibuf, strlen(ibuf)) < 0)
                goto closeident;
 
        /* get result */
                goto closeident;
 
        /* get result */
-       p = &hbuf[0];
-       nleft = sizeof(hbuf);
+       p = &ibuf[0];
+       nleft = sizeof(ibuf - 1);
        while ((i = read(s, p, nleft)) > 0)
        {
                p += i;
        while ((i = read(s, p, nleft)) > 0)
        {
                p += i;
@@ -660,7 +661,7 @@ getauthinfo(fd)
        }
        (void) close(s);
        clrevent(ev);
        }
        (void) close(s);
        clrevent(ev);
-       if (i < 0 || p == &hbuf[0])
+       if (i < 0 || p == &ibuf[0])
                goto noident;
 
        if (*--p == '\n' && *--p == '\r')
                goto noident;
 
        if (*--p == '\n' && *--p == '\r')
@@ -668,10 +669,10 @@ getauthinfo(fd)
        *++p = '\0';
 
        if (tTd(9, 3))
        *++p = '\0';
 
        if (tTd(9, 3))
-               printf("getauthinfo:  got %s\n", hbuf);
+               printf("getauthinfo:  got %s\n", ibuf);
 
        /* parse result */
 
        /* parse result */
-       p = strchr(hbuf, ':');
+       p = strchr(ibuf, ':');
        if (p == NULL)
        {
                /* malformed response */
        if (p == NULL)
        {
                /* malformed response */
index 4a6d403..668884d 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.84 (Berkeley) %G%";
+static char sccsid[] = "@(#)main.c     8.55.1.4 (Berkeley) %G%";
 #endif /* not lint */
 
 #define        _DEFINE
 #endif /* not lint */
 
 #define        _DEFINE
@@ -298,10 +298,13 @@ main(argc, argv, envp)
 
 #if NAMED_BIND
        if (tTd(8, 8))
 
 #if NAMED_BIND
        if (tTd(8, 8))
+       {
+               res_init();
        {
                res_init();
                _res.options |= RES_DEBUG;
        }
        {
                res_init();
                _res.options |= RES_DEBUG;
        }
+       }
 #endif
 
        errno = 0;
 #endif
 
        errno = 0;
@@ -483,7 +486,7 @@ main(argc, argv, envp)
                                ExitStat = EX_USAGE;
                                break;
                        }
                                ExitStat = EX_USAGE;
                                break;
                        }
-                       from = newstr(denlstring(optarg));
+                       from = newstr(denlstring(optarg, TRUE));
                        if (strcmp(RealUserName, from) != 0)
                                warn_f_flag = j;
                        break;
                        if (strcmp(RealUserName, from) != 0)
                                warn_f_flag = j;
                        break;
@@ -648,6 +651,15 @@ main(argc, argv, envp)
        **  Initialize name server if it is going to be used.
        */
 
        **  Initialize name server if it is going to be used.
        */
 
+#if NAMED_BIND
+       if (!bitset(RES_INIT, _res.options))
+               res_init();
+#endif
+
+       /*
+       **  Initialize name server if it is going to be used.
+       */
+
 #if NAMED_BIND
        if (UseNameServer && !bitset(RES_INIT, _res.options))
                res_init();
 #if NAMED_BIND
        if (UseNameServer && !bitset(RES_INIT, _res.options))
                res_init();
@@ -742,7 +754,7 @@ main(argc, argv, envp)
 
        /* full names can't have newlines */
        if (FullName != NULL && strchr(FullName, '\n') != NULL)
 
        /* full names can't have newlines */
        if (FullName != NULL && strchr(FullName, '\n') != NULL)
-               FullName = newstr(denlstring(FullName));
+               FullName = newstr(denlstring(FullName, TRUE));
 
        /* do heuristic mode adjustment */
        if (Verbose)
 
        /* do heuristic mode adjustment */
        if (Verbose)
index 50f74f5..0829fff 100644 (file)
@@ -10,9 +10,9 @@
 
 #ifndef lint
 #ifdef QUEUE
 
 #ifndef lint
 #ifdef QUEUE
-static char sccsid[] = "@(#)queue.c    8.63 (Berkeley) %G% (with queueing)";
+static char sccsid[] = "@(#)queue.c    8.41.1.2 (Berkeley) %G% (with queueing)";
 #else
 #else
-static char sccsid[] = "@(#)queue.c    8.63 (Berkeley) %G% (without queueing)";
+static char sccsid[] = "@(#)queue.c    8.41.1.2 (Berkeley) %G% (without queueing)";
 #endif
 #endif /* not lint */
 
 #endif
 #endif /* not lint */
 
@@ -216,7 +216,7 @@ queueup(e, queueall, announce)
 
        /* message from envelope, if it exists */
        if (e->e_message != NULL)
 
        /* message from envelope, if it exists */
        if (e->e_message != NULL)
-               fprintf(tfp, "M%s\n", denlstring(e->e_message));
+               fprintf(tfp, "M%s\n", denlstring(e->e_message, FALSE));
 
        /* send various flag bits through */
        p = buf;
 
        /* send various flag bits through */
        p = buf;
@@ -232,14 +232,14 @@ queueup(e, queueall, announce)
 
        /* $r and $s and $_ macro values */
        if ((p = macvalue('r', e)) != NULL)
 
        /* $r and $s and $_ macro values */
        if ((p = macvalue('r', e)) != NULL)
-               fprintf(tfp, "$r%s\n", denlstring(p));
+               fprintf(tfp, "$r%s\n", denlstring(p, FALSE));
        if ((p = macvalue('s', e)) != NULL)
        if ((p = macvalue('s', e)) != NULL)
-               fprintf(tfp, "$s%s\n", denlstring(p));
+               fprintf(tfp, "$s%s\n", denlstring(p, FALSE));
        if ((p = macvalue('_', e)) != NULL)
        if ((p = macvalue('_', e)) != NULL)
-               fprintf(tfp, "$_%s\n", denlstring(p));
+               fprintf(tfp, "$_%s\n", denlstring(p, FALSE));
 
        /* output name of sender */
 
        /* output name of sender */
-       fprintf(tfp, "S%s\n", denlstring(e->e_from.q_paddr));
+       fprintf(tfp, "S%s\n", denlstring(e->e_from.q_paddr, FALSE));
 
        /* output ESMTP-supplied "original" information */
        if (e->e_envid != NULL)
 
        /* output ESMTP-supplied "original" information */
        if (e->e_envid != NULL)
@@ -251,7 +251,7 @@ queueup(e, queueall, announce)
                if (!bitset(QDONTSEND|QBADADDR, q->q_flags))
                {
                        printctladdr(q, tfp);
                if (!bitset(QDONTSEND|QBADADDR, q->q_flags))
                {
                        printctladdr(q, tfp);
-                       fprintf(tfp, "E%s\n", denlstring(q->q_paddr));
+                       fprintf(tfp, "E%s\n", denlstring(q->q_paddr, FALSE));
                }
        }
 
                }
        }
 
@@ -263,7 +263,7 @@ queueup(e, queueall, announce)
                {
                        printctladdr(q, tfp);
                        if (q->q_orcpt != NULL)
                {
                        printctladdr(q, tfp);
                        if (q->q_orcpt != NULL)
-                       fprintf(tfp, "R%s\n", denlstring(q->q_paddr));
+                       fprintf(tfp, "R%s\n", denlstring(q->q_paddr, FALSE));
                        if (announce)
                        {
                                e->e_to = q->q_paddr;
                        if (announce)
                        {
                                e->e_to = q->q_paddr;
@@ -440,7 +440,7 @@ printctladdr(a, tfp)
        else
                uname = pw->pw_name;
 
        else
                uname = pw->pw_name;
 
-       fprintf(tfp, "C%s:%s\n", uname, denlstring(a->q_paddr));
+       fprintf(tfp, "C%s:%s\n", uname, denlstring(a->q_paddr, FALSE));
 }
 \f/*
 **  RUNQUEUE -- run the jobs in the queue.
 }
 \f/*
 **  RUNQUEUE -- run the jobs in the queue.
index 2c29fc9..ad4b572 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)recipient.c        8.67 (Berkeley) %G%";
+static char sccsid[] = "@(#)recipient.c        8.44.1.5 (Berkeley) %G%";
 #endif /* not lint */
 
 # include "sendmail.h"
 #endif /* not lint */
 
 # include "sendmail.h"
@@ -103,7 +103,7 @@ sendto(list, copyf, ctladdr, qflags)
                bufp = buf;
        else
                bufp = xalloc(i);
                bufp = buf;
        else
                bufp = xalloc(i);
-       strcpy(bufp, denlstring(list));
+       strcpy(bufp, denlstring(list, FALSE));
 
        for (p = bufp; *p != '\0'; )
        {
 
        for (p = bufp; *p != '\0'; )
        {
index 1358a82..b109443 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)util.c     8.51 (Berkeley) %G%";
+static char sccsid[] = "@(#)util.c     8.39.1.3 (Berkeley) %G%";
 #endif /* not lint */
 
 # include "sendmail.h"
 #endif /* not lint */
 
 # include "sendmail.h"
@@ -1578,7 +1578,7 @@ cleanstrcpy(t, f, l)
 {
 #ifdef LOG
        /* check for newlines and log if necessary */
 {
 #ifdef LOG
        /* check for newlines and log if necessary */
-       (void) denlstring(f);
+       (void) denlstring(f, TRUE);
 #endif
 
        l--;
 #endif
 
        l--;
@@ -1599,6 +1599,7 @@ cleanstrcpy(t, f, l)
 **
 **     Parameters:
 **             s -- the input string
 **
 **     Parameters:
 **             s -- the input string
+**             logattacks -- if set, log attempted attacks.
 **
 **     Returns:
 **             A pointer to a version of the string with newlines
 **
 **     Returns:
 **             A pointer to a version of the string with newlines
@@ -1606,8 +1607,9 @@ cleanstrcpy(t, f, l)
 */
 
 char *
 */
 
 char *
-denlstring(s)
+denlstring(s, logattacks)
        char *s;
        char *s;
+       bool logattacks;
 {
        register char *p;
        int l;
 {
        register char *p;
        int l;
@@ -1632,9 +1634,12 @@ denlstring(s)
 
 /*
 #ifdef LOG
 
 /*
 #ifdef LOG
-       p = macvalue('_', CurEnv);
-       syslog(LOG_ALERT, "POSSIBLE ATTACK from %s: newline in string \"%s\"",
-               p == NULL ? "[UNKNOWN]" : p, bp);
+       if (logattacks)
+       {
+               syslog(LOG_NOTICE, "POSSIBLE ATTACK from %s: newline in string \"%s\"",
+                       RealHostName == NULL ? "[UNKNOWN]" : RealHostName,
+                       shortenstring(bp, 80));
+       }
 #endif
 */
 
 #endif
 */