libnm: accept invalid connections in NMVpnServicePlugin
authorThomas Haller <thaller@redhat.com>
Wed, 23 Mar 2016 14:39:49 +0000 (15:39 +0100)
committerThomas Haller <thaller@redhat.com>
Sat, 26 Mar 2016 11:10:54 +0000 (12:10 +0100)
When we receive a connection from NetworkManager it is not guaranteed
that the connection verifies. For example, if the current libnm version
is older then the NetworkManager version.

Be more accepting and don't do any verification of the connection.

For NMVpnPluginOld this change is uncritical, because there are probably
no users of this API anyway.

NMVpnServicePlugin is new API since nm-1-1. However, this API is already
strongly used by all the plugins we ported over. So this change is
affecting them.
This should only matter if libnm's and NetworkManager's version differ,
because NetworkManager just doesn't send out an invalid connection. It
actually only matters if NetworkManager is a newer version and sends an
invalid connection to the client. That is anyway badly tested and probably
this changes rather improves compatibility than breaking existing users.

libnm/nm-vpn-plugin-old.c
libnm/nm-vpn-service-plugin.c

index 74861ed..634e61a 100644 (file)
@@ -465,7 +465,7 @@ _connect_generic (NMVpnPluginOld *plugin,
                return;
        }
 
-       connection = nm_simple_connection_new_from_dbus (properties, &error);
+       connection = _nm_simple_connection_new_from_dbus (properties, NM_SETTING_PARSE_FLAGS_BEST_EFFORT, &error);
        if (!connection) {
                g_dbus_method_invocation_return_error (context,
                                                       NM_VPN_PLUGIN_ERROR,
@@ -547,7 +547,7 @@ impl_vpn_plugin_old_need_secrets (NMVpnPluginOld *plugin,
        gboolean needed;
        GError *error = NULL;
 
-       connection = nm_simple_connection_new_from_dbus (properties, &error);
+       connection = _nm_simple_connection_new_from_dbus (properties, NM_SETTING_PARSE_FLAGS_BEST_EFFORT, &error);
        if (!connection) {
                g_dbus_method_invocation_return_error (context,
                                                       NM_VPN_PLUGIN_ERROR,
@@ -606,7 +606,7 @@ impl_vpn_plugin_old_new_secrets (NMVpnPluginOld *plugin,
                return;
        }
 
-       connection = nm_simple_connection_new_from_dbus (properties, &error);
+       connection = _nm_simple_connection_new_from_dbus (properties, NM_SETTING_PARSE_FLAGS_BEST_EFFORT, &error);
        if (!connection) {
                g_dbus_method_invocation_return_error (context,
                                                       NM_VPN_PLUGIN_ERROR,
index 876d479..82e29ee 100644 (file)
@@ -481,7 +481,7 @@ _connect_generic (NMVpnServicePlugin *plugin,
                return;
        }
 
-       connection = nm_simple_connection_new_from_dbus (properties, &error);
+       connection = _nm_simple_connection_new_from_dbus (properties, NM_SETTING_PARSE_FLAGS_BEST_EFFORT, &error);
        if (!connection) {
                g_dbus_method_invocation_return_error (context,
                                                       NM_VPN_PLUGIN_ERROR,
@@ -567,7 +567,7 @@ impl_vpn_service_plugin_need_secrets (NMVpnServicePlugin *plugin,
        gboolean needed;
        GError *error = NULL;
 
-       connection = nm_simple_connection_new_from_dbus (properties, &error);
+       connection = _nm_simple_connection_new_from_dbus (properties, NM_SETTING_PARSE_FLAGS_BEST_EFFORT, &error);
        if (!connection) {
                g_dbus_method_invocation_return_error (context,
                                                       NM_VPN_PLUGIN_ERROR,
@@ -626,7 +626,7 @@ impl_vpn_service_plugin_new_secrets (NMVpnServicePlugin *plugin,
                return;
        }
 
-       connection = nm_simple_connection_new_from_dbus (properties, &error);
+       connection = _nm_simple_connection_new_from_dbus (properties, NM_SETTING_PARSE_FLAGS_BEST_EFFORT, &error);
        if (!connection) {
                g_dbus_method_invocation_return_error (context,
                                                       NM_VPN_PLUGIN_ERROR,