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