mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-24 16:23:40 +01:00
Fix extauth.py failure in test suite with Python 3 (#3612)
This commit is contained in:
parent
7b33499811
commit
1ee64091b3
@ -1,8 +1,14 @@
|
|||||||
import sys
|
import sys
|
||||||
import struct
|
import struct
|
||||||
|
|
||||||
|
def read_from_stdin(bytes):
|
||||||
|
if hasattr(sys.stdin, 'buffer'):
|
||||||
|
return sys.stdin.buffer.read(bytes)
|
||||||
|
else:
|
||||||
|
return sys.stdin.read(bytes)
|
||||||
|
|
||||||
def read():
|
def read():
|
||||||
(pkt_size,) = struct.unpack('>H', sys.stdin.read(2))
|
(pkt_size,) = struct.unpack('>H', read_from_stdin(2))
|
||||||
pkt = sys.stdin.read(pkt_size)
|
pkt = sys.stdin.read(pkt_size)
|
||||||
cmd = pkt.split(':')[0]
|
cmd = pkt.split(':')[0]
|
||||||
if cmd == 'auth':
|
if cmd == 'auth':
|
||||||
|
Loading…
Reference in New Issue
Block a user