aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--camel/ChangeLog7
-rw-r--r--camel/providers/pop3/camel-pop3-engine.c1
-rw-r--r--camel/providers/pop3/camel-pop3-store.c36
3 files changed, 29 insertions, 15 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index a5192f8110..2e85fa9be6 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,5 +1,12 @@
2002-05-06 Jeffrey Stedfast <fejj@ximian.com>
+ * providers/pop3/camel-pop3-store.c (pop3_try_authenticate): If
+ the pop3 command status is -1, then we probably have a TCP error
+ (?) so set a SYSTEM exception so our caller can distinguish
+ between a "bad password" and a "tcp error".
+ (pop3_connect): Only uncache the password on "bad password"
+ errors.
+
* camel-pgp-mime.c (pgp_mime_part_sign_prepare_part): Use
CamelMimeFilterBestenc to get a more appropriate encoding rather
than just blindling assigning QP.
diff --git a/camel/providers/pop3/camel-pop3-engine.c b/camel/providers/pop3/camel-pop3-engine.c
index 1783520b7c..a76df8f9bc 100644
--- a/camel/providers/pop3/camel-pop3-engine.c
+++ b/camel/providers/pop3/camel-pop3-engine.c
@@ -315,7 +315,6 @@ camel_pop3_engine_iterate(CamelPOP3Engine *pe, CamelPOP3Command *pcwait)
e_dlist_remove((EDListNode *)pw);
-
pe->sentlen += strlen(pw->data);
pw->state = CAMEL_POP3_COMMAND_DISPATCHED;
diff --git a/camel/providers/pop3/camel-pop3-store.c b/camel/providers/pop3/camel-pop3-store.c
index dcdeefb392..ebf55ccd10 100644
--- a/camel/providers/pop3/camel-pop3-store.c
+++ b/camel/providers/pop3/camel-pop3-store.c
@@ -439,9 +439,9 @@ pop3_try_authenticate (CamelService *service, const char *errmsg,
CamelException *ex)
{
CamelPOP3Store *store = (CamelPOP3Store *)service;
- int status;
CamelPOP3Command *pcu = NULL, *pcp = NULL;
-
+ int status;
+
/* override, testing only */
/*printf("Forcing authmech to 'login'\n");
service->url->authmech = g_strdup("LOGIN");*/
@@ -494,14 +494,19 @@ pop3_try_authenticate (CamelService *service, const char *errmsg,
"authentication mechanism."));
return FALSE;
}
-
- while (camel_pop3_engine_iterate(store->engine, pcp) > 0)
+
+ while ((status = camel_pop3_engine_iterate(store->engine, pcp)) > 0)
;
- status = pcp->state != CAMEL_POP3_COMMAND_OK;
- if (status) {
- camel_exception_setv(ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE,
- _("Unable to connect to POP server.\nError sending password: %s"),
- store->engine->line);
+
+ if (status != CAMEL_POP3_COMMAND_OK) {
+ if (status == CAMEL_POP3_COMMAND_ERR)
+ camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE,
+ _("Unable to connect to POP server.\nError sending password: %s"),
+ store->engine->line);
+ else
+ camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
+ _("Unable to connect to POP server.\nError sending password: %s"),
+ errno ? g_strerror (errno) : _("Unknown error"));
}
camel_pop3_engine_command_free(store->engine, pcp);
@@ -542,11 +547,14 @@ pop3_connect (CamelService *service, CamelException *ex)
errbuf = g_strdup_printf ("%s\n\n", camel_exception_get_description (ex));
camel_exception_clear (ex);
- /* Uncache the password before prompting again. */
- camel_session_forget_password (camel_service_get_session (service),
- service, "password", ex);
- g_free (service->url->passwd);
- service->url->passwd = NULL;
+ /* don't forget the password if we encountered an unknown error */
+ if (camel_exception_get_id (ex) == CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE) {
+ /* Uncache the password before prompting again. */
+ camel_session_forget_password (camel_service_get_session (service),
+ service, "password", ex);
+ g_free (service->url->passwd);
+ service->url->passwd = NULL;
+ }
}
tryagain = pop3_try_authenticate (service, errbuf, ex);