summaryrefslogtreecommitdiffstats
path: root/mutt_ssl.c
diff options
context:
space:
mode:
authorKevin McCarthy <kevin@8t8.us>2022-08-25 13:23:43 -0700
committerKevin McCarthy <kevin@8t8.us>2022-08-25 13:23:43 -0700
commitc46db2be0e08ca59760cb26ad0e00d3a3970bc08 (patch)
tree46c205ebe33cc01378363f39b59d3a6c98a1b47d /mutt_ssl.c
parent56f1d3986a24d905dc558803a506cf32c838adf0 (diff)
Add error handling for cert prompts in batch mode.
It looks like there are no batch mode checks before trying to throw up a curses menu for certificate prompts. This currently affects SMTP, and I guess either hasn't been an issue or people just learned to work around it. Mutt has no great way to deal with this, so at least for now display an error and abort verification gracefully as opposed to whatever was happening before (which could not have been pretty). Alas, this breaks my rule of adding translation strings in stable, but I couldn't find another appropriate string.
Diffstat (limited to 'mutt_ssl.c')
-rw-r--r--mutt_ssl.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/mutt_ssl.c b/mutt_ssl.c
index 229ff4b4..4dc431db 100644
--- a/mutt_ssl.c
+++ b/mutt_ssl.c
@@ -1250,13 +1250,21 @@ static int interactive_check_cert (X509 *cert, int idx, int len, SSL *ssl, int a
char helpstr[LONG_STRING];
char buf[STRING];
char title[STRING];
- MUTTMENU *menu = mutt_new_menu (MENU_GENERIC);
+ MUTTMENU *menu;
int done;
BUFFER *drow = NULL;
unsigned u;
FILE *fp;
int allow_skip = 0, reset_ignoremacro = 0;
+ if (option (OPTNOCURSES))
+ {
+ dprint (1, (debugfile, "interactive_check_cert: unable to prompt for certificate in batch mode\n"));
+ mutt_error _("Untrusted server certificate");
+ return 0;
+ }
+
+ menu = mutt_new_menu (MENU_GENERIC);
mutt_push_current_menu (menu);
drow = mutt_buffer_pool_get ();