ids.cgi: Fix upstream proxy validation

Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
Acked-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
This commit is contained in:
Peter Müller
2019-05-18 15:14:00 +00:00
committed by Michael Tremer
parent b06288b74d
commit 40407aee99

View File

@@ -174,11 +174,8 @@ sub downloadruleset {
# Check if an upstream proxy is configured. # Check if an upstream proxy is configured.
if ($proxysettings{'UPSTREAM_PROXY'}) { if ($proxysettings{'UPSTREAM_PROXY'}) {
my ($peer, $peerport) = (/^(?:[a-zA-Z ]+\:\/\/)?(?:[A-Za-z0-9\_\.\-]*?(?:\:[A-Za-z0-9\_\.\-]*?)?\@)?([a-zA-Z0-9\.\_\-]*?)(?:\:([0-9]{1,5}))?(?:\/.*?)?$/);
my $proxy_url; my $proxy_url;
# Check if we got a peer.
if ($peer) {
$proxy_url = "http://"; $proxy_url = "http://";
# Check if the proxy requires authentication. # Check if the proxy requires authentication.
@@ -187,14 +184,7 @@ sub downloadruleset {
} }
# Add proxy server address and port. # Add proxy server address and port.
$proxy_url .= "$peer\:$peerport"; $proxy_url .= $proxysettings{'UPSTREAM_PROXY'};
} else {
# Log error message and break.
&_log_to_syslog("Could not proper configure the proxy server access.");
# Return "1" - false.
return 1;
}
# Setup proxy settings. # Setup proxy settings.
$downloader->proxy(['http', 'https'], $proxy_url); $downloader->proxy(['http', 'https'], $proxy_url);