Code

Added support for master-key encrypted passwords in gosa.conf
[gosa.git] / include / class_ldap.inc
index 04294325d4a263b086c1a88c54c05f753b092756..b5a5026b0db14e3e5014bc137be276b1c6d93795 100644 (file)
@@ -32,6 +32,8 @@ class LDAP{
   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;
@@ -94,6 +96,14 @@ class LDAP{
   }
 
 
+  /* 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;
@@ -185,7 +195,6 @@ class LDAP{
       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);
@@ -213,6 +222,7 @@ class LDAP{
   {
     if($this->hascon){
       if ($this->reconnect) $this->connect();
+
       $this->clearResult();
       if ($basedn == "")
         $basedn = $this->basedn;
@@ -247,6 +257,7 @@ class LDAP{
   {
     if($this->hascon){
       if ($this->reconnect) $this->connect();
+
       $start = microtime();
       $this->clearResult();
       $filter = "(objectclass=*)";
@@ -747,6 +758,7 @@ class LDAP{
           /* Assemble_entry */
           if ($tag != ""){
             $na['objectClass']= array($ocname, "gosaAdministrativeUnitTag");
+            $na["gosaUnitTag"]= $tag;
           } else {
             $na['objectClass']= array($ocname);
           }