aboutsummaryrefslogtreecommitdiffstats
path: root/camel/providers
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2003-10-29 03:01:58 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2003-10-29 03:01:58 +0800
commit535593e50467d2fcd5f7a2d0d99c28eb0a45a4fc (patch)
tree5596d684cb752c75bd94af2c90ddf7a84a471f7b /camel/providers
parent5e343da080176558a478506c9fcfac912a230aaf (diff)
downloadgsoc2013-evolution-535593e50467d2fcd5f7a2d0d99c28eb0a45a4fc.tar
gsoc2013-evolution-535593e50467d2fcd5f7a2d0d99c28eb0a45a4fc.tar.gz
gsoc2013-evolution-535593e50467d2fcd5f7a2d0d99c28eb0a45a4fc.tar.bz2
gsoc2013-evolution-535593e50467d2fcd5f7a2d0d99c28eb0a45a4fc.tar.lz
gsoc2013-evolution-535593e50467d2fcd5f7a2d0d99c28eb0a45a4fc.tar.xz
gsoc2013-evolution-535593e50467d2fcd5f7a2d0d99c28eb0a45a4fc.tar.zst
gsoc2013-evolution-535593e50467d2fcd5f7a2d0d99c28eb0a45a4fc.zip
Fixes bug #35083
2003-10-28 Jeffrey Stedfast <fejj@ximian.com> * Fixes bug #35083 * providers/imap/camel-imap-store.c (connect_to_server): Same here. * providers/pop3/camel-pop3-store.c (connect_to_server): Same as the smtp changes. * providers/smtp/camel-smtp-transport.c (connect_to_server): If HAVE_SSL is undefined, don't default to raw connections if the option to connect via ssl is set. Instead set an exception and return fail. svn path=/trunk/; revision=23110
Diffstat (limited to 'camel/providers')
-rw-r--r--camel/providers/imap/camel-imap-store.c18
-rw-r--r--camel/providers/pop3/camel-pop3-store.c18
-rw-r--r--camel/providers/smtp/camel-smtp-transport.c18
3 files changed, 42 insertions, 12 deletions
diff --git a/camel/providers/imap/camel-imap-store.c b/camel/providers/imap/camel-imap-store.c
index a95b1c7c7a..46c30ab7a0 100644
--- a/camel/providers/imap/camel-imap-store.c
+++ b/camel/providers/imap/camel-imap-store.c
@@ -566,20 +566,30 @@ connect_to_server (CamelService *service, int ssl_mode, int try_starttls, CamelE
port = service->url->port ? service->url->port : 143;
-#ifdef HAVE_SSL
if (ssl_mode != USE_SSL_NEVER) {
+#ifdef HAVE_SSL
if (try_starttls) {
tcp_stream = camel_tcp_stream_ssl_new_raw (service->session, service->url->host, STARTTLS_FLAGS);
} else {
port = service->url->port ? service->url->port : 993;
tcp_stream = camel_tcp_stream_ssl_new (service->session, service->url->host, SSL_PORT_FLAGS);
}
+#else
+ if (!try_starttls)
+ port = service->url->port ? service->url->port : 993;
+
+ camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
+ _("Could not connect to %s (port %d): %s"),
+ service->url->host, port,
+ _("SSL unavailable"));
+
+ camel_free_host (h);
+
+ return FALSE;
+#endif /* HAVE_SSL */
} else {
tcp_stream = camel_tcp_stream_raw_new ();
}
-#else
- tcp_stream = camel_tcp_stream_raw_new ();
-#endif /* HAVE_SSL */
ret = camel_tcp_stream_connect (CAMEL_TCP_STREAM (tcp_stream), h, port);
camel_free_host (h);
diff --git a/camel/providers/pop3/camel-pop3-store.c b/camel/providers/pop3/camel-pop3-store.c
index 82aa051015..fbdae86833 100644
--- a/camel/providers/pop3/camel-pop3-store.c
+++ b/camel/providers/pop3/camel-pop3-store.c
@@ -161,20 +161,30 @@ connect_to_server (CamelService *service, int ssl_mode, int try_starttls, CamelE
port = service->url->port ? service->url->port : 110;
+ if (ssl_mode != USE_SSL_NEVER) {
#ifdef HAVE_SSL
- if (camel_url_get_param (service->url, "use_ssl")) {
if (try_starttls) {
tcp_stream = camel_tcp_stream_ssl_new_raw (service->session, service->url->host, STARTTLS_FLAGS);
} else {
port = service->url->port ? service->url->port : 995;
tcp_stream = camel_tcp_stream_ssl_new (service->session, service->url->host, SSL_PORT_FLAGS);
}
+#else
+ if (!try_starttls)
+ port = service->url->port ? service->url->port : 995;
+
+ camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
+ _("Could not connect to %s (port %d): %s"),
+ service->url->host, port,
+ _("SSL unavailable"));
+
+ camel_free_host (h);
+
+ return FALSE;
+#endif /* HAVE_SSL */
} else {
tcp_stream = camel_tcp_stream_raw_new ();
}
-#else
- tcp_stream = camel_tcp_stream_raw_new ();
-#endif /* HAVE_SSL */
ret = camel_tcp_stream_connect (CAMEL_TCP_STREAM (tcp_stream), h, port);
camel_free_host (h);
diff --git a/camel/providers/smtp/camel-smtp-transport.c b/camel/providers/smtp/camel-smtp-transport.c
index 3d8c4118aa..6e15b33ce6 100644
--- a/camel/providers/smtp/camel-smtp-transport.c
+++ b/camel/providers/smtp/camel-smtp-transport.c
@@ -253,20 +253,30 @@ connect_to_server (CamelService *service, int try_starttls, CamelException *ex)
port = service->url->port ? service->url->port : SMTP_PORT;
-#ifdef HAVE_SSL
if (transport->flags & CAMEL_SMTP_TRANSPORT_USE_SSL) {
+#ifdef HAVE_SSL
if (try_starttls) {
tcp_stream = camel_tcp_stream_ssl_new_raw (service->session, service->url->host, STARTTLS_FLAGS);
} else {
port = service->url->port ? service->url->port : 465;
tcp_stream = camel_tcp_stream_ssl_new (service->session, service->url->host, SSL_PORT_FLAGS);
}
+#else
+ if (!try_starttls)
+ port = service->url->port ? service->url->port : 465;
+
+ camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
+ _("Could not connect to %s (port %d): %s"),
+ service->url->host, port,
+ _("SSL unavailable"));
+
+ camel_free_host (h);
+
+ return FALSE;
+#endif /* HAVE_SSL */
} else {
tcp_stream = camel_tcp_stream_raw_new ();
}
-#else
- tcp_stream = camel_tcp_stream_raw_new ();
-#endif /* HAVE_SSL */
ret = camel_tcp_stream_connect (CAMEL_TCP_STREAM (tcp_stream), h, port);
camel_free_host (h);