summaryrefslogtreecommitdiffstats
path: root/pw/pw_user.c
diff options
context:
space:
mode:
authorBaptiste Daroussin <bapt@FreeBSD.org>2014-10-28 15:46:22 +0000
committerBaptiste Daroussin <bapt@FreeBSD.org>2014-10-28 15:46:22 +0000
commit3dbd5cfb7b9eec912c68ae204ea36bec869b48cd (patch)
treee5bb438cc4d8a4e90946d1cd873331e6b9a93dbd /pw/pw_user.c
parent1f6950b26c668b108ded74fdea09aaf5f8abaeb8 (diff)
downloadpw-darwin-3dbd5cfb7b9eec912c68ae204ea36bec869b48cd.tar.gz
pw-darwin-3dbd5cfb7b9eec912c68ae204ea36bec869b48cd.tar.zst
pw-darwin-3dbd5cfb7b9eec912c68ae204ea36bec869b48cd.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/pw_user.c')
-rw-r--r--pw/pw_user.c3
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");
}
/*