diff options
author | Baptiste Daroussin <bapt@FreeBSD.org> | 2014-10-28 15:46:22 +0000 |
---|---|---|
committer | Baptiste Daroussin <bapt@FreeBSD.org> | 2014-10-28 15:46:22 +0000 |
commit | 87189f48bb3ff275026600ac63f7f684d92a7f3a (patch) | |
tree | 2ad501ea0a7ea4359f6d1a961e0907bb639d6117 /pw | |
parent | 77eacc73737116b101278ac7984c1a85adb55950 (diff) | |
download | pw-darwin-87189f48bb3ff275026600ac63f7f684d92a7f3a.tar.gz pw-darwin-87189f48bb3ff275026600ac63f7f684d92a7f3a.tar.zst pw-darwin-87189f48bb3ff275026600ac63f7f684d92a7f3a.zip |
Ensure pw userdel -u <invalid> do not try to remove root
Check the uid passed is actually a number as early as possible
MFC after: 1 week
Diffstat (limited to 'pw')
-rw-r--r-- | pw/pw_user.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/pw/pw_user.c b/pw/pw_user.c index 0b56b81..483148a 100644 --- a/pw/pw_user.c +++ b/pw/pw_user.c @@ -321,6 +321,9 @@ pw_user(struct userconf * cnf, int mode, struct cargs * args) (a_uid = a_name)->ch = 'u'; a_name = NULL; } + } else { + if (strspn(a_uid->val, "0123456789") != strlen(a_uid->val)) + errx(EX_USAGE, "-u expects a number"); } /* |