Code

Updated class ldap.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 20 Oct 2009 08:20:08 +0000 (08:20 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 20 Oct 2009 08:20:08 +0000 (08:20 +0000)
-Added information about missing objectClass name

git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@14607 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/include/class_ldap.inc

index 3bcf7f410dca6fad7a1bee1610ebda6c0eaccfa1..4b578a8f9f910fde6e4bc0d93a31ba7f1958e103 100644 (file)
@@ -566,6 +566,12 @@ class LDAP{
       if ($this->reconnect) $this->connect();
       $r = @ldap_modify($this->cid, LDAP::fix($this->basedn), $attrs);
       $this->error = @ldap_error($this->cid);
+      if(!$this->success() && preg_match("/^objectClass: value #([0-9]*) invalid per syntax$/", $this->get_additional_error())){
+        $oc = preg_replace("/^objectClass: value #([0-9]*) invalid per syntax$/","\\1", $this->get_additional_error());
+        if(isset($attrs['objectClass'][$oc])){
+          $this->error.= " <b>objectClass: ".$attrs['objectClass'][$oc]."</b>"; 
+        }
+      }
       return($r ? $r : 0);
     }else{
       $this->error = "Could not connect to LDAP server";
@@ -579,6 +585,12 @@ class LDAP{
       if ($this->reconnect) $this->connect();
       $r = @ldap_add($this->cid, LDAP::fix($this->basedn), $attrs);
       $this->error = @ldap_error($this->cid);
+      if(!$this->success() && preg_match("/^objectClass: value #([0-9]*) invalid per syntax$/", $this->get_additional_error())){
+        $oc = preg_replace("/^objectClass: value #([0-9]*) invalid per syntax$/","\\1", $this->get_additional_error());
+        if(isset($attrs['objectClass'][$oc])){
+          $this->error.= " <b>objectClass: ".$attrs['objectClass'][$oc]."</b>"; 
+        }
+      }
       return($r ? $r : 0);
     }else{
       $this->error = "Could not connect to LDAP server";