[empathy] UOA auth: Wait for callback when requesting password



commit 26aa1b3654cab66d91e0ada194be547e790a847b
Author: Xavier Claessens <xavier claessens collabora co uk>
Date:   Thu Aug 23 15:02:10 2012 +0200

    UOA auth: Wait for callback when requesting password
    
    signon_auth_session_process() does not keep its own ref on the session
    object, so freeing the AuthContext before callback cancels the call.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=680776

 libempathy/empathy-uoa-auth-handler.c |   22 +++++++++++++++++++---
 1 files changed, 19 insertions(+), 3 deletions(-)
---
diff --git a/libempathy/empathy-uoa-auth-handler.c b/libempathy/empathy-uoa-auth-handler.c
index ee37734..16d664f 100644
--- a/libempathy/empathy-uoa-auth-handler.c
+++ b/libempathy/empathy-uoa-auth-handler.c
@@ -139,6 +139,23 @@ auth_context_done (AuthContext *ctx)
 }
 
 static void
+request_password_session_process_cb (SignonAuthSession *session,
+    GHashTable *session_data,
+    const GError *error,
+    gpointer user_data)
+{
+  AuthContext *ctx = user_data;
+
+  if (error != NULL)
+    {
+      DEBUG ("Error processing the session to request user's attention: %s",
+          error->message);
+    }
+
+  auth_context_done (ctx);
+}
+
+static void
 auth_cb (GObject *source,
     GAsyncResult *result,
     gpointer user_data)
@@ -166,16 +183,15 @@ auth_cb (GObject *source,
       signon_auth_session_process (ctx->session,
           ag_auth_data_get_parameters (ctx->auth_data),
           ag_auth_data_get_mechanism (ctx->auth_data),
-          NULL, NULL);
+          request_password_session_process_cb, ctx);
 
       g_hash_table_unref (extra_params);
     }
   else
     {
       DEBUG ("Auth on %s suceeded", tp_proxy_get_object_path (channel));
+      auth_context_done (ctx);
     }
-
-  auth_context_done (ctx);
 }
 
 static void



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