Re: [PATCH 12/35] autofs-5.1.3 - fix a couple of compiler warnings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Index of Archives]     [Linux Filesystem Development]     [Linux Ext4]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux