nmcli: when adding a vpn store the full service name in vpn-type

When NM looks for vpn plugins, it would expect the full service name
otherwise it will not be able to retrieve the correct plugin.
Fixes VPN configurations generated with "nmcli connection add".
This commit is contained in:
Francesco Giudici 2016-06-24 15:44:58 +02:00
parent 4c7f609d51
commit 18cd265b2d

View file

@ -26,6 +26,7 @@
#include "utils.h"
#include "common.h"
#include "nm-vpn-helpers.h"
/* Forward declarations */
static char *wep_key_type_to_string (NMWepKeyType type);
@ -2958,6 +2959,16 @@ nmc_property_set_secret_flags (NMSetting *setting, const char *prop, const char
return TRUE;
}
static gboolean
nmc_property_set_vpn_service (NMSetting *setting, const char *prop, const char *val, GError **error)
{
gs_free char *service_name = NULL;
service_name = nm_vpn_plugin_info_list_find_service_type (nm_vpn_get_plugin_infos (), val);
g_object_set (setting, prop, service_name ? : val, NULL);
return TRUE;
}
static gboolean
nmc_util_is_domain (const char *domain)
{
@ -7081,7 +7092,7 @@ nmc_properties_init (void)
/* Add editable properties for NM_SETTING_VPN_SETTING_NAME */
nmc_add_prop_funcs (GLUE (VPN, SERVICE_TYPE),
nmc_property_vpn_get_service_type,
nmc_property_set_string,
nmc_property_set_vpn_service,
NULL,
NULL,
NULL,