from Bryan Costales: several smallish changes, mostly to clean
authorEric Allman <eric@ucbvax.Berkeley.EDU>
Sat, 22 Feb 1992 12:57:54 +0000 (04:57 -0800)
committerEric Allman <eric@ucbvax.Berkeley.EDU>
Sat, 22 Feb 1992 12:57:54 +0000 (04:57 -0800)
up debugging output.  The major change is that test mode (-bt)
doesn't automatically run through ruleset three any more.

SCCS-vsn: usr.sbin/sendmail/src/main.c 5.45
SCCS-vsn: usr.sbin/sendmail/src/parseaddr.c 5.17
SCCS-vsn: usr.sbin/sendmail/src/version.c 5.92
SCCS-vsn: usr.sbin/sendmail/src/util.c 5.24
SCCS-vsn: usr.sbin/sendmail/src/readcf.c 5.32

usr/src/usr.sbin/sendmail/src/main.c
usr/src/usr.sbin/sendmail/src/parseaddr.c
usr/src/usr.sbin/sendmail/src/readcf.c
usr/src/usr.sbin/sendmail/src/util.c
usr/src/usr.sbin/sendmail/src/version.c

index abc1fe1..c521f36 100644 (file)
@@ -13,7 +13,7 @@ char copyright[] =
 #endif /* not lint */
 
 #ifndef lint
 #endif /* not lint */
 
 #ifndef lint
-static char sccsid[] = "@(#)main.c     5.44 (Berkeley) %G%";
+static char sccsid[] = "@(#)main.c     5.45 (Berkeley) %G%";
 #endif /* not lint */
 
 #define        _DEFINE
 #endif /* not lint */
 
 #define        _DEFINE
@@ -590,6 +590,18 @@ main(argc, argv, envp)
                                        (void) putchar(j);
                        printf(" E=");
                        xputs(m->m_eol);
                                        (void) putchar(j);
                        printf(" E=");
                        xputs(m->m_eol);
+                       if (m->m_argv != NULL)
+                       {
+                               char **a = m->m_argv;
+
+                               printf(" A=");
+                               while (*a != NULL)
+                               {
+                                       if (a != m->m_argv)
+                                               printf(" ");
+                                       xputs(*a++);
+                               }
+                       }
                        printf("\n");
                }
        }
                        printf("\n");
                }
        }
