From 2255df2722c5d8458e9bf199c13ed3f25817c199 Mon Sep 17 00:00:00 2001 From: hickert Date: Fri, 23 Jul 2010 09:34:37 +0000 Subject: [PATCH] Fixed post handling. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19078 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../goto/events/class_filterSystemByIp.inc | 64 +++++++++---------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/gosa-plugins/goto/addons/goto/events/class_filterSystemByIp.inc b/gosa-plugins/goto/addons/goto/events/class_filterSystemByIp.inc index 643a42303..dd2ae09ba 100644 --- a/gosa-plugins/goto/addons/goto/events/class_filterSystemByIp.inc +++ b/gosa-plugins/goto/addons/goto/events/class_filterSystemByIp.inc @@ -1,42 +1,42 @@ $entry){ - if(!isset($entry['ipHostNumber'])){ - unset($entries[$key]); - continue; + // IP Range selection + $filterByIP = preg_match("/__FilterByIP__/", $filter); + $filter = preg_replace("/__FilterByIP__/","",$filter); + $ipstart = ""; + $ipstop = ""; + if(preg_match("/__IPSTART__=/", $filter)){ + $ipstart = trim(preg_replace("/^.*__IPSTART__=([^_]*)__.*$/","\\1",$filter),"*"); + } + if(preg_match("/__IPSTOP__=/", $filter)){ + $ipstop = trim(preg_replace("/^.*__IPSTOP__=([^_]*)__.*$/","\\1",$filter),"*"); } - if(!tests::is_in_ip_range($ipstart,$ipstop, $entry['ipHostNumber'][0])){ - unset($entries[$key]); - continue; + + + // Get entries + $filter= preg_replace("/__IPSTART.*$/","",$filter); + $entries = filterLDAP::query($base, $scope, $filter, $attributes, $category, $objectStorage); + + + // Filter entries by IP-Address + if($filterByIP){ + foreach($entries as $key => $entry){ + if(!isset($entry['ipHostNumber'])){ + unset($entries[$key]); + continue; + } + if(!tests::is_in_ip_range($ipstart,$ipstop, $entry['ipHostNumber'][0])){ + unset($entries[$key]); + continue; + } + } } - } + return(array_values($entries)); } - return(array_values($entries)); - } } ?> -- 2.30.2