From e08db5cae5873b0ad68e6be7d87e5a1d9ae0cb14 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Sat, 12 Feb 2011 22:37:33 -0600 Subject: [PATCH] libnm-util: warn if trying to set NULL VPN secrets --- libnm-util/nm-setting-vpn.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/libnm-util/nm-setting-vpn.c b/libnm-util/nm-setting-vpn.c index 7cf2470271..53884f9db6 100644 --- a/libnm-util/nm-setting-vpn.c +++ b/libnm-util/nm-setting-vpn.c @@ -316,8 +316,18 @@ update_secret_hash (NMSetting *setting, /* Now add the items to the settings' secrets list */ g_hash_table_iter_init (&iter, secrets); - while (g_hash_table_iter_next (&iter, (gpointer *) &name, (gpointer *) &value)) + while (g_hash_table_iter_next (&iter, (gpointer *) &name, (gpointer *) &value)) { + if (value == NULL) { + g_warn_if_fail (value != NULL); + continue; + } + if (strlen (value) == 0) { + g_warn_if_fail (strlen (value) > 0); + continue; + } + g_hash_table_insert (priv->secrets, g_strdup (name), g_strdup (value)); + } return TRUE; }