[network-manager-applet] applet: don't overwrite already-migrated certificate paths (rh #682288)



commit 145069e46e9e039cf8b113b6ca55090e7abdd628
Author: Dan Williams <dcbw redhat com>
Date:   Tue Mar 8 16:51:27 2011 -0600

    applet: don't overwrite already-migrated certificate paths (rh #682288)

 src/gconf-helpers/gconf-helpers.c |   25 +++++++++++++++++++++++++
 src/gconf-helpers/gconf-helpers.h |    6 ++++++
 src/gconf-helpers/gconf-upgrade.c |    4 ++++
 3 files changed, 35 insertions(+), 0 deletions(-)
---
diff --git a/src/gconf-helpers/gconf-helpers.c b/src/gconf-helpers/gconf-helpers.c
index 48092bc..cd0963a 100644
--- a/src/gconf-helpers/gconf-helpers.c
+++ b/src/gconf-helpers/gconf-helpers.c
@@ -1608,6 +1608,31 @@ out:
 	return success;
 }
 
+
+gboolean
+nm_gconf_key_is_set (GConfClient *client,
+                     const char *path,
+                     const char *key,
+                     const char *setting)
+{
+	char *gc_key;
+	GConfValue *gc_value;
+	gboolean exists = FALSE;
+
+	g_return_val_if_fail (path != NULL, FALSE);
+	g_return_val_if_fail (key != NULL, FALSE);
+	g_return_val_if_fail (setting != NULL, FALSE);
+
+	gc_key = g_strdup_printf ("%s/%s/%s", path, setting, key);
+	gc_value = gconf_client_get (client, gc_key, NULL);
+	if (gc_value) {
+		exists = TRUE;
+		gconf_value_free (gc_value);
+	}
+	g_free (gc_key);
+	return exists;
+}
+
 GSList *
 nm_gconf_get_all_connections (GConfClient *client)
 {
diff --git a/src/gconf-helpers/gconf-helpers.h b/src/gconf-helpers/gconf-helpers.h
index d5280dd..66bd020 100644
--- a/src/gconf-helpers/gconf-helpers.h
+++ b/src/gconf-helpers/gconf-helpers.h
@@ -245,6 +245,12 @@ nm_gconf_set_ip6route_array_helper (GConfClient *client,
 									const char *setting,
 									GPtrArray *value);
 
+gboolean
+nm_gconf_key_is_set (GConfClient *client,
+                     const char *path,
+                     const char *key,
+                     const char *setting);
+
 GSList *
 nm_gconf_get_all_connections (GConfClient *client);
 
diff --git a/src/gconf-helpers/gconf-upgrade.c b/src/gconf-helpers/gconf-upgrade.c
index b969287..73dcdfa 100644
--- a/src/gconf-helpers/gconf-upgrade.c
+++ b/src/gconf-helpers/gconf-upgrade.c
@@ -1915,6 +1915,10 @@ copy_one_cert_value (GConfClient *client,
 {
 	char *path = NULL;
 
+	/* Do nothing if already migrated */
+	if (nm_gconf_key_is_set (client, dir, key, NM_SETTING_802_1X_SETTING_NAME))
+		return;
+
 	if (nm_gconf_get_string_helper (client, dir,
 	                                tag,
 	                                NM_SETTING_802_1X_SETTING_NAME,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]