blob: 53df7a709add06aca91f6c6978198e98a7fa00d0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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
|