[ovs-dev] [PATCH] lib: protect daemon_set_new_user against non existing user:group specs

Christian Ehrhardt christian.ehrhardt at canonical.com
Mon Apr 25 05:55:15 UTC 2016


Thanks Ben,
I wrote that for something in DPDK inspired by that code when I found the
bug and to eventually converted it back to help OVS as well.
Sorry to miss that part on converting it back - will come up with a fixed
version soon.

Christian Ehrhardt
Software Engineer, Ubuntu Server
Canonical Ltd

On Fri, Apr 22, 2016 at 8:37 PM, Ben Pfaff <blp at ovn.org> wrote:

> On Fri, Apr 22, 2016 at 04:04:26PM +0200, Christian Ehrhardt wrote:
> > From the manpages of getgrnam_r (getpwnam_r is similar):
> > "If no matching group record was found, these functions return 0 and
> > store NULL in *result."
> >
> > The code checked only against errors, but non existing users didn't set
> > e != 0 therefore the code could try to set arbitrary uid/gid values.
> >
> > Fixes: e91b927d lib/daemon: support --user option for all OVS daemon
> >
> > Signed-off-by: Christian Ehrhardt <christian.ehrhardt at canonical.com>
>
> Thanks for the patch.
>
> This does not compile:
>
>     ../lib/daemon-unix.c:975:18: error: invalid operands to binary
> expression ('struct passwd' and 'void *')
>     ../lib/daemon-unix.c:1018:22: error: invalid operands to binary
> expression ('struct group' and 'void *')
>



More information about the dev mailing list