@@ -609,7 +621,8 @@ main(argc, argv, envp)
        {
                char buf[MAXLINE];
 
        {
                char buf[MAXLINE];
 
-               printf("ADDRESS TEST MODE\nEnter <ruleset> <address>\n");
+               printf("ADDRESS TEST MODE (ruleset 3 NOT automatically invoked)\n");
+               printf("Enter <ruleset> <address>\n");
                for (;;)
                {
                        register char **pvp;
                for (;;)
                {
                        register char **pvp;
@@ -636,7 +649,6 @@ main(argc, argv, envp)
                                pvp = prescan(++p, ',', pvpbuf);
                                if (pvp == NULL)
                                        continue;
                                pvp = prescan(++p, ',', pvpbuf);
                                if (pvp == NULL)
                                        continue;
-                               rewrite(pvp, 3);
                                p = q;
                                while (*p != '\0')
                                {
                                p = q;
                                while (*p != '\0')
                                {
index 9a5125d..94c3955 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)parseaddr.c        5.16 (Berkeley) %G%";
+static char sccsid[] = "@(#)parseaddr.c        5.17 (Berkeley) %G%";
 #endif /* not lint */
 
 # include "sendmail.h"
 #endif /* not lint */
 
 # include "sendmail.h"
@@ -551,6 +551,8 @@ rewrite(pvp, ruleset)
 
        for (rwr = RewriteRules[ruleset]; rwr != NULL; )
        {
 
        for (rwr = RewriteRules[ruleset]; rwr != NULL; )
        {
+               int loopcount = 0;
+
                if (tTd(21, 12))
                {
                        printf("-----trying rule:");
                if (tTd(21, 12))
                {
                        printf("-----trying rule:");
@@ -563,12 +565,17 @@ rewrite(pvp, ruleset)
                avp = pvp;
                while ((ap = *avp) != NULL || *rvp != NULL)
                {
                avp = pvp;
                while ((ap = *avp) != NULL || *rvp != NULL)
                {
+                       if (++loopcount > 100)
+                       {
+                               syserr("Infinite loop in ruleset %d", ruleset);
+                               break;
+                       }
                        rp = *rvp;
                        if (tTd(21, 35))
                        {
                        rp = *rvp;
                        if (tTd(21, 35))
                        {
-                               printf("ap=");
+                               printf("operator=");
                                xputs(ap);
                                xputs(ap);
-                               printf(", rp=");
+                               printf(", token=");
                                xputs(rp);
                                printf("\n");
                        }
                                xputs(rp);
                                printf("\n");
                        }
index 8a066fa..258e14d 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)readcf.c   5.31 (Berkeley) %G%";
+static char sccsid[] = "@(#)readcf.c   5.32 (Berkeley) %G%";
 #endif /* not lint */
 
 # include "sendmail.h"
 #endif /* not lint */
 
 # include "sendmail.h"
@@ -77,6 +77,9 @@ readcf(cfname)
        LineNumber = 0;
        while (fgetfolded(buf, sizeof buf, cf) != NULL)
        {
        LineNumber = 0;
        while (fgetfolded(buf, sizeof buf, cf) != NULL)
        {
+               if (buf[0] == '#')
+                       continue;
+
                /* map $ into \001 (ASCII SOH) for macro expansion */
                for (p = buf; *p != '\0'; p++)
                {
                /* map $ into \001 (ASCII SOH) for macro expansion */
                for (p = buf; *p != '\0'; p++)
                {
@@ -254,6 +257,12 @@ readcf(cfname)
                        syserr("unknown control line \"%s\"", buf);
                }
        }
                        syserr("unknown control line \"%s\"", buf);
                }
        }
+       if (ferror(cf))
+       {
+               syserr("Error reading %s", cfname);
+               exit(EX_OSFILE);
+       }
+       fclose(cf);
        FileName = NULL;
 }
 \f/*
        FileName = NULL;
 }
 \f/*
@@ -417,7 +426,7 @@ makemailer(line)
                        p++;
                if (*p++ != '=')
                {
                        p++;
                if (*p++ != '=')
                {
-                       syserr("`=' expected");
+                       syserr("mailer %s: `=' expected", m->m_name);
                        return;
                }
                while (isspace(*p))
                        return;
                }
                while (isspace(*p))
@@ -435,7 +444,8 @@ makemailer(line)
 
                  case 'F':             /* flags */
                        for (; *p != '\0'; p++)
 
                  case 'F':             /* flags */
                        for (; *p != '\0'; p++)
-                               setbitn(*p, m->m_flags);
+                               if (!isspace(*p))
+                                       setbitn(*p, m->m_flags);
                        break;
 
                  case 'S':             /* sender rewriting ruleset */
                        break;
 
                  case 'S':             /* sender rewriting ruleset */
index 3f046f3..3b7f24b 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)util.c     5.23 (Berkeley) %G%";
+static char sccsid[] = "@(#)util.c     5.24 (Berkeley) %G%";
 #endif /* not lint */
 
 # include <stdio.h>
 #endif /* not lint */
 
 # include <stdio.h>
@@ -305,6 +305,10 @@ xputs(s)
                                c = 't';
                                break;
 
                                c = 't';
                                break;
 
+                         case '\001':
+                               (void) putchar('$');
+                               continue;
+
                          default:
                                (void) putchar('^');
                                (void) putchar(c ^ 0100);
                          default:
                                (void) putchar('^');
                                (void) putchar(c ^ 0100);
index 0f398d4..745babd 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)version.c  5.91 (Berkeley) %G%";
+static char sccsid[] = "@(#)version.c  5.92 (Berkeley) %G%";
 #endif /* not lint */
 
 #endif /* not lint */
 
-char   Version[] = "5.91";
+char   Version[] = "5.92";