diff options
-rw-r--r-- | libnm-core/nm-setting-private.h | 4 | ||||
-rw-r--r-- | libnm-core/nm-setting-vpn.c | 4 | ||||
-rw-r--r-- | libnm-core/nm-setting.c | 11 | ||||
-rw-r--r-- | libnm-core/tests/test-setting.c | 3 |
4 files changed, 14 insertions, 8 deletions
diff --git a/libnm-core/nm-setting-private.h b/libnm-core/nm-setting-private.h index 0b7509d8c1..a85237e0bb 100644 --- a/libnm-core/nm-setting-private.h +++ b/libnm-core/nm-setting-private.h @@ -67,6 +67,10 @@ gboolean _nm_setting_clear_secrets (NMSetting *setting, */ #define NM_SETTING_PARAM_REAPPLY_IMMEDIATELY (1 << (6 + G_PARAM_USER_SHIFT)) +/* property_to_dbus() should ignore the property flags, and instead always calls to_dbus_fcn() + */ +#define NM_SETTING_PARAM_TO_DBUS_IGNORE_FLAGS (1 << (7 + G_PARAM_USER_SHIFT)) + extern const NMSettInfoPropertType nm_sett_info_propert_type_deprecated_interface_name; extern const NMSettInfoPropertType nm_sett_info_propert_type_deprecated_ignore_i; extern const NMSettInfoPropertType nm_sett_info_propert_type_deprecated_ignore_u; diff --git a/libnm-core/nm-setting-vpn.c b/libnm-core/nm-setting-vpn.c index 4adc0bc8ca..bc30f47641 100644 --- a/libnm-core/nm-setting-vpn.c +++ b/libnm-core/nm-setting-vpn.c @@ -921,6 +921,9 @@ vpn_secrets_to_dbus (const NMSettInfoSetting *sett_info, const char *key, *value; NMSettingSecretFlags secret_flags; + if (NM_FLAGS_HAS (flags, NM_CONNECTION_SERIALIZE_NO_SECRETS)) + return NULL; + g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{ss}")); g_object_get (setting, property_name, &secrets, NULL); @@ -1150,6 +1153,7 @@ nm_setting_vpn_class_init (NMSettingVpnClass *klass) G_TYPE_HASH_TABLE, G_PARAM_READWRITE | NM_SETTING_PARAM_SECRET | + NM_SETTING_PARAM_TO_DBUS_IGNORE_FLAGS | G_PARAM_STATIC_STRINGS); _nm_properties_override_gobj (properties_override, obj_properties[PROP_SECRETS], 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() */ diff --git a/libnm-core/tests/test-setting.c b/libnm-core/tests/test-setting.c index e6a7e900b2..1cbdf07cd0 100644 --- a/libnm-core/tests/test-setting.c +++ b/libnm-core/tests/test-setting.c @@ -3487,6 +3487,9 @@ test_setting_metadata (void) else g_assert_cmpstr (g_value_get_string (&val), ==, default_value); } + + if (NM_FLAGS_HAS (sip->param_spec->flags, NM_SETTING_PARAM_TO_DBUS_IGNORE_FLAGS)) + g_assert (sip->property_type->to_dbus_fcn); } } |