fix saving of apikey allowed-from setting

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2018-10-09 10:37:27 +02:00
parent 854986abcb
commit b6e4dbd70a
4 changed files with 5 additions and 5 deletions

View File

@@ -62,9 +62,9 @@ class FroxlorRPC
if ($result) {
if ($result['apikey'] == $key && $result['secret'] == $secret && ($result['valid_until'] == -1 || $result['valid_until'] >= time())) {
if (!empty($result['allowed_from'])) {
// @todo allow specification and validating of whole subnets later
$ip_list = explode(",", $result['allowed_from']);
$ip_list = array_map('inet_pton', $ip_list);
$access_ip = inet_pton($_SERVER['REMOTE_ADDR']);
$access_ip = inet_ntop(inet_pton($_SERVER['REMOTE_ADDR']));
if (in_array($access_ip, $ip_list)) {
return true;
}