diff options
author | Baptiste Daroussin <bapt@FreeBSD.org> | 2015-01-26 16:50:42 +0000 |
---|---|---|
committer | Baptiste Daroussin <bapt@FreeBSD.org> | 2015-01-26 16:50:42 +0000 |
commit | f31ec719878d9025a455971cbe1d0976dc9ef719 (patch) | |
tree | 509f61dfe69737fed25ee89158846427b8e14f73 /pw | |
parent | d43b0a43ca09d1f11cbe2612df6d8b0761a08591 (diff) | |
download | pw-darwin-f31ec719878d9025a455971cbe1d0976dc9ef719.tar.gz pw-darwin-f31ec719878d9025a455971cbe1d0976dc9ef719.tar.zst pw-darwin-f31ec719878d9025a455971cbe1d0976dc9ef719.zip |
Revert r277652
uid and gid are never and should never be negative. The pw(8) manpage clearly
states the -u and -g arguments are for uids/gids, hence using negative values is
abusing a bug in former versions of pw(8)
Diffstat (limited to 'pw')
-rw-r--r-- | pw/pw_group.c | 6 | ||||
-rw-r--r-- | pw/pw_user.c | 5 |
2 files changed, 2 insertions, 9 deletions
diff --git a/pw/pw_group.c b/pw/pw_group.c index 51166cd..b20ce88 100644 --- a/pw/pw_group.c +++ b/pw/pw_group.c @@ -68,11 +68,7 @@ pw_group(struct userconf * cnf, int mode, struct cargs * args) }; if (a_gid != NULL) { - const char *teststr; - teststr = a_gid->val; - if (*teststr == '-') - teststr++; - if (strspn(teststr, "0123456789") != strlen(teststr)) + if (strspn(a_gid->val, "0123456789") != strlen(a_gid->val)) errx(EX_USAGE, "-g expects a number"); } diff --git a/pw/pw_user.c b/pw/pw_user.c index f146b46..483148a 100644 --- a/pw/pw_user.c +++ b/pw/pw_user.c @@ -322,10 +322,7 @@ pw_user(struct userconf * cnf, int mode, struct cargs * args) a_name = NULL; } } else { - const char *teststr = a_uid->val; - if (*teststr == '-') - teststr++; - if (strspn(teststr, "0123456789") != strlen(teststr)) + if (strspn(a_uid->val, "0123456789") != strlen(a_uid->val)) errx(EX_USAGE, "-u expects a number"); } |