#include "camel-stream-buffer.h"
#include "camel-tcp-stream-raw.h"
-#ifdef HAVE_SSL
+#ifdef CAMEL_HAVE_SSL
#include "camel-tcp-stream-ssl.h"
#endif
d(printf("connecting to http stream @ '%s'\n", url->host));
if (!g_ascii_strcasecmp (url->protocol, "https")) {
-#ifdef HAVE_SSL
+#ifdef CAMEL_HAVE_SSL
stream = camel_tcp_stream_ssl_new (http->session, url->host, SSL_FLAGS);
#endif
} else {
#include <errno.h>
#include <unistd.h>
-#ifdef HAVE_NSS
+#ifdef CAMEL_HAVE_NSS
#include <nspr.h>
#endif
struct _CamelMsgPort {
GAsyncQueue *queue;
gint pipe[2]; /* on Win32, actually a pair of SOCKETs */
-#ifdef HAVE_NSS
+#ifdef CAMEL_HAVE_NSS
PRFileDesc *prpipe[2];
#endif
};
#endif
}
-#ifdef HAVE_NSS
+#ifdef CAMEL_HAVE_NSS
static gint
msgport_prpipe (PRFileDesc **fds)
{
}
}
-#ifdef HAVE_NSS
+#ifdef CAMEL_HAVE_NSS
static void
msgport_sync_with_prpipe (PRFileDesc *prfd)
{
msgport->queue = g_async_queue_new ();
msgport->pipe[0] = -1;
msgport->pipe[1] = -1;
-#ifdef HAVE_NSS
+#ifdef CAMEL_HAVE_NSS
msgport->prpipe[0] = NULL;
msgport->prpipe[1] = NULL;
#endif
MP_CLOSE (msgport->pipe[0]);
MP_CLOSE (msgport->pipe[1]);
}
-#ifdef HAVE_NSS
+#ifdef CAMEL_HAVE_NSS
if (msgport->prpipe[0] != NULL) {
PR_Close (msgport->prpipe[0]);
PR_Close (msgport->prpipe[1]);
return fd;
}
-#ifdef HAVE_NSS
+#ifdef CAMEL_HAVE_NSS
/**
* camel_msgport_prfd:
*
camel_msgport_push (CamelMsgPort *msgport, CamelMsg *msg)
{
gint fd;
-#ifdef HAVE_NSS
+#ifdef CAMEL_HAVE_NSS
PRFileDesc *prfd;
#endif
}
}
-#ifdef HAVE_NSS
+#ifdef CAMEL_HAVE_NSS
prfd = msgport->prpipe[1];
while (prfd != NULL) {
if (PR_Write (prfd, "E", 1) > 0) {
if (msg->flags & MSG_FLAG_SYNC_WITH_PIPE)
msgport_sync_with_pipe (msgport->pipe[0]);
-#ifdef HAVE_NSS
+#ifdef CAMEL_HAVE_NSS
if (msg->flags & MSG_FLAG_SYNC_WITH_PR_PIPE)
msgport_sync_with_prpipe (msgport->prpipe[0]);
#endif
if (msg != NULL && msg->flags & MSG_FLAG_SYNC_WITH_PIPE)
msgport_sync_with_pipe (msgport->pipe[0]);
-#ifdef HAVE_NSS
+#ifdef CAMEL_HAVE_NSS
if (msg != NULL && msg->flags & MSG_FLAG_SYNC_WITH_PR_PIPE)
msgport_sync_with_prpipe (msgport->prpipe[0]);
#endif
if (msg != NULL && msg->flags & MSG_FLAG_SYNC_WITH_PIPE)
msgport_sync_with_pipe (msgport->pipe[0]);
-#ifdef HAVE_NSS
+#ifdef CAMEL_HAVE_NSS
if (msg != NULL && msg->flags & MSG_FLAG_SYNC_WITH_PR_PIPE)
msgport_sync_with_prpipe (msgport->prpipe[0]);
#endif
CamelMsg * camel_msgport_timed_pop (CamelMsgPort *msgport, GTimeVal *end_time);
void camel_msgport_reply (CamelMsg *msg);
-#ifdef HAVE_NSS
+#ifdef CAMEL_HAVE_NSS
struct PRFileDesc * camel_msgport_prfd (CamelMsgPort *msgport);
#endif
#include <unistd.h>
#include <sys/time.h>
-#ifdef HAVE_NSS
+#ifdef CAMEL_HAVE_NSS
#include <nspr.h>
#endif
CamelMsgPort *cancel_port;
gint cancel_fd;
-#ifdef HAVE_NSS
+#ifdef CAMEL_HAVE_NSS
PRFileDesc *cancel_prfd;
#endif
};
return cc->cancel_fd;
}
-#ifdef HAVE_NSS
+#ifdef CAMEL_HAVE_NSS
/**
* camel_operation_cancel_prfd:
* @cc: operation context
return cc->cancel_prfd;
}
-#endif /* HAVE_NSS */
+#endif /* CAMEL_HAVE_NSS */
/**
* camel_operation_start:
/* called internally by camel, for the current thread */
gint camel_operation_cancel_check(CamelOperation *cc);
gint camel_operation_cancel_fd(CamelOperation *cc);
-#ifdef HAVE_NSS
+#ifdef CAMEL_HAVE_NSS
struct PRFileDesc *camel_operation_cancel_prfd(CamelOperation *cc);
#endif
/* return the registered operation for this thread, if there is one */
#include <config.h>
#endif
-#ifdef HAVE_NSS
+#ifdef CAMEL_HAVE_NSS
#include <errno.h>
#include <fcntl.h>
return 0;
}
-#endif /* HAVE_NSS */
+#endif /* CAMEL_HAVE_NSS */
#ifndef CAMEL_TCP_STREAM_SSL_H
#define CAMEL_TCP_STREAM_SSL_H
-#ifdef HAVE_SSL
+#ifdef CAMEL_HAVE_SSL
#include <camel/camel-tcp-stream.h>
#include <prio.h>
G_END_DECLS
-#endif /* HAVE_SSL */
+#endif /* CAMEL_HAVE_SSL */
#endif /* CAMEL_TCP_STREAM_SSL_H */
#include <signal.h>
-#ifdef HAVE_NSS
+#ifdef CAMEL_HAVE_NSS
#include <nspr.h>
#include <prthread.h>
#include "nss.h" /* Don't use <> here or it will include the system nss.h instead */
#include <ssl.h>
#include <errno.h>
-#endif /* HAVE_NSS */
+#endif /* CAMEL_HAVE_NSS */
#include <glib/gi18n-lib.h>
#include "camel-provider.h"
#include "camel-win32.h"
-#ifdef HAVE_NSS
+#ifdef CAMEL_HAVE_NSS
/* To protect NSS initialization and shutdown. This prevents
concurrent calls to shutdown() and init() by different threads */
PRLock *nss_initlock = NULL;
camel_debug_init();
-#ifdef HAVE_NSS
+#ifdef CAMEL_HAVE_NSS
if (nss_init) {
gchar *nss_configdir = NULL;
gchar *nss_sql_configdir = NULL;
g_free (nss_configdir);
g_free (nss_sql_configdir);
}
-#endif /* HAVE_NSS */
+#endif /* CAMEL_HAVE_NSS */
path = g_strdup_printf ("%s/camel-cert.db", configdir);
certdb = camel_certdb_new ();
/* These next calls must come last. */
-#if defined (HAVE_NSS)
+#if defined (CAMEL_HAVE_NSS)
if (nss_initlock != NULL) {
PR_Lock(nss_initlock);
if (nss_initialized)
NSS_Shutdown ();
PR_Unlock(nss_initlock);
}
-#endif /* HAVE_NSS */
+#endif /* CAMEL_HAVE_NSS */
initialised = FALSE;
}
Version: @VERSION@
Requires: glib-2.0 libedataserver-@API_VERSION@ sqlite3 @mozilla_nss@ @mozilla_nspr@
Libs: -L${libdir} -lcamel-@API_VERSION@ @MANUAL_NSS_LIBS@
-Cflags: -I${privincludedir} @MANUAL_NSS_CFLAGS@
+Cflags: -I${privincludedir} @CAMEL_SSL_DEFINES@ @MANUAL_NSS_CFLAGS@
MODE_TLS
};
-#ifdef HAVE_SSL
+#ifdef CAMEL_HAVE_SSL
#define SSL_PORT_FLAGS (CAMEL_TCP_STREAM_SSL_ENABLE_SSL2 | CAMEL_TCP_STREAM_SSL_ENABLE_SSL3)
#define STARTTLS_FLAGS (CAMEL_TCP_STREAM_SSL_ENABLE_TLS)
#endif
gchar *buf;
if (ssl_mode != MODE_CLEAR) {
-#ifdef HAVE_SSL
+#ifdef CAMEL_HAVE_SSL
if (ssl_mode == MODE_TLS)
tcp_stream = camel_tcp_stream_ssl_new_raw (service->session, service->url->host, STARTTLS_FLAGS);
else
return FALSE;
-#endif /* HAVE_SSL */
+#endif /* CAMEL_HAVE_SSL */
} else
tcp_stream = camel_tcp_stream_raw_new ();
return TRUE;
}
-#ifdef HAVE_SSL
+#ifdef CAMEL_HAVE_SSL
/* as soon as we send a STARTTLS command, all hope is lost of a clean QUIT if problems arise */
clean_quit = FALSE;
_("Failed to connect to IMAP server %s in secure mode: %s"),
service->url->host, _("SSL is not available in this build"));
goto exception;
-#endif /* HAVE_SSL */
+#endif /* CAMEL_HAVE_SSL */
/* rfc2595, section 4 states that after a successful STLS
command, the client MUST discard prior CAPA responses */
// fixme, use own type funcs
#include <ctype.h>
-#ifdef HAVE_NSS
+#ifdef CAMEL_HAVE_NSS
#include <nspr.h>
#include <prio.h>
#include <prerror.h>
CamelSockOptData sockopt;
gint ret, ssl_mode = 0;
-#ifdef HAVE_SSL
+#ifdef CAMEL_HAVE_SSL
const gchar *mode;
#endif
guint len;
serv = "imap";
port = "143";
}
-#ifdef HAVE_SSL
+#ifdef CAMEL_HAVE_SSL
mode = camel_url_get_param(is->url, "use_ssl");
if (mode && strcmp(mode, "never") != 0) {
if (!strcmp(mode, "when-possible")) {
#else
tcp_stream = camel_tcp_stream_raw_new ();
is->is_ssl_stream = FALSE;
-#endif /* HAVE_SSL */
+#endif /* CAMEL_HAVE_SSL */
camel_session_get_socks_proxy (is->session, &socks_host, &socks_port);
camel_imapx_command_free(ic);
}
-#ifdef HAVE_SSL
+#ifdef CAMEL_HAVE_SSL
if (ssl_mode == 2)
{
while (local_error == NULL && is->stream) {
camel_operation_uncancel (op);
-#ifdef HAVE_SSL
+#ifdef CAMEL_HAVE_SSL
if (is->is_ssl_stream) {
PRPollDesc pollfds[2] = { };
gint res;
MODE_TLS
};
-#ifdef HAVE_SSL
+#ifdef CAMEL_HAVE_SSL
#define SSL_PORT_FLAGS (CAMEL_TCP_STREAM_SSL_ENABLE_SSL2 | CAMEL_TCP_STREAM_SSL_ENABLE_SSL3)
#define STARTTLS_FLAGS (CAMEL_TCP_STREAM_SSL_ENABLE_TLS)
#endif
camel_service_lock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
if (ssl_mode != MODE_CLEAR) {
-#ifdef HAVE_SSL
+#ifdef CAMEL_HAVE_SSL
if (ssl_mode == MODE_TLS) {
tcp_stream = camel_tcp_stream_ssl_new_raw (service->session, service->url->host, STARTTLS_FLAGS);
} else {
_("Could not connect to %s: %s"),
service->url->host, _("SSL unavailable"));
goto fail;
-#endif /* HAVE_SSL */
+#endif /* CAMEL_HAVE_SSL */
} else {
tcp_stream = camel_tcp_stream_raw_new ();
}
MODE_TLS
};
-#ifdef HAVE_SSL
+#ifdef CAMEL_HAVE_SSL
#define SSL_PORT_FLAGS (CAMEL_TCP_STREAM_SSL_ENABLE_SSL2 | CAMEL_TCP_STREAM_SSL_ENABLE_SSL3)
#define STARTTLS_FLAGS (CAMEL_TCP_STREAM_SSL_ENABLE_TLS)
#endif
const gchar *delete_days;
if (ssl_mode != MODE_CLEAR) {
-#ifdef HAVE_SSL
+#ifdef CAMEL_HAVE_SSL
if (ssl_mode == MODE_TLS) {
tcp_stream = camel_tcp_stream_ssl_new_raw (service->session, service->url->host, STARTTLS_FLAGS);
} else {
service->url->host, _("SSL unavailable"));
return FALSE;
-#endif /* HAVE_SSL */
+#endif /* CAMEL_HAVE_SSL */
} else
tcp_stream = camel_tcp_stream_raw_new ();
return TRUE;
}
-#ifdef HAVE_SSL
+#ifdef CAMEL_HAVE_SSL
/* as soon as we send a STLS command, all hope is lost of a clean QUIT if problems arise */
clean_quit = FALSE;
_("Failed to connect to POP server %s in secure mode: %s"),
service->url->host, _("TLS is not available in this build"));
goto stls_exception;
-#endif /* HAVE_SSL */
+#endif /* CAMEL_HAVE_SSL */
g_object_unref (tcp_stream);
MODE_TLS
};
-#ifdef HAVE_SSL
+#ifdef CAMEL_HAVE_SSL
#define SSL_PORT_FLAGS (CAMEL_TCP_STREAM_SSL_ENABLE_SSL2 | CAMEL_TCP_STREAM_SSL_ENABLE_SSL3)
#define STARTTLS_FLAGS (CAMEL_TCP_STREAM_SSL_ENABLE_TLS)
#endif
transport->authtypes = NULL;
if (ssl_mode != MODE_CLEAR) {
-#ifdef HAVE_SSL
+#ifdef CAMEL_HAVE_SSL
if (ssl_mode == MODE_TLS) {
tcp_stream = camel_tcp_stream_ssl_new_raw (service->session, service->url->host, STARTTLS_FLAGS);
} else {
service->url->host, _("SSL unavailable"));
return FALSE;
-#endif /* HAVE_SSL */
+#endif /* CAMEL_HAVE_SSL */
} else {
tcp_stream = camel_tcp_stream_raw_new ();
}
return TRUE;
}
-#ifdef HAVE_SSL
+#ifdef CAMEL_HAVE_SSL
if (!(transport->flags & CAMEL_SMTP_TRANSPORT_STARTTLS)) {
g_set_error (
error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
_("Failed to connect to SMTP server %s in secure mode: %s"),
service->url->host, _("SSL is not available in this build"));
goto exception_cleanup;
-#endif /* HAVE_SSL */
+#endif /* CAMEL_HAVE_SSL */
/* We are supposed to re-EHLO after a successful STARTTLS to
re-fetch any supported extensions. */
AC_DEFINE(ENABLE_SMIME,1,[Define if SMIME should be enabled])
msg_smime="yes"
fi
- AC_DEFINE(HAVE_NSS,1,[Define if you have NSS])
- AC_DEFINE(HAVE_SSL,1,[Define if you have a supported SSL library])
+ AC_DEFINE(CAMEL_HAVE_NSS,1,[Define if you have NSS])
+ AC_DEFINE(CAMEL_HAVE_SSL,1,[Define if you have a supported SSL library])
MANUAL_NSPR_CFLAGS=""
MANUAL_NSPR_LIBS=""
MANUAL_NSS_CFLAGS=""
LIBS="$LIBS_save"
if test "x${moz_nss_libs}" = "xyes"; then
- AC_DEFINE(HAVE_NSS)
- AC_DEFINE(HAVE_SSL)
+ AC_DEFINE(CAMEL_HAVE_NSS)
+ AC_DEFINE(CAMEL_HAVE_SSL)
msg_ssl="yes"
if test "x${enable_smime}" = "xyes"; then
AC_DEFINE(ENABLE_SMIME,1,[Define if SMIME should be enabled])
fi
fi
+dnl These flags are used in camel.pc.in.
+if test "x${msg_ssl}" = "xyes"; then
+ CAMEL_SSL_DEFINES="-DCAMEL_HAVE_NSS -DCAMEL_HAVE_SSL"
+else
+ CAMEL_SSL_DEFINES=""
+fi
+
AM_CONDITIONAL(ENABLE_SMIME, test "x$msg_smime" != "xno")
dnl For pkgconfig files.
AC_SUBST(mozilla_nss)
AC_SUBST(mozilla_nspr)
+AC_SUBST(CAMEL_SSL_DEFINES)
AC_SUBST(MANUAL_NSPR_CFLAGS)
AC_SUBST(MANUAL_NSPR_LIBS)
AC_SUBST(MANUAL_NSS_CFLAGS)