aboutsummaryrefslogtreecommitdiffstats
path: root/camel/providers
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2002-03-11 10:33:27 +0800
committerDan Winship <danw@src.gnome.org>2002-03-11 10:33:27 +0800
commit6024691d3c352e0c845672667cd2ef6a9e3bfdad (patch)
tree608115b1b394f0f64b7de202b599f6df4ccdb85c /camel/providers
parentb1b809031f5a11223d97ee02d21fb6bb3693a367 (diff)
downloadgsoc2013-evolution-6024691d3c352e0c845672667cd2ef6a9e3bfdad.tar
gsoc2013-evolution-6024691d3c352e0c845672667cd2ef6a9e3bfdad.tar.gz
gsoc2013-evolution-6024691d3c352e0c845672667cd2ef6a9e3bfdad.tar.bz2
gsoc2013-evolution-6024691d3c352e0c845672667cd2ef6a9e3bfdad.tar.lz
gsoc2013-evolution-6024691d3c352e0c845672667cd2ef6a9e3bfdad.tar.xz
gsoc2013-evolution-6024691d3c352e0c845672667cd2ef6a9e3bfdad.tar.zst
gsoc2013-evolution-6024691d3c352e0c845672667cd2ef6a9e3bfdad.zip
Rename the OpenSSL implementation of things to match the NSS
implementation so that callers don't need to care which one is being used. * camel-tcp-stream-openssl.c: Implement CamelTcpStreamSSL, not CamelTcpStreamOpenSSL. Rename methods as well. Replace the camel-tcp-stream-openssl.h include with camel-tcp-stream-ssl.h. * camel-tcp-stream-openssl.h: Gone. * camel-tcp-stream-ssl.c: Add a note explaining that this implementation is only used for NSS, and that OpenSSL's implementation is in another file. (Should probably do some CVS renaming magic at some point.) * camel-http-stream.c (http_connect): Remove OpenSSL refs; the previously-NSS-specific code works for both now. * camel-remote-store.c: Likewise. * providers/smtp/camel-smtp-transport.c: Likewise. * providers/pop3/camel-pop3-store.c: Likewise. * Makefile.am (libcamelinclude_HEADERS): Remove camel-tcp-stream-openssl.h svn path=/trunk/; revision=16093
Diffstat (limited to 'camel/providers')
-rw-r--r--camel/providers/pop3/camel-pop3-store.c39
-rw-r--r--camel/providers/smtp/camel-smtp-transport.c37
2 files changed, 22 insertions, 54 deletions
diff --git a/camel/providers/pop3/camel-pop3-store.c b/camel/providers/pop3/camel-pop3-store.c
index 515e982b95..5a9a8aa7f0 100644
--- a/camel/providers/pop3/camel-pop3-store.c
+++ b/camel/providers/pop3/camel-pop3-store.c
@@ -51,12 +51,8 @@
#include "camel-data-cache.h"
#include "camel-tcp-stream.h"
#include "camel-tcp-stream-raw.h"
-#ifdef HAVE_NSS
+#ifdef HAVE_SSL
#include "camel-tcp-stream-ssl.h"
-#include <prnetdb.h>
-#endif
-#ifdef HAVE_OPENSSL
-#include "camel-tcp-stream-openssl.h"
#endif
/* Specified in RFC 1939 */
@@ -161,30 +157,21 @@ connect_to_server (CamelService *service, int ssl_mode, int try_starttls, int *s
port = service->url->port ? service->url->port : 110;
-#if defined (HAVE_NSS) || defined (HAVE_OPENSSL)
+#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)
- port = service->url->port ? service->url->port : 995;
-#ifdef HAVE_NSS
- /* this is the preferred SSL implementation */
if (try_starttls)
tcp_stream = camel_tcp_stream_ssl_new_raw (service, service->url->host);
- else
+ else {
+ port = service->url->port ? service->url->port : 995;
tcp_stream = camel_tcp_stream_ssl_new (service, service->url->host);
-#else
- /* use openssl... */
- if (try_starttls)
- tcp_stream = camel_tcp_stream_openssl_new_raw (service, service->url->host);
- else
- tcp_stream = camel_tcp_stream_openssl_new (service, service->url->host);
-#endif /* HAVE_NSS */
+ }
} else {
tcp_stream = camel_tcp_stream_raw_new ();
}
#else
tcp_stream = camel_tcp_stream_raw_new ();
-#endif /* HAVE_NSS || HAVE_OPENSSL */
+#endif /* HAVE_SSL */
ret = camel_tcp_stream_connect (CAMEL_TCP_STREAM (tcp_stream), h, port);
camel_free_host (h);
@@ -211,7 +198,7 @@ connect_to_server (CamelService *service, int ssl_mode, int try_starttls, int *s
if (stls_support)
*stls_support = store->engine->capa & CAMEL_POP3_CAP_STLS;
-#if defined (HAVE_NSS) || defined (HAVE_OPENSSL)
+#ifdef HAVE_SSL
if (store->engine) {
if (ssl_mode == USE_SSL_WHEN_POSSIBLE) {
if (store->engine->capa & CAMEL_POP3_CAP_STLS)
@@ -233,13 +220,13 @@ connect_to_server (CamelService *service, int ssl_mode, int try_starttls, int *s
}
}
}
-#endif /* HAVE_NSS || HAVE_OPENSSL */
+#endif /* HAVE_SSL */
camel_object_unref (CAMEL_OBJECT (tcp_stream));
return store->engine != NULL;
-#if defined (HAVE_NSS) || defined (HAVE_OPENSSL)
+#ifdef HAVE_SSL
starttls:
/* as soon as we send a STLS command, all hope is lost of a clean QUIT if problems arise */
clean_quit = FALSE;
@@ -259,11 +246,7 @@ connect_to_server (CamelService *service, int ssl_mode, int try_starttls, int *s
}
/* Okay, now toggle SSL/TLS mode */
-#ifdef HAVE_NSS
ret = camel_tcp_stream_ssl_enable_ssl (CAMEL_TCP_STREAM_SSL (tcp_stream));
-#else /* HAVE_OPENSSL */
- ret = camel_tcp_stream_openssl_enable_ssl (CAMEL_TCP_STREAM_OPENSSL (tcp_stream));
-#endif
camel_object_unref (CAMEL_OBJECT (tcp_stream));
@@ -294,7 +277,7 @@ connect_to_server (CamelService *service, int ssl_mode, int try_starttls, int *s
store->engine = NULL;
return FALSE;
-#endif /* HAVE_NSS || HAVE_OPENSSL */
+#endif /* HAVE_SSL */
}
static struct {
@@ -314,7 +297,7 @@ static struct {
static gboolean
connect_to_server_wrapper (CamelService *service, CamelException *ex)
{
-#if defined (HAVE_NSS) || defined (HAVE_OPENSSL)
+#ifdef HAVE_SSL
const char *use_ssl;
int stls_supported;
int i, ssl_mode;
diff --git a/camel/providers/smtp/camel-smtp-transport.c b/camel/providers/smtp/camel-smtp-transport.c
index 26cf4aa17f..d45c617c02 100644
--- a/camel/providers/smtp/camel-smtp-transport.c
+++ b/camel/providers/smtp/camel-smtp-transport.c
@@ -49,12 +49,9 @@
#include "camel-stream-buffer.h"
#include "camel-tcp-stream.h"
#include "camel-tcp-stream-raw.h"
-#ifdef HAVE_NSS
+#ifdef HAVE_SSL
#include "camel-tcp-stream-ssl.h"
#endif
-#ifdef HAVE_OPENSSL
-#include "camel-tcp-stream-openssl.h"
-#endif
#include "camel-session.h"
#include "camel-exception.h"
#include "camel-sasl.h"
@@ -261,28 +258,20 @@ connect_to_server (CamelService *service, int try_starttls, CamelException *ex)
port = service->url->port ? service->url->port : SMTP_PORT;
-#if defined (HAVE_NSS) || defined (HAVE_OPENSSL)
+#ifdef HAVE_SSL
if (transport->flags & CAMEL_SMTP_TRANSPORT_USE_SSL) {
- if (!try_starttls)
- port = service->url->port ? service->url->port : 465;
-#ifdef HAVE_NSS
- /* use the preferred implementation - NSS */
if (try_starttls)
tcp_stream = camel_tcp_stream_ssl_new_raw (service, service->url->host);
- else
+ else {
+ port = service->url->port ? service->url->port : 465;
tcp_stream = camel_tcp_stream_ssl_new (service, service->url->host);
-#else
- if (try_starttls)
- tcp_stream = camel_tcp_stream_openssl_new_raw (service, service->url->host);
- else
- tcp_stream = camel_tcp_stream_openssl_new (service, service->url->host);
-#endif /* HAVE_NSS */
+ }
} else {
tcp_stream = camel_tcp_stream_raw_new ();
}
#else
tcp_stream = camel_tcp_stream_raw_new ();
-#endif /* HAVE_NSS || HAVE_OPENSSL */
+#endif /* HAVE_SSL */
ret = camel_tcp_stream_connect (CAMEL_TCP_STREAM (tcp_stream), h, port);
camel_free_host (h);
@@ -335,7 +324,7 @@ connect_to_server (CamelService *service, int try_starttls, CamelException *ex)
smtp_helo (transport, ex);
}
-#if defined (HAVE_NSS) || defined (HAVE_OPENSSL)
+#ifdef HAVE_SSL
if (transport->flags & CAMEL_SMTP_TRANSPORT_USE_SSL_WHEN_POSSIBLE) {
/* try_starttls is always TRUE here */
if (transport->flags & CAMEL_SMTP_TRANSPORT_STARTTLS)
@@ -353,11 +342,11 @@ connect_to_server (CamelService *service, int try_starttls, CamelException *ex)
}
}
}
-#endif /* HAVE_NSS || HAVE_OPENSSL */
+#endif /* HAVE_SSL */
return TRUE;
-#if defined (HAVE_NSS) || defined (HAVE_OPENSSL)
+#ifdef HAVE_SSL
starttls:
d(fprintf (stderr, "sending : STARTTLS\r\n"));
if (camel_stream_write (tcp_stream, "STARTTLS\r\n", 10) == -1) {
@@ -384,11 +373,7 @@ connect_to_server (CamelService *service, int try_starttls, CamelException *ex)
} while (*(respbuf+3) == '-'); /* if we got "220-" then loop again */
/* Okay, now toggle SSL/TLS mode */
-#ifdef HAVE_NSS
ret = camel_tcp_stream_ssl_enable_ssl (CAMEL_TCP_STREAM_SSL (tcp_stream));
-#else /* HAVE_OPENSSL */
- ret = camel_tcp_stream_openssl_enable_ssl (CAMEL_TCP_STREAM_OPENSSL (tcp_stream));
-#endif
if (ret != -1)
return TRUE;
@@ -403,7 +388,7 @@ connect_to_server (CamelService *service, int try_starttls, CamelException *ex)
transport->ostream = NULL;
return FALSE;
-#endif /* HAVE_NSS || HAVE_OPENSSL */
+#endif /* HAVE_SSL */
}
#define EXCEPTION_RETRY(ex) (camel_exception_get_id (ex) != CAMEL_EXCEPTION_USER_CANCEL && \
@@ -412,7 +397,7 @@ connect_to_server (CamelService *service, int try_starttls, CamelException *ex)
static gboolean
connect_to_server_wrapper (CamelService *service, CamelException *ex)
{
-#if defined (HAVE_NSS) || defined (HAVE_OPENSSL)
+#ifdef HAVE_SSL
CamelSmtpTransport *transport = (CamelSmtpTransport *) service;
if (transport->flags & CAMEL_SMTP_TRANSPORT_USE_SSL_ALWAYS) {