make eight-bit clean; backslashes are carried through as-is
authorEric Allman <eric@ucbvax.Berkeley.EDU>
Mon, 13 Jul 1992 01:14:14 +0000 (17:14 -0800)
committerEric Allman <eric@ucbvax.Berkeley.EDU>
Mon, 13 Jul 1992 01:14:14 +0000 (17:14 -0800)
SCCS-vsn: usr.sbin/sendmail/src/headers.c 5.18
SCCS-vsn: usr.sbin/sendmail/src/recipient.c 5.31
SCCS-vsn: usr.sbin/sendmail/src/parseaddr.c 5.19
SCCS-vsn: usr.sbin/sendmail/src/version.c 5.103
SCCS-vsn: usr.sbin/sendmail/src/util.c 5.26
SCCS-vsn: usr.sbin/sendmail/src/deliver.c 5.58

usr/src/usr.sbin/sendmail/src/deliver.c
usr/src/usr.sbin/sendmail/src/headers.c
usr/src/usr.sbin/sendmail/src/parseaddr.c
usr/src/usr.sbin/sendmail/src/recipient.c
usr/src/usr.sbin/sendmail/src/util.c
usr/src/usr.sbin/sendmail/src/version.c

index 2f4519e..7aefe1b 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)deliver.c  5.57 (Berkeley) %G%";
+static char sccsid[] = "@(#)deliver.c  5.58 (Berkeley) %G%";
 #endif /* not lint */
 
 #include "sendmail.h"
 #endif /* not lint */
 
 #include "sendmail.h"
@@ -267,13 +267,8 @@ deliver(e, firstto)
 
                if (bitnset(M_STRIPQ, m->m_flags))
                {
 
                if (bitnset(M_STRIPQ, m->m_flags))
                {
-                       stripquotes(user, TRUE);
-                       stripquotes(host, TRUE);
-               }
-               else
-               {
-                       stripquotes(user, FALSE);
-                       stripquotes(host, FALSE);
+                       stripquotes(user);
+                       stripquotes(host);
                }
 
                /* hack attack -- delivermail compatibility */
                }
 
                /* hack attack -- delivermail compatibility */
index 9204609..28da75d 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)headers.c  5.17 (Berkeley) %G%";
+static char sccsid[] = "@(#)headers.c  5.18 (Berkeley) %G%";
 #endif /* not lint */
 
 # include <sys/param.h>
 #endif /* not lint */
 
 # include <sys/param.h>
@@ -685,6 +685,7 @@ commaize(h, p, fp, oldstyle, m)
        while (*p != '\0')
        {
                register char *name;
        while (*p != '\0')
        {
                register char *name;
+               register int c;
                char savechar;
                extern char *remotename();
                extern char *DelimChar;         /* defined in prescan */
                char savechar;
                extern char *remotename();
                extern char *DelimChar;         /* defined in prescan */
@@ -744,7 +745,7 @@ commaize(h, p, fp, oldstyle, m)
                }
 
                /* output the name with nice formatting */
                }
 
                /* output the name with nice formatting */
-               opos += qstrlen(name);
+               opos += strlen(name);
                if (!firstone)
                        opos += 2;
                if (opos > 78 && !firstone)
                if (!firstone)
                        opos += 2;
                if (opos > 78 && !firstone)
@@ -755,7 +756,7 @@ commaize(h, p, fp, oldstyle, m)
                        (void) sprintf(obp, "        ");
                        opos = strlen(obp);
                        obp += opos;
                        (void) sprintf(obp, "        ");
                        opos = strlen(obp);
                        obp += opos;
-                       opos += qstrlen(name);
+                       opos += strlen(name);
                }
                else if (!firstone)
                {
                }
                else if (!firstone)
                {
@@ -764,11 +765,11 @@ commaize(h, p, fp, oldstyle, m)
                }
 
                /* strip off quote bits as we output */
                }
 
                /* strip off quote bits as we output */
-               while (*name != '\0' && obp < &obuf[MAXLINE])
+               while ((c = *name++) != '\0' && obp < &obuf[MAXLINE])
                {
                {
-                       if (bitset(0200, *name))
-                               *obp++ = '\\';
-                       *obp++ = *name++ & ~0200;
+                       if (bitnset(M_7BITS, m->m_flags))
+                               c &= 0177;
+                       *obp++ = c;
                }
                firstone = FALSE;
                *p = savechar;
                }
                firstone = FALSE;
                *p = savechar;
index 878beb9..2bb96aa 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)parseaddr.c        5.18 (Berkeley) %G%";
+static char sccsid[] = "@(#)parseaddr.c        5.19 (Berkeley) %G%";
 #endif /* not lint */
 
 # include "sendmail.h"
 #endif /* not lint */
 
 # include "sendmail.h"
@@ -292,7 +292,7 @@ prescan(addr, delim, pvpbuf)
        cmntcnt = 0;
        anglecnt = 0;
        avp = av;
        cmntcnt = 0;
        anglecnt = 0;
        avp = av;
-       state = OPR;
+       state = ATM;
        c = NOCHAR;
        p = addr;
        if (tTd(22, 45))
        c = NOCHAR;
        p = addr;
        if (tTd(22, 45))
