diff --git a/include/class_ldap.inc b/include/class_ldap.inc
index a95e002afaabc15a62f6f9030fe4e5a14df8c691..b5a5026b0db14e3e5014bc137be276b1c6d93795 100644 (file)
--- a/include/class_ldap.inc
+++ b/include/class_ldap.inc
var $referrals= array();
var $max_ldap_query_time = 0; // 0, empty or negative values will disable this check
+ var $re = NULL;
+
function LDAP($binddn,$bindpw, $hostname, $follow_referral= FALSE, $tls= FALSE)
{
global $config;
Currently used codes:
, => CO
\2C => CO
+ \22 => TO
+ \" => TO
+ \+ => PL
( => OB
) => CB
/ => SL */
function convert($dn)
{
if (SPECIALS_OVERRIDE == TRUE){
- $tmp= preg_replace(array("/\\\\,/", "/\\\\2C/", "/\(/", "/\)/", "/\//"),
- array("\001CO", "\001CO", "\001OB", "\001CB", "\001SL"),
+ $tmp= preg_replace(array("/\\\\,/", "/\\\\2C/", "/\(/", "/\)/", "/\//", "/\\\\22/", '/\\\\"/', "/\\\\3D/", "/\\\\2B/", '/\\\\+/'),
+ array("\001CO", "\001CO", "\001OB", "\001CB", "\001SL", "\001TO", "\001TO", "\001GL", "\001PL", "\001PL"),
$dn);
return (preg_replace('/,\s+/', ',', $tmp));
} else {
function fix($dn)
{
if (SPECIALS_OVERRIDE == TRUE){
- return (preg_replace(array("/\001CO/", "/\001OB/", "/\001CB/", "/\001SL/"),
- array("\,", "(", ")", "/"),
+ return (preg_replace(array("/\001CO/", "/\001OB/", "/\001CB/", "/\001SL/", "/\001TO/", "/\001PL/", "/\001GL/"),
+ array("\,", "(", ")", "/", '\"', "\+", "="),
$dn));
} else {
return ($dn);
}
+ /* Function to fix problematic characters in DN's that are used for search
+ requests. I.e. member=.... */
+ function prepare4filter($dn)
+ {
+ return normalizeLdap(preg_replace('/\\\\/', '\\\\\\', @LDAP::fix($dn)));
+ }
+
+
function connect()
{
$this->hascon=false;
if ($this->reconnect) $this->connect();
$start = microtime();
-
$this->clearResult();
$this->sr = @ldap_search($this->cid, $this->fix($this->basedn), $filter, $attrs);
$this->error = @ldap_error($this->cid);
{
if($this->hascon){
if ($this->reconnect) $this->connect();
+
$this->clearResult();
if ($basedn == "")
$basedn = $this->basedn;
{
if($this->hascon){
if ($this->reconnect) $this->connect();
+
$start = microtime();
$this->clearResult();
$filter = "(objectclass=*)";
}
if($this->error != "Success"){
- /* Some error occured */
+ /* Some error occurred */
print "---------------------------------------------";
print $this->get_error()."<br>";
print $sourcedn."<br>";
/* Assemble_entry */
if ($tag != ""){
$na['objectClass']= array($ocname, "gosaAdministrativeUnitTag");
+ $na["gosaUnitTag"]= $tag;
} else {
$na['objectClass']= array($ocname);
}
@@ -1311,10 +1326,13 @@ function gen_xls ($dn, $filter= "(objectClass=*)", $attributes= array('*'), $rec
function get_objectclasses()
{
+ global $config;
$objectclasses = array();
- if(!isset($this->config->data['MAIN']['SCHEMA_CHECK']) || !preg_match("/true/i",$config->data['MAIN']['SCHEMA_CHECK'])){
- return($objectclasses);
+ 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'])){
+ return($objectclasses);
+ }
}
# Get base to look for schema