diff options
author | bapt <bapt@FreeBSD.org> | 2015-06-07 20:59:59 +0000 |
---|---|---|
committer | bapt <bapt@FreeBSD.org> | 2015-06-07 20:59:59 +0000 |
commit | b0235ac2ee534e2b1b0cf6d6bfb141458d57690a (patch) | |
tree | a1452134668dfba6203fcc813fc8da97fefe27fb /usr.sbin/pw/pw.c | |
parent | fc781f489d6d2f9918c9ecdeea749b37a453cdd9 (diff) | |
download | FreeBSD-src-b0235ac2ee534e2b1b0cf6d6bfb141458d57690a.zip FreeBSD-src-b0235ac2ee534e2b1b0cf6d6bfb141458d57690a.tar.gz |
Fix setting uid/gid min/max via pw
Diffstat (limited to 'usr.sbin/pw/pw.c')
-rw-r--r-- | usr.sbin/pw/pw.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/usr.sbin/pw/pw.c b/usr.sbin/pw/pw.c index d8d8c03..30fb55b 100644 --- a/usr.sbin/pw/pw.c +++ b/usr.sbin/pw/pw.c @@ -251,11 +251,20 @@ main(int argc, char *argv[]) addarg(&arglist, 'g', optarg); break; } - /* FALLTHROUGH */ - case 'u': if (strspn(optarg, "0123456789") != strlen(optarg)) - errx(EX_USAGE, "%s expects a number", - which == 1 ? "-g" : "-u" ); + errx(EX_USAGE, "-g expects a number"); + id = strtonum(optarg, 0, LONG_MAX, &errstr); + if (errstr != NULL) + errx(EX_USAGE, "Bad id '%s': %s", optarg, + errstr); + break; + case 'u': + if (strspn(optarg, "0123456789,") != strlen(optarg)) + errx(EX_USAGE, "-u expects a number"); + if (strchr(optarg, ',') != NULL) { + addarg(&arglist, 'u', optarg); + break; + } id = strtonum(optarg, 0, LONG_MAX, &errstr); if (errstr != NULL) errx(EX_USAGE, "Bad id '%s': %s", optarg, |