From 72a9ec5b7c46dbaf006182141ade3d1bd228ff83 Mon Sep 17 00:00:00 2001 From: cbachert Date: Sat, 24 Oct 2020 00:25:53 +0100 Subject: [PATCH] Fix extract_host_port port separation Regex quantifier should be lazy to make port separation work. --- core/admin/mailu/internal/nginx.py | 2 +- optional/fetchmail/fetchmail.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core/admin/mailu/internal/nginx.py b/core/admin/mailu/internal/nginx.py index fa127584..1e0b16c2 100644 --- a/core/admin/mailu/internal/nginx.py +++ b/core/admin/mailu/internal/nginx.py @@ -84,7 +84,7 @@ def get_status(protocol, status): return status, codes[protocol] def extract_host_port(host_and_port, default_port): - host, _, port = re.match('^(.*)(:([0-9]*))?$', host_and_port).groups() + host, _, port = re.match('^(.*?)(:([0-9]*))?$', host_and_port).groups() return host, int(port) if port else default_port def get_server(protocol, authenticated=False): diff --git a/optional/fetchmail/fetchmail.py b/optional/fetchmail/fetchmail.py index 98b61c4c..4be3c2bd 100755 --- a/optional/fetchmail/fetchmail.py +++ b/optional/fetchmail/fetchmail.py @@ -28,7 +28,7 @@ poll "{host}" proto {protocol} port {port} def extract_host_port(host_and_port, default_port): - host, _, port = re.match('^(.*)(:([0-9]*))?$', host_and_port).groups() + host, _, port = re.match('^(.*?)(:([0-9]*))?$', host_and_port).groups() return host, int(port) if port else default_port