From 5fdc65495da23f20323f03f8905d9c1f68236627 Mon Sep 17 00:00:00 2001 From: Stefan Schantl Date: Sun, 20 Nov 2016 11:28:31 +0100 Subject: [PATCH] guardian.cgi: Fix colorize of OpenVPN CCD subnets. They have not been extracted correctly in the past and therefore completely wrong beeing colorzied. Signed-off-by: Stefan Schantl --- html/cgi-bin/guardian.cgi | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/html/cgi-bin/guardian.cgi b/html/cgi-bin/guardian.cgi index fccfd47e22..b7e1fd0dae 100644 --- a/html/cgi-bin/guardian.cgi +++ b/html/cgi-bin/guardian.cgi @@ -1264,12 +1264,21 @@ sub GrabNetworks() { close(OVPNSUB); # Process the grabbed OpenVPN subnets. - foreach my $ovpnsubnet (@ovpnsub) { + foreach my $line (@ovpnsub) { + # Remove any newlines. + chomp($line); + + # Splitt the line into parts. + my @ovpnsubnet = split(',', $line); + + # Grab subnet. + my $ovpnnet = $ovpnsubnet[2]; + # Skip the subnet if it is not valid. - next unless (&Network::check_subnet($ovpnsubnet)); + next unless (&Network::check_subnet($ovpnnet)); # Add the subnet to the networks hash. - $networks{$ovpnsubnet} = ["$Lang::tr{'ovpn'}", "$Header::colourovpn"]; + $networks{$ovpnnet} = ["$Lang::tr{'ovpn'}", "$Header::colourovpn"]; } } -- 2.39.5