diff options
author | Thomas Haller <thaller@redhat.com> | 2019-09-24 18:25:00 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2019-09-27 12:25:31 +0200 |
commit | 05b46029bff915b965e76ebbee9ddc7f194728ca (patch) | |
tree | 26c4dccd071d79b9548800109044ae513e4e2e45 /libnm-core/nm-setting.c | |
parent | aca2360cccae19c21f9b7a220b2246d92f099ea9 (diff) | |
download | NetworkManager-th/libnm-properties-override.tar.gz |
libnm: don't special case "vpn.secrets" property in property_to_dbus()th/libnm-properties-override
"nm-setting.c" (and property_to_dbus()) should stay independent of
actualy settings implementations. Instead, the property-info should
control the behavior.
What I like about this change is also that the generic handling is not a
flags "handle_secrets_for_vpn", but it just says to skip checking the
param-spec flags and directly call the to_dbus_fcn(). It's just a
generally useful thing to do, to let the to_dbus_fcn() function also
handle checking the property flags. The fact that only vpn.secrets
properties uses this for a certain pupose, is abstracted in a way that
makes sense.
Diffstat (limited to 'libnm-core/nm-setting.c')
-rw-r--r-- | libnm-core/nm-setting.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/libnm-core/nm-setting.c b/libnm-core/nm-setting.c index d4bd9bc764..6f77282b70 100644 --- a/libnm-core/nm-setting.c +++ b/libnm-core/nm-setting.c @@ -586,7 +586,8 @@ property_to_dbus (const NMSettInfoSetting *sett_info, if (!property->param_spec) { if (!property->property_type->to_dbus_fcn) return NULL; - } else if (!ignore_flags) { + } else if ( !ignore_flags + && !NM_FLAGS_HAS (property->param_spec->flags, NM_SETTING_PARAM_TO_DBUS_IGNORE_FLAGS)) { if (!NM_FLAGS_HAS (property->param_spec->flags, G_PARAM_WRITABLE)) return NULL; @@ -598,13 +599,7 @@ property_to_dbus (const NMSettInfoSetting *sett_info, if (NM_FLAGS_HAS (flags, NM_CONNECTION_SERIALIZE_NO_SECRETS)) return NULL; - /* Check agent secrets. Secrets in the vpn.secrets property are special as - * the flag for each of them is specified as a separate key in the - * vpn.data property. They are handled separately in the to_dbus_fcn() - * of VPN setting. */ - if ( NM_FLAGS_HAS (flags, NM_CONNECTION_SERIALIZE_WITH_SECRETS_AGENT_OWNED) - && !nm_streq (nm_setting_get_name (setting), NM_SETTING_VPN_SETTING_NAME) - && !nm_streq (property->name, NM_SETTING_VPN_SECRETS)) { + if (NM_FLAGS_HAS (flags, NM_CONNECTION_SERIALIZE_WITH_SECRETS_AGENT_OWNED)) { NMSettingSecretFlags f; /* see also _nm_connection_serialize_secrets() */ |