On 10/16/17 1:07 AM, Ian Kent wrote: > Fix a few compiler warnings that have been around far too long. Hi Ian - > diff --git a/daemon/spawn.c b/daemon/spawn.c > index 4515607b..b931d678 100644 > --- a/daemon/spawn.c > +++ b/daemon/spawn.c > @@ -195,8 +195,14 @@ static int do_spawn(unsigned logopt, unsigned int wait, > * program group to trigger mount > */ > if (euid) { > - seteuid(euid); > - setegid(egid); > + if (seteuid(euid) == -1) > + fprintf(stderr, > + "warning: seteuid: %s\n", > + strerror(errno)); > + if (setegid(egid) == -1) > + fprintf(stderr, > + "warning: setegid: %s\n", > + strerror(errno)); > } > setpgrp(); This one fixes the warning but there are a few issues with it, but none of them are new. 1) We'll see that second warning *every* time since we just dropped root privs and no longer have permission to change groups. That's a bug that's been lurking there for a while but now we're informed of it. 2) We're only changing the primary group and not the supplementary groups, so the open is being performed with root's other group membership (if any) and none of the user's other groups. 3) Do we really want to continue if we couldn't setuid? I'll post a patch to address the first two as a reply to this post. What's your take on point 3? -Jeff -- Jeff Mahoney SUSE Labs
Attachment:
signature.asc
Description: OpenPGP digital signature