@@ -327,7 +327,6 @@ prescan(addr, delim, pvpbuf)
                        c = *p++;
                        if (c == '\0')
                                break;
                        c = *p++;
                        if (c == '\0')
                                break;
-                       c &= ~0200;
 
                        if (tTd(22, 101))
                                printf("c=%c, s=%d; ", c, state);
 
                        if (tTd(22, 101))
                                printf("c=%c, s=%d; ", c, state);
@@ -338,14 +337,16 @@ prescan(addr, delim, pvpbuf)
                        {
                                /* kludge \! for naive users */
                                if (c != '!')
                        {
                                /* kludge \! for naive users */
                                if (c != '!')
-                                       c |= 0200;
+                                       *q++ = '\\';
                                bslashmode = FALSE;
                                bslashmode = FALSE;
+                               continue;
                        }
 
                        if (c == '\\')
                        {
                                bslashmode = TRUE;
                                c = NOCHAR;
                        }
 
                        if (c == '\\')
                        {
                                bslashmode = TRUE;
                                c = NOCHAR;
+                               continue;
                        }
                        else if (state == QST)
                        {
                        }
                        else if (state == QST)
                        {
index a07d450..fa7d1d9 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)recipient.c        5.30 (Berkeley) %G%";
+static char sccsid[] = "@(#)recipient.c        5.31 (Berkeley) %G%";
 #endif /* not lint */
 
 # include <sys/types.h>
 #endif /* not lint */
 
 # include <sys/types.h>
@@ -254,7 +254,7 @@ recipient(a, sendq)
                if (!isascii(*p) && (*p & 0377) != (SpaceSub & 0377))
                        quoted = TRUE;
        }
                if (!isascii(*p) && (*p & 0377) != (SpaceSub & 0377))
                        quoted = TRUE;
        }
-       stripquotes(buf, TRUE);
+       stripquotes(buf);
 
        /* do sickly crude mapping for program mailing, etc. */
        if (m == LocalMailer && buf[0] == '|')
 
        /* do sickly crude mapping for program mailing, etc. */
        if (m == LocalMailer && buf[0] == '|')
index a096e97..ae3bf7b 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)util.c     5.25 (Berkeley) %G%";
+static char sccsid[] = "@(#)util.c     5.26 (Berkeley) %G%";
 #endif /* not lint */
 
 # include <stdio.h>
 #endif /* not lint */
 
 # include <stdio.h>
@@ -27,8 +27,6 @@ static char sccsid[] = "@(#)util.c    5.25 (Berkeley) %G%";
 **
 **     Parameters:
 **             s -- the string to strip.
 **
 **     Parameters:
 **             s -- the string to strip.
-**             qf -- if set, remove actual `` " '' characters
-**                     as well as the quote bits.
 **
 **     Returns:
 **             none.
 **
 **     Returns:
 **             none.
@@ -40,9 +38,8 @@ static char sccsid[] = "@(#)util.c    5.25 (Berkeley) %G%";
 **             deliver
 */
 
 **             deliver
 */
 
-stripquotes(s, qf)
+stripquotes(s)
        char *s;
        char *s;
-       bool qf;
 {
        register char *p;
        register char *q;
 {
        register char *p;
        register char *q;
@@ -51,39 +48,16 @@ stripquotes(s, qf)
        if (s == NULL)
                return;
 
        if (s == NULL)
                return;
 
-       for (p = q = s; (c = *p++) != '\0'; )
-       {
-               if (c != '"' || !qf)
-                       *q++ = c & 0177;
-       }
-       *q = '\0';
-}
-\f/*
-**  QSTRLEN -- give me the string length assuming 0200 bits add a char
-**
-**     Parameters:
-**             s -- the string to measure.
-**
-**     Reurns:
-**             The length of s, including space for backslash escapes.
-**
-**     Side Effects:
-**             none.
-*/
-
-qstrlen(s)
-       register char *s;
-{
-       register int l = 0;
-       register char c;
-
-       while ((c = *s++) != '\0')
+       p = q = s;
+       do
        {
        {
-               if (bitset(0200, c))
-                       l++;
-               l++;
-       }
-       return (l);
+               c = *p++;
+               if (c == '\\')
+                       c = *p++;
+               else if (c == '"')
+                       continue;
+               *q++ = c;
+       } while (c != '\0');
 }
 \f/*
 **  CAPITALIZE -- return a copy of a string, properly capitalized.
 }
 \f/*
 **  CAPITALIZE -- return a copy of a string, properly capitalized.
@@ -711,13 +685,6 @@ fgetfolded(buf, n, f)
        if (p == buf)
                return (NULL);
        *--p = '\0';
        if (p == buf)
                return (NULL);
        *--p = '\0';
-       if (!EightBit)
-       {
-               /* headers always have to be 7-bit */
-               for (p = buf; (i = *p) != '\0'; *p++)
-                       if (bitset(0200, i))
-                               *p = i & ~0200;
-       }
        return (buf);
 }
 \f/*
        return (buf);
 }
 \f/*
index 6779ed6..7c94cd5 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)version.c  5.102 (Berkeley) %G%";
+static char sccsid[] = "@(#)version.c  5.103 (Berkeley) %G%";
 #endif /* not lint */
 
 #endif /* not lint */
 
-char   Version[] = "5.102";
+char   Version[] = "5.103";