Rocco Rutte:
authorpdmef <pdmef@e385b8ad-14ed-0310-8656-cc95a2468c6d>
Tue, 30 Aug 2005 22:27:29 +0000 (22:27 +0000)
committerpdmef <pdmef@e385b8ad-14ed-0310-8656-cc95a2468c6d>
Tue, 30 Aug 2005 22:27:29 +0000 (22:27 +0000)
- use only either OpenSSL _or_ GNUTLS

git-svn-id: svn://svn.berlios.de/mutt-ng/trunk@470 e385b8ad-14ed-0310-8656-cc95a2468c6d

VERSION.svn
configure.in
imap/imap.c
mutt_socket.c
mutt_ssl.c
mutt_ssl.h
mutt_ssl_gnutls.c
pop/pop_lib.c

index 5ef9d24..5f476b6 100644 (file)
@@ -1 +1 @@
-469
+470
index 2215e55..9838694 100644 (file)
@@ -607,6 +607,10 @@ then
   then
     AC_MSG_ERROR([SSL support is only useful with POP or IMAP support])
   fi
   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"
   MUTT_AM_PATH_GNUTLS([$gnutls_prefix],
     [dnl GNUTLS found
     CPPFLAGS="$CPPFLAGS $LIBGNUTLS_CFLAGS"
index 06e14ed..4a34d57 100644 (file)
@@ -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) {
         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))
           if (mutt_ssl_starttls (idata->conn))
-#elif USE_GNUTLS
-          if (mutt_gnutls_starttls (idata->conn))
 #endif
           {
             mutt_error (_("Could not negotiate TLS connection"));
 #endif
           {
             mutt_error (_("Could not negotiate TLS connection"));
index 94dbfc5..f0ca158 100644 (file)
@@ -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) {
   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;
     }
       mutt_socket_free (conn);
       return NULL;
     }
index 88bd825..f73cca7 100644 (file)
@@ -11,6 +11,8 @@
 # include "config.h"
 #endif
 
 # include "config.h"
 #endif
 
+#ifdef USE_SSL
+
 #include <openssl/ssl.h>
 #include <openssl/x509.h>
 #include <openssl/err.h>
 #include <openssl/ssl.h>
 #include <openssl/x509.h>
 #include <openssl/err.h>
@@ -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)
  */
  * 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;
 {
   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;
 {
   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);
 }
 
   return snprintf (buf, size, "%s", account->pass);
 }
+
+#endif /* USE_SSL */
index 26fe2ca..97a3fab 100644 (file)
 
 #include "mutt_socket.h"
 
 
 #include "mutt_socket.h"
 
-#ifdef USE_SSL
+#if defined (USE_SSL) || defined (USE_GNUTLS)
+
 int mutt_ssl_starttls (CONNECTION * conn);
 int mutt_ssl_starttls (CONNECTION * conn);
+int mutt_ssl_socket_setup (CONNECTION * conn);
 
 
-extern int ssl_socket_setup (CONNECTION * conn);
 #endif
 #endif
-#ifdef USE_GNUTLS
-int mutt_gnutls_starttls (CONNECTION * conn);
 
 
-extern int mutt_gnutls_socket_setup (CONNECTION * conn);
-#endif
 #endif /* _MUTT_SSL_H_ */
 #endif /* _MUTT_SSL_H_ */
index a7181bd..4028629 100644 (file)
@@ -12,6 +12,8 @@
 # include "config.h"
 #endif
 
 # include "config.h"
 #endif
 
+#ifdef USE_GNUTLS
+
 #include <gnutls/gnutls.h>
 #include <gnutls/x509.h>
 #ifdef HAVE_GNUTLS_OPENSSL_H
 #include <gnutls/gnutls.h>
 #include <gnutls/x509.h>
 #ifdef HAVE_GNUTLS_OPENSSL_H
@@ -65,7 +67,7 @@ static int tls_init (void)
   return 0;
 }
 
   return 0;
 }
 
-int mutt_gnutls_socket_setup (CONNECTION * conn)
+int mutt_ssl_socket_setup (CONNECTION * conn)
 {
   if (tls_init () < 0)
     return -1;
 {
   if (tls_init () < 0)
     return -1;
@@ -131,7 +133,7 @@ static int tls_socket_open (CONNECTION * conn)
   return 0;
 }
 
   return 0;
 }
 
-int mutt_gnutls_starttls (CONNECTION * conn)
+int mutt_ssl_starttls (CONNECTION * conn)
 {
   if (tls_init () < 0)
     return -1;
 {
   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);
 }
   gnutls_x509_crt_deinit (cert);
   return (done == 2);
 }
+
+#endif /* USE_GNUTLS */
index c8764ef..22b2eaa 100644 (file)
@@ -285,10 +285,8 @@ pop_query_status pop_open_connection (POP_DATA * pop_data)
         mutt_error ("%s", pop_data->err_msg);
         mutt_sleep (2);
       }
         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))
       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"));
 #endif
       {
         mutt_error (_("Could not negotiate TLS connection"));