From b58baee6f027fd03d81d1847be54aec33e0b2f95 Mon Sep 17 00:00:00 2001 From: Dirk Engling Date: Thu, 17 Mar 2022 19:27:17 +0100 Subject: Add workaround for dovecot to still support vpopmail --- files/arts/software/Code/elektropost/auth.lua | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 files/arts/software/Code/elektropost/auth.lua (limited to 'files/arts/software') diff --git a/files/arts/software/Code/elektropost/auth.lua b/files/arts/software/Code/elektropost/auth.lua new file mode 100644 index 0000000..53df7a7 --- /dev/null +++ b/files/arts/software/Code/elektropost/auth.lua @@ -0,0 +1,22 @@ +function auth_password_verify(req, pass) + local handle = io.popen("/usr/local/vpopmail/bin/vuserinfo -p "..req.user) + local result = handle:read("*a") + handle:close() + + local epass = result:match "^%s*(.-)%s*$" + if req:password_verify("{MD5-CRYPT}"..epass,pass) > 0 then + return dovecot.auth.PASSDB_RESULT_OK, {} + end + return dovecot.auth.PASSDB_RESULT_PASSWORD_MISMATCH, {} +end + +function auth_userdb_lookup(req) + local handle = io.popen("/usr/local/vpopmail/bin/vuserinfo -d "..req.user) + local result = handle:read("*a") + handle:close() + + if result:find("no such user") ~= nil then + return dovecot.auth.USERDB_RESULT_USER_UNKNOWN, "no such user" + end + return dovecot.auth.USERDB_RESULT_OK, "uid=vpopmail gid=vchkpw home="..result:match "^%s*(.-)%s*$" +end -- cgit v1.2.3