network-manager-applet r1177 - in branches/NETWORKMANAGER_APPLET_0_7: . src/connection-editor src/gconf-helpers



Author: dcbw
Date: Tue Feb 17 23:06:06 2009
New Revision: 1177
URL: http://svn.gnome.org/viewvc/network-manager-applet?rev=1177&view=rev

Log:
2009-02-17  Dan Williams  <dcbw redhat com>

	* src/gconf-helpers/gconf-helpers.c
	  src/gconf-helpers/gconf-helpers.h
		- (nm_gconf_clear_keyring_items): clear keyring items for a
			connection

	* src/connection-editor/nm-connection-list.c
		- (remove_connection): clear keyring items when removing a user connection



Modified:
   branches/NETWORKMANAGER_APPLET_0_7/ChangeLog
   branches/NETWORKMANAGER_APPLET_0_7/src/connection-editor/nm-connection-list.c
   branches/NETWORKMANAGER_APPLET_0_7/src/gconf-helpers/gconf-helpers.c
   branches/NETWORKMANAGER_APPLET_0_7/src/gconf-helpers/gconf-helpers.h

Modified: branches/NETWORKMANAGER_APPLET_0_7/src/connection-editor/nm-connection-list.c
==============================================================================
--- branches/NETWORKMANAGER_APPLET_0_7/src/connection-editor/nm-connection-list.c	(original)
+++ branches/NETWORKMANAGER_APPLET_0_7/src/connection-editor/nm-connection-list.c	Tue Feb 17 23:06:06 2009
@@ -419,7 +419,10 @@
 		s_con = (NMSettingConnection *) nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION);
 		g_assert (s_con);
 
-		/* FIXME: clean up any left-over connection secrets here */
+		if (nm_connection_get_scope (connection) == NM_CONNECTION_SCOPE_USER) {
+			/* Clean up keyring keys */
+			nm_gconf_clear_keyring_items (connection);
+		}
 
 		/* Clean up VPN secrets and any plugin-specific data */
 		if (!strcmp (nm_setting_connection_get_connection_type (s_con), NM_SETTING_VPN_SETTING_NAME)) {

Modified: branches/NETWORKMANAGER_APPLET_0_7/src/gconf-helpers/gconf-helpers.c
==============================================================================
--- branches/NETWORKMANAGER_APPLET_0_7/src/gconf-helpers/gconf-helpers.c	(original)
+++ branches/NETWORKMANAGER_APPLET_0_7/src/gconf-helpers/gconf-helpers.c	Tue Feb 17 23:06:06 2009
@@ -1820,6 +1820,50 @@
 	return secrets;
 }
 
+static void
+delete_done (GnomeKeyringResult result, gpointer user_data)
+{
+}
+
+void
+nm_gconf_clear_keyring_items (NMConnection *connection)
+{
+	NMSettingConnection *s_con;
+	const char *uuid;
+	GList *found_list = NULL;
+	GnomeKeyringResult ret;
+	GList *iter;
+
+	g_return_if_fail (connection != NULL);
+
+	s_con = (NMSettingConnection *) nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION);
+	g_return_if_fail (s_con != NULL);
+
+	uuid = nm_setting_connection_get_uuid (s_con);
+	g_return_if_fail (uuid != NULL);
+
+	pre_keyring_callback ();
+
+	ret = gnome_keyring_find_itemsv_sync (GNOME_KEYRING_ITEM_GENERIC_SECRET,
+	                                      &found_list,
+	                                      KEYRING_UUID_TAG,
+	                                      GNOME_KEYRING_ATTRIBUTE_TYPE_STRING,
+	                                      nm_setting_connection_get_uuid (s_con),
+	                                      NULL);
+	if (ret == GNOME_KEYRING_RESULT_OK) {
+		for (iter = found_list; iter != NULL; iter = g_list_next (iter)) {
+			GnomeKeyringFound *found = (GnomeKeyringFound *) iter->data;
+
+			gnome_keyring_item_delete (found->keyring,
+			                           found->item_id,
+			                           delete_done,
+			                           NULL,
+			                           NULL);
+		}
+		gnome_keyring_found_list_free (found_list);
+	}
+}
+
 static inline void
 copy_str_item (NMConnection *dst, NMConnection *src, const char *tag)
 {

Modified: branches/NETWORKMANAGER_APPLET_0_7/src/gconf-helpers/gconf-helpers.h
==============================================================================
--- branches/NETWORKMANAGER_APPLET_0_7/src/gconf-helpers/gconf-helpers.h	(original)
+++ branches/NETWORKMANAGER_APPLET_0_7/src/gconf-helpers/gconf-helpers.h	Tue Feb 17 23:06:06 2009
@@ -231,6 +231,9 @@
                             gboolean include_private_passwords,
                             GError **error);
 
+void
+nm_gconf_clear_keyring_items (NMConnection *connection);
+
 typedef void (*PreKeyringCallback) (gpointer user_data);
 void nm_gconf_set_pre_keyring_callback (PreKeyringCallback func, gpointer user_data);
 



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