diff --git a/auth_mysql.py b/auth_mysql.py index 22e26e5..d239c17 100755 --- a/auth_mysql.py +++ b/auth_mysql.py @@ -94,10 +94,10 @@ def ejabberd_in(): return income -def ejabberd_out(bool): - logging.debug("Ejabberd gets: %s" % bool) +def ejabberd_out(output): + logging.debug("Ejabberd gets: %s" % output) - token = genanswer(bool) + token = struct.pack('>hh', 2, int(bool(output))) logging.debug("sent bytes: %#x %#x %#x %#x" % (ord(token[0]), ord(token[1]), ord(token[2]), ord(token[3]))) @@ -105,14 +105,6 @@ def ejabberd_out(bool): sys.stdout.flush() -def genanswer(bool): - answer = 0 - if bool: - answer = 1 - token = struct.pack('>hh', 2, answer) - return token - - def password_hash(password, old_password=None): if old_password == None: old_password = '$6$'+''.join(random.choice("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ./") for i in range(16))