api dns, better to use parameter for address (list) https://github.com/opnsense/core/issues/1788

This commit is contained in:
Ad Schellevis 2017-11-06 20:48:09 +01:00
parent 41755d0e02
commit 3a3bb837c5

View File

@ -41,14 +41,17 @@ class DnsController extends ApiControllerBase
/**
* perform a reverse dns lookup
* @param string|array $address ip address or list of addresses
* @return array
*/
public function reverse_lookupAction($address)
public function reverse_lookupAction()
{
if ($this->request->isGet()) {
if ($this->request->isGet() && $this->request->has('address')) {
$this->sessionClose(); // long running action, close session
$address = !is_array($address) ? array($address) : $address;
if (is_array($this->request->get('address'))) {
$address = $this->request->get('address');
} else {
$address = array($this->request->get('address'));
}
$result = array();
foreach ($address as $addr) {
$result[] = gethostbyaddr($addr);