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-04 18:12:30 +0100
commit0376aaea2896aa094aedb99e36371c60422dfdf6 (patch)
tree440412a05e55a2c8273f7b9777639eb093337f36
parent87f2b92da3b6775dfb21fa2973c28c31a31edcdd (diff)
downloadNetworkManager-th/add-connection-uuid-bgo740813.tar.gz
libnm: normalize connections in nm_simple_connection_new_from_dbus()th/add-connection-uuid-bgo740813
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);