move the meta-characters from C0 into C1 space
authorEric Allman <eric@ucbvax.Berkeley.EDU>
Fri, 19 Feb 1993 12:22:46 +0000 (04:22 -0800)
committerEric Allman <eric@ucbvax.Berkeley.EDU>
Fri, 19 Feb 1993 12:22:46 +0000 (04:22 -0800)
SCCS-vsn: usr.sbin/sendmail/src/usersmtp.c 6.10
SCCS-vsn: usr.sbin/sendmail/src/headers.c 6.7
SCCS-vsn: usr.sbin/sendmail/src/recipient.c 6.10
SCCS-vsn: usr.sbin/sendmail/src/macro.c 6.5
SCCS-vsn: usr.sbin/sendmail/src/convtime.c 6.2
SCCS-vsn: usr.sbin/sendmail/src/main.c 6.18
SCCS-vsn: usr.sbin/sendmail/src/parseaddr.c 6.15
SCCS-vsn: usr.sbin/sendmail/src/arpadate.c 6.6
SCCS-vsn: usr.sbin/sendmail/src/collect.c 6.4
SCCS-vsn: usr.sbin/sendmail/src/sendmail.h 6.12
SCCS-vsn: usr.sbin/sendmail/src/savemail.c 6.6
SCCS-vsn: usr.sbin/sendmail/src/srvrsmtp.c 6.8
SCCS-vsn: usr.sbin/sendmail/src/util.c 6.6
SCCS-vsn: usr.sbin/sendmail/src/readcf.c 6.8
SCCS-vsn: usr.sbin/sendmail/src/deliver.c 6.17
SCCS-vsn: usr.sbin/sendmail/src/queue.c 6.12
SCCS-vsn: usr.sbin/sendmail/src/conf.c 6.15
SCCS-vsn: usr.sbin/sendmail/src/alias.c 6.11
SCCS-vsn: usr.sbin/sendmail/src/udb.c 6.7
SCCS-vsn: usr.sbin/sendmail/src/map.c 6.5

20 files changed:
usr/src/usr.sbin/sendmail/src/alias.c
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/convtime.c
usr/src/usr.sbin/sendmail/src/deliver.c
usr/src/usr.sbin/sendmail/src/headers.c
usr/src/usr.sbin/sendmail/src/macro.c
usr/src/usr.sbin/sendmail/src/main.c
usr/src/usr.sbin/sendmail/src/map.c
usr/src/usr.sbin/sendmail/src/parseaddr.c
usr/src/usr.sbin/sendmail/src/queue.c
usr/src/usr.sbin/sendmail/src/readcf.c
usr/src/usr.sbin/sendmail/src/recipient.c
usr/src/usr.sbin/sendmail/src/savemail.c
usr/src/usr.sbin/sendmail/src/sendmail.h
usr/src/usr.sbin/sendmail/src/srvrsmtp.c
usr/src/usr.sbin/sendmail/src/udb.c
usr/src/usr.sbin/sendmail/src/usersmtp.c
usr/src/usr.sbin/sendmail/src/util.c

index 6a75f6d..a6c8e3c 100644 (file)
@@ -29,15 +29,15 @@ ERROR: DBM is no longer supported -- use NDBM instead.
 #ifndef lint
 #ifdef NEWDB
 #ifdef NDBM
 #ifndef lint
 #ifdef NEWDB
 #ifdef NDBM
-static char sccsid[] = "@(#)alias.c    6.10 (Berkeley) %G% (with NEWDB and NDBM)";
+static char sccsid[] = "@(#)alias.c    6.11 (Berkeley) %G% (with NEWDB and NDBM)";
 #else
 #else
-static char sccsid[] = "@(#)alias.c    6.10 (Berkeley) %G% (with NEWDB)";
+static char sccsid[] = "@(#)alias.c    6.11 (Berkeley) %G% (with NEWDB)";
 #endif
 #else
 #ifdef NDBM
 #endif
 #else
 #ifdef NDBM
-static char sccsid[] = "@(#)alias.c    6.10 (Berkeley) %G% (with NDBM)";
+static char sccsid[] = "@(#)alias.c    6.11 (Berkeley) %G% (with NDBM)";
 #else
 #else
-static char sccsid[] = "@(#)alias.c    6.10 (Berkeley) %G% (without NEWDB or NDBM)";
+static char sccsid[] = "@(#)alias.c    6.11 (Berkeley) %G% (without NEWDB or NDBM)";
 #endif
 #endif
 #endif /* not lint */
 #endif
 #endif
 #endif /* not lint */
@@ -665,7 +665,8 @@ readaliases(aliasfile, init, e)
                                {
                                        extern char *DelimChar;
 
                                {
                                        extern char *DelimChar;
 
-                                       while (isspace(*p) || *p == ',')
+                                       while ((isascii(*p) && isspace(*p)) ||
+                                                               *p == ',')
                                                p++;
                                        if (*p == '\0')
                                                break;
                                                p++;
                                        if (*p == '\0')
                                                break;
@@ -852,7 +853,7 @@ forward(user, sendq, e)
        define('u', user->q_user, e);
        define('h', user->q_host, e);
        if (ForwardPath == NULL)
        define('u', user->q_user, e);
        define('h', user->q_host, e);
        if (ForwardPath == NULL)
-               ForwardPath = newstr("\001z/.forward");
+               ForwardPath = newstr("\201z/.forward");
 
        for (pp = ForwardPath; pp != NULL; pp = ep)
        {
 
        for (pp = ForwardPath; pp != NULL; pp = ep)
        {
index 6e8a563..d5d2a23 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)arpadate.c 6.5 (Berkeley) %G%";
+static char sccsid[] = "@(#)arpadate.c 6.6 (Berkeley) %G%";
 #endif /* not lint */
 
 # include "sendmail.h"
 #endif /* not lint */
 
 # include "sendmail.h"
@@ -321,7 +321,7 @@ arpatounix(s, e)
 
        /* now must have date */
        tm.tm_mday = atoi(p);
 
        /* now must have date */
        tm.tm_mday = atoi(p);
-       while (isdigit((int) *p))               /* skip over date */
+       while (isascii(*p) && isdigit(*p))      /* skip over date */
                p++;
        p = nextatom(p);                        /* point to month name */
        for (tm.tm_mon = 0; MonthList[tm.tm_mon]; tm.tm_mon++)
                p++;
        p = nextatom(p);                        /* point to month name */
        for (tm.tm_mon = 0; MonthList[tm.tm_mon]; tm.tm_mon++)
@@ -362,28 +362,28 @@ arpatounix(s, e)
                        tm.tm_year += ((gmt->tm_year - tm.tm_year) / 100) * 100;
                }
        }
                        tm.tm_year += ((gmt->tm_year - tm.tm_year) / 100) * 100;
                }
        }
-       while (isdigit((int) *p))       /* skip over year */
+       while (isascii(*p) && isdigit(*p))      /* skip over year */
                p++;
                p++;
-       p = nextatom(p);                /* hours */
+       p = nextatom(p);                        /* hours */
        tm.tm_hour = atoi(p);
        tm.tm_hour = atoi(p);
-       while (isdigit((int) *p))       /* skip over hours */
+       while (isascii(*p) && isdigit(*p))      /* skip over hours */
                p++;
                p++;
-       p = nextatom(p);                /* colon */
+       p = nextatom(p);                        /* colon */
        if (*p == ':')
                p = nextatom(++p);
        if (*p == ':')
                p = nextatom(++p);
-       p = nextatom(p);                /* minutes */
+       p = nextatom(p);                        /* minutes */
        tm.tm_min = atoi(p);
        tm.tm_min = atoi(p);
-       while (isdigit((int) *p))       /* skip over minutes */
+       while (isascii(*p) && isdigit(*p))      /* skip over minutes */
                p++;
                p++;
-       p = nextatom(p);                /* colon or zone */
-       if (*p == ':')                  /* have seconds field */
+       p = nextatom(p);                        /* colon or zone */
+       if (*p == ':')                          /* have seconds field */
        {
                p = nextatom(++p);
                tm.tm_sec = atoi(p);
        {
                p = nextatom(++p);
                tm.tm_sec = atoi(p);
-               while (isdigit((int) *p))       /* skip over seconds */
+               while (isascii(*p) && isdigit(*p))      /* skip over seconds */
                        p++;
        }
                        p++;
        }
