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 ...@@ -147,15 +147,19 @@ class SettingsController extends ApiControllerBase
/** /**
* get rule information * get rule information
* @param $sid rule identifier * @param string|null $sid rule identifier
* @return array|mixed * @return array|mixed
*/ */
public function getRuleInfoAction($sid) public function getRuleInfoAction($sid=null)
{ {
// request list of installed rules // request list of installed rules
if (!empty($sid)) {
$backend = new Backend(); $backend = new Backend();
$response = $backend->configdpRun("ids query rules", array(1, 0,'sid/'.$sid)); $response = $backend->configdpRun("ids query rules", array(1, 0,'sid/'.$sid));
$data = json_decode($response, true); $data = json_decode($response, true);
} else {
$data = null;
}
if ($data != null && array_key_exists("rows", $data) && count($data['rows'])>0) { if ($data != null && array_key_exists("rows", $data) && count($data['rows'])>0) {
$row = $data['rows'][0]; $row = $data['rows'][0];
......
...@@ -131,7 +131,7 @@ class IDS extends BaseModel ...@@ -131,7 +131,7 @@ class IDS extends BaseModel
public function getRuleStatus($sid, $default) public function getRuleStatus($sid, $default)
{ {
$this->updateSIDlist(); $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; return (string)$this->sid_list[$sid]->enabled;
} else { } else {
return $default; return $default;
...@@ -148,7 +148,7 @@ class IDS extends BaseModel ...@@ -148,7 +148,7 @@ class IDS extends BaseModel
public function getRuleAction($sid, $default, $response_plain = false) public function getRuleAction($sid, $default, $response_plain = false)
{ {
$this->updateSIDlist(); $this->updateSIDlist();
if (array_key_exists($sid, $this->sid_list)) { if (!empty($sid) && array_key_exists($sid, $this->sid_list)) {
if (!$response_plain) { if (!$response_plain) {
return $this->sid_list[$sid]->action->getNodeData(); return $this->sid_list[$sid]->action->getNodeData();
} else { } 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