Commit 3a9501a4 authored by Ad Schellevis's avatar Ad Schellevis Committed by Franco Fichtner

IDS / crash reports, closes https://github.com/opnsense/core/issues/1117

(cherry picked from commit 7bf1343b)
parent ade7bf5e
......@@ -147,15 +147,19 @@ class SettingsController extends ApiControllerBase
/**
* get rule information
* @param $sid rule identifier
* @param string|null $sid rule identifier
* @return array|mixed
*/
public function getRuleInfoAction($sid)
public function getRuleInfoAction($sid=null)
{
// request list of installed rules
$backend = new Backend();
$response = $backend->configdpRun("ids query rules", array(1, 0,'sid/'.$sid));
$data = json_decode($response, true);
if (!empty($sid)) {
$backend = new Backend();
$response = $backend->configdpRun("ids query rules", array(1, 0,'sid/'.$sid));
$data = json_decode($response, true);
} else {
$data = null;
}
if ($data != null && array_key_exists("rows", $data) && count($data['rows'])>0) {
$row = $data['rows'][0];
......
......@@ -131,7 +131,7 @@ class IDS extends BaseModel
public function getRuleStatus($sid, $default)
{
$this->updateSIDlist();
if (array_key_exists($sid, $this->sid_list)) {
if (!empty($sid) && array_key_exists($sid, $this->sid_list)) {
return (string)$this->sid_list[$sid]->enabled;
} else {
return $default;
......@@ -148,7 +148,7 @@ class IDS extends BaseModel
public function getRuleAction($sid, $default, $response_plain = false)
{
$this->updateSIDlist();
if (array_key_exists($sid, $this->sid_list)) {
if (!empty($sid) && array_key_exists($sid, $this->sid_list)) {
if (!$response_plain) {
return $this->sid_list[$sid]->action->getNodeData();
} else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment