Changeset 4622:296e096c6331
- Timestamp:
- 2006-04-28 01:35:02 (3 years ago)
- Author:
- Rocco Rutte <pdmef@…>
- Branch:
- HEAD
- Message:
-
pdmef+fix+sslinterface. Triggered by a warning when compiling
with POP and GNUTLS, I noticed the SSL interfaces for OpenSSL
and GNUTLS internally are different which doesn't make sense.
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
r4475
|
r4622
|
|
| 310 | 310 | #ifdef USE_IMAP |
| 311 | 311 | if (tmp->magic != M_IMAP) |
| | 312 | { |
| 312 | 313 | #endif |
| 313 | 314 | #ifdef USE_POP |
| … |
… |
|
| 328 | 329 | continue; |
| 329 | 330 | } |
| | 331 | #ifdef USE_IMAP |
| | 332 | } |
| | 333 | #endif |
| 330 | 334 | |
| 331 | 335 | /* check to see if the folder is the currently selected folder |
-
|
r4620
|
r4622
|
|
| 588 | 588 | |
| 589 | 589 | AC_DEFINE(USE_SSL,1,[ Define if you want support for SSL. ]) |
| | 590 | AC_DEFINE(USE_SSL_OPENSSL,1,[ Define if you want support for SSL via OpenSSL. ]) |
| 590 | 591 | LIBS="$saved_LIBS" |
| 591 | 592 | MUTTLIBS="$MUTTLIBS -lssl -lcrypto" |
| … |
… |
|
| 598 | 599 | AC_ARG_WITH([gnutls], AC_HELP_STRING([--with-gnutls[=PFX]], [Enable SSL support using gnutls]), |
| 599 | 600 | [gnutls_prefix="$withval"], [gnutls_prefix="no"]) |
| 600 | | if test "$gnutls_prefix" != "no" |
| | 601 | if test "$gnutls_prefix" != "no" -a x"$need_ssl" != xyes |
| 601 | 602 | then |
| 602 | 603 | if test "$need_socket" != "yes" |
| … |
… |
|
| 608 | 609 | CPPFLAGS="$CPPFLAGS $LIBGNUTLS_CFLAGS" |
| 609 | 610 | MUTTLIBS="$MUTTLIBS $LIBGNUTLS_LIBS" |
| 610 | | AC_DEFINE(USE_GNUTLS, 1, [Define if you want support for SSL via the gnutls library.]) |
| | 611 | |
| | 612 | AC_DEFINE(USE_SSL,1,[ Define if you want support for SSL. ]) |
| | 613 | AC_DEFINE(USE_SSL_GNUTLS,1,[ Define if you want support for SSL via GNUTLS. ]) |
| 611 | 614 | |
| 612 | 615 | MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS mutt_ssl_gnutls.o" |
-
|
r4556
|
r4622
|
|
| 116 | 116 | WHERE char *Spoolfile; |
| 117 | 117 | WHERE char *SpamSep; |
| 118 | | #if defined(USE_SSL) || defined(USE_GNUTLS) |
| | 118 | #if defined(USE_SSL) |
| 119 | 119 | WHERE char *SslCertFile INITVAL (NULL); |
| 120 | 120 | #endif |
| 121 | | #ifdef USE_SSL |
| | 121 | #ifdef USE_SSL_OPENSSL |
| 122 | 122 | WHERE char *SslClientCert INITVAL (NULL); |
| 123 | 123 | WHERE LIST *SslSessionCerts INITVAL (NULL); |
| … |
… |
|
| 126 | 126 | WHERE char *SslEntropyFile INITVAL (NULL); |
| 127 | 127 | #endif |
| 128 | | #ifdef USE_GNUTLS |
| | 128 | #ifdef USE_SSL_GNUTLS |
| 129 | 129 | WHERE short SslDHPrimeBits; |
| 130 | 130 | WHERE char *SslCACertFile INITVAL (NULL); |
-
|
r4574
|
r4622
|
|
| 33 | 33 | #include "message.h" |
| 34 | 34 | #include "imap_private.h" |
| 35 | | #if defined(USE_SSL) || defined(USE_GNUTLS) |
| | 35 | #if defined(USE_SSL) |
| 36 | 36 | # include "mutt_ssl.h" |
| 37 | 37 | #endif |
| … |
… |
|
| 410 | 410 | && imap_check_capabilities (idata)) |
| 411 | 411 | goto bail; |
| 412 | | #if defined(USE_SSL) || defined(USE_GNUTLS) |
| | 412 | #if defined(USE_SSL) |
| 413 | 413 | /* Attempt STARTTLS if available and desired. */ |
| 414 | 414 | if (!idata->conn->ssf && (option(OPTSSLFORCETLS) || |
| … |
… |
|
| 427 | 427 | if (rc != -2) |
| 428 | 428 | { |
| 429 | | #ifdef USE_SSL |
| 430 | 429 | if (mutt_ssl_starttls (idata->conn)) |
| 431 | | #elif USE_GNUTLS |
| 432 | | if (mutt_gnutls_starttls (idata->conn)) |
| 433 | | #endif |
| 434 | 430 | { |
| 435 | 431 | mutt_error (_("Could not negotiate TLS connection")); |
| … |
… |
|
| 470 | 466 | return 0; |
| 471 | 467 | |
| | 468 | #if defined(USE_SSL) |
| 472 | 469 | err_close_conn: |
| 473 | 470 | mutt_socket_close (idata->conn); |
| 474 | 471 | idata->state = IMAP_DISCONNECTED; |
| | 472 | #endif |
| 475 | 473 | bail: |
| 476 | 474 | FREE (&idata->capstr); |
-
|
r4572
|
r4622
|
|
| 32 | 32 | #include "mutt_idna.h" |
| 33 | 33 | |
| 34 | | #if defined(USE_SSL) || defined(USE_GNUTLS) |
| | 34 | #if defined(USE_SSL) |
| 35 | 35 | #include "mutt_ssl.h" |
| 36 | 36 | #endif |
-
|
r4606
|
r4622
|
|
| 93 | 93 | # define USE_POP |
| 94 | 94 | # endif |
| | 95 | # ifndef USE_SSL_OPENSSL |
| | 96 | # define USE_SSL_OPENSSL |
| | 97 | # endif |
| | 98 | # ifndef USE_SSL_GNUTLS |
| | 99 | # define USE_SSL_GNUTLS |
| | 100 | # endif |
| 95 | 101 | # ifndef USE_SSL |
| 96 | 102 | # define USE_SSL |
| 97 | | # endif |
| 98 | | # ifndef USE_GNUTLS |
| 99 | | # define USE_GNUTLS |
| 100 | 103 | # endif |
| 101 | 104 | # ifndef USE_SOCKET |
| … |
… |
|
| 1915 | 1918 | */ |
| 1916 | 1919 | |
| 1917 | | #if defined(USE_SSL) || defined(USE_GNUTLS) |
| 1918 | | #ifdef USE_SSL |
| | 1920 | #if defined(USE_SSL) |
| | 1921 | #ifdef USE_SSL_OPENSSL |
| 1919 | 1922 | { "ssl_client_cert", DT_PATH, R_NONE, UL &SslClientCert, 0 }, |
| 1920 | 1923 | /* |
| … |
… |
|
| 1923 | 1926 | ** key. |
| 1924 | 1927 | */ |
| 1925 | | #endif /* USE_SSL */ |
| | 1928 | #endif /* USE_SSL_OPENSSL */ |
| 1926 | 1929 | { "ssl_force_tls", DT_BOOL, R_NONE, OPTSSLFORCETLS, 0 }, |
| 1927 | 1930 | /* |
| … |
… |
|
| 1955 | 1958 | ** Example: set certificate_file=~/.mutt/certificates |
| 1956 | 1959 | */ |
| 1957 | | # if defined _MAKEDOC || !defined(USE_GNUTLS) |
| | 1960 | # if defined _MAKEDOC || !defined(USE_SSL_GNUTLS) |
| 1958 | 1961 | { "ssl_usesystemcerts", DT_BOOL, R_NONE, OPTSSLSYSTEMCERTS, 1 }, |
| 1959 | 1962 | /* |
| … |
… |
|
| 1975 | 1978 | ** SSL authentication process. |
| 1976 | 1979 | */ |
| 1977 | | # endif /* defined _MAKEDOC || !defined(USE_GNUTLS) */ |
| | 1980 | # endif /* defined _MAKEDOC || !defined(USE_SSL_GNUTLS) */ |
| 1978 | 1981 | { "ssl_use_sslv3", DT_BOOL, R_NONE, OPTSSLV3, 1 }, |
| 1979 | 1982 | /* |
| … |
… |
|
| 1988 | 1991 | ** SSL authentication process. |
| 1989 | 1992 | */ |
| 1990 | | # ifdef USE_GNUTLS |
| | 1993 | # ifdef USE_SSL_GNUTLS |
| 1991 | 1994 | { "ssl_min_dh_prime_bits", DT_NUM, R_NONE, UL &SslDHPrimeBits, 0 }, |
| 1992 | 1995 | /* |
| … |
… |
|
| 2005 | 2008 | ** Example: set ssl_ca_certificates_file=/etc/ssl/certs/ca-certificates.crt |
| 2006 | 2009 | */ |
| 2007 | | # endif /* USE_GNUTLS */ |
| 2008 | | #endif /* defined(USE_SSL) || defined(USE_GNUTLS) */ |
| | 2010 | # endif /* USE_SSL_GNUTLS */ |
| | 2011 | #endif /* defined(USE_SSL) */ |
| 2009 | 2012 | |
| 2010 | 2013 | { "pipe_split", DT_BOOL, R_NONE, OPTPIPESPLIT, 0 }, |
-
|
r4574
|
r4622
|
|
| 265 | 265 | |
| 266 | 266 | |
| 267 | | #ifdef USE_SSL |
| 268 | | "+USE_SSL " |
| 269 | | #else |
| 270 | | "-USE_SSL " |
| 271 | | #endif |
| 272 | | |
| 273 | | #ifdef USE_GNUTLS |
| 274 | | "+USE_GNUTLS " |
| 275 | | #else |
| 276 | | "-USE_GNUTLS " |
| | 267 | #ifdef USE_SSL_OPENSSL |
| | 268 | "+USE_SSL_OPENSSL " |
| | 269 | #else |
| | 270 | "-USE_SSL_OPENSSL " |
| | 271 | #endif |
| | 272 | |
| | 273 | #ifdef USE_SSL_GNUTLS |
| | 274 | "+USE_SSL_GNUTLS " |
| | 275 | #else |
| | 276 | "-USE_SSL_GNUTLS " |
| 277 | 277 | #endif |
| 278 | 278 | |
-
|
r4556
|
r4622
|
|
| 249 | 249 | /* options for socket code */ |
| 250 | 250 | M_NEW_SOCKET, |
| 251 | | #ifdef USE_SSL |
| | 251 | #ifdef USE_SSL_OPENSSL |
| 252 | 252 | M_NEW_SSL_SOCKET, |
| 253 | 253 | #endif |
| … |
… |
|
| 290 | 290 | OPT_REPLYTO, |
| 291 | 291 | OPT_RECALL, |
| 292 | | #if defined(USE_SSL) || defined(USE_GNUTLS) |
| | 292 | #if defined(USE_SSL) |
| 293 | 293 | OPT_SSLSTARTTLS, |
| 294 | 294 | #endif |
| … |
… |
|
| 377 | 377 | OPTIMAPSERVERNOISE, |
| 378 | 378 | #endif |
| 379 | | #if defined(USE_SSL) || defined(USE_GNUTLS) |
| 380 | | # ifndef USE_GNUTLS |
| | 379 | #if defined(USE_SSL) |
| | 380 | # ifndef USE_SSL_GNUTLS |
| 381 | 381 | OPTSSLSYSTEMCERTS, |
| 382 | 382 | OPTSSLV2, |
| 383 | | # endif /* USE_GNUTLS */ |
| | 383 | # endif /* USE_SSL_GNUTLS */ |
| 384 | 384 | OPTSSLV3, |
| 385 | 385 | OPTTLSV1, |
| 386 | 386 | OPTSSLFORCETLS, |
| 387 | | #endif /* defined(USE_SSL) || defined(USE_GNUTLS) */ |
| | 387 | #endif /* defined(USE_SSL) */ |
| 388 | 388 | OPTIMPLICITAUTOVIEW, |
| 389 | 389 | OPTINCLUDEONLYFIRST, |
-
|
r4468
|
r4622
|
|
| 27 | 27 | #include "mutt_socket.h" |
| 28 | 28 | #include "mutt_tunnel.h" |
| 29 | | #if defined(USE_SSL) || defined(USE_GNUTLS) |
| | 29 | #if defined(USE_SSL) |
| 30 | 30 | # include "mutt_ssl.h" |
| 31 | 31 | #endif |
| … |
… |
|
| 276 | 276 | else if (account->flags & M_ACCT_SSL) |
| 277 | 277 | { |
| 278 | | #ifdef USE_SSL |
| 279 | | ssl_socket_setup (conn); |
| 280 | | #elif USE_GNUTLS |
| 281 | | if (mutt_gnutls_socket_setup (conn) < 0) |
| | 278 | #if defined(USE_SSL) |
| | 279 | if (mutt_ssl_socket_setup (conn) < 0) |
| 282 | 280 | { |
| 283 | 281 | mutt_socket_free (conn); |
-
|
r4477
|
r4622
|
|
| 230 | 230 | |
| 231 | 231 | |
| 232 | | int ssl_socket_setup (CONNECTION * conn) |
| | 232 | int mutt_ssl_socket_setup (CONNECTION * conn) |
| 233 | 233 | { |
| 234 | 234 | if (ssl_init() < 0) |
-
|
r4343
|
r4622
|
|
| 22 | 22 | #include "mutt_socket.h" |
| 23 | 23 | |
| 24 | | #ifdef USE_SSL |
| | 24 | #if defined(USE_SSL) |
| 25 | 25 | int mutt_ssl_starttls (CONNECTION* conn); |
| | 26 | int mutt_ssl_socket_setup (CONNECTION *conn); |
| | 27 | #endif |
| 26 | 28 | |
| 27 | | extern int ssl_socket_setup (CONNECTION *conn); |
| 28 | | #endif |
| 29 | | #ifdef USE_GNUTLS |
| 30 | | int mutt_gnutls_starttls (CONNECTION* conn); |
| 31 | | |
| 32 | | extern int mutt_gnutls_socket_setup (CONNECTION *conn); |
| 33 | | #endif |
| 34 | 29 | #endif /* _MUTT_SSL_H_ */ |
-
|
r4477
|
r4622
|
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | | int mutt_gnutls_socket_setup (CONNECTION* conn) |
| | 75 | int mutt_ssl_socket_setup (CONNECTION* conn) |
| 76 | 76 | { |
| 77 | 77 | if (tls_init() < 0) |
| … |
… |
|
| 145 | 145 | } |
| 146 | 146 | |
| 147 | | int mutt_gnutls_starttls (CONNECTION* conn) |
| | 147 | int mutt_ssl_starttls (CONNECTION* conn) |
| 148 | 148 | { |
| 149 | 149 | if (tls_init() < 0) |
| … |
… |
|
| 442 | 442 | { |
| 443 | 443 | regfree(&preg); |
| 444 | | safe_free((void**)&linestr); |
| | 444 | FREE(&linestr); |
| 445 | 445 | fclose(fp); |
| 446 | 446 | return 1; |
-
|
r4343
|
r4622
|
|
| 25 | 25 | #include "url.h" |
| 26 | 26 | #include "pop.h" |
| 27 | | #ifdef USE_SSL |
| | 27 | #if defined(USE_SSL) |
| 28 | 28 | # include "mutt_ssl.h" |
| 29 | 29 | #endif |
| … |
… |
|
| 275 | 275 | } |
| 276 | 276 | |
| 277 | | #if defined(USE_SSL) || defined(USE_GNUTLS) |
| | 277 | #if defined(USE_SSL) |
| 278 | 278 | /* Attempt STLS if available and desired. */ |
| 279 | 279 | if (!pop_data->conn->ssf && (pop_data->cmd_stls || option(OPTSSLFORCETLS))) |
| … |
… |
|
| 302 | 302 | mutt_sleep (2); |
| 303 | 303 | } |
| 304 | | #ifdef USE_SSL |
| 305 | 304 | else if (mutt_ssl_starttls (pop_data->conn)) |
| 306 | | #elif USE_GNUTLS |
| 307 | | else if (mutt_gnutls_starttls (pop_data->conn)) |
| 308 | | #endif |
| 309 | 305 | { |
| 310 | 306 | mutt_error (_("Could not negotiate TLS connection")); |