Re: systemd compat for doas
On Mon, 3 Jul 2017, Franco Fichtner wrote: > > > On 2. Jul 2017, at 8:59 PM, Ted Unangst wrote: > > > > If the username starts with a digit, but isn't a number, treat it like root. > > I question the simplicity of this patch due to the fact that it leaves > no head room for further security-related regressions. Maybe more > progressive over-engineering of the code is a better course of action. yeah, where's the dbus integration?
Re: systemd compat for doas
> On 2. Jul 2017, at 8:59 PM, Ted Unangst wrote: > > If the username starts with a digit, but isn't a number, treat it like root. I question the simplicity of this patch due to the fact that it leaves no head room for further security-related regressions. Maybe more progressive over-engineering of the code is a better course of action. > > 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.c27 May 2017 09:51:07 - 1.72 > +++ doas.c2 Jul 2017 18:57:36 - > @@ -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; > } > >
Re: systemd compat for doas
Where would this be needed and make sense? I wasn't aware of this systemd behaviour until now, but a quick google search shows me that it's seen by many as a bug and I tend to agree. A type-O shouldn't imply root access. martijn@ On 07/02/17 20:59, Ted Unangst wrote: > 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.c27 May 2017 09:51:07 - 1.72 > +++ doas.c2 Jul 2017 18:57:36 - > @@ -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; > } > >
systemd compat for doas
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 - 1.72 +++ doas.c 2 Jul 2017 18:57:36 - @@ -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; }