From ec4a12ecdbebbca5b8108e1611e95fa93b43d637 Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Tue, 23 Apr 2019 22:01:15 +0200 Subject: [PATCH] cli: complete 802.1x certificate file names --- clients/common/nm-meta-setting-desc.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/clients/common/nm-meta-setting-desc.c b/clients/common/nm-meta-setting-desc.c index d70cf3c9a..c7a7fe54b 100644 --- a/clients/common/nm-meta-setting-desc.c +++ b/clients/common/nm-meta-setting-desc.c @@ -2294,6 +2294,26 @@ _set_fcn_cert_8021x (ARGS_SET_FCN) } } +static const char *const* +_complete_fcn_cert_8021x (ARGS_COMPLETE_FCN) +{ + const NMSetting8021xSchemeVtable *vtable; + + vtable = &nm_setting_8021x_scheme_vtable[property_info->property_typ_data->subtype.cert_8021x.scheme_type]; + + if (vtable->is_secret) { + gs_free const char **strv = NULL; + + strv = nm_utils_escaped_tokens_split (text, NM_ASCII_SPACES); + /* don't try to complete the password */ + if (NM_PTRARRAY_LEN (strv) > 1) + return NULL; + } + + NM_SET_OUT (out_complete_filename, TRUE); + return NULL; +} + static gconstpointer _get_fcn_bond_options (ARGS_GET_FCN) { @@ -4437,6 +4457,7 @@ static const NMMetaPropertyType _pt_dcb = { static const NMMetaPropertyType _pt_cert_8021x = { .get_fcn = _get_fcn_cert_8021x, .set_fcn = _set_fcn_cert_8021x, + .complete_fcn = _complete_fcn_cert_8021x, }; static const NMMetaPropertyType _pt_ethtool = {