[evolution-mapi] Stop authentication when user cancells password prompt in mailer
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-mapi] Stop authentication when user cancells password prompt in mailer
- Date: Mon, 22 Aug 2011 11:53:26 +0000 (UTC)
commit 69ac4fd5077982d6389a6599b35159029af21601
Author: Milan Crha <mcrha redhat com>
Date: Mon Aug 22 13:52:42 2011 +0200
Stop authentication when user cancells password prompt in mailer
src/camel/camel-mapi-store.c | 34 +++++++++++++++++-----------------
1 files changed, 17 insertions(+), 17 deletions(-)
---
diff --git a/src/camel/camel-mapi-store.c b/src/camel/camel-mapi-store.c
index 88db8ee..ee54af1 100644
--- a/src/camel/camel-mapi-store.c
+++ b/src/camel/camel-mapi-store.c
@@ -1646,31 +1646,29 @@ mapi_prompt_pass_creds (CamelService *service, CamelURL *url, const gchar *reaso
guint32 prompt_flags = CAMEL_SESSION_PASSWORD_SECRET;
CamelSession *session = camel_service_get_session (service);
- if (reason && *reason) {
+ if (reason) {
/* We need to un-cache the password before prompting again */
prompt_flags |= CAMEL_SESSION_PASSWORD_REPROMPT;
- g_free (url->passwd);
- url->passwd = NULL;
+ camel_url_set_passwd (url, NULL);
}
/*To translators : First %s : is the error text or the reason
for prompting the user if it is available.
Second %s is : Username.
Third %s is : Server host name.*/
- prompt = g_strdup_printf (_("%s Please enter the MAPI password for %s %s"),
- reason, url->user, url->host);
- url->passwd =
- camel_session_get_password (session, service,
- prompt, "password", prompt_flags, NULL);
+ prompt = g_strdup_printf (_("%s Please enter the MAPI password for %s %s"), reason ? reason : "", url->user, url->host);
+ url->passwd = camel_session_get_password (session, service, prompt, "password", prompt_flags, NULL);
g_free (prompt);
if (!url->passwd) {
- g_set_error (
- error, G_IO_ERROR,
- G_IO_ERROR_CANCELLED,
- _("You did not enter a password."));
+ if (error && !*error)
+ g_set_error (
+ error, G_IO_ERROR,
+ G_IO_ERROR_CANCELLED,
+ _("You did not enter a password."));
return FALSE;
}
+
return TRUE;
}
@@ -1684,7 +1682,7 @@ mapi_auth_loop (CamelService *service, GError **error)
ExchangeMapiProfileData empd = { 0 };
gchar *errbuf = NULL;
- gboolean authenticated = FALSE, ret, krb_requested = FALSE;
+ gboolean authenticated = FALSE, ret = TRUE, krb_requested = FALSE;
const gchar *profile;
url = camel_service_get_camel_url (service);
@@ -1702,22 +1700,24 @@ mapi_auth_loop (CamelService *service, GError **error)
while (!authenticated) {
GError *mapi_error = NULL;
- if (!url->passwd) {
- const gchar *why = errbuf ? errbuf : "";
+ if (!url->passwd || errbuf) {
+ const gchar *why = errbuf ? errbuf : NULL;
if (empd.krb_sso) {
if (!krb_requested) {
ret = exchange_mapi_util_trigger_krb_auth (&empd, error);
krb_requested = TRUE;
+ } else {
+ ret = FALSE;
}
} else {
- ret = mapi_prompt_pass_creds (service, url,
- why, error);
+ ret = mapi_prompt_pass_creds (service, url, why, error);
}
g_free (errbuf);
errbuf = NULL;
}
+
if (!ret || (error && *error)) {
return FALSE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]