aboutsummaryrefslogtreecommitdiffstats
path: root/camel/providers/pop3
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2002-03-19 05:31:25 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2002-03-19 05:31:25 +0800
commitae8129bbb2d1607c0776ec3e6bbe0a7791fec33f (patch)
tree9bac625073d1993020aeb758194a7bbdf2fb0be2 /camel/providers/pop3
parent91c17571fdc9048b4fb4a0dbf6e6feca9c7b2a69 (diff)
downloadgsoc2013-evolution-ae8129bbb2d1607c0776ec3e6bbe0a7791fec33f.tar
gsoc2013-evolution-ae8129bbb2d1607c0776ec3e6bbe0a7791fec33f.tar.gz
gsoc2013-evolution-ae8129bbb2d1607c0776ec3e6bbe0a7791fec33f.tar.bz2
gsoc2013-evolution-ae8129bbb2d1607c0776ec3e6bbe0a7791fec33f.tar.lz
gsoc2013-evolution-ae8129bbb2d1607c0776ec3e6bbe0a7791fec33f.tar.xz
gsoc2013-evolution-ae8129bbb2d1607c0776ec3e6bbe0a7791fec33f.tar.zst
gsoc2013-evolution-ae8129bbb2d1607c0776ec3e6bbe0a7791fec33f.zip
No longer takes a stls_supported argument since we no longer need it with
2002-03-18 Jeffrey Stedfast <fejj@ximian.com> * providers/pop3/camel-pop3-store.c (connect_to_server): No longer takes a stls_supported argument since we no longer need it with the new logic. (connect_to_server_wrapper): New logic: First try connecting to the SSL port (995 by default), if that fails with SERVICE_UNAVAILABLE, then we attempt to connect (to port 110 by default) and try to use STARTTLS. svn path=/trunk/; revision=16202
Diffstat (limited to 'camel/providers/pop3')
-rw-r--r--camel/providers/pop3/camel-pop3-store.c25
1 files changed, 9 insertions, 16 deletions
diff --git a/camel/providers/pop3/camel-pop3-store.c b/camel/providers/pop3/camel-pop3-store.c
index e441531c05..dcdeefb392 100644
--- a/camel/providers/pop3/camel-pop3-store.c
+++ b/camel/providers/pop3/camel-pop3-store.c
@@ -142,7 +142,7 @@ enum {
};
static gboolean
-connect_to_server (CamelService *service, int ssl_mode, int try_starttls, int *stls_support, CamelException *ex)
+connect_to_server (CamelService *service, int ssl_mode, int try_starttls, CamelException *ex)
{
CamelPOP3Store *store = CAMEL_POP3_STORE (service);
CamelStream *tcp_stream;
@@ -195,9 +195,6 @@ connect_to_server (CamelService *service, int ssl_mode, int try_starttls, int *s
#ifdef HAVE_SSL
if (store->engine) {
- if (stls_support)
- *stls_support = store->engine->capa & CAMEL_POP3_CAP_STLS;
-
if (ssl_mode == USE_SSL_WHEN_POSSIBLE) {
if (store->engine->capa & CAMEL_POP3_CAP_STLS)
goto starttls;
@@ -289,15 +286,11 @@ static struct {
{ NULL, USE_SSL_NEVER },
};
-#define EXCEPTION_RETRY(ex) (camel_exception_get_id (ex) != CAMEL_EXCEPTION_USER_CANCEL && \
- camel_exception_get_id (ex) != CAMEL_EXCEPTION_SERVICE_UNAVAILABLE)
-
static gboolean
connect_to_server_wrapper (CamelService *service, CamelException *ex)
{
#ifdef HAVE_SSL
const char *use_ssl;
- int stls_supported;
int i, ssl_mode;
use_ssl = camel_url_get_param (service->url, "use_ssl");
@@ -310,12 +303,12 @@ connect_to_server_wrapper (CamelService *service, CamelException *ex)
ssl_mode = USE_SSL_NEVER;
if (ssl_mode == USE_SSL_ALWAYS) {
- /* First try STARTTLS */
- if (!connect_to_server (service, ssl_mode, TRUE, &stls_supported, ex)) {
- if (!stls_supported && EXCEPTION_RETRY (ex)) {
- /* STARTTLS is unavailable - okay, now try old-style SSL */
+ /* First try the ssl port */
+ if (!connect_to_server (service, ssl_mode, FALSE, ex)) {
+ if (camel_exception_get_id (ex) == CAMEL_EXCEPTION_SERVICE_UNAVAILABLE) {
+ /* The ssl port seems to be unavailable, lets try STARTTLS */
camel_exception_clear (ex);
- return connect_to_server (service, ssl_mode, FALSE, NULL, ex);
+ return connect_to_server (service, ssl_mode, TRUE, ex);
} else {
return FALSE;
}
@@ -324,13 +317,13 @@ connect_to_server_wrapper (CamelService *service, CamelException *ex)
return TRUE;
} else if (ssl_mode == USE_SSL_WHEN_POSSIBLE) {
/* If the server supports STARTTLS, use it */
- return connect_to_server (service, ssl_mode, TRUE, NULL, ex);
+ return connect_to_server (service, ssl_mode, TRUE, ex);
} else {
/* User doesn't care about SSL */
- return connect_to_server (service, ssl_mode, FALSE, NULL, ex);
+ return connect_to_server (service, ssl_mode, FALSE, ex);
}
#else
- return connect_to_server (service, USE_SSL_NEVER, FALSE, NULL, ex);
+ return connect_to_server (service, USE_SSL_NEVER, FALSE, ex);
#endif
}