Merge branch 'ent-6470-error-componentes-remotos' into 'develop'
Ent 6470 error componentes remotos Closes pandora_enterprise#6470 See merge request artica/pandorafms!3558
This commit is contained in:
commit
5d4723ba15
|
@ -3002,7 +3002,7 @@ class AgentWizard extends HTML
|
||||||
$newModule = $module;
|
$newModule = $module;
|
||||||
// Split the values got to obtain the name.
|
// Split the values got to obtain the name.
|
||||||
$tmpFirst = explode('.', $value);
|
$tmpFirst = explode('.', $value);
|
||||||
$tmpSecond = explode(' ', $tmpFirst[1]);
|
$tmpSecond = explode(' ', $tmpFirst[(count($tmpFirst) - 1)]);
|
||||||
// Position 0 is the index, Position 3 is the MIB name.
|
// Position 0 is the index, Position 3 is the MIB name.
|
||||||
$snmpwalkNames[$tmpSecond[0]] = $tmpSecond[3];
|
$snmpwalkNames[$tmpSecond[0]] = $tmpSecond[3];
|
||||||
// Perform the operations for get the values.
|
// Perform the operations for get the values.
|
||||||
|
@ -3011,6 +3011,11 @@ class AgentWizard extends HTML
|
||||||
$currentOid = $oid.'.'.$tmpSecond[0];
|
$currentOid = $oid.'.'.$tmpSecond[0];
|
||||||
$macros['macros'][$oidName] = $currentOid;
|
$macros['macros'][$oidName] = $currentOid;
|
||||||
$currentOidValue = $this->snmpgetValue($currentOid);
|
$currentOidValue = $this->snmpgetValue($currentOid);
|
||||||
|
// If for any reason the value comes empty, add 1.
|
||||||
|
if ($currentOidValue == '') {
|
||||||
|
$currentOidValue = 1;
|
||||||
|
}
|
||||||
|
|
||||||
$thisOperation = preg_replace(
|
$thisOperation = preg_replace(
|
||||||
'/'.$oidName.'/',
|
'/'.$oidName.'/',
|
||||||
$currentOidValue,
|
$currentOidValue,
|
||||||
|
@ -4733,17 +4738,18 @@ class AgentWizard extends HTML
|
||||||
* @param integer|null $type Module type.
|
* @param integer|null $type Module type.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
|
* @throws Exception Handle of unwanted operations.
|
||||||
*/
|
*/
|
||||||
private function evalOperation(
|
private function evalOperation(
|
||||||
string $operation,
|
string $operation,
|
||||||
string $unit='',
|
string $unit='',
|
||||||
?int $type=0
|
?int $type=0
|
||||||
) {
|
) {
|
||||||
|
try {
|
||||||
// Avoid non-numeric or arithmetic chars for security reasons.
|
// Avoid non-numeric or arithmetic chars for security reasons.
|
||||||
if (preg_match('/(([^0-9\s\+\-\*\/\(\).,])+)/', $operation) === 1) {
|
if (preg_match('/(([^0-9\s\+\-\*\/\(\).,])+)/', $operation) === 1) {
|
||||||
$output = 'ERROR';
|
throw new Exception(sprintf(__("The operation '%s' is not permitted. Review for remote components."), $operation));
|
||||||
} else {
|
} else {
|
||||||
try {
|
|
||||||
// Get the result of the operation and set it.
|
// Get the result of the operation and set it.
|
||||||
$output = '';
|
$output = '';
|
||||||
eval('$output = '.$operation.';');
|
eval('$output = '.$operation.';');
|
||||||
|
@ -4753,9 +4759,11 @@ class AgentWizard extends HTML
|
||||||
$unit,
|
$unit,
|
||||||
$type
|
$type
|
||||||
);
|
);
|
||||||
} catch (Exception $e) {
|
|
||||||
$output = 'ERROR';
|
|
||||||
}
|
}
|
||||||
|
} catch (Exception $e) {
|
||||||
|
$this->message['type'][] = 'error';
|
||||||
|
$this->message['message'][] = $e->getMessage();
|
||||||
|
$this->showMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $output;
|
return $output;
|
||||||
|
|
Loading…
Reference in New Issue