From a907da9907c970e74c0d3b2421b248749243c369 Mon Sep 17 00:00:00 2001 From: holger krekel Date: Fri, 13 Oct 2023 13:32:27 +0200 Subject: [PATCH] wip --- src/chatmail/dovecot/doveauth.lua | 5 +---- src/chatmail/dovecot/doveauth.py | 1 - src/chatmail/dovecot/test_doveauth.lua | 16 ++++++++-------- 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/src/chatmail/dovecot/doveauth.lua b/src/chatmail/dovecot/doveauth.lua index 3d0f555e..fd019ee4 100644 --- a/src/chatmail/dovecot/doveauth.lua +++ b/src/chatmail/dovecot/doveauth.lua @@ -8,7 +8,6 @@ end -- call out to python program to actually manage authentication for dovecot function chatctl_verify(user, password) - dovecot.i_debug("chatctl_verify wurde aufgerufen") local handle = io.popen("python3 /home/vmail/chatctl hexauth "..escape(user).." "..escape(password)) local result = handle:read("*a") handle:close() @@ -30,7 +29,7 @@ end function auth_password_verify(request, password) local res = chatctl_verify(request.user, password) - request:log_error("auth_password_verify "..request.user.." "..password) + -- request:log_error("auth_password_verify "..request.user.." "..password) if res.status == "ok" then local extra = get_extra_dovecot_output(res) return dovecot.auth.PASSDB_RESULT_OK, get_extra_dovecot_output(res) @@ -41,8 +40,6 @@ end function auth_userdb_lookup(request) local res = chatctl_lookup(request.user) - dovecot.i_debug("auth_userdb_lookup") - if res.status == "ok" then return dovecot.auth.USERDB_RESULT_OK, get_extra_dovecot_output(res) end diff --git a/src/chatmail/dovecot/doveauth.py b/src/chatmail/dovecot/doveauth.py index d36336bb..9c361b2e 100644 --- a/src/chatmail/dovecot/doveauth.py +++ b/src/chatmail/dovecot/doveauth.py @@ -6,7 +6,6 @@ import sys def get_user_data(user): if user == b"link2xt@c1.testrun.org": return dict( - home="/home/vmail/link2xt", uid="vmail", gid="vmail", password=b"Ahyei6ie", diff --git a/src/chatmail/dovecot/test_doveauth.lua b/src/chatmail/dovecot/test_doveauth.lua index a0f7090f..1b0b4da7 100644 --- a/src/chatmail/dovecot/test_doveauth.lua +++ b/src/chatmail/dovecot/test_doveauth.lua @@ -15,19 +15,19 @@ dovecot = { -- Tests for testing the lua<->python interaction -function test_passdb_verify_ok(user, password) - local res, extra = auth_passdb_verify({user=user}, password) +function test_password_verify_ok(user, password) + local res, extra = auth_password_verify({user=user}, password) assert(res==dovecot.auth.PASSDB_RESULT_OK) assert(extra.uid == "vmail") assert(extra.gid == "vmail") -- assert(extra.homedir == "/home/vmail/link2xt") - print("OK test_passdb_verify_ok "..user.." "..password) + print("OK test_password_verify_ok "..user.." "..password) end -function test_passdb_verify_mismatch(user, password) - local res = auth_passdb_verify({user=user}, password) +function test_password_verify_mismatch(user, password) + local res = auth_password_verify({user=user}, password) assert(res == dovecot.auth.PASSDB_RESULT_PASSWORD_MISMATCH) - print("OK test_passdb_verify_mismatch "..user.." "..password) + print("OK test_password_verify_mismatch "..user.." "..password) end function test_userdb_lookup_ok(user) @@ -67,8 +67,8 @@ function test_split_chatctl() end test_split_chatctl() -test_passdb_verify_ok("link2xt@instant2.testrun.org", "Ahyei6ie") -test_passdb_verify_mismatch("link2xt@instant2.testrun.org", "Aqwlek") +test_password_verify_ok("link2xt@instant2.testrun.org", "Ahyei6ie") +test_password_verify_mismatch("link2xt@instant2.testrun.org", "Aqwlek") test_userdb_lookup_ok("link2xt@instant2.testrun.org") test_userdb_lookup_mismatch("wlekqjlew@xyz.org") test_passdb_lookup_ok("link2xt@instant2.testrun.org")