summaryrefslogtreecommitdiff
path: root/libnm-core/nm-setting-wireless.c
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2019-01-02 15:54:18 +0100
committerThomas Haller <thaller@redhat.com>2019-01-07 10:09:10 +0100
commite8bf89a90679274609c7e9b8fcb7b2ef13f89b83 (patch)
treefbe1617b3294504348dab2a0e404c69188f6e2ee /libnm-core/nm-setting-wireless.c
parent1b361aaea9e8d024de73330235cc1d0ae515b112 (diff)
downloadNetworkManager-e8bf89a90679274609c7e9b8fcb7b2ef13f89b83.tar.gz
libnm: pass serialization flags to settings synth_func()
We will need access to the serialization flags from within the synth_func(). That will be for WireGuard's peers. Peers are a list of complex, structured elements, and some fields (the peer's preshared-key) are secret and others are not. So when serializing the peers, we need to know whether to include secrets or not. Instead of letting _nm_setting_to_dbus() check the flags, pass them down. While at it, don't pass the property_name argument. Instead, pass the entire meta-data information we have. Most synth functions don't care about the property or the name either way. But we should not pre-filter information that we have at hand. Just pass it to the synth function. If the synth function would be public API, that would be a reason to be careful about what we pass. But it isn't and it only has one caller. So passing it along is fine. Also, do it now when adding the flags argument, as we touch all synth implementations anyway.
Diffstat (limited to 'libnm-core/nm-setting-wireless.c')
-rw-r--r--libnm-core/nm-setting-wireless.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/libnm-core/nm-setting-wireless.c b/libnm-core/nm-setting-wireless.c
index 31eda97fa8..02ff534b2f 100644
--- a/libnm-core/nm-setting-wireless.c
+++ b/libnm-core/nm-setting-wireless.c
@@ -949,17 +949,22 @@ compare_property (NMSetting *setting,
/*****************************************************************************/
static GVariant *
-nm_setting_wireless_get_security (NMSetting *setting,
+nm_setting_wireless_get_security (const NMSettInfoSetting *sett_info,
+ guint property_idx,
NMConnection *connection,
- const char *property_name)
+ NMSetting *setting,
+ NMConnectionSerializationFlags flags)
{
+ if (flags & NM_CONNECTION_SERIALIZE_ONLY_SECRETS)
+ return NULL;
+
if (!connection)
return NULL;
- if (nm_connection_get_setting_wireless_security (connection))
- return g_variant_new_string (NM_SETTING_WIRELESS_SECURITY_SETTING_NAME);
- else
+ if (!nm_connection_get_setting_wireless_security (connection))
return NULL;
+
+ return g_variant_new_string (NM_SETTING_WIRELESS_SECURITY_SETTING_NAME);
}
/**