From 8c8c1b9dd5eba73043b1f4e2a0036348ccdb5d82 Mon Sep 17 00:00:00 2001
From: Elmar Ludwig <elmar.ludwig@uni-osnabrueck.de>
Date: Mon, 26 Aug 2024 09:16:05 +0000
Subject: [PATCH] replace ip2long() with inet_pton(), fixes #4524

Closes #4524

Merge request studip/studip!3322
---
 app/controllers/admin/webservice_access.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/app/controllers/admin/webservice_access.php b/app/controllers/admin/webservice_access.php
index 1ba8324c0b0..c994d151b61 100644
--- a/app/controllers/admin/webservice_access.php
+++ b/app/controllers/admin/webservice_access.php
@@ -97,7 +97,7 @@ class Admin_WebserviceAccessController extends AuthenticatedController
                     continue;
                 }
                 list($ip_address, $mask) = explode('/', $ip);
-                if (!ip2long($ip_address) || ($mask && ($mask < 8 || $mask > 30))) {
+                if (!inet_pton($ip_address) || ($mask && ($mask < 0 || $mask > 128))) {
                     $msg['error'][] = sprintf(_("Der IP Bereich %s ist ungültig."), htmlready($ip));
                     unset($rule->ip_range[$key]);
                 }
-- 
GitLab