summaryrefslogtreecommitdiffstats
path: root/libc
diff options
context:
space:
mode:
authorCameron Katri <me@cameronkatri.com>2021-05-02 16:00:07 -0400
committerCameron Katri <me@cameronkatri.com>2021-05-02 16:00:07 -0400
commitf3dab068fce37270e5e4e1a00e5a44e30f00baf7 (patch)
treed6b8c70074d440e56c1d7cdbfc7b68d8b96bda96 /libc
parent6b46c62f4663c84790120a4e74e155a6ef16b41c (diff)
downloadpw-darwin-f3dab068fce37270e5e4e1a00e5a44e30f00baf7.tar.gz
pw-darwin-f3dab068fce37270e5e4e1a00e5a44e30f00baf7.tar.zst
pw-darwin-f3dab068fce37270e5e4e1a00e5a44e30f00baf7.zip
Recommit everything, add chpass, improve history (except for a few files that git-filter-repo dislikes for some reason [_secure_path.c and login_cap.h])
Diffstat (limited to 'libc')
-rw-r--r--libc/gen/pw_scan.c27
1 files changed, 4 insertions, 23 deletions
diff --git a/libc/gen/pw_scan.c b/libc/gen/pw_scan.c
index 619092d..f680a90 100644
--- a/libc/gen/pw_scan.c
+++ b/libc/gen/pw_scan.c
@@ -92,23 +92,17 @@ __pw_scan(char *bp, struct passwd *pw, int flags)
if (pw_big_ids_warning == -1)
pw_big_ids_warning = getenv("PW_SCAN_BIG_IDS") == NULL ? 1 : 0;
- 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;
- else {
+ if (p[0]) {
+ } else {
if (pw->pw_name[0] != '+' && pw->pw_name[0] != '-') {
if (flags & _PWSCAN_WARN)
warnx("no uid for user %s", pw->pw_name);
@@ -141,9 +135,8 @@ __pw_scan(char *bp, struct passwd *pw, int flags)
if (!(p = strsep(&bp, ":"))) /* gid */
goto fmt;
- if (p[0])
- pw->pw_fields |= _PWF_GID;
- else {
+ if (p[0]) {
+ } else {
if (pw->pw_name[0] != '+' && pw->pw_name[0] != '-') {
if (flags & _PWSCAN_WARN)
warnx("no gid for user %s", pw->pw_name);
@@ -172,30 +165,20 @@ __pw_scan(char *bp, struct passwd *pw, int flags)
if (flags & _PWSCAN_MASTER ) {
if (!(pw->pw_class = strsep(&bp, ":"))) /* class */
goto fmt;
- 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);
}
if (!(pw->pw_gecos = strsep(&bp, ":"))) /* gecos */
goto fmt;
- if (pw->pw_gecos[0])
- pw->pw_fields |= _PWF_GECOS;
if (!(pw->pw_dir = strsep(&bp, ":"))) /* directory */
goto fmt;
- if (pw->pw_dir[0])
- pw->pw_fields |= _PWF_DIR;
if (!(pw->pw_shell = strsep(&bp, ":"))) /* shell */
goto fmt;
@@ -213,8 +196,6 @@ __pw_scan(char *bp, struct passwd *pw, int flags)
}
endusershell();
}
- if (p[0])
- pw->pw_fields |= _PWF_SHELL;
if ((p = strsep(&bp, ":"))) { /* too many */
fmt: