mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-27 05:09:23 +01:00
src/irclib.py: Delay sending SASL authstring until given green light
That means wait until receiving 'AUTHENTICATE +' from the server, which means the mechanism is supported and we can proceed to send the authstring. It generally works anyway, but it's better to follow the standards, plus old versions of elemental-ircd may crash if we don't do this.
This commit is contained in:
parent
0af3bb91fb
commit
414249c9ac
@ -930,7 +930,7 @@ class Irc(IrcCommandDispatcher):
|
||||
else:
|
||||
if self.sasl_password:
|
||||
if not self.sasl_username:
|
||||
log.error('SASL username is not set, unable to identify.')
|
||||
log.warning('SASL username is not set, unable to identify.')
|
||||
else:
|
||||
auth_string = base64.b64encode('\x00'.join([
|
||||
self.sasl_username,
|
||||
@ -941,8 +941,6 @@ class Irc(IrcCommandDispatcher):
|
||||
self.queueMsg(ircmsgs.IrcMsg(command="CAP", args=('REQ', 'sasl')))
|
||||
log.debug('Using SASL mechanism PLAIN.')
|
||||
self.queueMsg(ircmsgs.IrcMsg(command="AUTHENTICATE", args=('PLAIN',)))
|
||||
log.info('Authenticating using SASL.')
|
||||
self.queueMsg(ircmsgs.IrcMsg(command="AUTHENTICATE", args=(auth_string,)))
|
||||
if self.password:
|
||||
log.info('Sending PASS command, not logging the password.')
|
||||
self.queueMsg(ircmsgs.password(self.password))
|
||||
@ -952,6 +950,12 @@ class Irc(IrcCommandDispatcher):
|
||||
self.ident, self.user)
|
||||
self.queueMsg(ircmsgs.user(self.ident, self.user))
|
||||
|
||||
def doAuthenticate(self, msg):
|
||||
if msg.args[0] == '+':
|
||||
log.info('Authenticating using SASL.')
|
||||
self.queueMsg(ircmsgs.IrcMsg(command="AUTHENTICATE", args=(auth_string,)))
|
||||
|
||||
|
||||
def do903(self, msg):
|
||||
log.info('%s: SASL authentication successful' % self.network)
|
||||
self.queueMsg(ircmsgs.IrcMsg(command='CAP', args=('END',)))
|
||||
|
Loading…
Reference in New Issue
Block a user