-       p = nextatom(p);                /* zone */
+       p = nextatom(p);                        /* zone */
 
        if (*p == '+')
        {
 
        if (*p == '+')
        {
index 2ccc039..37d9742 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)collect.c  6.3 (Berkeley) %G%";
+static char sccsid[] = "@(#)collect.c  6.4 (Berkeley) %G%";
 #endif /* not lint */
 
 # include <errno.h>
 #endif /* not lint */
 
 # include <errno.h>
@@ -408,7 +408,8 @@ eatfrom(fm, e)
                        p++;
                while (*p == ' ')
                        p++;
                        p++;
                while (*p == ' ')
                        p++;
-               if (!isupper(*p) || p[3] != ' ' || p[13] != ':' || p[16] != ':')
+               if (!(isascii(*p) && isupper(*p)) ||
+                   p[3] != ' ' || p[13] != ':' || p[16] != ':')
                        continue;
 
                /* we have a possible date */
                        continue;
 
                /* we have a possible date */
index b1e434f..c626655 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)conf.c     6.14 (Berkeley) %G%";
+static char sccsid[] = "@(#)conf.c     6.15 (Berkeley) %G%";
 #endif /* not lint */
 
 # include <sys/ioctl.h>
 #endif /* not lint */
 
 # include <sys/ioctl.h>
@@ -268,7 +268,7 @@ host_map_init(map, mapname, args)
 
        for (;;)
        {
 
        for (;;)
        {
-               while (isspace(*p))
+               while (isascii(*p) && isspace(*p))
                        p++;
                if (*p != '-')
                        break;
                        p++;
                if (*p != '-')
                        break;
@@ -278,7 +278,7 @@ host_map_init(map, mapname, args)
                        map->map_app = ++p;
                        break;
                }
                        map->map_app = ++p;
                        break;
                }
-               while (*p != '\0' && !isspace(*p))
+               while (*p != '\0' && !(isascii(*p) && isspace(*p)))
                        p++;
                if (*p != '\0')
                        *p++ = '\0';
                        p++;
                if (*p != '\0')
                        *p++ = '\0';
index dc449ef..2074d37 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)convtime.c 6.1 (Berkeley) %G%";
+static char sccsid[] = "@(#)convtime.c 6.2 (Berkeley) %G%";
 #endif /* not lint */
 
 # include <ctype.h>
 #endif /* not lint */
 
 # include <ctype.h>
@@ -46,7 +46,7 @@ convtime(p)
        while (*p != '\0')
        {
                t = 0;
        while (*p != '\0')
        {
                t = 0;
-               while (isdigit(c = *p++))
+               while (isascii(c = *p++) && isdigit(c))
                        t = t * 10 + (c - '0');
                if (c == '\0')
                        p--;
                        t = t * 10 + (c - '0');
                if (c == '\0')
                        p--;
index 35e2709..e5a30f8 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)deliver.c  6.16 (Berkeley) %G%";
+static char sccsid[] = "@(#)deliver.c  6.17 (Berkeley) %G%";
 #endif /* not lint */
 
 #include "sendmail.h"
 #endif /* not lint */
 
 #include "sendmail.h"
@@ -170,10 +170,17 @@ deliver(e, firstto)
 
        for (mvp = m->m_argv; (p = *++mvp) != NULL; )
        {
 
        for (mvp = m->m_argv; (p = *++mvp) != NULL; )
        {
-               while ((p = strchr(p, '\001')) != NULL)
-                       if (*++p == 'u')
-                               break;
-               if (p != NULL)
+               /* can't use strchr here because of sign extension problems */
+               while (*p != '\0')
+               {
+                       if ((*p++ & 0377) == MACROEXPAND)
+                       {
+                               if (*p == 'u')
+                                       break;
+                       }
+               }
+
+               if (*p != '\0')
                        break;
 
                /* this entry is safe -- go ahead and process it */
                        break;
 
                /* this entry is safe -- go ahead and process it */
@@ -1185,7 +1192,7 @@ putfromline(fp, m, e)
        register MAILER *m;
        ENVELOPE *e;
 {
        register MAILER *m;
        ENVELOPE *e;
 {
-       char *template = "\001l\n";
+       char *template = "\201l\n";
        char buf[MAXLINE];
        extern char SentDate[];
 
        char buf[MAXLINE];
        extern char SentDate[];
 
@@ -1198,14 +1205,14 @@ putfromline(fp, m, e)
                char *bang;
                char xbuf[MAXLINE];
 
                char *bang;
                char xbuf[MAXLINE];
 
-               expand("\001<", buf, &buf[sizeof buf - 1], e);
+               expand("\201<", buf, &buf[sizeof buf - 1], e);
                bang = strchr(buf, '!');
                if (bang == NULL)
                        syserr("No ! in UUCP! (%s)", buf);
                else
                {
                        *bang++ = '\0';
                bang = strchr(buf, '!');
                if (bang == NULL)
                        syserr("No ! in UUCP! (%s)", buf);
                else
                {
                        *bang++ = '\0';
-                       (void) sprintf(xbuf, "From %s  \001d remote from %s\n", bang, buf);
+                       (void) sprintf(xbuf, "From %s  \201d remote from %s\n", bang, buf);
                        template = xbuf;
                }
        }
                        template = xbuf;
                }
        }
@@ -1765,7 +1772,7 @@ hostsignature(m, host, e)
 
 #ifdef NAMED_BIND
        if (myhostbuf[0] == '\0')
 
 #ifdef NAMED_BIND
        if (myhostbuf[0] == '\0')
-               expand("\001j", myhostbuf, &myhostbuf[sizeof myhostbuf - 1], e);
+               expand("\201j", myhostbuf, &myhostbuf[sizeof myhostbuf - 1], e);
 
        nmx = getmxrr(host, mxhosts, myhostbuf, &rcode);
        if (nmx <= 0)
 
        nmx = getmxrr(host, mxhosts, myhostbuf, &rcode);
        if (nmx <= 0)
index ecdcd3b..01152e6 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)headers.c  6.6 (Berkeley) %G%";
+static char sccsid[] = "@(#)headers.c  6.7 (Berkeley) %G%";
 #endif /* not lint */
 
 # include <errno.h>
 #endif /* not lint */
 
 # include <errno.h>
@@ -78,7 +78,7 @@ chompheader(line, def, e)
                return (0);
        }
        fvalue = &p[1];
                return (0);
        }
        fvalue = &p[1];
-       while (isspace(*--p))
+       while (isascii(*--p) && isspace(*p))
                continue;
        *++p = '\0';
        makelower(fname);
                continue;
        *++p = '\0';
        makelower(fname);
@@ -264,7 +264,7 @@ isheader(s)
                s++;
 
        /* following technically violates RFC822 */
                s++;
 
        /* following technically violates RFC822 */
-       while (isspace(*s))
+       while (isascii(*s) && isspace(*s))
                s++;
 
        return (*s == ':');
                s++;
 
        return (*s == ':');
@@ -484,7 +484,7 @@ crackaddr(addr)
                printf("crackaddr(%s)\n", addr);
 
        /* strip leading spaces */
                printf("crackaddr(%s)\n", addr);
 
        /* strip leading spaces */
-       while (*addr != '\0' && isspace(*addr))
+       while (*addr != '\0' && isascii(*addr) && isspace(*addr))
                addr++;
 
        /*
                addr++;
 
        /*
@@ -606,7 +606,7 @@ crackaddr(addr)
 
                                /* back up over the '<' and any spaces */
                                --p;
 
                                /* back up over the '<' and any spaces */
                                --p;
-                               while (isspace(*--p))
+                               while (isascii(*--p) && isspace(*p))
                                        continue;
                                p++;
                        }
                                        continue;
                                p++;
                        }
@@ -662,7 +662,7 @@ crackaddr(addr)
        putg:
                if (copylev <= 0 && !putgmac)
                {
        putg:
                if (copylev <= 0 && !putgmac)
                {
-                       *bp++ = '\001';
+                       *bp++ = MACROEXPAND;
                        *bp++ = 'g';
                        putgmac = TRUE;
                }
                        *bp++ = 'g';
                        putgmac = TRUE;
                }
