From 225c249ec20e8603297bc0ed3b4a643c4ed4791c Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Sat, 5 Jun 2021 15:50:00 +0200 Subject: [PATCH] irclib: Fix crash on SASL authentication failure --- src/irclib.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/irclib.py b/src/irclib.py index a74efda3c..07d5427c7 100644 --- a/src/irclib.py +++ b/src/irclib.py @@ -1973,7 +1973,14 @@ class Irc(IrcCommandDispatcher, log.Firewalled): def do906(self, msg): log.warning('%s: SASL authentication aborted', self.network) - self.tryNextSaslMechanism(msg) # TODO: should not try this in state INIT_WAITING_MOTD (set when sending CAP END because of exhausted list of SASL mechs) + if self.state.fsm.state == IrcStateFsm.States.INIT_WAITING_MOTD: + # This 906 was triggered by sending 'CAP END' after we exhausted + # all authentication mechanism; so it does not make sense to try + # self.tryNextSaslMechanism() again. And it would crash anyway, + # because it does not expect the connection to be in this state. + pass + else: + self.tryNextSaslMechanism(msg) def do907(self, msg): log.warning('%s: Attempted SASL authentication when we were already '