summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a78be17)
raw | patch | inline | side by side (parent: a78be17)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 20 Sep 2010 13:24:02 +0000 (13:24 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 20 Sep 2010 13:24:02 +0000 (13:24 +0000) |
-Updated special char handling
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19770 594d385d-05f5-0310-b6e9-bd551577e9d8
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19770 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-core/include/class_ldap.inc | patch | blob | history | |
gosa-core/include/class_ldapMultiplexer.inc | patch | blob | history | |
gosa-core/include/functions.inc | patch | blob | history |
index b87a228fd85bf527c3cf9fbde8f6219af94eb3e8..68a94658d8d8f606ded0db5fac0cedcc191fae88 100644 (file)
}
}
- 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 557bc7dfb5145b24f0fc75964e08259790c748d9..fbd6d91b47d47168cfb579ecd57596f8ebde0b66 100644 (file)
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);
}
index 192a0bb1b54b7858f53b6b590f18c98b0faa3bde..680416e1bd020c973af54622d3a81b596f66808e 100644 (file)
global $config;
if(!$config) return(NULL);
+
$testChars = array(',','"');
// In the DN we've to use escaped characters, but the object name (o)
// 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);