summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@novell.com>2008-10-02 21:15:35 +0000
committerJeffrey Stedfast <fejj@src.gnome.org>2008-10-02 21:15:35 +0000
commit2411b4725f56ce7303da52d64ebe2809d9d0e05a (patch)
tree65c3046913edbcfe11bb2184a205adbbe89c858c
parent227233ab0d809b1953ddfb8afbf3716386987f0c (diff)
downloadevolution-data-server-2411b4725f56ce7303da52d64ebe2809d9d0e05a.tar.gz
If we fail to get the password, don't return FALSE; return -1 instead.
2008-10-02 Jeffrey Stedfast <fejj@novell.com> * camel-pop3-store.c (pop3_try_authenticate): If we fail to get the password, don't return FALSE; return -1 instead. (pop3_connect): If we fail to authenticate, we need to tell the session to forget the password. svn path=/branches/gnome-2-22/; revision=9636
-rw-r--r--camel/providers/pop3/ChangeLog7
-rw-r--r--camel/providers/pop3/camel-pop3-store.c9
-rw-r--r--camel/providers/pop3/camel-pop3-stream.c2
3 files changed, 14 insertions, 4 deletions
diff --git a/camel/providers/pop3/ChangeLog b/camel/providers/pop3/ChangeLog
index 74c6fe0cc..fbb1d11e8 100644
--- a/camel/providers/pop3/ChangeLog
+++ b/camel/providers/pop3/ChangeLog
@@ -1,3 +1,10 @@
+2008-10-02 Jeffrey Stedfast <fejj@novell.com>
+
+ * camel-pop3-store.c (pop3_try_authenticate): If we fail to get
+ the password, don't return FALSE; return -1 instead.
+ (pop3_connect): If we fail to authenticate, we need to tell the
+ session to forget the password.
+
2008-02-18 Chenthill Palanisamy <pchenthill@novell.com>
* camel-pop3-store.c (connect_to_server): Fix for some
diff --git a/camel/providers/pop3/camel-pop3-store.c b/camel/providers/pop3/camel-pop3-store.c
index 328d94a48..09b8b825b 100644
--- a/camel/providers/pop3/camel-pop3-store.c
+++ b/camel/providers/pop3/camel-pop3-store.c
@@ -491,7 +491,7 @@ pop3_try_authenticate (CamelService *service, gboolean reprompt, const char *err
g_free (base_prompt);
g_free (full_prompt);
if (!service->url->passwd)
- return FALSE;
+ return -1;
}
if (!service->url->authmech) {
@@ -564,13 +564,15 @@ pop3_try_authenticate (CamelService *service, gboolean reprompt, const char *err
"Error sending username: %s"),
CAMEL_SERVICE (store)->url->host,
store->engine->line ? (char *)store->engine->line : _("Unknown error"));
- } else if (pcp->state != CAMEL_POP3_COMMAND_OK)
+ status = -1;
+ } else if (pcp->state != CAMEL_POP3_COMMAND_OK) {
camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE,
_("Unable to connect to POP server %s.\n"
"Error sending password: %s"),
CAMEL_SERVICE (store)->url->host,
store->engine->line ? (char *)store->engine->line : _("Unknown error"));
-
+ }
+
camel_pop3_engine_command_free (store->engine, pcp);
if (pcu)
@@ -616,6 +618,7 @@ pop3_connect (CamelService *service, CamelException *ex)
/* we only re-prompt if we failed to authenticate, any other error and we just abort */
if (status == 0 && camel_exception_get_id (ex) == CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE) {
errbuf = g_markup_printf_escaped ("%s\n\n", camel_exception_get_description (ex));
+ camel_session_forget_password (session, service, NULL, "password", NULL);
g_free (service->url->passwd);
service->url->passwd = NULL;
reprompt = TRUE;
diff --git a/camel/providers/pop3/camel-pop3-stream.c b/camel/providers/pop3/camel-pop3-stream.c
index bebf0d54c..f23cc812a 100644
--- a/camel/providers/pop3/camel-pop3-stream.c
+++ b/camel/providers/pop3/camel-pop3-stream.c
@@ -148,7 +148,7 @@ stream_write(CamelStream *stream, const char *buffer, size_t n)
{
CamelPOP3Stream *is = (CamelPOP3Stream *)stream;
- if (strncmp (buffer, "PASS ", 5) != 0)
+ if (TRUE || strncmp (buffer, "PASS ", 5) != 0)
dd(printf("POP3_STREAM_WRITE(%d):\n%.*s\n", (int)n, (int)n, buffer));
else
dd(printf("POP3_STREAM_WRITE(%d):\nPASS xxxxxxxx\n", (int)n));