diff options
author | Sheldon Hearn <sheldonh@FreeBSD.org> | 1999-07-29 16:30:35 +0000 |
---|---|---|
committer | Sheldon Hearn <sheldonh@FreeBSD.org> | 1999-07-29 16:30:35 +0000 |
commit | 44b5cc40c0a4b5cd60c930467ef855be1c15d479 (patch) | |
tree | 597047158e2154f7b8933c1bebd5c925fd5b820e /chpass | |
parent | 75e207ee656a8a6dd36a966aa03a0b5fc38a79dd (diff) | |
download | pw-darwin-44b5cc40c0a4b5cd60c930467ef855be1c15d479.tar.gz pw-darwin-44b5cc40c0a4b5cd60c930467ef855be1c15d479.tar.zst pw-darwin-44b5cc40c0a4b5cd60c930467ef855be1c15d479.zip |
Allow comments and blank lines as advertised in passwd(5).
PR: 12828
Submitted by: Yasuhiro Fukuma <yasuf@big.or.jp>
Diffstat (limited to 'chpass')
-rw-r--r-- | chpass/Makefile | 2 | ||||
-rw-r--r-- | chpass/pw_copy.c | 11 |
2 files changed, 12 insertions, 1 deletions
diff --git a/chpass/Makefile b/chpass/Makefile index c17a4ce..37374d2 100644 --- a/chpass/Makefile +++ b/chpass/Makefile @@ -1,7 +1,7 @@ # @(#)Makefile 8.2 (Berkeley) 4/2/94 PROG= chpass -CFLAGS+=-Wall +CFLAGS+=-Wall -DPASSWD_IGNORE_COMMENTS SRCS= chpass.c edit.c field.c pw_copy.c pw_scan.c pw_util.c pw_yp.c \ table.c util.c ypxfr_misc.c ${GENSRCS} GENSRCS=yp.h yp_clnt.c yppasswd.h yppasswd_clnt.c yppasswd_private.h \ diff --git a/chpass/pw_copy.c b/chpass/pw_copy.c index f584ba3..9018e4b 100644 --- a/chpass/pw_copy.c +++ b/chpass/pw_copy.c @@ -85,6 +85,17 @@ pw_copy(ffd, tfd, pw) goto err; continue; } +#ifdef PASSWD_IGNORE_COMMENTS + for (p = buf; *p != '\n'; p++) + if (*p != ' ' && *p != '\t') + break; + if (*p == '#' || *p == '\n') { + (void)fprintf(to, "%s", buf); + if (ferror(to)) + goto err; + continue; + } +#endif if (!(p = strchr(buf, ':'))) { warnx("%s: corrupted entry", _PATH_MASTERPASSWD); pw_error(NULL, 0, 1); |