[network-manager-applet/NMA_0_8] applet: don't store "ask every time" passwords to keyring (rh #692519, rh #692578)



commit 27803e6e40b8a5085b5955baafbeb0b3cc76f11f
Author: JiÅ?í KlimeÅ¡ <jklimes redhat com>
Date:   Mon Apr 11 12:47:38 2011 +0200

    applet: don't store "ask every time" passwords to keyring (rh #692519, rh #692578)
    
    And also don't show the old password in the dialog when asking for the new password.

 src/gconf-helpers/nma-gconf-connection.c  |   76 +++++++++++++++--------------
 src/wireless-security/eap-method-simple.c |   24 +++++++--
 2 files changed, 59 insertions(+), 41 deletions(-)
---
diff --git a/src/gconf-helpers/nma-gconf-connection.c b/src/gconf-helpers/nma-gconf-connection.c
index 8b6cf5a..7393a78 100644
--- a/src/gconf-helpers/nma-gconf-connection.c
+++ b/src/gconf-helpers/nma-gconf-connection.c
@@ -443,42 +443,6 @@ nma_gconf_connection_update (NMAGConfConnection *self,
 /******************************************************/
 
 static gboolean
-update (NMSettingsConnectionInterface *connection,
-	    NMSettingsConnectionInterfaceUpdateFunc callback,
-	    gpointer user_data)
-{
-	/* Always update secrets since it's assumed that secrets are included in
-	 * the new connection data.
-	 */
-	nma_gconf_connection_update (NMA_GCONF_CONNECTION (connection), FALSE);
-
-	return parent_settings_connection_iface->update (connection, callback, user_data);
-}
-
-static gboolean 
-do_delete (NMSettingsConnectionInterface *connection,
-	       NMSettingsConnectionInterfaceDeleteFunc callback,
-	       gpointer user_data)
-{
-	NMAGConfConnectionPrivate *priv = NMA_GCONF_CONNECTION_GET_PRIVATE (connection);
-	gboolean success;
-	GError *error = NULL;
-
-	/* Clean up keyring keys */
-	clear_keyring_items (NMA_GCONF_CONNECTION (connection));
-
-	success = gconf_client_recursive_unset (priv->client, priv->dir, 0, &error);
-	if (!success) {
-		callback (connection, error, user_data);
-		g_error_free (error);
-		return FALSE;
-	}
-	gconf_client_suggest_sync (priv->client, NULL);
-
-	return parent_settings_connection_iface->delete (connection, callback, user_data);
-}
-
-static gboolean
 is_otp_always_ask (NMConnection *connection)
 {
 	NMSetting8021x *s_8021x;
@@ -516,6 +480,46 @@ is_otp_always_ask (NMConnection *connection)
 }
 
 static gboolean
+update (NMSettingsConnectionInterface *connection,
+	    NMSettingsConnectionInterfaceUpdateFunc callback,
+	    gpointer user_data)
+{
+	gboolean always_ask;
+
+	always_ask = is_otp_always_ask (NM_CONNECTION (connection));
+
+	/* It's assumed that secrets are included in the new connection data.
+	 * However, update the secrets only if "always ask" is not set.
+	 */
+	nma_gconf_connection_update (NMA_GCONF_CONNECTION (connection), always_ask);
+
+	return parent_settings_connection_iface->update (connection, callback, user_data);
+}
+
+static gboolean 
+do_delete (NMSettingsConnectionInterface *connection,
+	       NMSettingsConnectionInterfaceDeleteFunc callback,
+	       gpointer user_data)
+{
+	NMAGConfConnectionPrivate *priv = NMA_GCONF_CONNECTION_GET_PRIVATE (connection);
+	gboolean success;
+	GError *error = NULL;
+
+	/* Clean up keyring keys */
+	clear_keyring_items (NMA_GCONF_CONNECTION (connection));
+
+	success = gconf_client_recursive_unset (priv->client, priv->dir, 0, &error);
+	if (!success) {
+		callback (connection, error, user_data);
+		g_error_free (error);
+		return FALSE;
+	}
+	gconf_client_suggest_sync (priv->client, NULL);
+
+	return parent_settings_connection_iface->delete (connection, callback, user_data);
+}
+
+static gboolean
 internal_get_secrets (NMSettingsConnectionInterface *connection,
                       const char *setting_name,
                       const char **hints,
diff --git a/src/wireless-security/eap-method-simple.c b/src/wireless-security/eap-method-simple.c
index c12453d..9adf3bb 100644
--- a/src/wireless-security/eap-method-simple.c
+++ b/src/wireless-security/eap-method-simple.c
@@ -168,11 +168,25 @@ fill_connection (EAPMethod *parent, NMConnection *connection)
 static void
 update_secrets (EAPMethod *parent, NMConnection *connection)
 {
-	helper_fill_secret_entry (connection,
-	                          parent->builder,
-	                          "eap_simple_password_entry",
-	                          NM_TYPE_SETTING_802_1X,
-	                          (HelperSecretFunc) nm_setting_802_1x_get_password);
+	gboolean always_ask = FALSE;
+
+	if (connection) {
+		NMSettingConnection *s_con;
+		const char *uuid;
+
+		s_con = (NMSettingConnection *) nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION);
+		g_assert (s_con);
+
+		uuid = nm_setting_connection_get_uuid (s_con);
+		always_ask = nm_gconf_get_8021x_password_always_ask (uuid);
+	}
+
+	if (!always_ask)
+		helper_fill_secret_entry (connection,
+		                          parent->builder,
+		                          "eap_simple_password_entry",
+		                          NM_TYPE_SETTING_802_1X,
+		                          (HelperSecretFunc) nm_setting_802_1x_get_password);
 }
 
 static void



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