diff options
author | Baptiste Daroussin <bapt@FreeBSD.org> | 2015-06-07 20:59:59 +0000 |
---|---|---|
committer | Baptiste Daroussin <bapt@FreeBSD.org> | 2015-06-07 20:59:59 +0000 |
commit | 50b3230917e6e4c6538d6d0f01fed543b8be5efc (patch) | |
tree | 39f614ab20b46861b3588619bf4212b0fe05a7f0 /pw/pw.c | |
parent | 5b291029a9ed6f6ac19b03b29501179559dc07c3 (diff) | |
download | pw-darwin-50b3230917e6e4c6538d6d0f01fed543b8be5efc.tar.gz pw-darwin-50b3230917e6e4c6538d6d0f01fed543b8be5efc.tar.zst pw-darwin-50b3230917e6e4c6538d6d0f01fed543b8be5efc.zip |
Fix setting uid/gid min/max via pw
Diffstat (limited to 'pw/pw.c')
-rw-r--r-- | pw/pw.c | 17 |
1 files changed, 13 insertions, 4 deletions
@@ -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, |