[evolution-data-server] EAuthenticationSession: Close prompt before storing password.
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] EAuthenticationSession: Close prompt before storing password.
- Date: Mon, 22 Oct 2012 17:33:01 +0000 (UTC)
commit d4e32002bfae7e48a83da10dfe53d17efafb74c6
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.
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 1a921ce..27c4bf0 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]