aboutsummaryrefslogtreecommitdiffstats
path: root/camel/providers/pop3
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2001-03-31 06:50:48 +0800
committerDan Winship <danw@src.gnome.org>2001-03-31 06:50:48 +0800
commit56952442a945854ba9c4ad9523bf0a9261f71e50 (patch)
tree6b4cc5f47e3c3deb66230a5654d79c5e4fc47b9c /camel/providers/pop3
parent5d97d3fa515a7054558b0aa1e12593e87984ac6d (diff)
downloadgsoc2013-evolution-56952442a945854ba9c4ad9523bf0a9261f71e50.tar.gz
gsoc2013-evolution-56952442a945854ba9c4ad9523bf0a9261f71e50.tar.zst
gsoc2013-evolution-56952442a945854ba9c4ad9523bf0a9261f71e50.zip
Move things around here to make this all work right again (so you don't
* providers/pop3/camel-pop3-store.c (connect_to_server, query_auth_types, pop3_connect): Move things around here to make this all work right again (so you don't get prompted for a password when checking the supported authtypes.) svn path=/trunk/; revision=9056
Diffstat (limited to 'camel/providers/pop3')
-rw-r--r--camel/providers/pop3/camel-pop3-store.c75
1 files changed, 28 insertions, 47 deletions
diff --git a/camel/providers/pop3/camel-pop3-store.c b/camel/providers/pop3/camel-pop3-store.c
index 4ebb92dd2b..c1cb5e1060 100644
--- a/camel/providers/pop3/camel-pop3-store.c
+++ b/camel/providers/pop3/camel-pop3-store.c
@@ -150,12 +150,31 @@ connect_to_server (CamelService *service, CamelException *ex)
{
CamelPop3Store *store = CAMEL_POP3_STORE (service);
char *buf, *apoptime, *apopend;
- gint status;
+ int status;
+ gboolean result;
+
#ifdef HAVE_KRB4
- gboolean kpop = service->url->authmech &&
- !strcmp (service->url->authmech, "+KPOP");
+ gboolean set_port = FALSE;
+
+ kpop = (service->url->authmech &&
+ !strcmp (service->url->authmech, "+KPOP"));
+
+ if (kpop && service->url->port == 0) {
+ set_port = TRUE;
+ service->url->port = KPOP_PORT;
+ }
#endif
+ result = CAMEL_SERVICE_CLASS (parent_class)->connect (service, ex);
+
+#ifdef HAVE_KRB4
+ if (set_port)
+ service->url->port = 0;
+#endif
+
+ if (result == FALSE)
+ return FALSE;
+
#ifdef HAVE_KRB4
if (kpop) {
KTEXT_ST ticket_st;
@@ -268,27 +287,22 @@ query_auth_types (CamelService *service, CamelException *ex)
CamelPop3Store *store = CAMEL_POP3_STORE (service);
GList *types = NULL;
gboolean passwd = TRUE, apop = TRUE;
-#ifdef HAVE_KRB4
- gboolean kpop = TRUE;
- int saved_port;
-#endif
types = CAMEL_SERVICE_CLASS (parent_class)->query_auth_types (service, ex);
if (camel_exception_is_set (ex))
return types;
- passwd = camel_service_connect (service, NULL);
+ passwd = connect_to_server (service, NULL);
apop = store->apop_timestamp != NULL;
if (passwd)
- camel_service_disconnect (service, TRUE, NULL);
+ pop3_disconnect (service, TRUE, NULL);
#ifdef HAVE_KRB4
- saved_port = service->url->port;
- service->url->port = KPOP_PORT;
- kpop = camel_service_connect (service, NULL);
- service->url->port = saved_port;
+ service->url->authtype = "+KPOP";
+ kpop = connect_to_server (service, NULL);
+ service->url->authtype = NULL;
if (kpop)
- camel_service_disconnect (service, TRUE, NULL);
+ pop3_disconnect (service, TRUE, NULL);
#endif
if (passwd)
@@ -412,40 +426,7 @@ pop3_connect (CamelService *service, CamelException *ex)
{
char *errbuf = NULL;
gboolean tryagain, kpop = FALSE;
- gboolean res;
-
-#ifdef HAVE_KRB4
- gboolean set_port = FALSE;
-
- kpop = (service->url->authmech &&
- !strcmp (service->url->authmech, "+KPOP"));
-
- if (kpop && service->url->port == 0) {
- set_port = TRUE;
- service->url->port = KPOP_PORT;
- }
-#endif
-
- res = CAMEL_SERVICE_CLASS (parent_class)->connect (service, ex);
-
-#ifdef HAVE_KRB4
- /* This is veeery nasty. When we set the port, we're changing the
- * hash value of our URL. service_cache_remove() gets called when
- * we're done checking the mail, but the hash table lookup fails
- * because the url port has changed. Then, a finalized instance of
- * the CamelService is stuck in the hash table, and the next time
- * we try to look up the service, with a URL of port 0, we look
- * up the freed service and a segfault results.
- */
-
- if (kpop && set_port)
- service->url->port = 0;
-#endif
-
- if (res == FALSE)
- return FALSE;
- /*FIXME integrate these functions */
if (!connect_to_server (service, ex))
return FALSE;