diff options
author | wollman <wollman@FreeBSD.org> | 1994-09-20 01:15:08 +0000 |
---|---|---|
committer | wollman <wollman@FreeBSD.org> | 1994-09-20 01:15:08 +0000 |
commit | c9c7dd75b710fc8858479675a3aa6994d6d60316 (patch) | |
tree | 3adadb06fae267423b17928b6f8dc1d61c8555c2 /lib/libc/gen/pw_scan.c | |
parent | b511765a267af1a4e54fe9d9657337b874b822f9 (diff) | |
download | FreeBSD-src-c9c7dd75b710fc8858479675a3aa6994d6d60316.zip FreeBSD-src-c9c7dd75b710fc8858479675a3aa6994d6d60316.tar.gz |
Maintain pw_fields, and output same to password database.
!!!!!!!!
NB
!!!!!!!!
You MUST pwd_mkdb /etc/master.passwd before attempting to use the new
libc, or things may go wrong. (I doubt anything actually /will/ go
wrong, but the actual behavior is undefined. YOU HAVE BEEN WARNED.)
The database format is, however, backwards-compatible, so old executables
will still work.
Diffstat (limited to 'lib/libc/gen/pw_scan.c')
-rw-r--r-- | lib/libc/gen/pw_scan.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/libc/gen/pw_scan.c b/lib/libc/gen/pw_scan.c index 3093ac2..fbefc5b 100644 --- a/lib/libc/gen/pw_scan.c +++ b/lib/libc/gen/pw_scan.c @@ -62,15 +62,20 @@ pw_scan(bp, pw) int root; char *p, *sh; + pw->pw_fields = 0; if (!(pw->pw_name = strsep(&bp, ":"))) /* login */ goto fmt; root = !strcmp(pw->pw_name, "root"); + if(pw->pw_name[0] && (pw->pw_name[0] != '+' || pw->pw_name[1] == '\0')) + pw->pw_fields |= _PWF_NAME; if (!(pw->pw_passwd = strsep(&bp, ":"))) /* passwd */ goto fmt; + if(pw->pw_passwd[0]) pw->pw_fields |= _PWF_PASSWD; if (!(p = strsep(&bp, ":"))) /* uid */ goto fmt; + if(p[0]) pw->pw_fields |= _PWF_UID; id = atol(p); if (root && id) { warnx("root uid should be 0"); @@ -84,6 +89,7 @@ pw_scan(bp, pw) if (!(p = strsep(&bp, ":"))) /* gid */ goto fmt; + if(p[0]) pw->pw_fields |= _PWF_GID; id = atol(p); if (id > USHRT_MAX) { warnx("%s > max gid value (%d)", p, USHRT_MAX); @@ -92,14 +98,24 @@ pw_scan(bp, pw) pw->pw_gid = id; pw->pw_class = strsep(&bp, ":"); /* class */ + if(pw->pw_class[0]) pw->pw_fields |= _PWF_CLASS; + if (!(p = strsep(&bp, ":"))) /* change */ goto fmt; + if(p[0]) pw->pw_fields |= _PWF_CHANGE; pw->pw_change = atol(p); + if (!(p = strsep(&bp, ":"))) /* expire */ goto fmt; + if(p[0]) pw->pw_fields |= _PWF_EXPIRE; pw->pw_expire = atol(p); + pw->pw_gecos = strsep(&bp, ":"); /* gecos */ + if(pw->pw_gecos[0]) pw->pw_fields |= _PWF_GECOS; + pw->pw_dir = strsep(&bp, ":"); /* directory */ + if(pw->pw_dir[0]) pw->pw_fields |= _PWF_DIR; + if (!(pw->pw_shell = strsep(&bp, ":"))) /* shell */ goto fmt; @@ -113,6 +129,7 @@ pw_scan(bp, pw) if (!strcmp(p, sh)) break; } + if(p[0]) pw->pw_fields |= _PWF_SHELL; if (p = strsep(&bp, ":")) { /* too many */ fmt: warnx("corrupted entry"); |