diff options
author | Evgeniy Khramtsov <ekhramtsov@process-one.net> | 2013-06-26 12:29:50 +1000 |
---|---|---|
committer | Evgeniy Khramtsov <ekhramtsov@process-one.net> | 2013-06-26 12:30:32 +1000 |
commit | aab70fc0666f62cd23828232806a344af352be03 (patch) | |
tree | 30310352bf076e9e2dfad4bee9c8d542aaeac2e2 /test/ejabberd_SUITE_data | |
parent | Do not fetch disco#info multiple times (diff) |
Fix external authentication
Diffstat (limited to 'test/ejabberd_SUITE_data')
-rw-r--r-- | test/ejabberd_SUITE_data/ejabberd.cfg | 4 | ||||
-rwxr-xr-x | test/ejabberd_SUITE_data/extauth.py | 36 |
2 files changed, 40 insertions, 0 deletions
diff --git a/test/ejabberd_SUITE_data/ejabberd.cfg b/test/ejabberd_SUITE_data/ejabberd.cfg index b50913353..458de2c7d 100644 --- a/test/ejabberd_SUITE_data/ejabberd.cfg +++ b/test/ejabberd_SUITE_data/ejabberd.cfg @@ -3,6 +3,7 @@ "mnesia.localhost", "mysql.localhost", "pgsql.localhost", + "extauth.localhost", "ldap.localhost"]}. {define_macro, 'CERTFILE', "cert.pem"}. {listen, @@ -59,6 +60,9 @@ {mod_version, []} ]}. {host_config, "localhost", [{auth_method, internal}]}. +{host_config, "extauth.localhost", + [{auth_method, external}, + {extauth_program, "python extauth.py"}]}. {host_config, "mnesia.localhost", [{auth_method, internal}, {{add, modules}, [{mod_announce, [{db_type, internal}]}, diff --git a/test/ejabberd_SUITE_data/extauth.py b/test/ejabberd_SUITE_data/extauth.py new file mode 100755 index 000000000..7f32eb8be --- /dev/null +++ b/test/ejabberd_SUITE_data/extauth.py @@ -0,0 +1,36 @@ +import sys +import struct + +def read(): + (pkt_size,) = struct.unpack('>H', sys.stdin.read(2)) + pkt = sys.stdin.read(pkt_size).split(':') + cmd = pkt[0] + args_num = len(pkt) - 1 + if cmd == 'auth' and args_num == 3: + write(True) + elif cmd == 'isuser' and args_num == 2: + write(True) + elif cmd == 'setpass' and args_num == 3: + write(True) + elif cmd == 'tryregister' and args_num == 3: + write(True) + elif cmd == 'removeuser' and args_num == 2: + write(True) + elif cmd == 'removeuser3' and args_num == 3: + write(True) + else: + write(False) + read() + +def write(result): + if result: + sys.stdout.write('\x00\x02\x00\x01') + else: + sys.stdout.write('\x00\x02\x00\x00') + sys.stdout.flush() + +if __name__ == "__main__": + try: + read() + except struct.error: + pass |