mirror of
https://github.com/jlu5/PyLink.git
synced 2024-12-25 04:02:45 +01:00
clientbot: fix SASL PLAIN auth on Python 3.4
A strange bug causes "TypeError: unsupported operand type(s) for %: 'bytes' and 'tuple'" when formatting multiple args into a byte string using %b.
This commit is contained in:
parent
f6f951fba8
commit
59f232d69f
@ -463,9 +463,10 @@ class ClientbotWrapperProtocol(Protocol):
|
|||||||
if args[0] == '+':
|
if args[0] == '+':
|
||||||
sasl_mech = self.irc.serverdata['sasl_mechanism'].upper()
|
sasl_mech = self.irc.serverdata['sasl_mechanism'].upper()
|
||||||
if sasl_mech == 'PLAIN':
|
if sasl_mech == 'PLAIN':
|
||||||
sasl_user = self.irc.serverdata['sasl_username'].encode('utf-8')
|
sasl_user = self.irc.serverdata['sasl_username']
|
||||||
sasl_pass = self.irc.serverdata['sasl_password'].encode('utf-8')
|
sasl_pass = self.irc.serverdata['sasl_password']
|
||||||
self.sendAuthChunk(b'%b\0%b\0%b' % (sasl_user, sasl_user, sasl_pass))
|
authstring = '%s\0%s\0%s' % (sasl_user, sasl_user, sasl_pass)
|
||||||
|
self.sendAuthChunk(authstring.encode('utf-8'))
|
||||||
elif sasl_mech == 'EXTERNAL':
|
elif sasl_mech == 'EXTERNAL':
|
||||||
self.irc.send('AUTHENTICATE +')
|
self.irc.send('AUTHENTICATE +')
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user