X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=gosa-core%2Finclude%2Fclass_ldap.inc;h=1aaa8e800c557389bb2888cd22edbfe0a93dc820;hb=4ea9e915f0fafd23fe70c0221ea174691a25c71f;hp=2bbb1d875ee9a5365f04a675af57c5ed22f27b1e;hpb=e2b4b86dd84c941e591f0560dc20a947854312c5;p=gosa.git diff --git a/gosa-core/include/class_ldap.inc b/gosa-core/include/class_ldap.inc index 2bbb1d875..1aaa8e800 100644 --- a/gosa-core/include/class_ldap.inc +++ b/gosa-core/include/class_ldap.inc @@ -60,8 +60,8 @@ class LDAP{ $this->hostname=$hostname; /* Check if MAX_LDAP_QUERY_TIME is defined */ - if(isset($config->data['MAIN']['MAX_LDAP_QUERY_TIME'])){ - $str = $config->data['MAIN']['MAX_LDAP_QUERY_TIME']; + if($config->get_cfg_value("max_ldap_query_time") != ""){ + $str = $config->get_cfg_value("max_ldap_query_time"); $this->max_ldap_query_time = (float)($str); } @@ -451,15 +451,20 @@ class LDAP{ */ function rename_dn($source,$dest) { + $source = LDAP::fix($source); + $dest = LDAP::fix($dest); + /* Check if source and destination are the same entry */ if(strtolower($source) == strtolower($dest)){ trigger_error("Source and destination can't be the same entry."); + $this->error = "Source and destination can't be the same entry."; return(FALSE); } /* Check if destination entry exists */ if($this->dn_exists($dest)){ trigger_error("Destination '$dest' already exists."); + $this->error = "Destination '$dest' already exists."; return(FALSE); } @@ -473,13 +478,13 @@ class LDAP{ if($this->hascon){ if ($this->reconnect) $this->connect(); - $r= @ldap_rename($this->cid,$source,$dest_rdn,$parent,TRUE); - $this->error = @ldap_error($this->cid); + $r= ldap_rename($this->cid,$source,$dest_rdn,$parent,TRUE); + $this->error = ldap_error($this->cid); /* Check if destination dn exists, if not the server may not support this operation */ - $r &= $this->dn_exists($dest); - return(!$r ? $r : TRUE); + $r &= is_resource($this->dn_exists($dest)); + return($r); }else{ $this->error = "Could not connect to LDAP server"; return(FALSE); @@ -1190,7 +1195,7 @@ class LDAP{ /* Only read schema if it is allowed */ if(isset($config) && preg_match("/config/i",get_class($config))){ - if(!isset($config->data['MAIN']['SCHEMA_CHECK']) || !preg_match("/true/i",$config->data['MAIN']['SCHEMA_CHECK'])){ + if ($config->get_cfg_value("schema_check") != "true"){ return($objectclasses); } } @@ -1202,11 +1207,7 @@ class LDAP{ } # Get base to look for schema - $sr = @ldap_read ($this->cid, NULL, "objectClass=*", array("subschemaSubentry")); - if(!$sr){ - $sr = @ldap_read ($this->cid, "", "objectClass=*", array("subschemaSubentry")); - } - + $sr = @ldap_read ($this->cid, "", "objectClass=*", array("subschemaSubentry")); $attr = @ldap_get_entries($this->cid,$sr); if (!isset($attr[0]['subschemasubentry'][0])){ return array(); @@ -1266,6 +1267,7 @@ class LDAP{ if(class_available("session")){ session::set("LDAP_CACHE::get_objectclasses",$objectclasses); } + return $objectclasses; }