This commit is contained in:
holger krekel
2023-10-13 13:32:27 +02:00
committed by missytake
parent 14649c37fd
commit a907da9907
3 changed files with 9 additions and 13 deletions

View File

@@ -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

View File

@@ -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",

View File

@@ -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")