summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2019-01-31 10:02:45 +0100
committerThomas Haller <thaller@redhat.com>2019-01-31 10:03:40 +0100
commitcf1263ba648e70b5badd822ccacf49f8bbfc1ab1 (patch)
tree3487dc4e981f8f793049c089a40401ebe4ab7846
parent01fabaf96563893282bfe597a2b42d4562776e55 (diff)
downloadNetworkManager-cf1263ba648e70b5badd822ccacf49f8bbfc1ab1.tar.gz
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.
-rw-r--r--src/settings/nm-settings-connection.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/settings/nm-settings-connection.c b/src/settings/nm-settings-connection.c
index c00cba4509..68efe8d31c 100644
--- a/src/settings/nm-settings-connection.c
+++ b/src/settings/nm-settings-connection.c
@@ -268,6 +268,13 @@ for_each_secret (NMConnection *self,
GVariantIter vpn_secrets_iter;
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 */
g_variant_builder_init (&vpn_secrets_builder, G_VARIANT_TYPE ("a{ss}"));
g_variant_iter_init (&vpn_secrets_iter, val);