2012-06-20 Hirofumi Kosaka <kosaka@rworks.jp>

* extensions/net_tools.php: Fixed bug: 'whereis' could find a
	command regardless of whether reachable or not with $PATH
	(and leads to fail the subsequent command execution).
	Merged from 4.0.2


git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6607 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
hkosaka 2012-06-20 07:54:50 +00:00
parent 331820371e
commit ffc635780b
2 changed files with 13 additions and 6 deletions

View File

@ -1,3 +1,10 @@
2012-06-20 Hirofumi Kosaka <kosaka@rworks.jp>
* extensions/net_tools.php: Fixed bug: 'whereis' could find a
command regardless of whether reachable or not with $PATH
(and leads to fail the subsequent command execution).
Merged from 4.0.2
2012-06-20 Hirofumi Kosaka <kosaka@rworks.jp> 2012-06-20 Hirofumi Kosaka <kosaka@rworks.jp>
* extensions/net_tools.php: Fixed bug: cannot find traceroute * extensions/net_tools.php: Fixed bug: cannot find traceroute

View File

@ -54,7 +54,7 @@ function main_net_tools () {
switch($operation) { switch($operation) {
case 1: case 1:
ob_start(); ob_start();
system('whereis traceroute'); system('which traceroute');
$output = ob_get_clean(); $output = ob_get_clean();
$result = explode(':', $output); $result = explode(':', $output);
$result = trim($result[1]); $result = trim($result[1]);
@ -77,7 +77,7 @@ function main_net_tools () {
case 2: case 2:
ob_start(); ob_start();
system('whereis ping'); system('which ping');
$output = ob_get_clean(); $output = ob_get_clean();
$result = explode(':', $output); $result = explode(':', $output);
$result = trim($result[1]); $result = trim($result[1]);
@ -94,7 +94,7 @@ function main_net_tools () {
case 4: case 4:
ob_start(); ob_start();
system('whereis nmap'); system('which nmap');
$output = ob_get_clean(); $output = ob_get_clean();
$result = explode(':', $output); $result = explode(':', $output);
$result = trim($result[1]); $result = trim($result[1]);
@ -112,7 +112,7 @@ function main_net_tools () {
case 5: case 5:
echo "<h3>".__("Domain and IP information for "). $ip. "</h3>"; echo "<h3>".__("Domain and IP information for "). $ip. "</h3>";
ob_start(); ob_start();
system('whereis dig'); system('which dig');
$output = ob_get_clean(); $output = ob_get_clean();
$result = explode(':', $output); $result = explode(':', $output);
$result = trim($result[1]); $result = trim($result[1]);
@ -125,7 +125,7 @@ function main_net_tools () {
echo "</pre>"; echo "</pre>";
} }
ob_start(); ob_start();
system('whereis whois'); system('which whois');
$output = ob_get_clean(); $output = ob_get_clean();
$result = explode(':', $output); $result = explode(':', $output);
$result = trim($result[1]); $result = trim($result[1]);
@ -141,7 +141,7 @@ function main_net_tools () {
break; break;
case 3: echo "<h3>".__("SNMP information for "). $ip. "</h3>"; case 3: echo "<h3>".__("SNMP information for "). $ip. "</h3>";
ob_start(); ob_start();
system('whereis snmpget'); system('which snmpget');
$output = ob_get_clean(); $output = ob_get_clean();
$result = explode(':', $output); $result = explode(':', $output);
$result = trim($result[1]); $result = trim($result[1]);