Fix for servers with LOGINDISABLED before STARTTLS

When connecting to a server that advertises LOGINDISABLED in its
CAPABILITIES before STARTTLS, the connection raises an error and
destroys the socket before completing STARTTLS.  This is demonstrated in
the following debug output:

debug: [connection] Connected to host
debug: <= '* OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE STARTTLS LOGINDISABLED] Dovecot ready.'
debug: => 'A0 CAPABILITY'
debug: <= '* CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE STARTTLS LOGINDISABLED'
debug: <= 'A0 OK Pre-login capabilities listed, post-login capabilities have more.'
error: Error: Logging in is disabled on this server source=authentication
debug: [connection] Closed

It appears that a return after _starttls was overlooked (since _starttls
will call _login again once the STARTTLS has completed).

Signed-off-by: Kevin Locke <klocke@quantpost.com>
fork
Kevin Locke 11 years ago
parent a3a1d158c5
commit 2981485551

@ -1463,8 +1463,10 @@ Connection.prototype._login = function() {
if (self.serverSupports('STARTTLS')
&& (self._config.autotls === 'always'
|| (self._config.autotls === 'required'
&& self.serverSupports('LOGINDISABLED'))))
&& self.serverSupports('LOGINDISABLED')))) {
self._starttls();
return;
}
if (self.serverSupports('LOGINDISABLED')) {
err = new Error('Logging in is disabled on this server');

Loading…
Cancel
Save