diff options
author | Thomas Haller <thaller@redhat.com> | 2018-04-12 14:02:39 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2018-04-18 07:55:15 +0200 |
commit | 5c4a6e9b6dfc5fe432c0bfacb4ae64a19b17042d (patch) | |
tree | b73d59ab595a7cf453c8e58df3bc74d353728d0d | |
parent | 10753c36168a82cd658df8a7da800960fddd78ed (diff) | |
download | NetworkManager-5c4a6e9b6dfc5fe432c0bfacb4ae64a19b17042d.tar.gz |
manager: ensure valid specific_object path is passed to _new_active_connection()
From the D-Bus layer, no specific-object is represented by "/". We
should early on normalize such values to NULL, and not expect or
handle them later (like during _new_active_connection()).
-rw-r--r-- | src/nm-manager.c | 19 | ||||
-rw-r--r-- | src/vpn/nm-vpn-connection.c | 1 |
2 files changed, 10 insertions, 10 deletions
diff --git a/src/nm-manager.c b/src/nm-manager.c index 67171e4b9a..f39035dbd3 100644 --- a/src/nm-manager.c +++ b/src/nm-manager.c @@ -4008,7 +4008,14 @@ _new_active_connection (NMManager *self, nm_assert ( ( is_vpn && !device) || (!is_vpn && NM_IS_DEVICE (device))); + nm_assert (!nm_streq0 (specific_object, "/")); + + if (NM_IS_SETTINGS_CONNECTION (connection)) + settings_connection = (NMSettingsConnection *) connection; + if (is_vpn) { + NMActiveConnection *parent; + /* FIXME: for VPN connections, we don't allow re-activating an * already active connection. It's a bug, and should be fixed together * when reworking VPN handling. */ @@ -4018,15 +4025,6 @@ _new_active_connection (NMManager *self, nm_connection_get_id (connection)); return NULL; } - } - - specific_object = nm_utils_dbus_normalize_object_path (specific_object); - - if (NM_IS_SETTINGS_CONNECTION (connection)) - settings_connection = (NMSettingsConnection *) connection; - - if (is_vpn) { - NMActiveConnection *parent = NULL; /* FIXME: apparently, activation here only works if @connection is * a settings-connection. Which is not the case during AddAndActivatate. @@ -4173,6 +4171,7 @@ nm_manager_activate_connection (NMManager *self, g_return_val_if_fail (NM_IS_SETTINGS_CONNECTION (connection), NULL); g_return_val_if_fail (NM_IS_DEVICE (device), NULL); g_return_val_if_fail (!error || !*error, NULL); + nm_assert (!nm_streq0 (specific_object, "/")); priv = NM_MANAGER_GET_PRIVATE (self); @@ -4192,7 +4191,7 @@ nm_manager_activate_connection (NMManager *self, active = iter->data; if ( connection == nm_active_connection_get_settings_connection (active) - && g_strcmp0 (nm_active_connection_get_specific_object (active), specific_object) == 0 + && nm_streq0 (nm_active_connection_get_specific_object (active), specific_object) && nm_active_connection_get_device (active) == device && nm_auth_subject_is_internal (nm_active_connection_get_subject (active)) && nm_auth_subject_is_internal (subject) diff --git a/src/vpn/nm-vpn-connection.c b/src/vpn/nm-vpn-connection.c index dd7be77492..436fc68b47 100644 --- a/src/vpn/nm-vpn-connection.c +++ b/src/vpn/nm-vpn-connection.c @@ -855,6 +855,7 @@ nm_vpn_connection_new (NMSettingsConnection *settings_connection, { g_return_val_if_fail (!settings_connection || NM_IS_SETTINGS_CONNECTION (settings_connection), NULL); g_return_val_if_fail (NM_IS_DEVICE (parent_device), NULL); + g_return_val_if_fail (specific_object, NULL); return (NMVpnConnection *) g_object_new (NM_TYPE_VPN_CONNECTION, NM_ACTIVE_CONNECTION_INT_SETTINGS_CONNECTION, settings_connection, |