core: be strict about connection argument for Reapply() D-Bus method
authorThomas Haller <thaller@redhat.com>
Wed, 23 Mar 2016 14:50:20 +0000 (15:50 +0100)
committerThomas Haller <thaller@redhat.com>
Sat, 26 Mar 2016 11:10:54 +0000 (12:10 +0100)
There is no excuse for clients to send connections to NetworkManager
that have invalid/unknown fields. Just reject them.

As Reapply() is new API in nm-1-1, there is no problem with backward
compatibility.

src/devices/nm-device.c

index 4f92ec1..33d33fa 100644 (file)
@@ -7369,7 +7369,10 @@ impl_device_reapply (NMDevice *self,
 
        if (settings && g_variant_n_children (settings)) {
                /* New settings specified inline. */
-               connection = nm_simple_connection_new_from_dbus (settings, &error);
+               connection = _nm_simple_connection_new_from_dbus (settings,
+                                                                   NM_SETTING_PARSE_FLAGS_STRICT
+                                                                 | NM_SETTING_PARSE_FLAGS_NORMALIZE,
+                                                                 &error);
                if (!connection) {
                        g_prefix_error (&error, "The settings specified are invalid: ");
                        nm_audit_log_device_op (NM_AUDIT_OP_DEVICE_REAPPLY, self, FALSE, context, error->message);