summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2014-11-27 15:59:08 +0100
committerThomas Haller <thaller@redhat.com>2014-12-05 11:04:20 +0100
commitcd025f05f7b0a2970ead8db3f093b9da4c324c8b (patch)
tree75777be3f5165ac5dc5085ff6308664fb546198e
parent9e2203c418816578c2b5c2f73a739024c7fef202 (diff)
downloadNetworkManager-cd025f05f7b0a2970ead8db3f093b9da4c324c8b.tar.gz
libnm: normalize connections in nm_simple_connection_new_from_dbus()
Before we would just call verify() and only return valid connections without attempting to fix them. It is better to use normalize(), because that function is especially there to accept and repair deprecated configurations that would no longer verify(). This changes behavior in the way that the function now accepts connections that would have been rejected before. Since commit b88715e05bc16c40ae68958c58aa86c2ad029a82 normalize() also adds a missing UUID. Hence this also affects the DBUS method 'AddConnection' in that it now accepts connections without UUID. Previously, clients were required to set a UUID for the new connection, now NM core can create a random one if no UUID is set. https://bugzilla.gnome.org/show_bug.cgi?id=740813
-rw-r--r--libnm-core/nm-simple-connection.c2
-rw-r--r--libnm-core/tests/test-general.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/libnm-core/nm-simple-connection.c b/libnm-core/nm-simple-connection.c
index 93cc4c786a..c67f624454 100644
--- a/libnm-core/nm-simple-connection.c
+++ b/libnm-core/nm-simple-connection.c
@@ -73,7 +73,7 @@ nm_simple_connection_new_from_dbus (GVariant *dict, GError **error)
connection = nm_simple_connection_new ();
if ( !nm_connection_replace_settings (connection, dict, error)
- || !nm_connection_verify (connection, error))
+ || !nm_connection_normalize (connection, NULL, NULL, error))
g_clear_object (&connection);
return connection;
}
diff --git a/libnm-core/tests/test-general.c b/libnm-core/tests/test-general.c
index 91d421190c..46d58ca3d9 100644
--- a/libnm-core/tests/test-general.c
+++ b/libnm-core/tests/test-general.c
@@ -1424,7 +1424,7 @@ test_connection_new_from_dbus (void)
g_assert_cmpstr (nm_setting_connection_get_uuid (s_con), ==, uuid);
g_assert (nm_connection_get_setting_wired (connection));
- g_assert (!nm_connection_get_setting_ip4_config (connection));
+ g_assert (nm_connection_get_setting_ip4_config (connection));
s_ip6 = nm_connection_get_setting_ip6_config (connection);
g_assert (s_ip6);