1
0
mirror of https://github.com/mailcow/mailcow-dockerized.git synced 2025-12-13 18:06:01 +00:00

Merge branch 'fix/dovecot-lua-timeout' into staging

This commit is contained in:
FreddleSpl0it
2025-04-03 14:18:33 +02:00

View File

@@ -3,10 +3,10 @@ function auth_password_verify(request, password)
return dovecot.auth.PASSDB_RESULT_USER_UNKNOWN, "No such user" return dovecot.auth.PASSDB_RESULT_USER_UNKNOWN, "No such user"
end end
json = require "cjson" local json = require "cjson"
ltn12 = require "ltn12" local ltn12 = require "ltn12"
https = require "ssl.https" local https = require "ssl.https"
https.TIMEOUT = 5 https.TIMEOUT = 30
local req = { local req = {
username = request.user, username = request.user,
@@ -28,6 +28,12 @@ function auth_password_verify(request, password)
sink = ltn12.sink.table(res), sink = ltn12.sink.table(res),
insecure = true insecure = true
} }
if c ~= 200 then
dovecot.i_info("HTTP request failed with " .. c .. " for user " .. request.user)
return dovecot.auth.PASSDB_RESULT_INTERNAL_FAILURE, "Upstream error"
end
local api_response = json.decode(table.concat(res)) local api_response = json.decode(table.concat(res))
if api_response.success == true then if api_response.success == true then
return dovecot.auth.PASSDB_RESULT_OK, "" return dovecot.auth.PASSDB_RESULT_OK, ""