[evolution-data-server/gnome-3-6] EAuthenticationSession: Close prompt before storing password.
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server/gnome-3-6] EAuthenticationSession: Close prompt before storing password.
- Date: Mon, 22 Oct 2012 17:33:37 +0000 (UTC)
commit 08d7e9f4c7de3934f74d6f2dc8504f211c63c712
Author: Matthew Barnes <mbarnes redhat com>
Date: Mon Oct 22 13:20:11 2012 -0400
EAuthenticationSession: Close prompt before storing password.
Close our prompt before storing the password in the keyring.
If the keyring is locked, it will need to prompt the user for
a keyring password, but it can't do that if our password prompt
is still open since both prompts are system-modal. Not sure what
would happen next; probably the store operation would either fail
or deadlock.
(cherry picked from commit d4e32002bfae7e48a83da10dfe53d17efafb74c6)
libebackend/e-authentication-session.c | 31 +++++++++++++++++++++++++++++--
1 files changed, 29 insertions(+), 2 deletions(-)
---
diff --git a/libebackend/e-authentication-session.c b/libebackend/e-authentication-session.c
index 1336ad8..b54842e 100644
--- a/libebackend/e-authentication-session.c
+++ b/libebackend/e-authentication-session.c
@@ -570,16 +570,41 @@ try_again:
if (auth_result == E_SOURCE_AUTHENTICATION_ACCEPTED) {
gboolean permanently;
+ gchar *password_copy;
permanently = gcr_prompt_get_choice_chosen (prompt);
session_result = E_AUTHENTICATION_SESSION_SUCCESS;
+ /* Close our prompt before storing the password in
+ * the keyring. If the keyring is locked, it will
+ * need to prompt the user for a keyring password,
+ * but it can't do that if our password prompt is
+ * still open since both prompts are system-modal.
+ * Not sure what would happen next; probably the
+ * store operation would either fail or deadlock. */
+
+ /* XXX Not sure if it's safe to use the prompt's
+ * password string after closing the prompt,
+ * so make a copy here just to be safe. */
+ password_copy = gcr_secure_memory_strdup (prompt_password);
+
/* Failure here does not affect the outcome of this
* operation, but leave a breadcrumb as evidence that
* something went wrong. */
+ gcr_system_prompt_close (
+ GCR_SYSTEM_PROMPT (prompt),
+ cancellable, &local_error);
+
+ if (local_error != NULL) {
+ g_warning ("%s: %s", G_STRFUNC, local_error->message);
+ g_clear_error (&local_error);
+ }
+
+ g_object_unref (prompt);
+
e_authentication_session_store_password_sync (
- session, prompt_password, permanently,
+ session, password_copy, permanently,
cancellable, &local_error);
if (local_error != NULL) {
@@ -587,7 +612,9 @@ try_again:
g_clear_error (&local_error);
}
- goto close_prompt;
+ gcr_secure_memory_strfree (password_copy);
+
+ goto exit;
}
g_warn_if_fail (auth_result == E_SOURCE_AUTHENTICATION_REJECTED);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]