summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2019-01-31 10:02:45 +0100
committerThomas Haller <thaller@redhat.com>2019-02-04 11:00:17 +0100
commitd3144b99a94f9c0aae8fea872925155c0feb2165 (patch)
treee81a99b0ba95be5a3e674f19f519854a2672836a
parentd6e48194cd81e616fa69954e3c813d0ac9a4a62b (diff)
downloadNetworkManager-d3144b99a94f9c0aae8fea872925155c0feb2165.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);