diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2002-03-12 01:01:15 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2002-03-12 01:01:15 +0800 |
commit | dd30dd5376eb85d2f3875d7192cd05e4575bcb27 (patch) | |
tree | d89ccfb24ea2614d21a7fcf44abaeaebfbe8a492 /camel/providers | |
parent | e5d67f7e4229c49f96ca8dfea7cf7e6b09423b90 (diff) | |
download | gsoc2013-evolution-dd30dd5376eb85d2f3875d7192cd05e4575bcb27.tar.gz gsoc2013-evolution-dd30dd5376eb85d2f3875d7192cd05e4575bcb27.tar.zst gsoc2013-evolution-dd30dd5376eb85d2f3875d7192cd05e4575bcb27.zip |
These fixes should fix bug #21737.
2002-03-11 Jeffrey Stedfast <fejj@ximian.com>
These fixes should fix bug #21737.
* providers/smtp/camel-smtp-transport.c
(connect_to_server_wrapper): Same as with the POP code.
* providers/pop3/camel-pop3-store.c (connect_to_server_wrapper):
Slight restructuring of the if-statements for the USE_SSL_ALWAYS
case so that we can't possibly return TRUE unless we really did
connect successfully.
svn path=/trunk/; revision=16097
Diffstat (limited to 'camel/providers')
-rw-r--r-- | camel/providers/pop3/camel-pop3-store.c | 23 | ||||
-rw-r--r-- | camel/providers/smtp/camel-smtp-transport.c | 14 |
2 files changed, 20 insertions, 17 deletions
diff --git a/camel/providers/pop3/camel-pop3-store.c b/camel/providers/pop3/camel-pop3-store.c index 5a9a8aa7f0..d5850d13dc 100644 --- a/camel/providers/pop3/camel-pop3-store.c +++ b/camel/providers/pop3/camel-pop3-store.c @@ -158,7 +158,6 @@ connect_to_server (CamelService *service, int ssl_mode, int try_starttls, int *s port = service->url->port ? service->url->port : 110; #ifdef HAVE_SSL - /* FIXME: check for "always" and "when-possible" to support STARTTLS */ if (camel_url_get_param (service->url, "use_ssl")) { if (try_starttls) tcp_stream = camel_tcp_stream_ssl_new_raw (service, service->url->host); @@ -182,8 +181,7 @@ connect_to_server (CamelService *service, int ssl_mode, int try_starttls, int *s else camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE, _("Could not connect to %s (port %d): %s"), - service->url->host ? service->url->host : _("(unknown host)"), - port, g_strerror (errno)); + service->url->host, port, g_strerror (errno)); return FALSE; } @@ -195,11 +193,11 @@ connect_to_server (CamelService *service, int ssl_mode, int try_starttls, int *s store->engine = camel_pop3_engine_new (tcp_stream); - if (stls_support) - *stls_support = store->engine->capa & CAMEL_POP3_CAP_STLS; - #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; @@ -313,11 +311,14 @@ connect_to_server_wrapper (CamelService *service, CamelException *ex) if (ssl_mode == USE_SSL_ALWAYS) { /* First try STARTTLS */ - if (!connect_to_server (service, ssl_mode, TRUE, &stls_supported, ex) && - !stls_supported && EXCEPTION_RETRY (ex)) { - /* STARTTLS is unavailable - okay, now try old-style SSL */ - camel_exception_clear (ex); - return connect_to_server (service, ssl_mode, FALSE, NULL, ex); + 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 */ + camel_exception_clear (ex); + return connect_to_server (service, ssl_mode, FALSE, NULL, ex); + } else { + return FALSE; + } } return TRUE; diff --git a/camel/providers/smtp/camel-smtp-transport.c b/camel/providers/smtp/camel-smtp-transport.c index d45c617c02..0c331bb673 100644 --- a/camel/providers/smtp/camel-smtp-transport.c +++ b/camel/providers/smtp/camel-smtp-transport.c @@ -402,12 +402,14 @@ connect_to_server_wrapper (CamelService *service, CamelException *ex) if (transport->flags & CAMEL_SMTP_TRANSPORT_USE_SSL_ALWAYS) { /* First try STARTTLS */ - if (!connect_to_server (service, TRUE, ex) && - !(transport->flags & CAMEL_SMTP_TRANSPORT_STARTTLS) && - EXCEPTION_RETRY (ex)) { - /* STARTTLS is unavailable - okay, now try port 465 */ - camel_exception_clear (ex); - return connect_to_server (service, FALSE, ex); + if (!connect_to_server (service, TRUE, ex)) { + if (!(transport->flags & CAMEL_SMTP_TRANSPORT_STARTTLS) && EXCEPTION_RETRY (ex)) { + /* STARTTLS is unavailable - okay, now try port 465 */ + camel_exception_clear (ex); + return connect_to_server (service, FALSE, ex); + } else { + return FALSE; + } } return TRUE; |