summaryrefslogtreecommitdiffstats
path: root/imap
diff options
context:
space:
mode:
authorKevin McCarthy <kevin@8t8.us>2020-11-16 10:20:21 -0800
committerKevin McCarthy <kevin@8t8.us>2020-11-19 17:29:17 -0800
commit04b06aaa3e0cc0022b9b01dbca2863756ebbf59a (patch)
tree4793b8141cb3e0d08c5ce1687c68a53de744534d /imap
parentd4c97068248a543ae17f0e94db0d68a8718126eb (diff)
Ensure IMAP connection is closed after a connection error.
During connection, if the server provided an illegal initial response, Mutt "bailed", but did not actually close the connection. The calling code unfortunately relied on the connection status to decide to continue with authentication, instead of checking the "bail" return value. This could result in authentication credentials being sent over an unencrypted connection, without $ssl_force_tls being consulted. Fix this by strictly closing the connection on any invalid response during connection. The fix is intentionally small, to ease backporting. A better fix would include removing the 'err_close_conn' label, and perhaps adding return value checking in the caller (though this change obviates the need for that). This addresses CVE-2020-28896. Thanks to Gabriel Salles-Loustau for reporting the problem, and providing test cases to reproduce.
Diffstat (limited to 'imap')
-rw-r--r--imap/imap.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/imap/imap.c b/imap/imap.c
index b24e8a3f..b13dd54d 100644
--- a/imap/imap.c
+++ b/imap/imap.c
@@ -561,9 +561,9 @@ int imap_open_connection (IMAP_DATA* idata)
#if defined(USE_SSL)
err_close_conn:
- imap_close_connection (idata);
#endif
bail:
+ imap_close_connection (idata);
FREE (&idata->capstr);
return -1;
}