]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/commitdiff
proxy.cgi: Check upstream proxy address and better neighbour detection.
authorBernhard Bitsch <bernhard.bitsch@ipfire.org>
Wed, 18 Jul 2012 10:56:41 +0000 (12:56 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 18 Jul 2012 10:56:41 +0000 (12:56 +0200)
html/cgi-bin/proxy.cgi [changed mode: 0644->0755]
langs/de/cgi-bin/de.pl
langs/en/cgi-bin/en.pl

old mode 100644 (file)
new mode 100755 (executable)
index 8c9574c..6f4aed2
@@ -353,6 +353,13 @@ if (($proxysettings{'ACTION'} eq $Lang::tr{'save'}) || ($proxysettings{'ACTION'}
                $errormessage = $Lang::tr{'advproxy errmsg invalid proxy port'};
                goto ERROR;
        }
+       if (!($proxysettings{'UPSTREAM_PROXY'} eq '')) {
+         my @temp = split(/:/,$proxysettings{'UPSTREAM_PROXY'});
+         if (!(&General::validip($temp[0]))) {
+           $errormessage = $Lang::tr{'advproxy errmsg invalid upstream proxy'};
+           goto ERROR;
+          }
+        }
        if (!($proxysettings{'CACHE_SIZE'} =~ /^\d+/) ||
                ($proxysettings{'CACHE_SIZE'} < 10))
        {
@@ -984,7 +991,7 @@ print <<END
 <tr><td class='base' >$Lang::tr{'processes'}<input type='text' name='CHILDREN' value='$proxysettings{'CHILDREN'}' size='5' /></td>
 END
 ;
-my $count = `arp -a | wc -l`;
+my $count = `ip n| wc -l`;
 if ( $count < 1 ){$count = 1;}
 if ( -e "/usr/bin/squidclamav" ) {
        print "<td class='base'><b>".$Lang::tr{'advproxy squidclamav'}."</b><br />";
@@ -3013,7 +3020,7 @@ sub writeconfig
        }
 
        $_ = $proxysettings{'UPSTREAM_PROXY'};
-       my ($remotehost, $remoteport) = (/^(?:[a-zA-Z ]+\:\/\/)?(?:[A-Za-z0-9\_\.\-]*?(?:\:[A-Za-z0-9\_\.\-]*?)?\@)?([a-zA-Z0-9\.\_\-]*?)(?:\:([0-9]{1,5}))?(?:\/.*?)?$/);
+        my ($remotehost, $remoteport) = split(/:/,$_);
 
        if ($remoteport eq '') { $remoteport = 80; }
 
index c7f254ae64ee87fd35c4a0dc615311e8ea658ece..3ec57ebb99b841b4f5ece52de198550ea96e3e87 100644 (file)
 'advproxy errmsg invalid pdc' => 'Ungültiger Hostname für den Primary Domain Controller',
 'advproxy errmsg invalid proxy port' => 'Ungültiger Proxy-Port',
 'advproxy errmsg invalid upstream proxy username or password setting' => 'Ungültiger Benutzername oder ungültiges Kennwort für Upstream Proxy',
+'advproxy errmsg invalid upstream proxy' => 'Ungültige IP für Upstream-Proxy',
 'advproxy errmsg invalid user' => 'Benutzername existiert nicht',
 'advproxy errmsg ldap base dn' => 'LDAP base DN erforderlich',
 'advproxy errmsg ldap bind dn' => 'LDAP bind DN Benutzername und Passwort erforderlich',
index 52872f49ac9d6c9a9dd21060ad959260fab1dc83..003056f9ee5a04aa624d214974dfcf9f36f478ca 100644 (file)
 'advproxy errmsg invalid pdc' => 'Invalid hostname for primary domain controller',
 'advproxy errmsg invalid proxy port' => 'Invalid proxy port',
 'advproxy errmsg invalid upstream proxy username or password setting' => 'Invalid upstream proxy username or password setting',
+'advproxy errmsg invalid upstream proxy' => 'Invalid upstream proxy IP',
 'advproxy errmsg invalid user' => 'Username does not exist',
 'advproxy errmsg ldap base dn' => 'LDAP base DN required',
 'advproxy errmsg ldap bind dn' => 'LDAP bind DN username and password required',