mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-27 04:40:09 +01:00
cli: fix an error in nmcli editor when setting vpn.data/vpn.secrets
nmcli> set vpn.data haha=
(process:3951): libnm-CRITICAL **: nm_setting_vpn_add_data_item: assertion 'strlen (item) > 0' failed
nmcli> set vpn.secrets haha=
(process:3951): libnm-CRITICAL **: nm_setting_vpn_add_secret: assertion 'strlen (secret) > 0' failed
(cherry picked from commit 5f9b8b887d)
This commit is contained in:
parent
9012e61bfb
commit
00bfaa4ed7
1 changed files with 15 additions and 2 deletions
|
|
@ -4150,13 +4150,26 @@ nmc_property_vlan_remove_egress_priority_map (NMSetting *setting,
|
|||
}
|
||||
|
||||
/* --- NM_SETTING_VPN_SETTING_NAME property setter functions --- */
|
||||
/* Validate value of vpn 'data' and 'secret' options */
|
||||
static const char *
|
||||
_validate_vpn_hash_value (const char *option, const char *value, GError **error)
|
||||
{
|
||||
/* nm_setting_vpn_add_data_item() and nm_setting_vpn_add_secret() does not
|
||||
* allow empty strings */
|
||||
if (!value || !*value) {
|
||||
g_set_error (error, 1, 0, _("'%s' cannot be empty"), option);
|
||||
return NULL;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
/* 'data' */
|
||||
DEFINE_SETTER_OPTIONS (nmc_property_vpn_set_data,
|
||||
NM_SETTING_VPN,
|
||||
NMSettingVpn,
|
||||
nm_setting_vpn_add_data_item,
|
||||
NULL,
|
||||
NULL)
|
||||
_validate_vpn_hash_value)
|
||||
DEFINE_REMOVER_OPTION (nmc_property_vpn_remove_option_data,
|
||||
NM_SETTING_VPN,
|
||||
nm_setting_vpn_remove_data_item)
|
||||
|
|
@ -4167,7 +4180,7 @@ DEFINE_SETTER_OPTIONS (nmc_property_vpn_set_secrets,
|
|||
NMSettingVpn,
|
||||
nm_setting_vpn_add_secret,
|
||||
NULL,
|
||||
NULL)
|
||||
_validate_vpn_hash_value)
|
||||
DEFINE_REMOVER_OPTION (nmc_property_vpn_remove_option_secret,
|
||||
NM_SETTING_VPN,
|
||||
nm_setting_vpn_remove_secret)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue