From de38d93085a8d050be4b09e0b0a286555d0514e1 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Thu, 28 Oct 2021 11:29:34 +0200 Subject: [PATCH] Always reply ERR_SASLABORTED on SASL abort Some clients (Hexchat) always expect AUTHENTICATE * to succeed with ERR_SASLABORTED even if SASL hasn't been started. --- downstream.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/downstream.go b/downstream.go index ba536ab..17ad0f9 100644 --- a/downstream.go +++ b/downstream.go @@ -601,7 +601,13 @@ func (dc *downstreamConn) handleMessageUnregistered(msg *irc.Message) error { } var resp []byte - if dc.saslServer == nil { + if msg.Params[0] == "*" { + dc.saslServer = nil + return ircError{&irc.Message{ + Command: irc.ERR_SASLABORTED, + Params: []string{"*", "SASL authentication aborted"}, + }} + } else if dc.saslServer == nil { mech := strings.ToUpper(msg.Params[0]) switch mech { case "PLAIN": @@ -614,12 +620,6 @@ func (dc *downstreamConn) handleMessageUnregistered(msg *irc.Message) error { Params: []string{"*", fmt.Sprintf("Unsupported SASL mechanism %q", mech)}, }} } - } else if msg.Params[0] == "*" { - dc.saslServer = nil - return ircError{&irc.Message{ - Command: irc.ERR_SASLABORTED, - Params: []string{"*", "SASL authentication aborted"}, - }} } else if msg.Params[0] == "+" { resp = nil } else {