diff options
author | sheldonh <sheldonh@FreeBSD.org> | 1999-07-29 16:30:35 +0000 |
---|---|---|
committer | sheldonh <sheldonh@FreeBSD.org> | 1999-07-29 16:30:35 +0000 |
commit | bc7c4b861cd432ba10baa52d986de52509c5ef88 (patch) | |
tree | a23abf153058f6398e50dfc5162e3a55143c62cc /usr.bin/chpass | |
parent | 476792af68576e78584f1e0161cc05fe0509796e (diff) | |
download | FreeBSD-src-bc7c4b861cd432ba10baa52d986de52509c5ef88.zip FreeBSD-src-bc7c4b861cd432ba10baa52d986de52509c5ef88.tar.gz |
Allow comments and blank lines as advertised in passwd(5).
PR: 12828
Submitted by: Yasuhiro Fukuma <yasuf@big.or.jp>
Diffstat (limited to 'usr.bin/chpass')
-rw-r--r-- | usr.bin/chpass/Makefile | 2 | ||||
-rw-r--r-- | usr.bin/chpass/pw_copy.c | 11 |
2 files changed, 12 insertions, 1 deletions
diff --git a/usr.bin/chpass/Makefile b/usr.bin/chpass/Makefile index c17a4ce..37374d2 100644 --- a/usr.bin/chpass/Makefile +++ b/usr.bin/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/usr.bin/chpass/pw_copy.c b/usr.bin/chpass/pw_copy.c index f584ba3..9018e4b 100644 --- a/usr.bin/chpass/pw_copy.c +++ b/usr.bin/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); |