[evolution-data-server] Bug #337479 - Evolution forgets password on any error



commit 6f124702d67c0e7c10bf4c4a7e041936d639bdfe
Author: Milan Crha <mcrha redhat com>
Date:   Mon May 10 17:40:19 2010 +0200

    Bug #337479 - Evolution forgets password on any error

 camel/providers/groupwise/camel-groupwise-store.c |    5 +++--
 camel/providers/imap/camel-imap-store.c           |    5 +++--
 camel/providers/imapx/camel-imapx-server.c        |    5 +++--
 camel/providers/nntp/camel-nntp-store.c           |    8 +++++---
 camel/providers/nntp/camel-nntp-store.h           |    1 +
 camel/providers/pop3/camel-pop3-store.c           |    4 ----
 camel/providers/smtp/camel-smtp-transport.c       |    1 -
 7 files changed, 15 insertions(+), 14 deletions(-)
---
diff --git a/camel/providers/groupwise/camel-groupwise-store.c b/camel/providers/groupwise/camel-groupwise-store.c
index c15776b..5362acb 100644
--- a/camel/providers/groupwise/camel-groupwise-store.c
+++ b/camel/providers/groupwise/camel-groupwise-store.c
@@ -178,6 +178,7 @@ groupwise_auth_loop (CamelService *service, CamelException *ex)
 	CamelGroupwiseStorePrivate *priv = groupwise_store->priv;
 	gboolean authenticated = FALSE;
 	gchar *uri;
+	guint32 prompt_flags = CAMEL_SESSION_PASSWORD_SECRET;
 	EGwConnectionErrors errors = {E_GW_CONNECTION_STATUS_INVALID_OBJECT, NULL};
 
 	if (priv->use_ssl && !g_str_equal (priv->use_ssl, "never"))
