From: Ján Tomko Date: Tue, 12 Nov 2013 12:18:54 +0000 (+0100) Subject: Disable nwfilter driver when running unprivileged X-Git-Tag: v1.0.5.8~10 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b2c87be92e631f6044755b1d937540c4b84ee150;p=thirdparty%2Flibvirt.git Disable nwfilter driver when running unprivileged When opening a new connection to the driver, nwfilterOpen only succeeds if the driverState has been allocated. Move the privilege check in driver initialization before the state allocation to disable the driver. This changes the nwfilter-define error from: error: cannot create config directory (null): Bad address To: this function is not supported by the connection driver: virNWFilterDefineXML https://bugzilla.redhat.com/show_bug.cgi?id=1029266 (cherry picked from commit b7829f959b33c6e32422222a9ed745c0da7dc696) --- diff --git a/src/nwfilter/nwfilter_driver.c b/src/nwfilter/nwfilter_driver.c index 51a991f192..0659b21480 100644 --- a/src/nwfilter/nwfilter_driver.c +++ b/src/nwfilter/nwfilter_driver.c @@ -172,6 +172,9 @@ nwfilterStateInitialize(bool privileged, char *base = NULL; DBusConnection *sysbus = NULL; + if (!privileged) + return 0; + #if WITH_DBUS sysbus = virDBusGetSystemBus(); #endif /* WITH_DBUS */ @@ -187,9 +190,6 @@ nwfilterStateInitialize(bool privileged, driverState->watchingFirewallD = (sysbus != NULL); driverState->privileged = privileged; - if (!privileged) - return 0; - nwfilterDriverLock(driverState); if (virNWFilterIPAddrMapInit() < 0)