Commit 5eac2415 authored by Thomas Haller's avatar Thomas Haller

settings: fix for_each_secret() to check variant type of VPN secrets

We cannot just blindly assume that the variant is of the right type
to iterate over it.
parent cabc1ddc
...@@ -268,6 +268,13 @@ for_each_secret (NMConnection *self, ...@@ -268,6 +268,13 @@ for_each_secret (NMConnection *self,
GVariantIter vpn_secrets_iter; GVariantIter vpn_secrets_iter;
const char *vpn_secret_name, *secret; const char *vpn_secret_name, *secret;
if (!g_variant_is_of_type (val, G_VARIANT_TYPE ("a{ss}"))) {
/* invalid type. Silently ignore the secrets as we cannot find out the
* secret-flags. */
g_variant_unref (val);
continue;
}
/* Iterate through each secret from the VPN dict in the overall secrets dict */ /* Iterate through each secret from the VPN dict in the overall secrets dict */
g_variant_builder_init (&vpn_secrets_builder, G_VARIANT_TYPE ("a{ss}")); g_variant_builder_init (&vpn_secrets_builder, G_VARIANT_TYPE ("a{ss}"));
g_variant_iter_init (&vpn_secrets_iter, val); g_variant_iter_init (&vpn_secrets_iter, val);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment