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

[Dovecot] return PASSDB_RESULT_PASSWORD_MISMATCH instead of PASSDB_RESULT_INTERNAL_FAILURE

This commit is contained in:
FreddleSpl0it
2025-05-08 11:38:29 +02:00
parent c4d0f35008
commit 401b744808

View File

@@ -29,9 +29,12 @@ function auth_password_verify(request, password)
insecure = true insecure = true
} }
-- Returning PASSDB_RESULT_PASSWORD_MISMATCH will reset the user's auth cache entry.
-- Returning PASSDB_RESULT_INTERNAL_FAILURE keeps the existing cache entry,
-- even if the TTL has expired. Useful to avoid cache eviction during backend issues.
if c ~= 200 and c ~= 401 then if c ~= 200 and c ~= 401 then
dovecot.i_info("HTTP request failed with " .. c .. " for user " .. request.user) dovecot.i_info("HTTP request failed with " .. c .. " for user " .. request.user)
return dovecot.auth.PASSDB_RESULT_INTERNAL_FAILURE, "Upstream error" return dovecot.auth.PASSDB_RESULT_PASSWORD_MISMATCH, "Upstream error"
end end
local response_str = table.concat(res) local response_str = table.concat(res)
@@ -39,7 +42,7 @@ function auth_password_verify(request, password)
if not is_response_valid then if not is_response_valid then
dovecot.i_info("Invalid JSON received: " .. response_str) dovecot.i_info("Invalid JSON received: " .. response_str)
return dovecot.auth.PASSDB_RESULT_INTERNAL_FAILURE, "Invalid response format" return dovecot.auth.PASSDB_RESULT_PASSWORD_MISMATCH, "Invalid response format"
end end
if response_json.success == true then if response_json.success == true then