fix quote processing on program mailers
authorEric Allman <eric@ucbvax.Berkeley.EDU>
Mon, 15 Nov 1982 07:14:17 +0000 (23:14 -0800)
committerEric Allman <eric@ucbvax.Berkeley.EDU>
Mon, 15 Nov 1982 07:14:17 +0000 (23:14 -0800)
SCCS-mr: usr.sbin/sendmail/src/version.c 074
SCCS-mr: usr.sbin/sendmail/src/recipient.c 074
SCCS-vsn: usr.sbin/sendmail/src/version.c 3.243
SCCS-vsn: usr.sbin/sendmail/src/recipient.c 3.44

usr/src/usr.sbin/sendmail/src/recipient.c
usr/src/usr.sbin/sendmail/src/version.c

index 9a2cd92..045d879 100644 (file)
@@ -2,7 +2,7 @@
 # include "sendmail.h"
 # include <sys/stat.h>
 
 # include "sendmail.h"
 # include <sys/stat.h>
 
-SCCSID(@(#)recipient.c 3.43            %G%);
+SCCSID(@(#)recipient.c 3.44            %G%);
 
 /*
 **  SENDTO -- Designate a send list.
 
 /*
 **  SENDTO -- Designate a send list.
@@ -194,6 +194,9 @@ recipient(a, sendq)
        register ADDRESS *q;
        ADDRESS **pq;
        register struct mailer *m;
        register ADDRESS *q;
        ADDRESS **pq;
        register struct mailer *m;
+       register char *p;
+       bool quoted = FALSE;            /* set if the addr has a quote bit */
+       char buf[MAXNAME];              /* unquoted image of the user name */
        extern ADDRESS *getctladdr();
        extern bool safefile();
 
        extern ADDRESS *getctladdr();
        extern bool safefile();
 
@@ -221,18 +224,23 @@ recipient(a, sendq)
 
        a->q_timeout = TimeOut;
 
 
        a->q_timeout = TimeOut;
 
+       (void) strcpy(buf, a->q_user);
+       for (p = buf; *p != '\0' && !quoted; p++)
+       {
+               if (!isascii(*p) && (*p & 0377) != (SpaceSub & 0377))
+                       quoted = TRUE;
+       }
+       stripquotes(buf, TRUE);
+
        /* do sickly crude mapping for program mailing, etc. */
        /* do sickly crude mapping for program mailing, etc. */
-       if (a->q_mailer == LocalMailer)
+       if (m == LocalMailer && buf[0] == '|')
        {
        {
-               if (a->q_user[0] == '|')
+               a->q_mailer = m = ProgMailer;
+               a->q_user++;
+               if (a->q_alias == NULL && !tTd(0, 1) && !QueueRun && !ForceMail)
                {
                {
-                       a->q_mailer = m = ProgMailer;
-                       a->q_user++;
-                       if (a->q_alias == NULL && !tTd(0, 1) && !QueueRun && !ForceMail)
-                       {
-                               usrerr("Cannot mail directly to programs");
-                               a->q_flags |= QDONTSEND;
-                       }
+                       usrerr("Cannot mail directly to programs");
+                       a->q_flags |= QDONTSEND;
                }
        }
 
                }
        }
 
@@ -276,7 +284,7 @@ recipient(a, sendq)
        **  Alias the name and handle :include: specs.
        */
 
        **  Alias the name and handle :include: specs.
        */
 
-       if (a->q_mailer == LocalMailer)
+       if (m == LocalMailer && !bitset(QDONTSEND, a->q_flags))
        {
                if (strncmp(a->q_user, ":include:", 9) == 0)
                {
        {
                if (strncmp(a->q_user, ":include:", 9) == 0)
                {
@@ -301,21 +309,10 @@ recipient(a, sendq)
        **  the user (which is probably correct anyway).
        */
 
        **  the user (which is probably correct anyway).
        */
 
-       if (!bitset(QDONTSEND, a->q_flags) && a->q_mailer == LocalMailer)
+       if (!bitset(QDONTSEND, a->q_flags) && m == LocalMailer)
        {
        {
-               char buf[MAXNAME];
-               register char *p;
                struct stat stb;
                extern bool writable();
                struct stat stb;
                extern bool writable();
-               bool quoted = FALSE;
-
-               (void) strcpy(buf, a->q_user);
-               for (p = buf; *p != '\0' && !quoted; p++)
-               {
-                       if (!isascii(*p) && (*p & 0377) != (SPACESUB) & 0377)
-                               quoted = TRUE;
-               }
-               stripquotes(buf, TRUE);
 
                /* see if this is to a file */
                if (buf[0] == '/')
 
                /* see if this is to a file */
                if (buf[0] == '/')
index 987b6db..528b2b7 100644 (file)
@@ -1,5 +1,5 @@
 # ifndef lint
 # ifndef lint
-static char    SccsId[] = "@(#)SendMail version 3.242 of %G%";
+static char    SccsId[] = "@(#)SendMail version 3.243 of %G%";
 # endif lint
 
 # endif lint
 
-char   Version[] = "3.242 [%G%]";
+char   Version[] = "3.243 [%G%]";