From: Pierre Habouzit Date: Sat, 26 May 2007 08:01:09 +0000 (+0200) Subject: various fixes and simplifications wrt openssl.h X-Git-Url: http://git.madism.org/?a=commitdiff_plain;h=e87df0bb071ba21d6e3d6a47cb797c135605eba5;p=apps%2Fmadmutt.git various fixes and simplifications wrt openssl.h Signed-off-by: Pierre Habouzit --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 607f6bf..0067433 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -192,6 +192,7 @@ ENDIF(WITH_GPGME) XCONFIG(libgnutls-config gnutls_INCDIR gnutls_LINKDIR gnutls_LDFLAGS gnutls_CFLAGS) INCLUDE_DIRECTORIES(${gnutls_INCDIR}) ADD_DEFINITIONS(${gnutls_CFLAGS}) +CHECK_INCLUDE_FILE(gnutls/openssl.h HAVE_GNUTLS_OPENSSL_H) SET(MUTTLIBS "${MUTTLIBS} ${gnutls_LDFLAGS}") CHECK_LIBRARY_EXISTS(sasl2 sasl_client_init "" WITH_SASL) diff --git a/config.h.cmake b/config.h.cmake index e56e82a..e9af40c 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -38,6 +38,7 @@ #cmakedefine HAVE_UNIX_H 1 #cmakedefine HAVE_WCHAR_H 1 #cmakedefine HAVE_WCTYPE_H 1 +#cmakedefine HAVE_GNUTLS_OPENSSL_H 1 /* type */ #cmakedefine HAVE_DIRENT_D_INO 1 diff --git a/lib-sys/mutt_ssl.cpkg b/lib-sys/mutt_ssl.cpkg index 8ceeb60..4495153 100644 --- a/lib-sys/mutt_ssl.cpkg +++ b/lib-sys/mutt_ssl.cpkg @@ -12,9 +12,6 @@ #include #include -#ifdef HAVE_GNUTLS_OPENSSL_H -#include -#endif #include #include diff --git a/sendlib.c b/sendlib.c index 8891280..0f33616 100644 --- a/sendlib.c +++ b/sendlib.c @@ -12,6 +12,10 @@ #include #ifdef USE_LIBESMTP +#ifdef HAVE_GNUTLS_OPENSSL_H +#define SSL_SESSION_ASN1_VERSION +#include +#endif #include #include #endif @@ -186,17 +190,6 @@ _send_smtp_messagefp_cb(void **buf, int *len, void *arg) return *buf; } -static int handle_invalid_peer_certificate (long vfy_result) { -#if defined (HAVE_GNUTLS_OPENSSL_H) - mutt_error (_("Error verifying certificate: %s"), - NONULL (X509_verify_cert_error_string (vfy_result))); -#else - mutt_error (_("Error verifying certificate. Error Code: %lu"), vfy_result); -#endif - sleep(2); - return 1; /* Accept the problem */ -} - static void event_cb (smtp_session_t session __attribute__ ((unused)), int event_no, void *arg,...) { @@ -225,8 +218,9 @@ static void event_cb (smtp_session_t session __attribute__ ((unused)), case SMTP_EV_INVALID_PEER_CERTIFICATE: { long vfy_result; vfy_result = va_arg(alist, long); ok = va_arg(alist, int*); - *ok = handle_invalid_peer_certificate(vfy_result); - sleep(1); + mutt_error (_("Error verifying certificate. Error Code: %lu"), vfy_result); + sleep(2); + *ok = 1; break; } case SMTP_EV_NO_PEER_CERTIFICATE: { @@ -317,8 +311,8 @@ int send_smtp_check_usetls (const char* option, unsigned long p, static int send_smtp_invoke(address_t *from, address_t *to, address_t *cc, address_t *bcc, const char *msg, int eightbit) -{ /* message contains 8bit chars */ - int ret = 0; /* return value, default = success */ +{ + int ret = 0; smtp_session_t session; smtp_message_t message; char *hostportstr = NULL; @@ -334,9 +328,9 @@ send_smtp_invoke(address_t *from, address_t *to, address_t *cc, SMTPFAIL ("smtp_create_session"); #ifdef HAVE_GNUTLS_OPENSSL_H - if (SmtpUseTLS != NULL && ascii_strncasecmp("enabled", SmtpUseTLS, 7) == 0) { + if (!ascii_strncasecmp("enabled", SmtpUseTLS, 7)) { smtp_starttls_enable(session, Starttls_ENABLED); - } else if (SmtpUseTLS != NULL && ascii_strncasecmp("required", SmtpUseTLS, 8) == 0) { + } else if (!ascii_strncasecmp("required", SmtpUseTLS, 8)) { smtp_starttls_enable(session, Starttls_REQUIRED); } #endif