@@ -195,7 +196,7 @@ groupwise_auth_loop (CamelService *service, CamelException *ex)
 				"GroupWise", service->url->user, service->url->host);
 			service->url->passwd =
 				camel_session_get_password (session, service, "Groupwise",
-							    prompt, "password", CAMEL_SESSION_PASSWORD_SECRET, ex);
+							    prompt, "password", prompt_flags, ex);
 			g_free (prompt);
 
 			if (!service->url->passwd) {
@@ -215,7 +216,7 @@ groupwise_auth_loop (CamelService *service, CamelException *ex)
 		if (!E_IS_GW_CONNECTION(priv->cnc)) {
 			if (errors.status == E_GW_CONNECTION_STATUS_INVALID_PASSWORD) {
 				/* We need to un-cache the password before prompting again */
-				camel_session_forget_password (session, service, "Groupwise", "password", ex);
+				prompt_flags |= CAMEL_SESSION_PASSWORD_REPROMPT;
 				g_free (service->url->passwd);
 				service->url->passwd = NULL;
 				camel_exception_clear (ex);
diff --git a/camel/providers/imap/camel-imap-store.c b/camel/providers/imap/camel-imap-store.c
index 61ec57c..713f829 100644
--- a/camel/providers/imap/camel-imap-store.c
+++ b/camel/providers/imap/camel-imap-store.c
@@ -1150,6 +1150,7 @@ imap_auth_loop (CamelService *service, CamelException *ex)
 	gchar *errbuf = NULL;
 	gboolean authenticated = FALSE;
 	const gchar *auth_domain;
+	guint32 prompt_flags = CAMEL_SESSION_PASSWORD_SECRET;
 
 	auth_domain = camel_url_get_param (service->url, "auth-domain");
 
@@ -1190,7 +1191,7 @@ imap_auth_loop (CamelService *service, CamelException *ex)
 	while (!authenticated) {
 		if (errbuf) {
 			/* We need to un-cache the password before prompting again */
-			camel_session_forget_password (session, service, auth_domain, "password", ex);
+			prompt_flags |= CAMEL_SESSION_PASSWORD_REPROMPT;
 			g_free (service->url->passwd);
 			service->url->passwd = NULL;
 		}
@@ -1209,7 +1210,7 @@ imap_auth_loop (CamelService *service, CamelException *ex)
 
 			service->url->passwd = camel_session_get_password (
 				session, service, auth_domain, full_prompt,
-				"password", CAMEL_SESSION_PASSWORD_SECRET, ex);
+				"password", prompt_flags, ex);
 
 			g_free (base_prompt);
 			g_free (full_prompt);
diff --git a/camel/providers/imapx/camel-imapx-server.c b/camel/providers/imapx/camel-imapx-server.c
index 7b9e0bf..811f8e0 100644
--- a/camel/providers/imapx/camel-imapx-server.c
+++ b/camel/providers/imapx/camel-imapx-server.c
@@ -2281,11 +2281,12 @@ imapx_reconnect (CamelIMAPXServer *is, CamelException *ex)
 	CamelService *service = (CamelService *) is->store;
 	const gchar *auth_domain = NULL;
 	gboolean authenticated = FALSE;
+	guint32 prompt_flags = CAMEL_SESSION_PASSWORD_SECRET;
 
 	while (!authenticated) {
 		if (errbuf) {
 			/* We need to un-cache the password before prompting again */
-			camel_session_forget_password (is->session, service, auth_domain, "password", ex);
+			prompt_flags |= CAMEL_SESSION_PASSWORD_REPROMPT;
 			g_free (service->url->passwd);
 			service->url->passwd = NULL;
 			camel_exception_clear (ex);
@@ -2310,7 +2311,7 @@ imapx_reconnect (CamelIMAPXServer *is, CamelException *ex)
 			auth_domain = camel_url_get_param (service->url, "auth-domain");
 			service->url->passwd = camel_session_get_password(is->session, (CamelService *)is->store,
 					auth_domain,
-					full_prompt, "password", CAMEL_SESSION_PASSWORD_SECRET, ex);
+					full_prompt, "password", prompt_flags, ex);
 
 			g_free (base_prompt);
 			g_free (full_prompt);
diff --git a/camel/providers/nntp/camel-nntp-store.c b/camel/providers/nntp/camel-nntp-store.c
index d42f91f..7ba0923 100644
--- a/camel/providers/nntp/camel-nntp-store.c
+++ b/camel/providers/nntp/camel-nntp-store.c
@@ -1307,12 +1307,14 @@ camel_nntp_try_authenticate (CamelNNTPStore *store, CamelException *ex)
 
 		service->url->passwd =
 			camel_session_get_password (session, service, NULL,
-						    prompt, "password", CAMEL_SESSION_PASSWORD_SECRET, ex);
+						    prompt, "password", CAMEL_SESSION_PASSWORD_SECRET | (store->password_reprompt ? CAMEL_SESSION_PASSWORD_REPROMPT : 0), ex);
 		g_free(prompt);
 		g_free(base);
 
 		if (!service->url->passwd)
 			return -1;
+
+		store->password_reprompt = FALSE;
 	}
 
 	/* now, send auth info (currently, only authinfo user/pass is supported) */
@@ -1326,8 +1328,8 @@ camel_nntp_try_authenticate (CamelNNTPStore *store, CamelException *ex)
 			    camel_exception_get_id (ex) == CAMEL_EXCEPTION_SERVICE_UNAVAILABLE)
 				return ret;
 
-			/* Need to forget the password here since we have no context on it */
-			camel_session_forget_password(session, service, NULL, "password", ex);
+			/* To force password reprompt */
+			store->password_reprompt = TRUE;
 			g_free (service->url->passwd);
 			service->url->passwd = NULL;
 			goto retry;
diff --git a/camel/providers/nntp/camel-nntp-store.h b/camel/providers/nntp/camel-nntp-store.h
index 1a07a95..95bede9 100644
--- a/camel/providers/nntp/camel-nntp-store.h
+++ b/camel/providers/nntp/camel-nntp-store.h
@@ -89,6 +89,7 @@ struct _CamelNNTPStore {
 	guint posting_allowed:1;
 	guint do_short_folder_notation:1;
 	guint folder_hierarchy_relative:1;
+	gboolean password_reprompt;
 
 	struct _CamelNNTPStoreSummary *summary;
 
diff --git a/camel/providers/pop3/camel-pop3-store.c b/camel/providers/pop3/camel-pop3-store.c
index 6e31ff7..78d4be6 100644
--- a/camel/providers/pop3/camel-pop3-store.c
+++ b/camel/providers/pop3/camel-pop3-store.c
@@ -667,10 +667,6 @@ pop3_connect (CamelService *service,
 			errbuf = g_markup_printf_escaped ("%s\n\n", camel_exception_get_description (ex));
 			camel_exception_clear (ex);
 
-			camel_session_forget_password (
-				session, service, NULL, "password", ex);
-			camel_exception_clear (ex);
-
 			g_free (service->url->passwd);
 			service->url->passwd = NULL;
 			reprompt = TRUE;
diff --git a/camel/providers/smtp/camel-smtp-transport.c b/camel/providers/smtp/camel-smtp-transport.c
index 7130893..41bfbad 100644
--- a/camel/providers/smtp/camel-smtp-transport.c
+++ b/camel/providers/smtp/camel-smtp-transport.c
@@ -485,7 +485,6 @@ smtp_connect (CamelService *service, CamelException *ex)
 		while (!authenticated) {
 			if (errbuf) {
 				/* We need to un-cache the password before prompting again */
-				camel_session_forget_password (session, service, NULL, "password", NULL);
 				g_free (service->url->passwd);
 				service->url->passwd = NULL;
 			}



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