summaryrefslogtreecommitdiff
path: root/files/arts/software
diff options
context:
space:
mode:
authorDirk Engling <erdgeist@erdgeist.org>2022-03-17 19:27:17 +0100
committerDirk Engling <erdgeist@erdgeist.org>2022-03-17 19:27:17 +0100
commitb58baee6f027fd03d81d1847be54aec33e0b2f95 (patch)
tree3fa2d9df020194c04bf918c9fe0aac7c3e0ab2c9 /files/arts/software
parent71876a7ced53b8bb0fbba332aa050664e09b0e85 (diff)
Add workaround for dovecot to still support vpopmail
Diffstat (limited to 'files/arts/software')
-rw-r--r--files/arts/software/Code/elektropost/auth.lua22
1 files changed, 22 insertions, 0 deletions
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 @@
1function auth_password_verify(req, pass)
2 local handle = io.popen("/usr/local/vpopmail/bin/vuserinfo -p "..req.user)
3 local result = handle:read("*a")
4 handle:close()
5
6 local epass = result:match "^%s*(.-)%s*$"
7 if req:password_verify("{MD5-CRYPT}"..epass,pass) > 0 then
8 return dovecot.auth.PASSDB_RESULT_OK, {}
9 end
10 return dovecot.auth.PASSDB_RESULT_PASSWORD_MISMATCH, {}
11end
12
13function auth_userdb_lookup(req)
14 local handle = io.popen("/usr/local/vpopmail/bin/vuserinfo -d "..req.user)
15 local result = handle:read("*a")
16 handle:close()
17
18 if result:find("no such user") ~= nil then
19 return dovecot.auth.USERDB_RESULT_USER_UNKNOWN, "no such user"
20 end
21 return dovecot.auth.USERDB_RESULT_OK, "uid=vpopmail gid=vchkpw home="..result:match "^%s*(.-)%s*$"
22end