From ab7b82d05b7aea2d53dd8dabc104566a5822ab0c Mon Sep 17 00:00:00 2001 From: Florent Daigniere Date: Tue, 4 Apr 2023 11:33:34 +0200 Subject: [PATCH] Clarify --- core/admin/mailu/internal/views/auth.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/admin/mailu/internal/views/auth.py b/core/admin/mailu/internal/views/auth.py index 3764355f..af9248b5 100644 --- a/core/admin/mailu/internal/views/auth.py +++ b/core/admin/mailu/internal/views/auth.py @@ -13,7 +13,8 @@ def nginx_authentication(): """ client_ip = flask.request.headers["Client-Ip"] headers = flask.request.headers - if headers["Auth-Port"] == '25' and headers['Auth-Method'] != 'none': + is_port_25 = headers["Auth-Port"] == '25' + if is_port_25 and headers['Auth-Method'] != 'none': response = flask.Response() response.headers['Auth-Status'] = 'AUTH not supported' response.headers['Auth-Error-Code'] = '502 5.5.1' @@ -47,7 +48,7 @@ def nginx_authentication(): is_valid_user = True if headers.get("Auth-Status") == "OK": # successful email delivery isn't enough to warrant an exemption - if headers["Auth-Port"] != '25': + if not is_port_25: utils.limiter.exempt_ip_from_ratelimits(client_ip) elif is_valid_user: utils.limiter.rate_limit_user(username, client_ip, password=response.headers.get('Auth-Password', None))