25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-22 16:20:52 +01:00

Fix extauth.py so support : in passwords (thanks to jmberg)(#1676)

This commit is contained in:
Badlop 2017-07-31 22:51:12 +02:00
parent 51fa438340
commit 67918b17d3

View File

@ -3,23 +3,27 @@ import struct
def read(): def read():
(pkt_size,) = struct.unpack('>H', sys.stdin.read(2)) (pkt_size,) = struct.unpack('>H', sys.stdin.read(2))
pkt = sys.stdin.read(pkt_size).split(':') pkt = sys.stdin.read(pkt_size)
cmd = pkt[0] cmd = pkt.split(':')[0]
args_num = len(pkt) - 1 if cmd == 'auth':
if cmd == 'auth' and args_num >= 3: u, s, p = pkt.split(':', 3)[1:]
if pkt[1] == "wrong": if u == "wrong":
write(False) write(False)
else: else:
write(True) write(True)
elif cmd == 'isuser' and args_num == 2: elif cmd == 'isuser':
u, s = pkt.split(':', 2)[1:]
elif cmd == 'setpass':
u, s, p = pkt.split(':', 3)[1:]
write(True) write(True)
elif cmd == 'setpass' and args_num >= 3: elif cmd == 'tryregister':
u, s, p = pkt.split(':', 3)[1:]
write(True) write(True)
elif cmd == 'tryregister' and args_num >= 3: elif cmd == 'removeuser':
u, s = pkt.split(':', 2)[1:]
write(True) write(True)
elif cmd == 'removeuser' and args_num == 2: elif cmd == 'removeuser3':
write(True) u, s, p = pkt.split(':', 3)[1:]
elif cmd == 'removeuser3' and args_num >= 3:
write(True) write(True)
else: else:
write(False) write(False)