From: pdmef Date: Tue, 30 Aug 2005 22:27:29 +0000 (+0000) Subject: Rocco Rutte: X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=commitdiff_plain;h=29ed7b79229bb8e12bb1ead911a9a48031861ede Rocco Rutte: - use only either OpenSSL _or_ GNUTLS git-svn-id: svn://svn.berlios.de/mutt-ng/trunk@470 e385b8ad-14ed-0310-8656-cc95a2468c6d --- diff --git a/VERSION.svn b/VERSION.svn index 5ef9d24..5f476b6 100644 --- a/VERSION.svn +++ b/VERSION.svn @@ -1 +1 @@ -469 +470 diff --git a/configure.in b/configure.in index 2215e55..9838694 100644 --- a/configure.in +++ b/configure.in @@ -607,6 +607,10 @@ then then AC_MSG_ERROR([SSL support is only useful with POP or IMAP support]) fi + if test x"$need_ssl" = x"yes" + then + AC_MSG_ERROR([Only either OpenSSL or GNUTLS may be used]) + fi MUTT_AM_PATH_GNUTLS([$gnutls_prefix], [dnl GNUTLS found CPPFLAGS="$CPPFLAGS $LIBGNUTLS_CFLAGS" diff --git a/imap/imap.c b/imap/imap.c index 06e14ed..4a34d57 100644 --- a/imap/imap.c +++ b/imap/imap.c @@ -433,10 +433,8 @@ int imap_open_connection (IMAP_DATA * idata) if ((rc = imap_exec (idata, "STARTTLS", IMAP_CMD_FAIL_OK)) == -1) goto bail; if (rc != -2) { -#ifdef USE_SSL +#if defined (USE_SSL) || defined (USE_GNUTLS) if (mutt_ssl_starttls (idata->conn)) -#elif USE_GNUTLS - if (mutt_gnutls_starttls (idata->conn)) #endif { mutt_error (_("Could not negotiate TLS connection")); diff --git a/mutt_socket.c b/mutt_socket.c index 94dbfc5..f0ca158 100644 --- a/mutt_socket.c +++ b/mutt_socket.c @@ -237,10 +237,8 @@ CONNECTION *mutt_conn_find (const CONNECTION * start, const ACCOUNT * account) if (Tunnel && *Tunnel) mutt_tunnel_socket_setup (conn); else if (account->flags & M_ACCT_SSL) { -#ifdef USE_SSL - ssl_socket_setup (conn); -#elif USE_GNUTLS - if (mutt_gnutls_socket_setup (conn) < 0) { +#if defined (USE_SSL) || defined (USE_GNUTLS) + if (mutt_ssl_socket_setup (conn) < 0) { mutt_socket_free (conn); return NULL; } diff --git a/mutt_ssl.c b/mutt_ssl.c index 88bd825..f73cca7 100644 --- a/mutt_ssl.c +++ b/mutt_ssl.c @@ -11,6 +11,8 @@ # include "config.h" #endif +#ifdef USE_SSL + #include #include #include @@ -137,7 +139,7 @@ bail: * versions also. (That's the reason for the ugly #ifdefs and macros, * otherwise I could have simply #ifdef'd the whole ssl_init funcion) */ -int ssl_init (void) +static int ssl_init (void) { char path[_POSIX_PATH_MAX]; static unsigned char init_complete = 0; @@ -219,7 +221,7 @@ static int ssl_socket_open_err (CONNECTION * conn) } -int ssl_socket_setup (CONNECTION * conn) +int mutt_ssl_socket_setup (CONNECTION * conn) { if (ssl_init () < 0) { conn->conn_open = ssl_socket_open_err; @@ -707,3 +709,5 @@ static int ssl_passwd_cb (char *buf, int size, int rwflag, void *userdata) return snprintf (buf, size, "%s", account->pass); } + +#endif /* USE_SSL */ diff --git a/mutt_ssl.h b/mutt_ssl.h index 26fe2ca..97a3fab 100644 --- a/mutt_ssl.h +++ b/mutt_ssl.h @@ -12,14 +12,11 @@ #include "mutt_socket.h" -#ifdef USE_SSL +#if defined (USE_SSL) || defined (USE_GNUTLS) + int mutt_ssl_starttls (CONNECTION * conn); +int mutt_ssl_socket_setup (CONNECTION * conn); -extern int ssl_socket_setup (CONNECTION * conn); #endif -#ifdef USE_GNUTLS -int mutt_gnutls_starttls (CONNECTION * conn); -extern int mutt_gnutls_socket_setup (CONNECTION * conn); -#endif #endif /* _MUTT_SSL_H_ */ diff --git a/mutt_ssl_gnutls.c b/mutt_ssl_gnutls.c index a7181bd..4028629 100644 --- a/mutt_ssl_gnutls.c +++ b/mutt_ssl_gnutls.c @@ -12,6 +12,8 @@ # include "config.h" #endif +#ifdef USE_GNUTLS + #include #include #ifdef HAVE_GNUTLS_OPENSSL_H @@ -65,7 +67,7 @@ static int tls_init (void) return 0; } -int mutt_gnutls_socket_setup (CONNECTION * conn) +int mutt_ssl_socket_setup (CONNECTION * conn) { if (tls_init () < 0) return -1; @@ -131,7 +133,7 @@ static int tls_socket_open (CONNECTION * conn) return 0; } -int mutt_gnutls_starttls (CONNECTION * conn) +int mutt_ssl_starttls (CONNECTION * conn) { if (tls_init () < 0) return -1; @@ -795,3 +797,5 @@ static int tls_check_certificate (CONNECTION * conn) gnutls_x509_crt_deinit (cert); return (done == 2); } + +#endif /* USE_GNUTLS */ diff --git a/pop/pop_lib.c b/pop/pop_lib.c index c8764ef..22b2eaa 100644 --- a/pop/pop_lib.c +++ b/pop/pop_lib.c @@ -285,10 +285,8 @@ pop_query_status pop_open_connection (POP_DATA * pop_data) mutt_error ("%s", pop_data->err_msg); mutt_sleep (2); } -#ifdef USE_SSL +#if defined (USE_SSL) || defined (USE_GNUTLS) else if (mutt_ssl_starttls (pop_data->conn)) -#elif USE_GNUTLS - else if (mutt_gnutls_starttls (pop_data->conn)) #endif { mutt_error (_("Could not negotiate TLS connection"));