diff options
author | mh@immerda.ch <mh@immerda.ch> | 2012-08-30 23:27:40 +0200 |
---|---|---|
committer | alice <alice@immerda.ch> | 2012-10-19 15:20:06 +0200 |
commit | 6efa48858f9a120d90d17e7dd54865fcd996192e (patch) | |
tree | 095758c7f7c68169ab5746316c1b1a55d3ee7c6a /py-bin | |
parent | 37c6d9efd6d020374ae2282f29a40dc4ab4320e5 (diff) |
fix a few things
ejabber auth, verifying a jid and setting a new password is now working
Diffstat (limited to 'py-bin')
-rw-r--r-- | py-bin/config.py-dist | 7 | ||||
-rw-r--r-- | py-bin/ejabber_auth.py | 15 |
2 files changed, 5 insertions, 17 deletions
diff --git a/py-bin/config.py-dist b/py-bin/config.py-dist index ba08d84..9eddc07 100644 --- a/py-bin/config.py-dist +++ b/py-bin/config.py-dist @@ -31,7 +31,6 @@ min_password_length = debugmode and 2 or 8 template_dir = "/var/www/jabber/py-bin/templates" # keep the following stuff on an encrypted fs! (especially sessions) session_dir = "/tmp" -jabberdb_path = "/var/db/jabberman/jabber_db" logfile_path = "/var/log/lighttpd/webreg.log" authlog_path = "/var/log/ejabberd/ext_auth.log" @@ -41,9 +40,3 @@ script_url = "https://www.domain1.ch/main.py" # secret needed for session ids and registration tokens # change it to your own! the_secret = "ahfkahfkjhaskjfhaskjfhaskjfhafhh" - -#experimental stuff... -ejabberdctl_path = "/usr/sbin/ejabberdctl" -ejabberdctl_use_sudo = True -ejabberdctl_environ = {"PATH":"/bin:/usr/bin", "HOME":"/var/www/lighttpd" } - diff --git a/py-bin/ejabber_auth.py b/py-bin/ejabber_auth.py index 8acb10d..4737d19 100644 --- a/py-bin/ejabber_auth.py +++ b/py-bin/ejabber_auth.py @@ -9,6 +9,8 @@ import sys, logging, os import config sys.stderr = open(config.authlog_path, 'a') +if config.debugmode: + logging.basicConfig(level=logging.DEBUG) from struct import * from jabberman import JabberDB @@ -39,7 +41,7 @@ class EjabberAuth: input_length = sys.stdin.read(2) except IOError: logging.debug("ioerror") - if len(input_length) is not 2: + if len(input_length) != 2: logging.debug("ejabberd sent us wrong things!") raise EjabberdInputError('Wrong input from ejabberd!') logging.debug('got 2 bytes via stdin') @@ -55,7 +57,7 @@ class EjabberAuth: def ejabberd_out(self, bool): logging.debug("Ejabberd gets: %s" % bool) - token = genanswer(bool) + token = self.genanswer(bool) logging.debug("sent bytes: %#x %#x %#x %#x" % (ord(token[0]), ord(token[1]), ord(token[2]), ord(token[3]))) sys.stdout.write(token) sys.stdout.flush() @@ -77,7 +79,7 @@ class EjabberAuth: def update_jid(self, jid, new_password): logging.debug("update_jid for %s" % (jid)) - if self.jabdb.update_jid(jid, new_password): + if self.jadb.update_jid(jid, new_password): logging.debug("password change for %s successful" % (jid)) return True else: @@ -124,10 +126,3 @@ class EjabberAuth: auth = EjabberAuth() auth.run() - - - - - - - |