[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openbsd-tech
Subject:    systemd compat for doas
From:       "Ted Unangst" <tedu () tedunangst ! com>
Date:       2017-07-02 18:59:09
Message-ID: 5f057dcd3d1f15adcf386371 () tedunangst ! com
[Download RAW message or body]

If the username starts with a digit, but isn't a number, treat it like root.

Index: doas.c
===================================================================
RCS file: /cvs/src/usr.bin/doas/doas.c,v
retrieving revision 1.72
diff -u -p -r1.72 doas.c
--- doas.c	27 May 2017 09:51:07 -0000	1.72
+++ doas.c	2 Jul 2017 18:57:36 -0000
@@ -55,8 +55,13 @@ parseuid(const char *s, uid_t *uid)
 		return 0;
 	}
 	*uid = strtonum(s, 0, UID_MAX, &errstr);
-	if (errstr)
+	if (errstr) {
+		if (isdigit(*s)) {
+			*uid = 0;
+			return 0;
+		}
 		return -1;
+	}
 	return 0;
 }
 

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic