]> git.ipfire.org Git - thirdparty/libvirt.git/commit
util: allow using virCommandAllowCap with setuid helpers
authorPaolo Bonzini <pbonzini@redhat.com>
Mon, 25 Mar 2013 14:25:29 +0000 (15:25 +0100)
committerEric Blake <eblake@redhat.com>
Thu, 18 Apr 2013 20:52:23 +0000 (14:52 -0600)
commit5c1cfea4036e2e031fffb71e00f3ce9804f5d165
tree2873ff7c971091c85318996d74c64fa8768bc1ee
parent658718454a8a78f14755ec5e74d3f42931b99196
util: allow using virCommandAllowCap with setuid helpers

When running unprivileged, virSetUIDGIDWithCaps will fail because it
tries to add the requested capabilities to the permitted and effective
sets.

Detect this case, and invoke the child with cleared permitted and
effective sets.  If it is a setuid program, it will get them.

Some care is needed also because you cannot drop capabilities from the
bounding set without CAP_SETPCAP.  Because of that, ignore errors from
setting the bounding set.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
src/util/virutil.c