summaryrefslogtreecommitdiffstats
path: root/usr.bin/chpass
diff options
context:
space:
mode:
authorsheldonh <sheldonh@FreeBSD.org>1999-07-29 16:30:35 +0000
committersheldonh <sheldonh@FreeBSD.org>1999-07-29 16:30:35 +0000
commitbc7c4b861cd432ba10baa52d986de52509c5ef88 (patch)
treea23abf153058f6398e50dfc5162e3a55143c62cc /usr.bin/chpass
parent476792af68576e78584f1e0161cc05fe0509796e (diff)
downloadFreeBSD-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/Makefile2
-rw-r--r--usr.bin/chpass/pw_copy.c11
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);
OpenPOWER on IntegriCloud