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 <berrange@redhat.com>
This commit is contained in:
Daniel P. Berrange 2013-10-10 17:45:14 +01:00
parent 9b0af09240
commit 9cd6a57db6

View File

@ -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