diff --git a/include/class_ldap.inc b/include/class_ldap.inc
index 3c1edad0ddbd557f7809a8afaba8c5d822509446..a1f960aa3bc730f67939ee52a170f3530ec83e84 100644 (file)
--- a/include/class_ldap.inc
+++ b/include/class_ldap.inc
if($this->max_ldap_query_time){
$diff = get_MicroTimeDiff($start,microtime());
if($diff > $this->max_ldap_query_time){
- print_red(sprintf(_("The ldapserver is answering very slow (%.2f), this may be responsible for performance breakdowns."),$diff)) ;
+ print_red(sprintf(_("The LDAP server is slow (%.2fs for the last query). This may be responsible for performance breakdowns."),$diff)) ;
}
}
function fetch()
{
+ $att= array();
if($this->hascon){
if($this->hasres){
if ($this->start == 0)
$l= array_reverse(ldap_explode_dn($real_path,0));
unset($l['count']);
$cdn= $this->basedn;
+ $tag= "";
foreach ($l as $part){
$cdn= "$part,$cdn";
$attrs= $this->fetch();
/* Create missing entry? */
- if (!count ($attrs)){
+ if (count ($attrs)){
+
+ /* Catch the tag - if present */
+ if (isset($attrs['gosaUnitTag'][0])){
+ $tag= $attrs['gosaUnitTag'][0];
+ }
+
+ } else {
$type= preg_replace('/^([^=]+)=.*$/', '\\1', $cdn);
$param= preg_replace('/^[^=]+=([^,]+),.*$/', '\\1', $cdn);
$na= array();
switch ($type){
case 'ou':
- $na["objectClass"]= "organizationalUnit";
+ if ($tag != ""){
+ $na["objectClass"]= array("organizationalUnit", "gosaAdministrativeUnitTag");
+ $na["gosaUnitTag"]= $tag;
+ } else {
+ $na["objectClass"]= "organizationalUnit";
+ }
$na["ou"]= $param;
break;
case 'dc':
- $na["objectClass"]= array("dcObject", "top", "locality");
+ if ($tag != ""){
+ $na["objectClass"]= array("dcObject", "top", "locality", "gosaAdministrativeUnitTag");
+ $na["gosaUnitTag"]= $tag;
+ } else {
+ $na["objectClass"]= array("dcObject", "top", "locality");
+ }
$na["dc"]= $param;
break;
default:
if ($this->error == 'Success'){
return $this->error;
} else {
- $error= $this->error." (".$this->get_additional_error().")";
+ $adderror= $this->get_additional_error();
+ if ($adderror != ""){
+ $error= $this->error." (".$this->get_additional_error().", ".sprintf(_("while operating on '%s' using LDAP server '%s'"), $this->base, $this->hostname).")";
+ } else {
+ $error= $this->error." (".sprintf(_("while operating on LDAP server %s"), $this->hostname).")";
+ }
return $error;
}
}