Code

Fix for #144
[gosa.git] / trunk / gosa-core / include / utils / class_tests.inc
index a34eac4ca8eb0a04547031e4dd4ce2d4cdaa078d..1be764926c7f4bd9450f9c0b067884e4dfb3d15d 100644 (file)
@@ -262,6 +262,14 @@ class tests {
   /* \brief Check if the specified IP address $address is inside the given network */
   public static function is_in_ip_range($from, $to, $address)
   {
+    if (!preg_match("/[0-2]?[0-9]?[0-9].[0-2]?[0-9]?[0-9].[0-2]?[0-9]?[0-9].[0-2]?[0-9]?[0-9]/", $address)) {
+      return FALSE;
+    }
+
+    if (($from == '*' && $to == '*') || ($from == '' && $to == '')) {
+      return TRUE;
+    }
+
     $from = split('\.', $from);
     $to   = split('\.', $to);
     $ad   = split('\.', $address);