diff options
author | Thomas Haller <thaller@redhat.com> | 2019-01-09 17:03:34 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2019-01-11 11:50:15 +0100 |
commit | d61cfc1774b72c7a33feb30322e477a031b9d4f4 (patch) | |
tree | 38b47804cef21d0482178dea33cd0aa592dded4a /libnm-core/nm-setting.c | |
parent | 885c872d5a542f820afdf4e8ca59c55f39467c7a (diff) | |
download | NetworkManager-d61cfc1774b72c7a33feb30322e477a031b9d4f4.tar.gz |
libnm: assert in _nm_setting_aggregate() that we handle secret-flags
Curreently all aggregate types only care about secrets.
The check for secets is done by checking for NM_SETTING_PARAM_SECRET
flag. Assert that this check is suitable to identify a secret.
Diffstat (limited to 'libnm-core/nm-setting.c')
-rw-r--r-- | libnm-core/nm-setting.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/libnm-core/nm-setting.c b/libnm-core/nm-setting.c index bea47b3509..6749eed12e 100644 --- a/libnm-core/nm-setting.c +++ b/libnm-core/nm-setting.c @@ -1779,14 +1779,19 @@ _nm_setting_aggregate (NMSetting *setting, sett_info = _nm_sett_info_setting_get (NM_SETTING_GET_CLASS (setting)); for (i = 0; i < sett_info->property_infos_len; i++) { - GParamSpec *prop_spec = sett_info->property_infos[i].param_spec; + const NMSettInfoProperty *property_info = &sett_info->property_infos[i]; + GParamSpec *prop_spec = property_info->param_spec; nm_auto_unset_gvalue GValue value = G_VALUE_INIT; NMSettingSecretFlags secret_flags; - if (!prop_spec) - continue; - if (!NM_FLAGS_HAS (prop_spec->flags, NM_SETTING_PARAM_SECRET)) + if ( !prop_spec + || !NM_FLAGS_HAS (prop_spec->flags, NM_SETTING_PARAM_SECRET)) { + nm_assert (!nm_setting_get_secret_flags (setting, property_info->name, NULL, NULL)); continue; + } + + /* for the moment, all aggregate types only care about secrets. */ + nm_assert (nm_setting_get_secret_flags (setting, property_info->name, NULL, NULL)); switch (type) { |