@@ -833,7 +833,7 @@ commaize(h, p, fp, oldstyle, m, e)
                */
 
                /* find end of name */
                */
 
                /* find end of name */
-               while (isspace(*p) || *p == ',')
+               while ((isascii(*p) && isspace(*p)) || *p == ',')
                        p++;
                name = p;
                for (;;)
                        p++;
                name = p;
                for (;;)
@@ -848,7 +848,7 @@ commaize(h, p, fp, oldstyle, m, e)
 
                        /* look to see if we have an at sign */
                        oldp = p;
 
                        /* look to see if we have an at sign */
                        oldp = p;
-                       while (*p != '\0' && isspace(*p))
+                       while (*p != '\0' && isascii(*p) && isspace(*p))
                                p++;
 
                        if (*p != '@' && !isatword(p))
                                p++;
 
                        if (*p != '@' && !isatword(p))
@@ -857,13 +857,14 @@ commaize(h, p, fp, oldstyle, m, e)
                                break;
                        }
                        p += *p == '@' ? 1 : 2;
                                break;
                        }
                        p += *p == '@' ? 1 : 2;
-                       while (*p != '\0' && isspace(*p))
+                       while (*p != '\0' && isascii(*p) && isspace(*p))
                                p++;
                }
                /* at the end of one complete name */
 
                /* strip off trailing white space */
                                p++;
                }
                /* at the end of one complete name */
 
                /* strip off trailing white space */
-               while (p >= name && (isspace(*p) || *p == ',' || *p == '\0'))
+               while (p >= name &&
+                      ((isascii(*p) && isspace(*p)) || *p == ',' || *p == '\0'))
                        p--;
                if (++p == name)
                        continue;
                        p--;
                if (++p == name)
                        continue;
@@ -933,7 +934,7 @@ isatword(p)
        extern char lower();
 
        if (lower(p[0]) == 'a' && lower(p[1]) == 't' &&
        extern char lower();
 
        if (lower(p[0]) == 'a' && lower(p[1]) == 't' &&
-           p[2] != '\0' && isspace(p[2]))
+           p[2] != '\0' && isascii(p[2]) && isspace(p[2]))
                return (TRUE);
        return (FALSE);
 }
                return (TRUE);
        return (FALSE);
 }
index b0baa32..79077d6 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)macro.c    6.4 (Berkeley) %G%";
+static char sccsid[] = "@(#)macro.c    6.5 (Berkeley) %G%";
 #endif /* not lint */
 
 # include "sendmail.h"
 #endif /* not lint */
 
 # include "sendmail.h"
@@ -67,7 +67,7 @@ expand(s, buf, buflim, e)
 
                q = NULL;
                c = *s;
 
                q = NULL;
                c = *s;
-               switch (c)
+               switch (c & 0377)
                {
                  case CONDIF:          /* see if var set */
                        c = *++s;
                {
                  case CONDIF:          /* see if var set */
                        c = *++s;
@@ -89,7 +89,7 @@ expand(s, buf, buflim, e)
                                iflev--;
                        continue;
 
                                iflev--;
                        continue;
 
-                 case '\001':          /* macro interpolation */
+                 case MACROEXPAND:     /* macro interpolation */
                        c = *++s;
                        q = macvalue(c & 0177, e);
                        if (q == NULL)
                        c = *++s;
                        q = macvalue(c & 0177, e);
                        if (q == NULL)
@@ -110,7 +110,8 @@ expand(s, buf, buflim, e)
                        /* copy to end of q or max space remaining in buf */
                        while ((c = *q++) != '\0' && xp < &xbuf[sizeof xbuf - 1])
                        {
                        /* copy to end of q or max space remaining in buf */
                        while ((c = *q++) != '\0' && xp < &xbuf[sizeof xbuf - 1])
                        {
-                               if (iscntrl(c) && !isspace(c))
+                               /* check for any sendmail metacharacters */
+                               if ((c & 0340) == 0200)
                                        recurse = TRUE;
                                *xp++ = c;
                        }
                                        recurse = TRUE;
                                *xp++ = c;
                        }
index a4d9136..75fd124 100644 (file)
@@ -13,7 +13,7 @@ char copyright[] =
 #endif /* not lint */
 
 #ifndef lint
 #endif /* not lint */
 
 #ifndef lint
-static char sccsid[] = "@(#)main.c     6.17 (Berkeley) %G%";
+static char sccsid[] = "@(#)main.c     6.18 (Berkeley) %G%";
 #endif /* not lint */
 
 #define        _DEFINE
 #endif /* not lint */
 
 #define        _DEFINE
@@ -727,10 +727,10 @@ main(argc, argv, envp)
                                printf("> %s", buf);
                        if (buf[0] == '#')
                                continue;
                                printf("> %s", buf);
                        if (buf[0] == '#')
                                continue;
-                       for (p = buf; isspace(*p); p++)
+                       for (p = buf; isascii(*p) && isspace(*p); p++)
                                continue;
                        q = p;
                                continue;
                        q = p;
-                       while (*p != '\0' && !isspace(*p))
+                       while (*p != '\0' && !(isascii(*p) && isspace(*p)))
                                p++;
                        if (*p == '\0')
                        {
                                p++;
                        if (*p == '\0')
                        {
index f0ab32e..f22cfc0 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)map.c      6.4 (Berkeley) %G%";
+static char sccsid[] = "@(#)map.c      6.5 (Berkeley) %G%";
 #endif /* not lint */
 
 #include "sendmail.h"
 #endif /* not lint */
 
 #include "sendmail.h"
@@ -100,7 +100,7 @@ dbm_map_lookup(map, buf, bufsiz, av)
                register char *p;
 
                for (p = buf; *p != '\0'; p++)
                register char *p;
 
                for (p = buf; *p != '\0'; p++)
-                       if (isupper(*p))
+                       if (isascii(*p) && isupper(*p))
                                *p = tolower(*p);
        }
        if (bitset(MF_INCLNULL, map->map_flags))
                                *p = tolower(*p);
        }
        if (bitset(MF_INCLNULL, map->map_flags))
@@ -241,7 +241,7 @@ db_map_lookup(map, buf, bufsiz, av)
                register char *p;
 
                for (p = buf; *p != '\0'; p++)
                register char *p;
 
                for (p = buf; *p != '\0'; p++)
-                       if (isupper(*p))
+                       if (isascii(*p) && isupper(*p))
                                *p = tolower(*p);
        }
        if (bitset(MF_INCLNULL, map->map_flags))
                                *p = tolower(*p);
        }
        if (bitset(MF_INCLNULL, map->map_flags))
@@ -278,7 +278,7 @@ map_parseargs(map, pp)
 
        for (;;)
        {
 
        for (;;)
        {
-               while (isspace(*p))
+               while (isascii(*p) && isspace(*p))
                        p++;
                if (*p != '-')
                        break;
                        p++;
                if (*p != '-')
                        break;
@@ -308,7 +308,7 @@ map_parseargs(map, pp)
                        map->map_domain = ++p;
                        break;
                }
                        map->map_domain = ++p;
                        break;
                }
-               while (*p != '\0' && !isspace(*p))
+               while (*p != '\0' && !(isascii(*p) && isspace(*p)))
                        p++;
                if (*p != '\0')
                        *p++ = 0;
                        p++;
                if (*p != '\0')
                        *p++ = 0;
@@ -321,7 +321,7 @@ map_parseargs(map, pp)
        if (*p == '\0')
                return NULL;
        map->map_file = p;
        if (*p == '\0')
                return NULL;
        map->map_file = p;
-       while (*p != '\0' && !isspace(*p))
+       while (*p != '\0' && !(isascii(*p) && isspace(*p)))
                p++;
        if (*p != '\0')
                *p++ = '\0';
                p++;
        if (*p != '\0')
                *p++ = '\0';
@@ -408,7 +408,7 @@ nis_map_lookup(map, buf, bufsiz, av)
                register char *p;
 
                for (p = buf; *p != '\0'; p++)
                register char *p;
 
                for (p = buf; *p != '\0'; p++)
