From 5081946172f35ef986bc6b2d2d6b0b8301ade8bc Mon Sep 17 00:00:00 2001 From: Dmitrij Tejblum Date: Tue, 29 Sep 1998 20:01:21 +0000 Subject: [PATCH] Rename a static variable, so it will not shadowed by a local variable. Now comments will be ignored, rather than put junk in the password database. Broken in: rev. 1.21 --- usr.sbin/pwd_mkdb/pwd_mkdb.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/usr.sbin/pwd_mkdb/pwd_mkdb.c b/usr.sbin/pwd_mkdb/pwd_mkdb.c index 93404646838f..3b73d8a4fdf2 100644 --- a/usr.sbin/pwd_mkdb/pwd_mkdb.c +++ b/usr.sbin/pwd_mkdb/pwd_mkdb.c @@ -42,7 +42,7 @@ static const char copyright[] = static char sccsid[] = "@(#)pwd_mkdb.c 8.5 (Berkeley) 4/20/94"; #endif static const char rcsid[] = - "$Id: pwd_mkdb.c,v 1.25 1998/04/19 07:15:34 phk Exp $"; + "$Id: pwd_mkdb.c,v 1.26 1998/06/09 20:19:59 ache Exp $"; #endif /* not lint */ #include @@ -81,7 +81,7 @@ static struct passwd pwd; /* password structure */ static char *pname; /* password file name */ static char prefix[MAXPATHLEN]; -static int Cflag; /* flag for comments */ +static int is_comment; /* flag for comments */ static char line[LINE_MAX]; void cleanup __P((void)); @@ -283,11 +283,11 @@ main(argc, argv) sdata.data = (u_char *)sbuf; key.data = (u_char *)tbuf; for (cnt = 1; scan(fp, &pwd); ++cnt) { - if (!Cflag && + if (!is_comment && (pwd.pw_name[0] == '+' || pwd.pw_name[0] == '-')) yp_enabled = 1; #define COMPACT(e) t = e; while ((*p++ = *t++)); - if (!Cflag && + if (!is_comment && (!username || (strcmp(username, pwd.pw_name) == 0))) { /* Create insecure data. */ p = buf; @@ -386,7 +386,7 @@ main(argc, argv) } } /* Create original format password file entry */ - if (Cflag && makeold){ /* copy comments */ + if (is_comment && makeold){ /* copy comments */ if (fprintf(oldfp, "%s\n", line) < 0) error("write old"); } else if (makeold) { @@ -484,10 +484,10 @@ scan(fp, pw) if (*p != ' ' && *p != '\t') break; if (*p == '#' || *p == '\0') { - Cflag = 1; + is_comment = 1; return(1); } else - Cflag = 0; + is_comment = 0; #endif if (!pw_scan(line, pw)) {