]> git.ipfire.org Git - people/stevee/ipfire-2.x.git/commitdiff
guardian.cgi: Fix colorize of OpenVPN CCD subnets.
authorStefan Schantl <stefan.schantl@ipfire.org>
Sun, 20 Nov 2016 10:28:31 +0000 (11:28 +0100)
committerStefan Schantl <stefan.schantl@ipfire.org>
Sun, 20 Nov 2016 10:28:31 +0000 (11:28 +0100)
They have not been extracted correctly in the past and therefore
completely wrong beeing colorzied.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
html/cgi-bin/guardian.cgi

index fccfd47e2278d415df0728dd9ea1c7a42506bfb9..b7e1fd0dae07319fa22d0ae79025de05c947351d 100644 (file)
@@ -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"];
                }
        }