Project

General

Profile

« Previous | Next » 

Revision ea031bde

Added by Warren Baker over 12 years ago

Dont pass -o option to view types that dont support it, it causes a segfault. Also make sure that when viewing all states that the correct switch is passed

View differences:

usr/local/www/diag_system_pftop.php
53 53
	if($_REQUEST['sorttype'] && in_array($_REQUEST['sorttype'], $sorttypes)
54 54
		&& $_REQUEST['viewtype'] && in_array($_REQUEST['viewtype'], $viewtypes)
55 55
		&& $_REQUEST['states'] && in_array($_REQUEST['states'], $numstates)) {
56
		$sorttype = escapeshellarg($_REQUEST['sorttype']);
57 56
		$viewtype = escapeshellarg($_REQUEST['viewtype']);
58
		$numstate = (in_array($_REQUEST['viewtype'], $viewall) ? "-a" : escapeshellarg($_REQUEST['states']));
57
		if (in_array($_REQUEST['viewtype'], $viewall)) {
58
			$sorttype = "";
59
			$numstate = "-a";
60
		} else {
61
			$sorttype = "-o " . escapeshellarg($_REQUEST['sorttype']);
62
			$numstate = ($_REQUEST['states'] == "all" ? "-a" : escapeshellarg($_REQUEST['states']));
63
		}
59 64
	} else {
60 65
		$sorttype = "bytes";
61 66
		$viewtype = "default";
62 67
		$numstate = "100";
63 68
	}
64

  
65
	$text = `pftop -b -o {$sorttype} -v {$viewtype} $numstate`;
69
	log_error("pftop -b {$sorttype} -v {$viewtype} $numstate");
70
		$text = `pftop -b {$sorttype} -v {$viewtype} {$numstate}`;
66 71
	echo $text;
67 72
	exit;
68 73
}
......
72 77
if($_REQUEST['sorttype'] && in_array($_REQUEST['sorttype'], $sorttypes)
73 78
	&& $_REQUEST['viewtype'] && in_array($_REQUEST['viewtype'], $viewtypes)
74 79
	&& $_REQUEST['states'] && in_array($_REQUEST['states'], $numstates)) {
75
	$sorttype = htmlentities($_REQUEST['sorttype']);
76
	$viewtype = htmlentities($_REQUEST['viewtype']);
77
	$numstate = (in_array($_REQUEST['viewtype'], $viewall) ? "-a" : htmlentities($_REQUEST['states']));
80
	$viewtype = escapeshellarg($_REQUEST['viewtype']);
81
	if (in_array($_REQUEST['viewtype'], $viewall)) {
82
		$sorttype = "";
83
		$numstate = "-a";
84
	} else {
85
		$sorttype = "-o " . escapeshellarg($_REQUEST['sorttype']);
86
		$numstate = ($_REQUEST['states'] == "all" ? "-a" : escapeshellarg($_REQUEST['states']));
87
	}
78 88
} else {
79 89
	$sorttype = "bytes";
80 90
	$viewtype = "default";

Also available in: Unified diff