aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--camel/ChangeLog7
-rw-r--r--camel/providers/pop3/camel-pop3-store.c75
2 files changed, 35 insertions, 47 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index b97bf87e1f..cd0adf82d0 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,10 @@
+2001-03-30 Dan Winship <danw@ximian.com>
+
+ * 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.)
+
2001-03-30 Jon Trowbridge <trow@ximian.com>
* camel-mime-message.c (camel_mime_message_set_source): Shrould
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;