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



commit 8f1dce5152554b5bcececfef8832170fb1bbb0f6
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 2e0db07..19ca925 100644
--- a/src/gconf-helpers/gconf-helpers.c
+++ b/src/gconf-helpers/gconf-helpers.c
@@ -1637,6 +1637,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 edece41..8576bc6 100644
--- a/src/gconf-helpers/gconf-helpers.h
+++ b/src/gconf-helpers/gconf-helpers.h
@@ -247,6 +247,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 d54ebd5..6a0697f 100644
--- a/src/gconf-helpers/gconf-upgrade.c
+++ b/src/gconf-helpers/gconf-upgrade.c
@@ -1916,6 +1916,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]