-                       if (isupper(*p))
+                       if (isascii(*p) && isupper(*p))
                                *p = tolower(*p);
        }
        if (yp_match(map->map_domain, map->map_file, buf, strlen(buf) + 1,
                                *p = tolower(*p);
        }
        if (yp_match(map->map_domain, map->map_file, buf, strlen(buf) + 1,
@@ -472,7 +472,7 @@ map_rewrite(s, slen, buf, buflen, av)
                        c = '%';
                if (c == '%')
                        goto pushc;
                        c = '%';
                if (c == '%')
                        goto pushc;
-               if (!isdigit(c))
+               if (!(isascii(c) && isdigit(c)))
                {
                        *bp++ = '%';
                        goto pushc;
                {
                        *bp++ = '%';
                        goto pushc;
index a4e2d25..b3f179a 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)parseaddr.c        6.14 (Berkeley) %G%";
+static char sccsid[] = "@(#)parseaddr.c        6.15 (Berkeley) %G%";
 #endif /* not lint */
 
 #include "sendmail.h"
 #endif /* not lint */
 
 #include "sendmail.h"
@@ -64,7 +64,7 @@ char  *DelimChar;             /* set to point to the delimiter */
 */
 
 /* following delimiters are inherent to the internal algorithms */
 */
 
 /* following delimiters are inherent to the internal algorithms */
-# define DELIMCHARS    "\001()<>,;\\\"\r\n"    /* word delimiters */
+# define DELIMCHARS    "\201()<>,;\\\"\r\n"    /* word delimiters */
 
 ADDRESS *
 parseaddr(addr, a, copyf, delim, e)
 
 ADDRESS *
 parseaddr(addr, a, copyf, delim, e)
@@ -128,7 +128,7 @@ parseaddr(addr, a, copyf, delim, e)
        **  See if we resolved to a real mailer.
        */
 
        **  See if we resolved to a real mailer.
        */
 
-       if (pvp[0][0] != CANONNET)
+       if ((pvp[0][0] & 0377) != CANONNET)
        {
                setstat(EX_USAGE);
                usrerr("cannot resolve name");
        {
                setstat(EX_USAGE);
                usrerr("cannot resolve name");
@@ -179,8 +179,7 @@ invalidaddr(addr)
 {
        for (; *addr != '\0'; addr++)
        {
 {
        for (; *addr != '\0'; addr++)
        {
-               if (!isascii((int) *addr & 0377) ||
-                   !iscntrl(*addr) || isspace(*addr))
+               if ((*addr & 0340) != 0200)
                        continue;
                setstat(EX_USAGE);
                usrerr("Address contained invalid control characters");
                        continue;
                setstat(EX_USAGE);
                usrerr("Address contained invalid control characters");
@@ -508,7 +507,7 @@ prescan(addr, delim, pvpbuf)
                                }
                                anglecnt--;
                        }
                                }
                                anglecnt--;
                        }
-                       else if (delim == ' ' && isspace(c))
+                       else if (delim == ' ' && isascii(c) && isspace(c))
                                c = ' ';
                        else if (c == ':' && !CurEnv->e_oldstyle)
                        {
                                c = ' ';
                        else if (c == ':' && !CurEnv->e_oldstyle)
                        {
@@ -587,7 +586,7 @@ prescan(addr, delim, pvpbuf)
 
 static int
 toktype(c)
 
 static int
 toktype(c)
-       register char c;
+       register int c;
 {
        static char buf[50];
        static bool firstime = TRUE;
 {
        static char buf[50];
        static bool firstime = TRUE;
@@ -595,9 +594,10 @@ toktype(c)
        if (firstime)
        {
                firstime = FALSE;
        if (firstime)
        {
                firstime = FALSE;
-               expand("\001o", buf, &buf[sizeof buf - 1], CurEnv);
+               expand("\201o", buf, &buf[sizeof buf - 1], CurEnv);
                (void) strcat(buf, DELIMCHARS);
        }
                (void) strcat(buf, DELIMCHARS);
        }
+       c &= 0377;
        if (c == MATCHCLASS || c == MATCHREPL || c == MATCHNCLASS)
                return (ONE);
 #ifdef MACVALUE
        if (c == MATCHCLASS || c == MATCHREPL || c == MATCHNCLASS)
                return (ONE);
 #ifdef MACVALUE
@@ -606,11 +606,13 @@ toktype(c)
 #endif /* MACVALUE */
        if (c == '"')
                return (QST);
 #endif /* MACVALUE */
        if (c == '"')
                return (QST);
+       if ((c & 0340) == 0200)
+               return (OPR);
        if (!isascii(c))
                return (ATM);
        if (isspace(c) || c == ')')
                return (SPC);
        if (!isascii(c))
                return (ATM);
        if (isspace(c) || c == ')')
                return (SPC);
-       if (iscntrl(c) || strchr(buf, c) != NULL)
+       if (strchr(buf, c) != NULL)
                return (OPR);
        return (ATM);
 }
                return (OPR);
        return (ATM);
 }
@@ -1113,18 +1115,18 @@ backup:
                }
 
                rp = *rvp;
                }
 
                rp = *rvp;
-               if (*rp == CANONUSER)
+               if ((*rp & 0377) == CANONUSER)
                {
                        rvp++;
                        rwr = rwr->r_next;
                        nmatches = 0;
                }
                {
                        rvp++;
                        rwr = rwr->r_next;
                        nmatches = 0;
                }
-               else if (*rp == CANONHOST)
+               else if ((*rp & 0377) == CANONHOST)
                {
                        rvp++;
                        rwr = NULL;
                }
                {
                        rvp++;
                        rwr = NULL;
                }
-               else if (*rp == CANONNET)
+               else if ((*rp & 0377) == CANONNET)
                        rwr = NULL;
 
                /* substitute */
                        rwr = NULL;
 
                /* substitute */
@@ -1220,7 +1222,8 @@ backup:
                        char begintype;
                        char db = '\0';
 
                        char begintype;
                        char db = '\0';
 
-                       if (**rvp != HOSTBEGIN && **rvp != LOOKUPBEGIN)
+                       if ((**rvp & 0377) != HOSTBEGIN &&
+                           (**rvp & 0377) != LOOKUPBEGIN)
                                continue;
 
                        /*
                                continue;
 
                        /*
@@ -1232,7 +1235,7 @@ backup:
                        begintype = **rvp;
                        hbrvp = rvp;
                        ubrvp = NULL;
                        begintype = **rvp;
                        hbrvp = rvp;
                        ubrvp = NULL;
-                       if (**rvp == HOSTBEGIN)
+                       if ((**rvp & 0377) == HOSTBEGIN)
                        {
                                endtoken = HOSTEND;
                                mapname = "host";
                        {
                                endtoken = HOSTEND;
                                mapname = "host";
@@ -1252,9 +1255,9 @@ backup:
                        arg_rvp = argvect;
                        xpvp = NULL;
                        replac = pvpbuf;
                        arg_rvp = argvect;
                        xpvp = NULL;
                        replac = pvpbuf;
-                       while (*rvp != NULL && **rvp != endtoken)
+                       while (*rvp != NULL && (**rvp & 0377) != endtoken)
                        {
                        {
-                               int nodetype = **rvp;
+                               int nodetype = **rvp & 0377;
 
                                if (nodetype != CANONHOST && nodetype != CANONUSER)
                                {
 
                                if (nodetype != CANONHOST && nodetype != CANONUSER)
                                {
@@ -1486,11 +1489,11 @@ buildaddr(tv, a)
        tv++;
        if (!strcasecmp(*tv, "error"))
        {
        tv++;
        if (!strcasecmp(*tv, "error"))
        {
-               if (**++tv == CANONHOST)
+               if ((**++tv & 0377) == CANONHOST)
                {
                        register struct errcodes *ep;
 
                {
                        register struct errcodes *ep;
 
-                       if (isdigit(**++tv))
+                       if (isascii(**++tv) && isdigit(**tv))
                        {
                                setstat(atoi(*tv));
                        }
                        {
                                setstat(atoi(*tv));
                        }
@@ -1510,7 +1513,7 @@ buildaddr(tv, a)
                                (void) strcat(buf, " ");
                        (void) strcat(buf, *tv);
                }
                                (void) strcat(buf, " ");
                        (void) strcat(buf, *tv);
                }
-               if (**tv != CANONUSER)
+               if ((**tv & 0377) != CANONUSER)
                        syserr("buildaddr: error: no user");
                while (*++tv != NULL)
                {
                        syserr("buildaddr: error: no user");
                while (*++tv != NULL)
                {
@@ -1581,7 +1584,7 @@ buildaddr(tv, a)
        }
 
        /* figure out the user */
        }
 
        /* figure out the user */
-       if (*tv == NULL || **tv != CANONUSER)
+       if (*tv == NULL || (**tv & 0377) != CANONUSER)
        {
                syserr("buildaddr: no user");
                return (NULL);
        {
                syserr("buildaddr: no user");
                return (NULL);
@@ -1839,7 +1842,7 @@ remotename(name, m, senderaddress, header, canonical, e)
        */
 
        if (canonical || bitnset(M_NOCOMMENT, m->m_flags))
        */
 
        if (canonical || bitnset(M_NOCOMMENT, m->m_flags))
-               fancy = "\001g";
+               fancy = "\201g";
        else
                fancy = crackaddr(name);
 
        else
                fancy = crackaddr(name);
 
@@ -2010,7 +2013,7 @@ maplocaluser(a, sendq, e)
                return;
 
        rewrite(pvp, 5);
                return;
 
        rewrite(pvp, 5);
-       if (pvp[0] == NULL || pvp[0][0] != CANONNET)
+       if (pvp[0] == NULL || (pvp[0][0] & 0377) != CANONNET)
                return;
 
        /* if non-null, mailer destination specified -- has it changed? */
                return;
 
        /* if non-null, mailer destination specified -- has it changed? */
index 653a98d..77ae272 100644 (file)
@@ -10,9 +10,9 @@
 
 #ifndef lint
 #ifdef QUEUE
 
 #ifndef lint
 #ifdef QUEUE
-static char sccsid[] = "@(#)queue.c    6.11 (Berkeley) %G% (with queueing)";
+static char sccsid[] = "@(#)queue.c    6.12 (Berkeley) %G% (with queueing)";
 #else
 #else
-static char sccsid[] = "@(#)queue.c    6.11 (Berkeley) %G% (without queueing)";
+static char sccsid[] = "@(#)queue.c    6.12 (Berkeley) %G% (without queueing)";
 #endif
 #endif /* not lint */
 
 #endif
 #endif /* not lint */
 
@@ -263,7 +263,7 @@ queueup(e, queueall, announce)
                        nullmailer.m_se_rwset = nullmailer.m_sh_rwset = -1;
        nullmailer.m_eol = "\n";
 
                        nullmailer.m_se_rwset = nullmailer.m_sh_rwset = -1;
        nullmailer.m_eol = "\n";
 
-       define('g', "\001f", e);
+       define('g', "\201f", e);
        for (h = e->e_header; h != NULL; h = h->h_link)
        {
                extern bool bitzerop();
        for (h = e->e_header; h != NULL; h = h->h_link)
        {
                extern bool bitzerop();
index c1b55c3..cb1304e 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)readcf.c   6.7 (Berkeley) %G%";
+static char sccsid[] = "@(#)readcf.c   6.8 (Berkeley) %G%";
 #endif /* not lint */
 
 # include "sendmail.h"
 #endif /* not lint */
 
 # include "sendmail.h"
@@ -139,7 +139,7 @@ readcf(cfname)
                        continue;
                }
 
                        continue;
                }
 
-               /* map $ into \001 (ASCII SOH) for macro expansion */
+               /* map $ into \201 for macro expansion */
                for (p = bp; *p != '\0'; p++)
                {
                        if (*p == '#' && p > bp && ConfigLevel >= 3)
                for (p = bp; *p != '\0'; p++)
                {
                        if (*p == '#' && p > bp && ConfigLevel >= 3)
@@ -147,9 +147,9 @@ readcf(cfname)
                                /* this is an on-line comment */
                                register char *e;
 
                                /* this is an on-line comment */
                                register char *e;
 
-                               switch (*--p)
+                               switch (*--p & 0377)
                                {
                                {
-                                 case '\001':
+                                 case MACROEXPAND:
                                        /* it's from $# -- let it go through */
                                        p++;
                                        break;
                                        /* it's from $# -- let it go through */
                                        p++;
                                        break;
@@ -161,7 +161,7 @@ readcf(cfname)
 
                                  default:
                                        /* delete preceeding white space */
 
                                  default:
                                        /* delete preceeding white space */
-                                       while (isspace(*p) && p > bp)
+                                       while (isascii(*p) && isspace(*p) && p > bp)
                                                p--;
                                        if ((e = strchr(++p, '\n')) != NULL)
                                                (void) strcpy(p, e);
                                                p--;
                                        if ((e = strchr(++p, '\n')) != NULL)
                                                (void) strcpy(p, e);
@@ -183,7 +183,7 @@ readcf(cfname)
                        }
 
                        /* convert to macro expansion character */
                        }
 
                        /* convert to macro expansion character */
-                       *p = '\001';
+                       *p = MACROEXPAND;
                }
 
                /* interpret this line */
                }
 
                /* interpret this line */
@@ -230,7 +230,7 @@ readcf(cfname)
                                /* count the number of fuzzy matches in LHS */
                                for (ap = rwp->r_lhs; *ap != NULL; ap++)
                                {
                                /* count the number of fuzzy matches in LHS */
                                for (ap = rwp->r_lhs; *ap != NULL; ap++)
                                {
-                                       switch (**ap)
+                                       switch (**ap & 0377)
                                        {
                                          case MATCHZANY:
                                          case MATCHANY:
                                        {
                                          case MATCHZANY:
                                          case MATCHANY:
@@ -263,7 +263,7 @@ readcf(cfname)
                                nfuzzy += '0';
                                for (ap = rwp->r_rhs; *ap != NULL; ap++)
                                {
                                nfuzzy += '0';
                                for (ap = rwp->r_rhs; *ap != NULL; ap++)
                                {
-                                       if (**ap != MATCHREPL)
+                                       if ((**ap & 0377) != MATCHREPL)
                                                continue;
                                        if ((*ap)[1] <= '0' || (*ap)[1] > nfuzzy)
                                        {
                                                continue;
                                        if ((*ap)[1] <= '0' || (*ap)[1] > nfuzzy)
                                        {
@@ -300,14 +300,16 @@ readcf(cfname)
                        if (bp[0] == 'F')
                        {
                                /* read from file */
                        if (bp[0] == 'F')
                        {
                                /* read from file */
-                               for (p = &bp[2]; *p != '\0' && !isspace(*p); p++)
+                               for (p = &bp[2];
+                                    *p != '\0' && !(isascii(*p) && isspace(*p));
+                                    p++)
                                        continue;
                                if (*p == '\0')
                                        p = "%s";
                                else
                                {
                                        *p = '\0';
                                        continue;
                                if (*p == '\0')
                                        p = "%s";
                                else
                                {
                                        *p = '\0';
-                                       while (isspace(*++p))
+                                       while (isascii(*++p) && isspace(*p))
                                                continue;
                                }
                                fileclass(bp[1], &bp[2], p, safe);
                                                continue;
                                }
                                fileclass(bp[1], &bp[2], p, safe);
@@ -320,10 +322,10 @@ readcf(cfname)
                                register char *wd;
                                char delim;
 
                                register char *wd;
                                char delim;
 
-                               while (*p != '\0' && isspace(*p))
+                               while (*p != '\0' && isascii(*p) && isspace(*p))
                                        p++;
                                wd = p;
                                        p++;
                                wd = p;
-                               while (*p != '\0' && !isspace(*p))
+                               while (*p != '\0' && !(isascii(*p) && isspace(*p)))
                                        p++;
                                delim = *p;
                                *p = '\0';
                                        p++;
                                delim = *p;
                                *p = '\0';
@@ -361,10 +363,10 @@ readcf(cfname)
                        p = &bp[1];
                        while (*p != '\0')
                        {
                        p = &bp[1];
                        while (*p != '\0')
                        {
-                               while (isspace(*p))
+                               while (isascii(*p) && isspace(*p))
                                        p++;
                                q = p;
                                        p++;
                                q = p;
-                               while (*p != '\0' && !isspace(*p))
+                               while (*p != '\0' && !(isascii(*p) && isspace(*p)))
                                        p++;
                                if (*p != '\0')
                                        *p++ = '\0';
                                        p++;
                                if (*p != '\0')
                                        *p++ = '\0';
@@ -505,14 +507,14 @@ fileclass(class, filename, fmt, safe)
                        register char *q;
 
                        /* strip leading spaces */
                        register char *q;
 
                        /* strip leading spaces */
-                       while (isspace(*p))
+                       while (isascii(*p) && isspace(*p))
                                p++;
                        if (*p == '\0')
                                break;
 
                        /* find the end of the word */
                        q = p;
                                p++;
                        if (*p == '\0')
                                break;
 
                        /* find the end of the word */
                        q = p;
-                       while (*p != '\0' && !isspace(*p))
+                       while (*p != '\0' && !(isascii(*p) && isspace(*p)))
                                p++;
                        if (*p != '\0')
                                *p++ = '\0';
                                p++;
                        if (*p != '\0')
                                *p++ = '\0';
@@ -567,7 +569,7 @@ makemailer(line)
        m->m_eol = "\n";
 
        /* collect the mailer name */
        m->m_eol = "\n";
 
        /* collect the mailer name */
-       for (p = line; *p != '\0' && *p != ',' && !isspace(*p); p++)
+       for (p = line; *p != '\0' && *p != ',' && !(isascii(*p) && isspace(*p)); p++)
                continue;
        if (*p != '\0')
                *p++ = '\0';
                continue;
        if (*p != '\0')
                *p++ = '\0';
@@ -576,7 +578,7 @@ makemailer(line)
        /* now scan through and assign info from the fields */
        while (*p != '\0')
        {
        /* now scan through and assign info from the fields */
        while (*p != '\0')
        {
-               while (*p != '\0' && (*p == ',' || isspace(*p)))
+               while (*p != '\0' && (*p == ',' || (isascii(*p) && isspace(*p))))
                        p++;
 
                /* p now points to field code */
                        p++;
 
                /* p now points to field code */
@@ -588,7 +590,7 @@ makemailer(line)
                        syserr("mailer %s: `=' expected", m->m_name);
                        return;
                }
                        syserr("mailer %s: `=' expected", m->m_name);
                        return;
                }
-               while (isspace(*p))
+               while (isascii(*p) && isspace(*p))
                        p++;
 
                /* p now points to the field body */
                        p++;
 
                /* p now points to the field body */
@@ -603,7 +605,7 @@ makemailer(line)
 
                  case 'F':             /* flags */
                        for (; *p != '\0'; p++)
 
                  case 'F':             /* flags */
                        for (; *p != '\0'; p++)
-                               if (!isspace(*p))
+                               if (!(isascii(*p) && isspace(*p)))
                                        setbitn(*p, m->m_flags);
                        break;
 
                                        setbitn(*p, m->m_flags);
                        break;
 
@@ -779,9 +781,9 @@ makeargv(p)
        while (*p != '\0' && i < MAXPV)
        {
                q = p;
        while (*p != '\0' && i < MAXPV)
        {
                q = p;
-               while (*p != '\0' && !isspace(*p))
+               while (*p != '\0' && !(isascii(*p) && isspace(*p)))
                        p++;
                        p++;
-               while (isspace(*p))
+               while (isascii(*p) && isspace(*p))
                        *p++ = '\0';
                argv[i++] = newstr(q);
        }
                        *p++ = '\0';
                argv[i++] = newstr(q);
        }
@@ -1028,7 +1030,7 @@ setoption(opt, val, sticky)
                                p--;
                        p++;
                        q = p;
                                p--;
                        p++;
                        q = p;
-                       while (*p != '\0' && !isspace(*p))
+                       while (*p != '\0' && !(isascii(*p) && isspace(*p)))
                                p++;
                        if (*p != '\0')
                                *p++ = '\0';
                                p++;
                        if (*p != '\0')
                                *p++ = '\0';
@@ -1222,32 +1224,32 @@ makemapentry(line)
        register STAB *map;
        STAB *class;
 
        register STAB *map;
        STAB *class;
 
-       for (p = line; isspace(*p); p++)
+       for (p = line; isascii(*p) && isspace(*p); p++)
                continue;
                continue;
-       if (!isalnum(*p))
+       if (!(isascii(*p) && isalnum(*p)))
        {
                syserr("readcf: config K line: no map name");
                return;
        }
 
        mapname = p;
        {
                syserr("readcf: config K line: no map name");
                return;
        }
 
        mapname = p;
-       while (isalnum(*++p))
+       while (isascii(*++p) && isalnum(*p))
                continue;
        if (*p != '\0')
                *p++ = '\0';
                continue;
        if (*p != '\0')
                *p++ = '\0';
-       while (isspace(*p))
+       while (isascii(*p) && isspace(*p))
                p++;
                p++;
-       if (!isalnum(*p))
+       if (!(isascii(*p) && isalnum(*p)))
        {
                syserr("readcf: config K line, map %s: no map class", mapname);
                return;
        }
        classname = p;
        {
                syserr("readcf: config K line, map %s: no map class", mapname);
                return;
        }
        classname = p;
-       while (isalnum(*++p))
+       while (isascii(*++p) && isalnum(*p))
                continue;
        if (*p != '\0')
                *p++ = '\0';
                continue;
        if (*p != '\0')
                *p++ = '\0';
-       while (isspace(*p))
+       while (isascii(*p) && isspace(*p))
                p++;
 
        /* look up the class */
                p++;
 
        /* look up the class */
index 1126c48..c034b9a 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)recipient.c        6.9 (Berkeley) %G%";
+static char sccsid[] = "@(#)recipient.c        6.10 (Berkeley) %G%";
 #endif /* not lint */
 
 # include <sys/types.h>
 #endif /* not lint */
 
 # include <sys/types.h>
@@ -88,7 +88,7 @@ sendto(list, copyf, ctladdr, qflags)
                extern char *DelimChar;         /* defined in prescan */
 
                /* parse the address */
                extern char *DelimChar;         /* defined in prescan */
 
                /* parse the address */
-               while (isspace(*p) || *p == ',')
+               while ((isascii(*p) && isspace(*p)) || *p == ',')
                        p++;
                a = parseaddr(p, (ADDRESS *) NULL, 1, delimiter, e);
                p = DelimChar;
                        p++;
                a = parseaddr(p, (ADDRESS *) NULL, 1, delimiter, e);
                p = DelimChar;
index 1b6dadb..9caafea 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)savemail.c 6.5 (Berkeley) %G%";
+static char sccsid[] = "@(#)savemail.c 6.6 (Berkeley) %G%";
 #endif /* not lint */
 
 # include <sys/types.h>
 #endif /* not lint */
 
 # include <sys/types.h>
@@ -157,7 +157,7 @@ savemail(e)
                                break;
                        }
 
                                break;
                        }
 
-                       expand("\001n", buf, &buf[sizeof buf - 1], e);
+                       expand("\201n", buf, &buf[sizeof buf - 1], e);
                        printf("\r\nMessage from %s...\r\n", buf);
                        printf("Errors occurred while sending mail.\r\n");
                        if (e->e_xfp != NULL)
                        printf("\r\nMessage from %s...\r\n", buf);
                        printf("Errors occurred while sending mail.\r\n");
                        if (e->e_xfp != NULL)
@@ -263,7 +263,7 @@ savemail(e)
 
                                /* we have a home directory; open dead.letter */
                                define('z', p, e);
 
                                /* we have a home directory; open dead.letter */
                                define('z', p, e);
-                               expand("\001z/dead.letter", buf, &buf[sizeof buf - 1], e);
+                               expand("\201z/dead.letter", buf, &buf[sizeof buf - 1], e);
                                Verbose = TRUE;
                                message(Arpa_Info, "Saving message in %s", buf);
                                Verbose = oldverb;
                                Verbose = TRUE;
                                message(Arpa_Info, "Saving message in %s", buf);
                                Verbose = oldverb;
@@ -377,10 +377,10 @@ returntosender(msg, returnq, sendbody, e)
        }
 
        SendBody = sendbody;
        }
 
        SendBody = sendbody;
-       define('g', "\001f", e);
-       define('<', "\001f", e);
+       define('g', "\201f", e);
+       define('<', "\201f", e);
        ee = newenvelope(&errenvelope);
        ee = newenvelope(&errenvelope);
-       define('a', "\001b", ee);
+       define('a', "\201b", ee);
        ee->e_puthdr = putheader;
        ee->e_putbody = errbody;
        ee->e_flags |= EF_RESPONSE;
        ee->e_puthdr = putheader;
        ee->e_putbody = errbody;
        ee->e_flags |= EF_RESPONSE;
@@ -404,7 +404,7 @@ returntosender(msg, returnq, sendbody, e)
        addheader("subject", buf, ee);
 
        /* fake up an address header for the from person */
        addheader("subject", buf, ee);
 
        /* fake up an address header for the from person */
-       expand("\001n", buf, &buf[sizeof buf - 1], e);
+       expand("\201n", buf, &buf[sizeof buf - 1], e);
        ee->e_sender = ee->e_returnpath = newstr(buf);
        if (parseaddr(buf, &ee->e_from, -1, '\0', e) == NULL)
        {
        ee->e_sender = ee->e_returnpath = newstr(buf);
        if (parseaddr(buf, &ee->e_from, -1, '\0', e) == NULL)
        {
@@ -417,7 +417,7 @@ returntosender(msg, returnq, sendbody, e)
 
        /* push state into submessage */
        CurEnv = ee;
 
        /* push state into submessage */
        CurEnv = ee;
-       define('f', "\001n", ee);
+       define('f', "\201n", ee);
        define('x', "Mail Delivery Subsystem", ee);
        eatheader(ee, FALSE);
 
        define('x', "Mail Delivery Subsystem", ee);
        eatheader(ee, FALSE);
 
index 8df97a9..5813f09 100644 (file)
@@ -5,7 +5,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)sendmail.h  6.11 (Berkeley) %G%
+ *     @(#)sendmail.h  6.12 (Berkeley) %G%
  */
 
 /*
  */
 
 /*
@@ -15,7 +15,7 @@
 # ifdef _DEFINE
 # define EXTERN
 # ifndef lint
 # ifdef _DEFINE
 # define EXTERN
 # ifndef lint
-static char SmailSccsId[] =    "@(#)sendmail.h 6.11            %G%";
+static char SmailSccsId[] =    "@(#)sendmail.h 6.12            %G%";
 # endif lint
 # else /*  _DEFINE */
 # define EXTERN extern
 # endif lint
 # else /*  _DEFINE */
 # define EXTERN extern
@@ -339,35 +339,36 @@ EXTERN struct rewrite     *RewriteRules[MAXRWSETS];
 */
 
 /* left hand side items */
 */
 
 /* left hand side items */
-# define MATCHZANY     '\020'  /* match zero or more tokens */
-# define MATCHANY      '\021'  /* match one or more tokens */
-# define MATCHONE      '\022'  /* match exactly one token */
-# define MATCHCLASS    '\023'  /* match one token in a class */
-# define MATCHNCLASS   '\024'  /* match anything not in class */
-# define MATCHREPL     '\025'  /* replacement on RHS for above */
+# define MATCHZANY     0220    /* match zero or more tokens */
+# define MATCHANY      0221    /* match one or more tokens */
+# define MATCHONE      0222    /* match exactly one token */
+# define MATCHCLASS    0223    /* match one token in a class */
+# define MATCHNCLASS   0224    /* match anything not in class */
+# define MATCHREPL     0225    /* replacement on RHS for above */
 # define MATCHLOOKUP   '\035'  /* look up and replace a sequence */
 # define MATCHELOOKUP  '\036'  /* end of the sequence */
 
 /* right hand side items */
 # define MATCHLOOKUP   '\035'  /* look up and replace a sequence */
 # define MATCHELOOKUP  '\036'  /* end of the sequence */
 
 /* right hand side items */
-# define CANONNET      '\026'  /* canonical net, next token */
-# define CANONHOST     '\027'  /* canonical host, next token */
-# define CANONUSER     '\030'  /* canonical user, next N tokens */
-# define CALLSUBR      '\031'  /* call another rewriting set */
+# define CANONNET      0226    /* canonical net, next token */
+# define CANONHOST     0227    /* canonical host, next token */
+# define CANONUSER     0230    /* canonical user, next N tokens */
+# define CALLSUBR      0231    /* call another rewriting set */
 
 /* conditionals in macros */
 
 /* conditionals in macros */
-# define CONDIF                '\032'  /* conditional if-then */
-# define CONDELSE      '\033'  /* conditional else */
-# define CONDFI                '\034'  /* conditional fi */
+# define CONDIF                0232    /* conditional if-then */
+# define CONDELSE      0233    /* conditional else */
+# define CONDFI                0234    /* conditional fi */
 
 /* bracket characters for host name lookup */
 
 /* bracket characters for host name lookup */
-# define HOSTBEGIN     '\035'  /* hostname lookup begin */
-# define HOSTEND       '\036'  /* hostname lookup end */
+# define HOSTBEGIN     0235    /* hostname lookup begin */
+# define HOSTEND       0236    /* hostname lookup end */
 
 /* bracket characters for generalized lookup */
 
 /* bracket characters for generalized lookup */
-# define LOOKUPBEGIN   '\005'  /* generalized lookup begin */
-# define LOOKUPEND     '\006'  /* generalized lookup end */
+# define LOOKUPBEGIN   0205    /* generalized lookup begin */
+# define LOOKUPEND     0206    /* generalized lookup end */
 
 
-/* \001 is also reserved as the macro expansion character */
+/* macro substitution character */
+# define MACROEXPAND   0201    /* macro expansion */
 
 /* external <==> internal mapping table */
 struct metamac
 
 /* external <==> internal mapping table */
 struct metamac
index 2f0b9fd..31192f8 100644 (file)
@@ -10,9 +10,9 @@
 
 #ifndef lint
 #ifdef SMTP
 
 #ifndef lint
 #ifdef SMTP
-static char sccsid[] = "@(#)srvrsmtp.c 6.7 (Berkeley) %G% (with SMTP)";
+static char sccsid[] = "@(#)srvrsmtp.c 6.8 (Berkeley) %G% (with SMTP)";
 #else
 #else
-static char sccsid[] = "@(#)srvrsmtp.c 6.7 (Berkeley) %G% (without SMTP)";
+static char sccsid[] = "@(#)srvrsmtp.c 6.8 (Berkeley) %G% (without SMTP)";
 #endif
 #endif /* not lint */
 
 #endif
 #endif /* not lint */
 
@@ -112,7 +112,7 @@ smtp(e)
                RealHostName = MyHostName;
        CurHostName = RealHostName;
        setproctitle("srvrsmtp %s", CurHostName);
                RealHostName = MyHostName;
        CurHostName = RealHostName;
        setproctitle("srvrsmtp %s", CurHostName);
-       expand("\001e", inp, &inp[sizeof inp], e);
+       expand("\201e", inp, &inp[sizeof inp], e);
        message("220", "%s", inp);
        SmtpPhase = "startup";
        sendinghost = NULL;
        message("220", "%s", inp);
        SmtpPhase = "startup";
        sendinghost = NULL;
@@ -155,15 +155,17 @@ smtp(e)
                        fprintf(e->e_xfp, "<<< %s\n", inp);
 
                /* break off command */
                        fprintf(e->e_xfp, "<<< %s\n", inp);
 
                /* break off command */
-               for (p = inp; isspace(*p); p++)
+               for (p = inp; isascii(*p) && isspace(*p); p++)
                        continue;
                cmd = cmdbuf;
                        continue;
                cmd = cmdbuf;
-               while (*p != '\0' && !isspace(*p) && cmd < &cmdbuf[sizeof cmdbuf - 2])
+               while (*p != '\0' &&
+                      !(isascii(*p) && isspace(*p)) &&
+                      cmd < &cmdbuf[sizeof cmdbuf - 2])
                        *cmd++ = *p++;
                *cmd = '\0';
 
                /* throw away leading whitespace */
                        *cmd++ = *p++;
                *cmd = '\0';
 
                /* throw away leading whitespace */
-               while (isspace(*p))
+               while (isascii(*p) && isspace(*p))
                        p++;
 
                /* decode command */
                        p++;
 
                /* decode command */
@@ -455,14 +457,14 @@ skipword(p, w)
        register char *q;
 
        /* find beginning of word */
        register char *q;
 
        /* find beginning of word */
-       while (isspace(*p))
+       while (isascii(*p) && isspace(*p))
                p++;
        q = p;
 
        /* find end of word */
                p++;
        q = p;
 
        /* find end of word */
-       while (*p != '\0' && *p != ':' && !isspace(*p))
+       while (*p != '\0' && *p != ':' && !(isascii(*p) && isspace(*p)))
                p++;
                p++;
-       while (isspace(*p))
+       while (isascii(*p) && isspace(*p))
                *p++ = '\0';
        if (*p != ':')
        {
                *p++ = '\0';
        if (*p != ':')
        {
@@ -472,7 +474,7 @@ skipword(p, w)
                return (NULL);
        }
        *p++ = '\0';
                return (NULL);
        }
        *p++ = '\0';
-       while (isspace(*p))
+       while (isascii(*p) && isspace(*p))
                p++;
 
        /* see if the input word matches desired word */
                p++;
 
        /* see if the input word matches desired word */
index 28e6360..00d8aa4 100644 (file)
@@ -8,9 +8,9 @@
 
 #ifndef lint
 #ifdef USERDB
 
 #ifndef lint
 #ifdef USERDB
-static char sccsid [] = "@(#)udb.c     6.6 (Berkeley) %G% (with USERDB)";
+static char sccsid [] = "@(#)udb.c     6.7 (Berkeley) %G% (with USERDB)";
 #else
 #else
-static char sccsid [] = "@(#)udb.c     6.6 (Berkeley) %G% (without USERDB)";
+static char sccsid [] = "@(#)udb.c     6.7 (Berkeley) %G% (without USERDB)";
 #endif
 #endif
 
 #endif
 #endif
 
@@ -606,7 +606,7 @@ _udb_parsespec(udbspec, opt, maxopts)
        {
                register char *p;
 
        {
                register char *p;
 
-               while (isspace(*spec))
+               while (isascii(*spec) && isspace(*spec))
                        spec++;
                spec_end = strchr(spec, ':');
                if (spec_end != NULL)
                        spec++;
                spec_end = strchr(spec, ':');
                if (spec_end != NULL)
index e857ac0..d6555f0 100644 (file)
@@ -10,9 +10,9 @@
 
 #ifndef lint
 #ifdef SMTP
 
 #ifndef lint
 #ifdef SMTP
-static char sccsid[] = "@(#)usersmtp.c 6.9 (Berkeley) %G% (with SMTP)";
+static char sccsid[] = "@(#)usersmtp.c 6.10 (Berkeley) %G% (with SMTP)";
 #else
 #else
-static char sccsid[] = "@(#)usersmtp.c 6.9 (Berkeley) %G% (without SMTP)";
+static char sccsid[] = "@(#)usersmtp.c 6.10 (Berkeley) %G% (without SMTP)";
 #endif
 #endif /* not lint */
 
 #endif
 #endif /* not lint */
 
@@ -187,7 +187,7 @@ smtpmailfrom(m, mci, e)
 
        mci->mci_state = MCIS_ACTIVE;
 
 
        mci->mci_state = MCIS_ACTIVE;
 
-       expand("\001<", buf, &buf[sizeof buf - 1], e);
+       expand("\201<", buf, &buf[sizeof buf - 1], e);
        if (e->e_from.q_mailer == LocalMailer ||
            !bitnset(M_FROMPATH, m->m_flags))
        {
        if (e->e_from.q_mailer == LocalMailer ||
            !bitnset(M_FROMPATH, m->m_flags))
        {
@@ -545,7 +545,8 @@ reply(m, mci, e, timeout)
                        nmessage(Arpa_Info, "%s", SmtpReplyBuffer);
 
                /* if continuation is required, we can go on */
                        nmessage(Arpa_Info, "%s", SmtpReplyBuffer);
 
                /* if continuation is required, we can go on */
-               if (SmtpReplyBuffer[3] == '-' || !isdigit(SmtpReplyBuffer[0]))
+               if (SmtpReplyBuffer[3] == '-' ||
+                   !(isascii(SmtpReplyBuffer[0]) && isdigit(SmtpReplyBuffer[0])))
                        continue;
 
                /* decode the reply code */
                        continue;
 
                /* decode the reply code */
index fc27a8e..0f96505 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)util.c     6.5 (Berkeley) %G%";
+static char sccsid[] = "@(#)util.c     6.6 (Berkeley) %G%";
 #endif /* not lint */
 
 # include <stdio.h>
 #endif /* not lint */
 
 # include <stdio.h>
@@ -82,13 +82,13 @@ capitalize(s)
 
        for (;;)
        {
 
        for (;;)
        {
-               while (!isalpha(*s) && *s != '\0')
+               while (!(isascii(*s) && isalpha(*s)) && *s != '\0')
                        *p++ = *s++;
                if (*s == '\0')
                        break;
                *p++ = toupper(*s);
                s++;
                        *p++ = *s++;
                if (*s == '\0')
                        break;
                *p++ = toupper(*s);
                s++;
-               while (isalpha(*s))
+               while (isascii(*s) && isalpha(*s))
                        *p++ = *s++;
        }
 
                        *p++ = *s++;
        }
 
@@ -212,7 +212,7 @@ char
 lower(c)
        register char c;
 {
 lower(c)
        register char c;
 {
-       return(isascii(c) && isupper(c) ? tolower(c) : c);
+       return((isascii(c) && isupper(c)) ? tolower(c) : c);
 }
 \f/*
 **  XPUTS -- put string doing control escapes.
 }
 \f/*
 **  XPUTS -- put string doing control escapes.
@@ -230,7 +230,7 @@ lower(c)
 xputs(s)
        register char *s;
 {
 xputs(s)
        register char *s;
 {
-       register char c;
+       register int c;
        register struct metamac *mp;
        extern struct metamac MetaMacros[];
 
        register struct metamac *mp;
        extern struct metamac MetaMacros[];
 
@@ -239,10 +239,25 @@ xputs(s)
                printf("<null>");
                return;
        }
                printf("<null>");
                return;
        }
-       while ((c = *s++) != '\0')
+       while ((c = (*s++ & 0377)) != '\0')
        {
                if (!isascii(c))
                {
        {
                if (!isascii(c))
                {
+                       if (c == MATCHREPL || c == MACROEXPAND)
+                       {
+                               putchar('$');
+                               continue;
+                       }
+                       for (mp = MetaMacros; mp->metaname != '\0'; mp++)
+                       {
+                               if ((mp->metaval & 0377) == c)
+                               {
+                                       printf("$%c", mp->metaname);
+                                       break;
+                               }
+                       }
+                       if (mp->metaname != '\0')
+                               continue;
                        (void) putchar('\\');
                        c &= 0177;
                }
                        (void) putchar('\\');
                        c &= 0177;
                }
@@ -251,20 +266,6 @@ xputs(s)
                        putchar(c);
                        continue;
                }
                        putchar(c);
                        continue;
                }
-               if (c == MATCHREPL || c == '\001')
-               {
-                       putchar('$');
-                       continue;
-               }
-               for (mp = MetaMacros; mp->metaname != '\0'; mp++)
-               {
-                       if (mp->metaval == c)
-                       {
-                               printf("$%c", mp->metaname);
-                               c = '\0';
-                               break;
-                       }
-               }
 
                /* wasn't a meta-macro -- find another way to print it */
                switch (c)
 
                /* wasn't a meta-macro -- find another way to print it */
                switch (c)