From: Daniel P. Berrange Date: Thu, 10 Oct 2013 16:45:14 +0000 (+0100) Subject: Block all use of libvirt.so in setuid programs X-Git-Tag: v1.1.4-rc1~26 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9cd6a57db6ea6762fbf85c59c379a27fa6e7fd2e;p=thirdparty%2Flibvirt.git Block all use of libvirt.so in setuid programs Avoid people introducing security flaws in their apps by forbidding the use of libvirt.so in setuid programs, with a check in virInitialize. Signed-off-by: Daniel P. Berrange --- diff --git a/src/libvirt.c b/src/libvirt.c index 96d8fdca39..d76e537c7f 100644 --- a/src/libvirt.c +++ b/src/libvirt.c @@ -409,6 +409,14 @@ virGlobalInit(void) virErrorInitialize() < 0) goto error; +#ifndef IN_VIRT_LOGIN_SHELL + if (virIsSUID()) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("libvirt.so is not safe to use from setuid programs")); + goto error; + } +#endif + #ifdef WITH_GNUTLS_GCRYPT /* * This sequence of API calls it copied exactly from