]> git.ipfire.org Git - thirdparty/libvirt.git/commit
util: Make failure to get supplementary group list for a uid non-fatal
authorPeter Krempa <pkrempa@redhat.com>
Fri, 17 Jun 2016 13:32:58 +0000 (15:32 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Mon, 20 Jun 2016 15:35:55 +0000 (17:35 +0200)
commit832f16024754a2c94ab103a794913e2aecaff1a5
tree8786889c1946df5a483f940d944c3d910faa992f
parentc674dcccf121ff6b6f05b8d20fa45c5640cdca54
util: Make failure to get supplementary group list for a uid non-fatal

Since introduction of the DAC security driver we've documented that
seclabels with a leading + can be used with numerical uid. This would
not work though with the rest of libvirt if the uid was not actually
used in the system as we'd fail when trying to get a list of
supplementary groups for the given uid. Since a uid without entry in
/etc/passwd (or other user database) will not have any supplementary
groups we can treat the failure to obtain them as such.

This patch modifies virGetGroupList to not report the error for missing
users and makes it return an empty list or just the group specified in
@gid.

All callers will grant less permissions to a user in case of failure of
this function and thus this change is safe.
src/util/virutil.c