mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-14 08:34:39 +00:00
mvc: small audit on configdRun(), only use when needed
This commit is contained in:
parent
cf6b28574d
commit
d222879577
@ -1,32 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2015 Deciso B.V.
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2015 Deciso B.V.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
namespace OPNsense\Diagnostics\Api;
|
||||
|
||||
@ -46,7 +44,7 @@ class ActivityController extends ApiControllerBase
|
||||
public function getActivityAction()
|
||||
{
|
||||
$backend = new Backend();
|
||||
$response = $backend->configdpRun("system diag activity json");
|
||||
$response = $backend->configdRun('system diag activity json');
|
||||
$activity = json_decode($response, true);
|
||||
|
||||
return $activity;
|
||||
|
||||
@ -70,7 +70,7 @@ class InterfaceController extends ApiControllerBase
|
||||
public function getArpAction()
|
||||
{
|
||||
$backend = new Backend();
|
||||
$response = $backend->configdpRun("interface list arp json");
|
||||
$response = $backend->configdRun('interface list arp json');
|
||||
$arptable = json_decode($response, true);
|
||||
|
||||
$intfmap = $this->getInterfaceNames();
|
||||
@ -96,7 +96,7 @@ class InterfaceController extends ApiControllerBase
|
||||
{
|
||||
if ($this->request->isPost()) {
|
||||
$backend = new Backend();
|
||||
$response = $backend->configdpRun("interface flush arp");
|
||||
$response = $backend->configdRun('interface flush arp');
|
||||
return $response;
|
||||
} else {
|
||||
return array("message" => "error");
|
||||
@ -110,7 +110,7 @@ class InterfaceController extends ApiControllerBase
|
||||
public function getNdpAction()
|
||||
{
|
||||
$backend = new Backend();
|
||||
$response = $backend->configdpRun("interface list ndp json");
|
||||
$response = $backend->configdRun('interface list ndp json');
|
||||
$ndptable = json_decode($response, true);
|
||||
|
||||
$intfmap = $this->getInterfaceNames();
|
||||
@ -136,9 +136,9 @@ class InterfaceController extends ApiControllerBase
|
||||
{
|
||||
$backend = new Backend();
|
||||
if (empty($this->request->get('resolve'))) {
|
||||
$response = $backend->configdpRun("interface routes list -n json");
|
||||
$response = $backend->configdRun('interface routes list -n json');
|
||||
} else {
|
||||
$response = $backend->configdpRun("interface routes list json");
|
||||
$response = $backend->configdRun('interface routes list json');
|
||||
}
|
||||
|
||||
$routingtable = json_decode($response, true);
|
||||
|
||||
@ -450,7 +450,7 @@ class SystemhealthController extends ApiControllerBase
|
||||
# Source of data: xml fields of corresponding .xml metadata
|
||||
$result = array();
|
||||
$backend = new Backend();
|
||||
$response = $backend->configdpRun("systemhealth list");
|
||||
$response = $backend->configdRun('systemhealth list');
|
||||
$healthList = json_decode($response, true);
|
||||
// search by topic and name, return array with filename
|
||||
if (is_array($healthList)) {
|
||||
@ -480,7 +480,7 @@ class SystemhealthController extends ApiControllerBase
|
||||
# Source of data: filelisting of /var/db/rrd/*.rrd
|
||||
$result = array();
|
||||
$backend = new Backend();
|
||||
$response = $backend->configdpRun("systemhealth list");
|
||||
$response = $backend->configdRun('systemhealth list');
|
||||
$healthList = json_decode($response, true);
|
||||
|
||||
$result['data'] = array();
|
||||
@ -530,7 +530,7 @@ class SystemhealthController extends ApiControllerBase
|
||||
$xml = false;
|
||||
if ($rrd_details['filename'] != "") {
|
||||
$backend = new Backend();
|
||||
$response = $backend->configdpRun("systemhealth fetch ", array($rrd_details['filename']));
|
||||
$response = $backend->configdpRun('systemhealth fetch', array($rrd_details['filename']));
|
||||
if ($response != null) {
|
||||
$xml = @simplexml_load_string($response);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user