From: Thomas Haller Date: Wed, 23 Mar 2016 14:39:49 +0000 (+0100) Subject: libnm: accept invalid connections in NMVpnServicePlugin X-Git-Url: https://iam.tj/gitweb/gitweb.cgi?p=NetworkManager.git;a=commitdiff_plain;h=559ab7bd7cd886b97d23ae43b3870f71cb147d62 libnm: accept invalid connections in NMVpnServicePlugin 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. --- diff --git a/libnm/nm-vpn-plugin-old.c b/libnm/nm-vpn-plugin-old.c index 74861edc4..634e61a23 100644 --- a/libnm/nm-vpn-plugin-old.c +++ b/libnm/nm-vpn-plugin-old.c @@ -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, diff --git a/libnm/nm-vpn-service-plugin.c b/libnm/nm-vpn-service-plugin.c index 876d47981..82e29ee8a 100644 --- a/libnm/nm-vpn-service-plugin.c +++ b/libnm/nm-vpn-service-plugin.c @@ -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,