Code

Added range checks
authorcajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 9 Aug 2007 10:42:30 +0000 (10:42 +0000)
committercajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 9 Aug 2007 10:42:30 +0000 (10:42 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@7026 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/systems/class_dhcpPool.inc
plugins/admin/systems/class_dhcpSubnet.inc

index 5386057a8152f46c50158a5bdfc3ada685625b4d..d1c016d58b3b3c385f84ae61fe06714bb6d252c3 100644 (file)
@@ -122,9 +122,17 @@ class dhcpPool extends dhcpPlugin
       $message[]= _("Field 'Range' contains invalid IP addresses.");
     }
 
-       if(!is_ip_range($this->range_start,$this->range_stop)){
-               $message[] = _("Field 'Range' contains invalid IP range.");
-       }
+    if(!is_ip_range($this->range_start,$this->range_stop)){
+      $message[] = _("Field 'Range' contains invalid IP range.");
+    }
+
+    /* Check if range is in the network */
+    #TODO: look for preceeding subnet entries in $cache and check if the
+    #      range is valid.
+    #if (!is_in_network($this->cn, $this->dhcpNetMask, $this->range_start) ||
+    #    !is_in_network($this->cn, $this->dhcpNetMask, $this->range_stop)){
+    #  $message[] = _("'Range' is not inside the configured network.");
+    #}
 
     return $message;
   }
index 7f8855b9eb80a7862f93067261f8391e31bb38fd..2620a7be0b411084d43088f88daa081f3649a6ed 100644 (file)
@@ -154,11 +154,17 @@ class dhcpSubnet extends dhcpPlugin
       }
     }
 
-       /* Check ip range */
+    /* Check ip range */
     if(!is_ip_range($this->range_start,$this->range_stop)){
         $message[] = _("Field 'Range' contains invalid IP range.");
     }
 
+    /* Check if range is in the network */
+    if (!is_in_network($this->cn, $this->dhcpNetMask, $this->range_start) ||
+        !is_in_network($this->cn, $this->dhcpNetMask, $this->range_stop)){
+      $message[] = _("'Range' is not inside the configured network.");
+    }
+
     return $message;
   }