DBus: merge NetworkManger{,SystemSettings}
Remove the org.freedesktop.NetworkManagerSystemSettings bus name and have everybody talk to org.freedesktop.NetworkManager. Now that we have a single settings service that's embedded in the main daemon, we don't need separate names anymore.
This commit is contained in:
@@ -22,7 +22,6 @@
|
|||||||
#define NM_DISPATCHER_DBUS_IFACE "org.freedesktop.nm_dispatcher"
|
#define NM_DISPATCHER_DBUS_IFACE "org.freedesktop.nm_dispatcher"
|
||||||
#define NM_DISPATCHER_DBUS_PATH "/org/freedesktop/nm_dispatcher"
|
#define NM_DISPATCHER_DBUS_PATH "/org/freedesktop/nm_dispatcher"
|
||||||
|
|
||||||
#define NMD_CONNECTION_PROPS_SERVICE_NAME "service-name"
|
|
||||||
#define NMD_CONNECTION_PROPS_PATH "path"
|
#define NMD_CONNECTION_PROPS_PATH "path"
|
||||||
|
|
||||||
#define NMD_DEVICE_PROPS_INTERFACE "interface"
|
#define NMD_DEVICE_PROPS_INTERFACE "interface"
|
||||||
|
@@ -41,7 +41,7 @@ con = dbus.Dictionary({
|
|||||||
|
|
||||||
bus = dbus.SystemBus()
|
bus = dbus.SystemBus()
|
||||||
|
|
||||||
proxy = bus.get_object("org.freedesktop.NetworkManagerSystemSettings", "/org/freedesktop/NetworkManagerSettings")
|
proxy = bus.get_object("org.freedesktop.NetworkManager", "/org/freedesktop/NetworkManagerSettings")
|
||||||
settings = dbus.Interface(proxy, "org.freedesktop.NetworkManagerSettings")
|
settings = dbus.Interface(proxy, "org.freedesktop.NetworkManagerSettings")
|
||||||
|
|
||||||
settings.AddConnection(con)
|
settings.AddConnection(con)
|
||||||
|
@@ -53,7 +53,7 @@ for a in active:
|
|||||||
# needed to connect to a specific network. Lets get those details so we
|
# needed to connect to a specific network. Lets get those details so we
|
||||||
# can find the user-readable name of the connection.
|
# can find the user-readable name of the connection.
|
||||||
con_path = prop_iface.Get("org.freedesktop.NetworkManager.ActiveConnection", "Connection")
|
con_path = prop_iface.Get("org.freedesktop.NetworkManager.ActiveConnection", "Connection")
|
||||||
service_proxy = bus.get_object("org.freedesktop.NetworkManagerSystemSettings", con_path)
|
service_proxy = bus.get_object("org.freedesktop.NetworkManager", con_path)
|
||||||
con_iface = dbus.Interface(service_proxy, "org.freedesktop.NetworkManagerSettings.Connection")
|
con_iface = dbus.Interface(service_proxy, "org.freedesktop.NetworkManagerSettings.Connection")
|
||||||
con_details = con_iface.GetSettings()
|
con_details = con_iface.GetSettings()
|
||||||
con_name = con_details['connection']['id']
|
con_name = con_details['connection']['id']
|
||||||
|
@@ -37,7 +37,7 @@ DBusGMainLoop(set_as_default=True)
|
|||||||
|
|
||||||
def get_connections():
|
def get_connections():
|
||||||
bus = dbus.SystemBus()
|
bus = dbus.SystemBus()
|
||||||
proxy = bus.get_object('org.freedesktop.NetworkManagerSystemSettings', '/org/freedesktop/NetworkManagerSettings')
|
proxy = bus.get_object('org.freedesktop.NetworkManager', '/org/freedesktop/NetworkManagerSettings')
|
||||||
iface = dbus.Interface(proxy, dbus_interface='org.freedesktop.NetworkManagerSettings')
|
iface = dbus.Interface(proxy, dbus_interface='org.freedesktop.NetworkManagerSettings')
|
||||||
return iface.ListConnections()
|
return iface.ListConnections()
|
||||||
|
|
||||||
@@ -45,7 +45,7 @@ def get_connections():
|
|||||||
def get_connection_by_uuid(uuid):
|
def get_connection_by_uuid(uuid):
|
||||||
bus = dbus.SystemBus()
|
bus = dbus.SystemBus()
|
||||||
for c in get_connections():
|
for c in get_connections():
|
||||||
proxy = bus.get_object('org.freedesktop.NetworkManagerSystemSettings', c)
|
proxy = bus.get_object('org.freedesktop.NetworkManager', c)
|
||||||
iface = dbus.Interface(proxy, dbus_interface='org.freedesktop.NetworkManagerSettings.Connection')
|
iface = dbus.Interface(proxy, dbus_interface='org.freedesktop.NetworkManagerSettings.Connection')
|
||||||
settings = iface.GetSettings()
|
settings = iface.GetSettings()
|
||||||
if settings['connection']['uuid'] == uuid:
|
if settings['connection']['uuid'] == uuid:
|
||||||
@@ -57,7 +57,7 @@ def get_connection_by_uuid(uuid):
|
|||||||
def list_uuids():
|
def list_uuids():
|
||||||
bus = dbus.SystemBus()
|
bus = dbus.SystemBus()
|
||||||
for c in get_connections():
|
for c in get_connections():
|
||||||
proxy = bus.get_object('org.freedesktop.NetworkManagerSystemSettings', c)
|
proxy = bus.get_object('org.freedesktop.NetworkManager', c)
|
||||||
iface = dbus.Interface(proxy, dbus_interface='org.freedesktop.NetworkManagerSettings.Connection')
|
iface = dbus.Interface(proxy, dbus_interface='org.freedesktop.NetworkManagerSettings.Connection')
|
||||||
settings = iface.GetSettings()
|
settings = iface.GetSettings()
|
||||||
conn = settings['connection']
|
conn = settings['connection']
|
||||||
@@ -76,7 +76,7 @@ def get_active_connection_path(uuid):
|
|||||||
iface = dbus.Interface(proxy, dbus_interface='org.freedesktop.DBus.Properties')
|
iface = dbus.Interface(proxy, dbus_interface='org.freedesktop.DBus.Properties')
|
||||||
path = iface.Get('org.freedesktop.NetworkManager.Connection.Active', 'Connection')
|
path = iface.Get('org.freedesktop.NetworkManager.Connection.Active', 'Connection')
|
||||||
|
|
||||||
proxy = bus.get_object('org.freedesktop.NetworkManagerSystemSettings', path)
|
proxy = bus.get_object('org.freedesktop.NetworkManager', path)
|
||||||
iface = dbus.Interface(proxy, dbus_interface='org.freedesktop.NetworkManagerSettings.Connection')
|
iface = dbus.Interface(proxy, dbus_interface='org.freedesktop.NetworkManagerSettings.Connection')
|
||||||
settings = iface.GetSettings()
|
settings = iface.GetSettings()
|
||||||
|
|
||||||
@@ -112,7 +112,7 @@ def activate_connection(connection_path, device_path):
|
|||||||
bus = dbus.SystemBus()
|
bus = dbus.SystemBus()
|
||||||
proxy = bus.get_object('org.freedesktop.NetworkManager', '/org/freedesktop/NetworkManager')
|
proxy = bus.get_object('org.freedesktop.NetworkManager', '/org/freedesktop/NetworkManager')
|
||||||
iface = dbus.Interface(proxy, dbus_interface='org.freedesktop.NetworkManager')
|
iface = dbus.Interface(proxy, dbus_interface='org.freedesktop.NetworkManager')
|
||||||
iface.ActivateConnection('org.freedesktop.NetworkManagerSystemSettings',
|
iface.ActivateConnection('org.freedesktop.NetworkManager',
|
||||||
connection_path,
|
connection_path,
|
||||||
device_path,
|
device_path,
|
||||||
"/",
|
"/",
|
||||||
|
@@ -45,7 +45,6 @@
|
|||||||
#define NM_DBUS_INTERFACE_DHCP6_CONFIG NM_DBUS_INTERFACE ".DHCP6Config"
|
#define NM_DBUS_INTERFACE_DHCP6_CONFIG NM_DBUS_INTERFACE ".DHCP6Config"
|
||||||
|
|
||||||
|
|
||||||
#define NM_DBUS_SERVICE_SYSTEM_SETTINGS "org.freedesktop.NetworkManagerSystemSettings"
|
|
||||||
#define NM_DBUS_IFACE_SETTINGS "org.freedesktop.NetworkManagerSettings"
|
#define NM_DBUS_IFACE_SETTINGS "org.freedesktop.NetworkManagerSettings"
|
||||||
#define NM_DBUS_PATH_SETTINGS "/org/freedesktop/NetworkManagerSettings"
|
#define NM_DBUS_PATH_SETTINGS "/org/freedesktop/NetworkManagerSettings"
|
||||||
|
|
||||||
|
@@ -343,14 +343,14 @@ constructor (GType type,
|
|||||||
g_assert (nm_connection_get_path (NM_CONNECTION (object)));
|
g_assert (nm_connection_get_path (NM_CONNECTION (object)));
|
||||||
|
|
||||||
priv->proxy = dbus_g_proxy_new_for_name (priv->bus,
|
priv->proxy = dbus_g_proxy_new_for_name (priv->bus,
|
||||||
NM_DBUS_SERVICE_SYSTEM_SETTINGS,
|
NM_DBUS_SERVICE,
|
||||||
nm_connection_get_path (NM_CONNECTION (object)),
|
nm_connection_get_path (NM_CONNECTION (object)),
|
||||||
NM_DBUS_IFACE_SETTINGS_CONNECTION);
|
NM_DBUS_IFACE_SETTINGS_CONNECTION);
|
||||||
g_assert (priv->proxy);
|
g_assert (priv->proxy);
|
||||||
dbus_g_proxy_set_default_timeout (priv->proxy, G_MAXINT);
|
dbus_g_proxy_set_default_timeout (priv->proxy, G_MAXINT);
|
||||||
|
|
||||||
priv->secrets_proxy = dbus_g_proxy_new_for_name (priv->bus,
|
priv->secrets_proxy = dbus_g_proxy_new_for_name (priv->bus,
|
||||||
NM_DBUS_SERVICE_SYSTEM_SETTINGS,
|
NM_DBUS_SERVICE,
|
||||||
nm_connection_get_path (NM_CONNECTION (object)),
|
nm_connection_get_path (NM_CONNECTION (object)),
|
||||||
NM_DBUS_IFACE_SETTINGS_CONNECTION_SECRETS);
|
NM_DBUS_IFACE_SETTINGS_CONNECTION_SECRETS);
|
||||||
g_assert (priv->secrets_proxy);
|
g_assert (priv->secrets_proxy);
|
||||||
|
@@ -485,7 +485,7 @@ name_owner_changed (DBusGProxy *proxy,
|
|||||||
{
|
{
|
||||||
NMRemoteSettings *self = NM_REMOTE_SETTINGS (user_data);
|
NMRemoteSettings *self = NM_REMOTE_SETTINGS (user_data);
|
||||||
NMRemoteSettingsPrivate *priv = NM_REMOTE_SETTINGS_GET_PRIVATE (self);
|
NMRemoteSettingsPrivate *priv = NM_REMOTE_SETTINGS_GET_PRIVATE (self);
|
||||||
const char *sname = NM_DBUS_SERVICE_SYSTEM_SETTINGS;
|
const char *sname = NM_DBUS_SERVICE;
|
||||||
|
|
||||||
if (!strcmp (name, sname)) {
|
if (!strcmp (name, sname)) {
|
||||||
if (priv->fetch_id)
|
if (priv->fetch_id)
|
||||||
@@ -633,7 +633,7 @@ constructor (GType type,
|
|||||||
object, NULL);
|
object, NULL);
|
||||||
|
|
||||||
if (!dbus_g_proxy_call (priv->dbus_proxy, "NameHasOwner", &error,
|
if (!dbus_g_proxy_call (priv->dbus_proxy, "NameHasOwner", &error,
|
||||||
G_TYPE_STRING, NM_DBUS_SERVICE_SYSTEM_SETTINGS,
|
G_TYPE_STRING, NM_DBUS_SERVICE,
|
||||||
G_TYPE_INVALID,
|
G_TYPE_INVALID,
|
||||||
G_TYPE_BOOLEAN, &priv->service_running,
|
G_TYPE_BOOLEAN, &priv->service_running,
|
||||||
G_TYPE_INVALID)) {
|
G_TYPE_INVALID)) {
|
||||||
@@ -646,7 +646,7 @@ constructor (GType type,
|
|||||||
}
|
}
|
||||||
|
|
||||||
priv->proxy = dbus_g_proxy_new_for_name (priv->bus,
|
priv->proxy = dbus_g_proxy_new_for_name (priv->bus,
|
||||||
NM_DBUS_SERVICE_SYSTEM_SETTINGS,
|
NM_DBUS_SERVICE,
|
||||||
NM_DBUS_PATH_SETTINGS,
|
NM_DBUS_PATH_SETTINGS,
|
||||||
NM_DBUS_IFACE_SETTINGS);
|
NM_DBUS_IFACE_SETTINGS);
|
||||||
g_assert (priv->proxy);
|
g_assert (priv->proxy);
|
||||||
@@ -665,7 +665,7 @@ constructor (GType type,
|
|||||||
|
|
||||||
/* D-Bus properties proxy */
|
/* D-Bus properties proxy */
|
||||||
priv->props_proxy = dbus_g_proxy_new_for_name (priv->bus,
|
priv->props_proxy = dbus_g_proxy_new_for_name (priv->bus,
|
||||||
NM_DBUS_SERVICE_SYSTEM_SETTINGS,
|
NM_DBUS_SERVICE,
|
||||||
NM_DBUS_PATH_SETTINGS,
|
NM_DBUS_PATH_SETTINGS,
|
||||||
"org.freedesktop.DBus.Properties");
|
"org.freedesktop.DBus.Properties");
|
||||||
g_assert (priv->props_proxy);
|
g_assert (priv->props_proxy);
|
||||||
|
@@ -4,10 +4,7 @@
|
|||||||
<busconfig>
|
<busconfig>
|
||||||
<policy user="root">
|
<policy user="root">
|
||||||
<allow own="org.freedesktop.NetworkManager"/>
|
<allow own="org.freedesktop.NetworkManager"/>
|
||||||
<allow own="org.freedesktop.NetworkManagerSystemSettings"/>
|
|
||||||
|
|
||||||
<allow send_destination="org.freedesktop.NetworkManager"/>
|
<allow send_destination="org.freedesktop.NetworkManager"/>
|
||||||
<allow send_destination="org.freedesktop.NetworkManagerSystemSettings"/>
|
|
||||||
|
|
||||||
<allow send_destination="org.freedesktop.NetworkManager"
|
<allow send_destination="org.freedesktop.NetworkManager"
|
||||||
send_interface="org.freedesktop.NetworkManager.PPP"/>
|
send_interface="org.freedesktop.NetworkManager.PPP"/>
|
||||||
@@ -63,10 +60,17 @@
|
|||||||
</policy>
|
</policy>
|
||||||
<policy context="default">
|
<policy context="default">
|
||||||
<deny own="org.freedesktop.NetworkManager"/>
|
<deny own="org.freedesktop.NetworkManager"/>
|
||||||
<deny own="org.freedesktop.NetworkManagerSystemSettings"/>
|
|
||||||
|
|
||||||
<deny send_destination="org.freedesktop.NetworkManager"/>
|
<deny send_destination="org.freedesktop.NetworkManager"/>
|
||||||
<allow send_destination="org.freedesktop.NetworkManagerSystemSettings"/>
|
|
||||||
|
<allow send_destination="org.freedesktop.NetworkManager"
|
||||||
|
send_interface="org.freedesktop.NetworkManagerSettings"/>
|
||||||
|
|
||||||
|
<allow send_destination="org.freedesktop.NetworkManager"
|
||||||
|
send_interface="org.freedesktop.NetworkManagerSettings.Connection"/>
|
||||||
|
|
||||||
|
<allow send_destination="org.freedesktop.NetworkManager"
|
||||||
|
send_interface="org.freedesktop.NetworkManagerSettings.Secrets"/>
|
||||||
|
|
||||||
<deny send_destination="org.freedesktop.NetworkManager"
|
<deny send_destination="org.freedesktop.NetworkManager"
|
||||||
send_interface="org.freedesktop.NetworkManager"
|
send_interface="org.freedesktop.NetworkManager"
|
||||||
|
@@ -406,13 +406,6 @@ nm_utils_call_dispatcher (const char *action,
|
|||||||
|
|
||||||
connection_props = value_hash_create ();
|
connection_props = value_hash_create ();
|
||||||
|
|
||||||
/* Backwards compatibility for the days of user settings services:
|
|
||||||
* Claim that this connection is from the system settings service.
|
|
||||||
*/
|
|
||||||
value_hash_add_str (connection_props,
|
|
||||||
NMD_CONNECTION_PROPS_SERVICE_NAME,
|
|
||||||
NM_DBUS_SERVICE_SYSTEM_SETTINGS);
|
|
||||||
|
|
||||||
/* path */
|
/* path */
|
||||||
value_hash_add_object_path (connection_props,
|
value_hash_add_object_path (connection_props,
|
||||||
NMD_CONNECTION_PROPS_PATH,
|
NMD_CONNECTION_PROPS_PATH,
|
||||||
|
@@ -339,24 +339,6 @@ nm_dbus_manager_start_service (NMDBusManager *self)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!dbus_g_proxy_call (priv->proxy, "RequestName", &err,
|
|
||||||
G_TYPE_STRING, NM_DBUS_SERVICE_SYSTEM_SETTINGS,
|
|
||||||
G_TYPE_UINT, DBUS_NAME_FLAG_DO_NOT_QUEUE,
|
|
||||||
G_TYPE_INVALID,
|
|
||||||
G_TYPE_UINT, &result,
|
|
||||||
G_TYPE_INVALID)) {
|
|
||||||
nm_log_warn (LOGD_CORE, "Could not acquire the NetworkManagerSystemSettings service.\n"
|
|
||||||
" Message: '%s'", err->message);
|
|
||||||
g_error_free (err);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (result != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) {
|
|
||||||
nm_log_warn (LOGD_CORE, "Could not acquire the NetworkManagerSystemSettings service "
|
|
||||||
"as it is already taken.");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
priv->started = TRUE;
|
priv->started = TRUE;
|
||||||
return priv->started;
|
return priv->started;
|
||||||
}
|
}
|
||||||
|
@@ -568,7 +568,7 @@ get_one_connection (DBusGConnection *bus,
|
|||||||
g_return_if_fail (path != NULL);
|
g_return_if_fail (path != NULL);
|
||||||
g_return_if_fail (table != NULL);
|
g_return_if_fail (table != NULL);
|
||||||
|
|
||||||
proxy = dbus_g_proxy_new_for_name (bus, NM_DBUS_SERVICE_SYSTEM_SETTINGS,
|
proxy = dbus_g_proxy_new_for_name (bus, NM_DBUS_SERVICE,
|
||||||
path, NM_DBUS_IFACE_SETTINGS_CONNECTION);
|
path, NM_DBUS_IFACE_SETTINGS_CONNECTION);
|
||||||
if (!proxy)
|
if (!proxy)
|
||||||
return;
|
return;
|
||||||
@@ -619,7 +619,7 @@ get_all_connections (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
proxy = dbus_g_proxy_new_for_name (bus,
|
proxy = dbus_g_proxy_new_for_name (bus,
|
||||||
NM_DBUS_SERVICE_SYSTEM_SETTINGS,
|
NM_DBUS_SERVICE,
|
||||||
NM_DBUS_PATH_SETTINGS,
|
NM_DBUS_PATH_SETTINGS,
|
||||||
NM_DBUS_IFACE_SETTINGS);
|
NM_DBUS_IFACE_SETTINGS);
|
||||||
if (!proxy) {
|
if (!proxy) {
|
||||||
|
Reference in New Issue
Block a user