1
0
mirror of https://github.com/Mailu/Mailu.git synced 2025-01-30 04:30:49 +02:00
This commit is contained in:
Florent Daigniere 2024-08-08 09:35:27 +02:00
parent 30bb83c42c
commit ee243ea735
2 changed files with 12 additions and 2 deletions

View File

@ -10,15 +10,24 @@ local http_client = dovecot.http.client {
max_attempts = 3; 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) function auth_passdb_lookup(req)
local auth_request = http_client:request { local auth_request = http_client:request {
url = "http://{{ ADMIN_ADDRESS }}:8080/internal/auth/email"; url = "http://{{ ADMIN_ADDRESS }}:8080/internal/auth/email";
} }
auth_request:add_header('Auth-Port', req.local_port) 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 if req.password ~= nil
then then
auth_request:add_header('Auth-Pass', req.password) local password = urlEncode(req.password)
auth_request:add_header('Auth-Pass', password)
end end
auth_request:add_header('Auth-Protocol', req.service) auth_request:add_header('Auth-Protocol', req.service)
auth_request:add_header('Client-IP', req.remote_ip) 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