From 72f91c2e6c009e93e5283b387c01ab12d72751fc Mon Sep 17 00:00:00 2001 From: Eric Allman Date: Sat, 22 Feb 1992 04:57:54 -0800 Subject: [PATCH] from Bryan Costales: several smallish changes, mostly to clean 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 | 18 +++++++++++++++--- usr/src/usr.sbin/sendmail/src/parseaddr.c | 13 ++++++++++--- usr/src/usr.sbin/sendmail/src/readcf.c | 16 +++++++++++++--- usr/src/usr.sbin/sendmail/src/util.c | 6 +++++- usr/src/usr.sbin/sendmail/src/version.c | 4 ++-- 5 files changed, 45 insertions(+), 12 deletions(-) diff --git a/usr/src/usr.sbin/sendmail/src/main.c b/usr/src/usr.sbin/sendmail/src/main.c index abc1fe15df..c521f367e9 100644 --- a/usr/src/usr.sbin/sendmail/src/main.c +++ b/usr/src/usr.sbin/sendmail/src/main.c @@ -13,7 +13,7 @@ char copyright[] = #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 @@ -590,6 +590,18 @@ main(argc, argv, envp) (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"); } } @@ -609,7 +621,8 @@ main(argc, argv, envp) { char buf[MAXLINE]; - printf("ADDRESS TEST MODE\nEnter
\n"); + printf("ADDRESS TEST MODE (ruleset 3 NOT automatically invoked)\n"); + printf("Enter
\n"); for (;;) { register char **pvp; @@ -636,7 +649,6 @@ main(argc, argv, envp) pvp = prescan(++p, ',', pvpbuf); if (pvp == NULL) continue; - rewrite(pvp, 3); p = q; while (*p != '\0') { diff --git a/usr/src/usr.sbin/sendmail/src/parseaddr.c b/usr/src/usr.sbin/sendmail/src/parseaddr.c index 9a5125db3d..94c3955dae 100644 --- a/usr/src/usr.sbin/sendmail/src/parseaddr.c +++ b/usr/src/usr.sbin/sendmail/src/parseaddr.c @@ -7,7 +7,7 @@ */ #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" @@ -551,6 +551,8 @@ rewrite(pvp, ruleset) for (rwr = RewriteRules[ruleset]; rwr != NULL; ) { + int loopcount = 0; + if (tTd(21, 12)) { printf("-----trying rule:"); @@ -563,12 +565,17 @@ rewrite(pvp, ruleset) 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)) { - printf("ap="); + printf("operator="); xputs(ap); - printf(", rp="); + printf(", token="); xputs(rp); printf("\n"); } diff --git a/usr/src/usr.sbin/sendmail/src/readcf.c b/usr/src/usr.sbin/sendmail/src/readcf.c index 8a066fa220..258e14d9af 100644 --- a/usr/src/usr.sbin/sendmail/src/readcf.c +++ b/usr/src/usr.sbin/sendmail/src/readcf.c @@ -7,7 +7,7 @@ */ #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" @@ -77,6 +77,9 @@ readcf(cfname) 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++) { @@ -254,6 +257,12 @@ readcf(cfname) syserr("unknown control line \"%s\"", buf); } } + if (ferror(cf)) + { + syserr("Error reading %s", cfname); + exit(EX_OSFILE); + } + fclose(cf); FileName = NULL; } /* @@ -417,7 +426,7 @@ makemailer(line) p++; if (*p++ != '=') { - syserr("`=' expected"); + syserr("mailer %s: `=' expected", m->m_name); return; } while (isspace(*p)) @@ -435,7 +444,8 @@ makemailer(line) 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 */ diff --git a/usr/src/usr.sbin/sendmail/src/util.c b/usr/src/usr.sbin/sendmail/src/util.c index 3f046f3af1..3b7f24b26b 100644 --- a/usr/src/usr.sbin/sendmail/src/util.c +++ b/usr/src/usr.sbin/sendmail/src/util.c @@ -7,7 +7,7 @@ */ #ifndef lint -static char sccsid[] = "@(#)util.c 5.23 (Berkeley) %G%"; +static char sccsid[] = "@(#)util.c 5.24 (Berkeley) %G%"; #endif /* not lint */ # include @@ -305,6 +305,10 @@ xputs(s) c = 't'; break; + case '\001': + (void) putchar('$'); + continue; + default: (void) putchar('^'); (void) putchar(c ^ 0100); diff --git a/usr/src/usr.sbin/sendmail/src/version.c b/usr/src/usr.sbin/sendmail/src/version.c index 0f398d42ba..745babd526 100644 --- a/usr/src/usr.sbin/sendmail/src/version.c +++ b/usr/src/usr.sbin/sendmail/src/version.c @@ -7,7 +7,7 @@ */ #ifndef lint -static char sccsid[] = "@(#)version.c 5.91 (Berkeley) %G%"; +static char sccsid[] = "@(#)version.c 5.92 (Berkeley) %G%"; #endif /* not lint */ -char Version[] = "5.91"; +char Version[] = "5.92"; -- 2.20.1