[network-manager-applet] applet: fix crash constructing GVariant for secrets
- From: Thomas Haller <thaller src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-applet] applet: fix crash constructing GVariant for secrets
- Date: Wed, 3 Jun 2015 09:31:40 +0000 (UTC)
commit 8664b54ade13af1e747c71de9ceab0572f2643e3
Author: Thomas Haller <thaller redhat com>
Date: Wed Jun 3 10:41:02 2015 +0200
applet: fix crash constructing GVariant for secrets
g_variant_builder_add() with format string "{sa{sv}}" requires a GVariantBuilder
argument for "a{sv}", not GVariant.
An alternative fix would be to replace the format string by
"{s a{sv}}".
Fixes: 3722a190468f5ce5898db8838611bc826d3153f1
src/applet-agent.c | 15 +++++++--------
1 files changed, 7 insertions(+), 8 deletions(-)
---
diff --git a/src/applet-agent.c b/src/applet-agent.c
index 794ff67..0c61c62 100644
--- a/src/applet-agent.c
+++ b/src/applet-agent.c
@@ -281,8 +281,8 @@ keyring_find_secrets_cb (GObject *source,
GError *error = NULL;
GError *search_error = NULL;
const char *connection_id = NULL;
- GVariantBuilder builder;
- GVariant *secrets = NULL, *settings = NULL;
+ GVariantBuilder builder_setting, builder_connection;
+ GVariant *settings = NULL;
GList *list = NULL;
GList *iter;
gboolean hint_found = FALSE, ask = FALSE;
@@ -323,7 +323,7 @@ keyring_find_secrets_cb (GObject *source,
return;
}
- g_variant_builder_init (&builder, NM_VARIANT_TYPE_SETTING);
+ g_variant_builder_init (&builder_setting, NM_VARIANT_TYPE_SETTING);
/* Extract the secrets from the list of matching keyring items */
for (iter = list; iter != NULL; iter = g_list_next (iter)) {
@@ -342,7 +342,7 @@ keyring_find_secrets_cb (GObject *source,
continue;
}
- g_variant_builder_add (&builder, "{sv}", key_name,
+ g_variant_builder_add (&builder_setting, "{sv}", key_name,
g_variant_new_string (secret_value_get (secret, NULL)));
/* See if this property matches a given hint */
@@ -356,7 +356,6 @@ keyring_find_secrets_cb (GObject *source,
break;
}
}
- secrets = g_variant_builder_end (&builder);
/* If there were hints, and none of the hints were returned by the keyring,
* get some new secrets.
@@ -375,9 +374,9 @@ keyring_find_secrets_cb (GObject *source,
/* Returned secrets are a{sa{sv}}; this is the outer a{s...} hash that
* will contain all the individual settings hashes.
*/
- g_variant_builder_init (&builder, NM_VARIANT_TYPE_CONNECTION);
- g_variant_builder_add (&builder, "{sa{sv}}", r->setting_name, secrets);
- settings = g_variant_builder_end (&builder);
+ g_variant_builder_init (&builder_connection, NM_VARIANT_TYPE_CONNECTION);
+ g_variant_builder_add (&builder_connection, "{sa{sv}}", r->setting_name, &builder_setting);
+ settings = g_variant_builder_end (&builder_connection);
done:
g_list_free_full (list, g_object_unref);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]