ifcfg: don't use D-Bus connection if NMDBusManager is without main connection

In configure-and-quit mode, NMDBusManager does not have a D-Bus connection.
Likewise, ifcfg-rh plugin should not use one either.
This commit is contained in:
Thomas Haller 2019-12-09 09:02:24 +01:00
parent 9d602529cc
commit 1e742e0fb4

View file

@ -20,6 +20,7 @@
#include "nm-utils.h"
#include "nm-core-internal.h"
#include "nm-config.h"
#include "nm-dbus-manager.h"
#include "settings/nm-settings-plugin.h"
#include "settings/nm-settings-utils.h"
#include "NetworkManagerUtils.h"
@ -1132,6 +1133,11 @@ _dbus_setup (NMSIfcfgRHPlugin *self)
_dbus_clear (self);
if (!NM_MAIN_DBUS_CONNECTION_GET) {
_LOGW ("dbus: don't use D-Bus for %s service", IFCFGRH1_BUS_NAME);
return;
}
/* We use a separate D-Bus connection so that org.freedesktop.NetworkManager and com.redhat.ifcfgrh1
* are exported by different connections. */
address = g_dbus_address_get_for_bus_sync (G_BUS_TYPE_SYSTEM, NULL, &error);