From: Damien Riegel Date: Wed, 8 Nov 2017 20:26:39 +0000 (-0500) Subject: conn: define mutt_ssl_socket_setup even when building without SSL X-Git-Tag: neomutt-20180512~54^2~8 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9a10f223fc00b17531532d5112d2ea0ce2ded953;p=neomutt conn: define mutt_ssl_socket_setup even when building without SSL Error conditions were duplicated for builds with and without SSL. This can be factorized by letting mutt_ssl_socket_setup be defined even when SSL is not enabled. --- diff --git a/conn/conn.h b/conn/conn.h index a4f822b31..ec0ae0876 100644 --- a/conn/conn.h +++ b/conn/conn.h @@ -45,12 +45,10 @@ #include "connection.h" #include "sasl_plain.h" #include "socket.h" +#include "ssl.h" #include "tunnel.h" #ifdef USE_SASL #include "sasl.h" #endif -#ifdef USE_SSL -#include "ssl.h" -#endif #endif /* _CONN_CONN_H */ diff --git a/conn/ssl.h b/conn/ssl.h index c14ccf746..8a2b7ce80 100644 --- a/conn/ssl.h +++ b/conn/ssl.h @@ -28,6 +28,11 @@ struct Connection; int mutt_ssl_starttls(struct Connection *conn); int mutt_ssl_socket_setup(struct Connection *conn); +#else +static inline int mutt_ssl_socket_setup(struct Connection *conn) +{ + return -1; +} #endif #endif /* _CONN_SSL_H */ diff --git a/mutt_socket.c b/mutt_socket.c index b00536837..9477d688f 100644 --- a/mutt_socket.c +++ b/mutt_socket.c @@ -92,18 +92,16 @@ struct Connection *mutt_conn_find(const struct Connection *start, const struct A mutt_tunnel_socket_setup(conn); else if (account->flags & MUTT_ACCT_SSL) { -#ifdef USE_SSL if (mutt_ssl_socket_setup(conn) < 0) { +#ifndef USE_SSL + /* that's probably why it failed */ + mutt_error(_("SSL is unavailable, cannot connect to %s"), account->host); +#endif mutt_socket_free(conn); + return NULL; } -#else - mutt_error(_("SSL is unavailable, cannot connect to %s"), account->host); - mutt_socket_free(conn); - - return NULL; -#endif } else {