1
0
mirror of https://github.com/Mailu/Mailu.git synced 2025-01-18 03:21:36 +02:00
(cherry picked from commit ee243ea735744b296bb90b2c1e6a1fded8915c8d)
This commit is contained in:
Florent Daigniere 2024-08-08 09:35:27 +02:00 committed by Mergify
parent 30734b49aa
commit 3d4a9ac29c
2 changed files with 12 additions and 2 deletions

View File

@ -10,15 +10,24 @@ local http_client = dovecot.http.client {
max_attempts = 3;
}
-- on the other end we use urllib.parse.unquote()
function urlEncode(str)
return str:gsub("[^%w_.-~]", function(c)
return string.format("%%%02X", string.byte(c))
end)
end
function auth_passdb_lookup(req)
local auth_request = http_client:request {
url = "http://{{ ADMIN_ADDRESS }}:8080/internal/auth/email";
}
auth_request:add_header('Auth-Port', req.local_port)
auth_request:add_header('Auth-User', req.user)
local user = urlEncode(req.user)
auth_request:add_header('Auth-User', user)
if req.password ~= nil
then
auth_request:add_header('Auth-Pass', req.password)
local password = urlEncode(req.password)
auth_request:add_header('Auth-Pass', password)
end
auth_request:add_header('Auth-Protocol', req.service)
auth_request:add_header('Client-IP', req.remote_ip)

View File

@ -0,0 +1 @@
Fix a bug preventing percent characters from being used in passwords