summaryrefslogtreecommitdiff
path: root/distrib/special
diff options
context:
space:
mode:
authorTed Unangst <tedu@cvs.openbsd.org>2019-10-21 03:14:54 +0000
committerTed Unangst <tedu@cvs.openbsd.org>2019-10-21 03:14:54 +0000
commitcfe8755e96dd20ba56747b69edf50afd109bd576 (patch)
tree0516102d988600b31fbed2f47d03eeb2f5111671 /distrib/special
parent2af8fd2932cf5f3069982462740ba3c7bbe08d0c (diff)
keep in sync with regular doas. req by millert
Diffstat (limited to 'distrib/special')
-rw-r--r--distrib/special/doas/doas.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/distrib/special/doas/doas.c b/distrib/special/doas/doas.c
index c2fab7d4574..ade6afbdc2d 100644
--- a/distrib/special/doas/doas.c
+++ b/distrib/special/doas/doas.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: doas.c,v 1.3 2017/01/21 08:18:53 krw Exp $ */
+/* $OpenBSD: doas.c,v 1.4 2019/10/21 03:14:53 tedu Exp $ */
/*
* Copyright (c) 2015 Ted Unangst <tedu@openbsd.org>
*
@@ -44,9 +44,11 @@ parseuid(const char *s, uid_t *uid)
if ((pw = getpwnam(s)) != NULL) {
*uid = pw->pw_uid;
+ if (*uid == UID_MAX)
+ return -1;
return 0;
}
- *uid = strtonum(s, 0, UID_MAX, &errstr);
+ *uid = strtonum(s, 0, UID_MAX - 1, &errstr);
if (errstr)
return -1;
return 0;