Code

Fixed wrong existance check
[gosa.git] / gosa-plugins / systems / admin / systems / class_termDNS.inc
index 410b34b3d4fafa40ac0275acc4ac9f480e706278..e336feb26d3a41f1d1dea274113d832a83b58b72 100644 (file)
@@ -79,7 +79,9 @@ class termDNS extends plugin
     $this->IPisMust       = $IPisMust;
     $this->namingAttr     = $namingAttr;
 
-    plugin::plugin ($config, $parent->dn);
+    plugin::plugin ($config, $parent->dn, $this->parent);
+  
+    $this->attrs = &$this->parent->attrs;
 
     if(isset($this->attrs[$namingAttr][0])){
       $this->OrigCn = preg_replace("/\\\$\$/","",$this->attrs[$namingAttr][0]);
@@ -719,7 +721,7 @@ class termDNS extends plugin
     }
 
     /* Do not add the objectClass ipHost if no ip address is given */
-    if(!$this->attrs['ipHostNumber']){
+    if(!isset($this->attrs['ipHostNumber'])){
       $this->attrs['objectClass'] = array_remove_entries(array("ipHost"),$this->attrs['objectClass']);
     }
 
@@ -1121,9 +1123,11 @@ class termDNS extends plugin
       "(objectClass=gotoPrinter)".
       "(objectClass=ipHost)";
     $list = array();
-    $ldap->search("(&(|{$ocs})(ipHostNumber={$net}*))",array("ipHostNumber"));
+    $ldap->search("(&(|{$ocs})(ipHostNumber=*))",array("ipHostNumber"));
     while($attrs = $ldap->fetch()){
-      $list[] = $attrs['ipHostNumber'][0];
+      if (preg_match("/^$net\./", $attrs['ipHostNumber'][0])) {
+        $list[] = $attrs['ipHostNumber'][0];
+      }
     }
 
     // Set starting ip.