aboutsummaryrefslogtreecommitdiffstats
path: root/camel
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2000-04-08 04:41:01 +0800
committerDan Winship <danw@src.gnome.org>2000-04-08 04:41:01 +0800
commit1fc95ea1f51dea8880bf7f815a2143ca2cbb7d5d (patch)
treeb4da572267fb775b95e0fe30f5c415914f6209f3 /camel
parent2b55a1e90c9554540413d2e74716e9c60b3710ce (diff)
downloadgsoc2013-evolution-1fc95ea1f51dea8880bf7f815a2143ca2cbb7d5d.tar
gsoc2013-evolution-1fc95ea1f51dea8880bf7f815a2143ca2cbb7d5d.tar.gz
gsoc2013-evolution-1fc95ea1f51dea8880bf7f815a2143ca2cbb7d5d.tar.bz2
gsoc2013-evolution-1fc95ea1f51dea8880bf7f815a2143ca2cbb7d5d.tar.lz
gsoc2013-evolution-1fc95ea1f51dea8880bf7f815a2143ca2cbb7d5d.tar.xz
gsoc2013-evolution-1fc95ea1f51dea8880bf7f815a2143ca2cbb7d5d.tar.zst
gsoc2013-evolution-1fc95ea1f51dea8880bf7f815a2143ca2cbb7d5d.zip
(pop3_connect): Remember the password after asking for it the
first time. svn path=/trunk/; revision=2331
Diffstat (limited to 'camel')
-rw-r--r--camel/ChangeLog2
-rw-r--r--camel/providers/pop3/camel-pop3-store.c29
2 files changed, 14 insertions, 17 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index 9807aa6242..e1f00fb68e 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -3,6 +3,8 @@
* providers/pop3/camel-pop3-store.c (pop3_connect): Clarify error
messages.
(finalize): fix a bug in camel_exception usage
+ (pop3_connect): Remember the password after asking for it the
+ first time.
2000-04-07 NotZed <NotZed@HelixCode.com>
diff --git a/camel/providers/pop3/camel-pop3-store.c b/camel/providers/pop3/camel-pop3-store.c
index 933e455c42..8afc77fd47 100644
--- a/camel/providers/pop3/camel-pop3-store.c
+++ b/camel/providers/pop3/camel-pop3-store.c
@@ -211,7 +211,7 @@ pop3_connect (CamelService *service, CamelException *ex)
struct hostent *h;
struct sockaddr_in sin;
int fd, status, apoplen;
- char *buf, *apoptime, *pass;
+ char *buf, *apoptime;
CamelPop3Store *store = CAMEL_POP3_STORE (service);
if (!service_class->connect (service, ex))
@@ -221,16 +221,16 @@ pop3_connect (CamelService *service, CamelException *ex)
if (!h)
return FALSE;
- pass = g_strdup (service->url->passwd);
- if (!pass) {
+ if (!service->url->passwd) {
char *prompt = g_strdup_printf ("Please enter the POP3 password for %s@%s",
service->url->user, h->h_name);
- pass = camel_session_query_authenticator (camel_service_get_session (service),
- prompt, TRUE,
- service, "password",
- ex);
+ service->url->passwd =
+ camel_session_query_authenticator (camel_service_get_session (service),
+ prompt, TRUE,
+ service, "password",
+ ex);
g_free (prompt);
- if (!pass)
+ if (!service->url->passwd)
return FALSE;
}
@@ -247,7 +247,6 @@ pop3_connect (CamelService *service, CamelException *ex)
strerror(errno));
if (fd > -1)
close (fd);
- g_free (pass);
return FALSE;
}
@@ -257,10 +256,8 @@ pop3_connect (CamelService *service, CamelException *ex)
/* Read the greeting, note APOP timestamp, if any. */
buf = camel_stream_buffer_read_line (CAMEL_STREAM_BUFFER (store->istream));
- if (!buf) {
- g_free (pass);
+ if (!buf)
return -1;
- }
apoptime = strchr (buf, '<');
if (apoptime) {
int len = strcspn (apoptime, ">");
@@ -277,7 +274,7 @@ pop3_connect (CamelService *service, CamelException *ex)
unsigned char md5sum[16], *s;
secret = g_strdup_printf("%.*s%s", apoplen + 1, apoptime,
- pass);
+ service->url->passwd);
md5_get_digest(secret, strlen(secret), md5sum);
g_free(secret);
@@ -299,23 +296,21 @@ pop3_connect (CamelService *service, CamelException *ex)
"server. Error sending username:"
" %s", msg ? msg : "(Unknown)");
g_free (msg);
- g_free (pass);
return FALSE;
}
- status = camel_pop3_command(store, &msg, "PASS %s", pass);
+ status = camel_pop3_command(store, &msg, "PASS %s",
+ service->url->passwd);
if (status != CAMEL_POP3_OK) {
camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE,
"Unable to authenticate to POP "
"server. Error sending password:"
" %s", msg ? msg : "(Unknown)");
g_free (msg);
- g_free (pass);
return FALSE;
}
}
- g_free (pass);
return TRUE;
}