From 9000bb9b17cd9a0d138e744b8e4451a2cb06921a Mon Sep 17 00:00:00 2001 From: Thomas Roessler Date: Wed, 26 Apr 2000 07:32:40 +0000 Subject: [PATCH] Add a new option named imap_force_ssl. --- imap/imap_ssl.c | 9 +++++++++ imap/imap_ssl.h | 1 + imap/util.c | 13 ++++++------- init.h | 8 ++++++++ mutt.h | 3 +++ 5 files changed, 27 insertions(+), 7 deletions(-) diff --git a/imap/imap_ssl.c b/imap/imap_ssl.c index 911492a1c..28081649b 100644 --- a/imap/imap_ssl.c +++ b/imap/imap_ssl.c @@ -30,6 +30,7 @@ #include "mutt.h" #include "imap.h" +#include "imap_private.h" #include "imap_socket.h" #include "mutt_menu.h" #include "mutt_curses.h" @@ -119,6 +120,14 @@ int ssl_init (void) return -1; } +void imap_set_ssl (IMAP_MBOX *mx) +{ + if (! (mx->flags & M_IMAP_PORT)) + mx->port = IMAP_SSL_PORT; + mx->socktype = M_NEW_SSL_SOCKET; + mx->flags |= M_IMAP_TYPE; +} + static int ssl_socket_open_err (CONNECTION *conn) { mutt_error (_("SSL disabled due the lack of entropy")); diff --git a/imap/imap_ssl.h b/imap/imap_ssl.h index 2e9bed2d1..4ee7062d6 100644 --- a/imap/imap_ssl.h +++ b/imap/imap_ssl.h @@ -23,5 +23,6 @@ extern char *SslCertFile; extern char *SslEntropyFile; extern int ssl_socket_setup (CONNECTION *conn); +extern void imap_set_ssl (IMAP_MBOX *mx); #endif diff --git a/imap/util.c b/imap/util.c index 2c4262ea9..bf0862a2c 100644 --- a/imap/util.c +++ b/imap/util.c @@ -171,12 +171,7 @@ int imap_parse_path (const char *path, IMAP_MBOX *mx) { #ifdef USE_SSL if (!strcmp (mx->type, "ssl")) - { - if (! (mx->flags & M_IMAP_PORT)) - mx->port = IMAP_SSL_PORT; - mx->socktype = M_NEW_SSL_SOCKET; - mx->flags |= M_IMAP_TYPE; - } + imap_set_ssl (mx); else #endif { @@ -184,8 +179,12 @@ int imap_parse_path (const char *path, IMAP_MBOX *mx) return (-1); } } +#ifdef USE_SSL + else if (option (OPTIMAPFORCESSL)) + imap_set_ssl (mx); +#endif } - + return 0; } diff --git a/init.h b/init.h index 02022ff80..0466e14a6 100644 --- a/init.h +++ b/init.h @@ -640,6 +640,14 @@ struct option_t MuttVars[] = { ** This variable configures how often (in seconds) IMAP should look for ** new mail. */ +# ifdef USE_SSL + { "imap_force_ssl", DT_BOOL, R_NONE, OPTIMAPFORCESSL, 0 }, + /* + ** .pp + ** If this variable is set, Mutt will always use SSL when + ** connecting to IMAP servers. + */ +# endif { "imap_list_subscribed", DT_BOOL, R_NONE, OPTIMAPLSUB, 0 }, /* ** .pp diff --git a/mutt.h b/mutt.h index 1edab7553..db7ba4c6e 100644 --- a/mutt.h +++ b/mutt.h @@ -301,6 +301,9 @@ enum OPTIMAPLSUB, OPTIMAPPASSIVE, OPTIMAPSERVERNOISE, +# ifdef USE_SSL + OPTIMAPFORCESSL, +# endif #endif #ifdef USE_SSL OPTSSLV2, -- 2.40.0