summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2001-03-30 22:53:23 +0000
committerDan Winship <danw@src.gnome.org>2001-03-30 22:53:23 +0000
commit6e8dbdd8ba0222914a979d62db58cec800b6f524 (patch)
tree4aff5222dc4cb3a876063b74e47fdadd05aad79f
parentd35a32c04a1c34bbf1e640af1493c5491336a60b (diff)
downloadevolution-data-server-6e8dbdd8ba0222914a979d62db58cec800b6f524.tar.gz
fix pop3 query_auth_types
-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 bfcfe693a..2b7de843a 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-29 Dan Winship <danw@ximian.com>
* camel-url.c (camel_url_to_string): change "gboolean show_passwd"
diff --git a/camel/providers/pop3/camel-pop3-store.c b/camel/providers/pop3/camel-pop3-store.c
index 558d8a8b3..7db901792 100644
--- a/camel/providers/pop3/camel-pop3-store.c
+++ b/camel/providers/pop3/camel-pop3-store.c
@@ -148,12 +148,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;
@@ -263,27 +282,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)
@@ -407,40 +421,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;