[gnome-shell] ShellNetworkAgent: don't access request fields if the operation is cancelled



commit c5804c19294cd0fb0e6670a6df957a95836af89c
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Mon Feb 13 15:54:46 2012 +0100

    ShellNetworkAgent: don't access request fields if the operation is cancelled
    
    When the operation is cancelled by NetworkManager, the request is
    cancelled immediately. Later when gnome-keyring invokes the callback
    notifying the error we must therefore not access its memory.
    Previously the callback would mistakenly treat "cancelled" (which
    indicates a programmatic cancel) as "denied" (which means the user
    clicked "Cancel" on the keyring prompt)
    
    https://bugzilla.gnome.org/show_bug.cgi?id=658484

 src/shell-network-agent.c |   17 ++++++++++++-----
 1 files changed, 12 insertions(+), 5 deletions(-)
---
diff --git a/src/shell-network-agent.c b/src/shell-network-agent.c
index b24999b..9640236 100644
--- a/src/shell-network-agent.c
+++ b/src/shell-network-agent.c
@@ -229,22 +229,29 @@ get_secrets_keyring_cb (GnomeKeyringResult  result,
 			GList              *list,
 			gpointer            user_data)
 {
-  ShellAgentRequest *closure = user_data;
-  ShellNetworkAgent *self = closure->self;
-  ShellNetworkAgentPrivate *priv = self->priv;
+  ShellAgentRequest *closure;
+  ShellNetworkAgent *self;
+  ShellNetworkAgentPrivate *priv;
   GError *error = NULL;
   gint n_found = 0;
   GList *iter;
   GHashTable *outer;
 
+  if (result == GNOME_KEYRING_RESULT_CANCELLED)
+    return;
+
+  closure = user_data;
+  self = closure->self;
+  priv  = self->priv;
+
   closure->keyring_op = NULL;
 
-  if (result == GNOME_KEYRING_RESULT_CANCELLED)
+  if (result == GNOME_KEYRING_RESULT_DENIED)
     {
       g_set_error (&error,
 		   NM_SECRET_AGENT_ERROR,
 		   NM_SECRET_AGENT_ERROR_USER_CANCELED,
-		   "The secret request was cancelled by the user");
+		   "Access to the secret storage was denied by the user");
 
       closure->callback (NM_SECRET_AGENT (closure->self), closure->connection, NULL, error, closure->callback_data);
 



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