summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2019-03-19 08:52:08 +0100
committerThomas Haller <thaller@redhat.com>2019-03-25 09:12:32 +0100
commit0700815d6395bd391cf979b885d9cf422b91701d (patch)
tree9a0ef889ef99452077477af4f8c1b25c5ace2571
parente58ec47d1b03eb79dbd133f70684154e2ad83691 (diff)
cli: implement NM_SETTING_VPN_SECRETS with the optionlist setter
-rw-r--r--clients/common/nm-meta-setting-desc.c25
1 files changed, 5 insertions, 20 deletions
diff --git a/clients/common/nm-meta-setting-desc.c b/clients/common/nm-meta-setting-desc.c
index d07d9964f..8cfd432aa 100644
--- a/clients/common/nm-meta-setting-desc.c
+++ b/clients/common/nm-meta-setting-desc.c
@@ -4150,18 +4150,6 @@ _get_fcn_vpn_secrets (ARGS_GET_FCN)
RETURN_STR_TO_FREE (g_string_free (secret_str, FALSE));
}
-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;
-}
-
static gboolean
_remove_fcn_vpn_data (ARGS_REMOVE_FCN)
{
@@ -4170,13 +4158,6 @@ _remove_fcn_vpn_data (ARGS_REMOVE_FCN)
return TRUE;
}
-DEFINE_SETTER_OPTIONS (_set_fcn_vpn_secrets,
- NM_SETTING_VPN,
- NMSettingVpn,
- nm_setting_vpn_add_secret,
- NULL,
- _validate_vpn_hash_value)
-
static gboolean
_remove_fcn_vpn_secrets (ARGS_REMOVE_FCN)
{
@@ -6957,9 +6938,13 @@ static const NMMetaPropertyInfo *const property_infos_VPN[] = {
.is_secret = TRUE,
.property_type = DEFINE_PROPERTY_TYPE (
.get_fcn = _get_fcn_vpn_secrets,
- .set_fcn = _set_fcn_vpn_secrets,
+ .set_fcn = _set_fcn_optionlist,
.remove_fcn = _remove_fcn_vpn_secrets,
),
+ .property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (optionlist,
+ .add2_fcn = OPTIONLIST_ADD2_FCN (NMSettingVpn, nm_setting_vpn_add_secret),
+ .no_empty_value = TRUE,
+ ),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_VPN_PERSISTENT,
.property_type = &_pt_gobject_bool,