From 063a8d479a70d2e9832f287bb58559c741894754 Mon Sep 17 00:00:00 2001 From: cajus Date: Thu, 9 Aug 2007 10:42:30 +0000 Subject: [PATCH] Added range checks git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@7026 594d385d-05f5-0310-b6e9-bd551577e9d8 --- plugins/admin/systems/class_dhcpPool.inc | 14 +++++++++++--- plugins/admin/systems/class_dhcpSubnet.inc | 8 +++++++- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/plugins/admin/systems/class_dhcpPool.inc b/plugins/admin/systems/class_dhcpPool.inc index 5386057a8..d1c016d58 100644 --- a/plugins/admin/systems/class_dhcpPool.inc +++ b/plugins/admin/systems/class_dhcpPool.inc @@ -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; } diff --git a/plugins/admin/systems/class_dhcpSubnet.inc b/plugins/admin/systems/class_dhcpSubnet.inc index 7f8855b9e..2620a7be0 100644 --- a/plugins/admin/systems/class_dhcpSubnet.inc +++ b/plugins/admin/systems/class_dhcpSubnet.inc @@ -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; } -- 2.30.2