[evolution-data-server] Bug 678602 - Inform server of client-side auth cancellations.



commit 55ee0653064c284bc13e2f2cbbc235af3f4dc76e
Author: Matthew Barnes <mbarnes redhat com>
Date:   Sat Jul 7 09:32:30 2012 -0400

    Bug 678602 - Inform server of client-side auth cancellations.

 libedataserver/e-source-registry.c |   18 +++++++++++++++++-
 1 files changed, 17 insertions(+), 1 deletions(-)
---
diff --git a/libedataserver/e-source-registry.c b/libedataserver/e-source-registry.c
index df2c3e5..e0e3061 100644
--- a/libedataserver/e-source-registry.c
+++ b/libedataserver/e-source-registry.c
@@ -1386,9 +1386,25 @@ source_registry_authenticate_respond_cb (AuthContext *auth_context)
 	 * session will either time out on its own or the authentication
 	 * dialog will eventually be dismissed by the user. */
 
+	/* If we were cancelled from our side, we have a bit of a dilemma.
+	 * We need to tell the server to cancel the authentication session,
+	 * but that involves making a synchronous D-Bus call, which we are
+	 * not supposed to do if we know we've been cancelled.  But if we
+	 * don't tell the server, the authentication session will be left
+	 * to timeout on its own (which may take minutes), and meanwhile
+	 * all other authentication requests are blocked.  So choose the
+	 * lesser evil and make the synchronous call but without passing
+	 * the already-cancelled GCancellable. */
+	if (g_cancellable_is_cancelled (auth_context->cancellable)) {
+		e_dbus_authenticator_call_cancel_sync (
+			auth_context->dbus_auth,
+			NULL, &non_fatal_error);
+		g_main_loop_quit (auth_context->main_loop);
+		auth_context->success = FALSE;
+
 	/* If an error occurred while attempting to authenticate,
 	 * tell the server to cancel the authentication session. */
-	if (auth_result == E_SOURCE_AUTHENTICATION_ERROR) {
+	} else if (auth_result == E_SOURCE_AUTHENTICATION_ERROR) {
 		e_dbus_authenticator_call_cancel_sync (
 			auth_context->dbus_auth,
 			auth_context->cancellable,



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