From: hickert Date: Mon, 20 Sep 2010 13:24:02 +0000 (+0000) Subject: Partly reverted last change X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=2629ea80e46bbf22fa768aa3b5c294cca345142c;p=gosa.git Partly reverted last change -Updated special char handling git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19770 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-core/include/class_ldap.inc b/gosa-core/include/class_ldap.inc index b87a228fd..68a94658d 100644 --- a/gosa-core/include/class_ldap.inc +++ b/gosa-core/include/class_ldap.inc @@ -327,11 +327,6 @@ class LDAP{ } } - function getSearchResultHandle($srp) - { - return($this->sr[$srp]); - } - function fetch($srp) { $att= array(); diff --git a/gosa-core/include/class_ldapMultiplexer.inc b/gosa-core/include/class_ldapMultiplexer.inc index 557bc7dfb..fbd6d91b4 100644 --- a/gosa-core/include/class_ldapMultiplexer.inc +++ b/gosa-core/include/class_ldapMultiplexer.inc @@ -39,7 +39,7 @@ class ldapMultiplexer { public function __call($methodName, $parameters) { /* Add resource pointer if the mentioned methods are used */ - if (preg_match('/^(search|ls|cat|fetch|clearResult|resetResult|count|getDN|recursive_remove|rmdir_recursive|gen_xls|create_missing_trees|import_single_entry|import_complete_ldif|getSearchResultHandle)$/', $methodName)){ + if (preg_match('/^(search|ls|cat|fetch|clearResult|resetResult|count|getDN|recursive_remove|rmdir_recursive|gen_xls|create_missing_trees|import_single_entry|import_complete_ldif)$/', $methodName)){ array_unshift($parameters, $this->sr); } diff --git a/gosa-core/include/functions.inc b/gosa-core/include/functions.inc index 192a0bb1b..680416e1b 100644 --- a/gosa-core/include/functions.inc +++ b/gosa-core/include/functions.inc @@ -3788,6 +3788,7 @@ function detectLdapSpecialCharHandling() global $config; if(!$config) return(NULL); + $testChars = array(',','"'); // In the DN we've to use escaped characters, but the object name (o) @@ -3801,31 +3802,34 @@ function detectLdapSpecialCharHandling() // Create the target dn $oDN = "o=".LDAP::convert($dnName).",".$config->current['BASE']; - // Create the object on demand. + // Get ldap connection and check if we've already created the character + // detection object. $ldap = $config->get_ldap_link(); - $ldap->cd($config->current['BASE']); - if(!$ldap->dn_exists($oDN)){ + $ldapCID = $ldap->cid(); + + $res = ldap_list($ldap->cid, $config->current['BASE'], "(&(o={$name})(objectClass=organization))",array('dn')); + $cnt = ldap_count_entries($ldap->cid, $res); + if(!$cnt){ $obj = array(); $obj['objectClass'] = array('top','organization'); $obj['o'] = $name; $obj['description'] = 'GOsa character encoding test-object.'; - $ldap->cd($oDN); - $ldap->add($obj); + ldap_add($ldap->cid, $config->current['BASE'], $attrs); } - - // Read the encoding instruction set. - $ldap->cd($config->current['BASE']); - $ldap->ls("(&(o={$name})(objectClass=organization))"); - - if(!$ldap->count() == 1){ + + // Read the encoding instruction set. + $res = ldap_list($ldap->cid, $config->current['BASE'], "(&(o={$name})(objectClass=organization))",array('*')); + $cnt = ldap_count_entries($ldap->cid, $res); + if($cnt != 1){ trigger_error("GOsa couldn't detect the special character encoding used by your ldap!"); return(NULL); }else{ - $re = ldap_first_entry($ldap->cid, $ldap->getSearchResultHandle()); + $re = ldap_first_entry($ldap->cid, $res); $attrs= ldap_get_attributes($ldap->cid, $re); $attrs['dn']= trim(ldap_get_dn($ldap->cid, $re)); + $o = $attrs['o'][0]; $dn = $attrs['dn']; $mapOstr = preg_replace("/^GOsaLdapEncoding_/","",$o);