Code

Updated function.inc
[gosa.git] / include / class_config.inc
index 7b55d77337bbeaf03a17f25be40dd6ffb37f0435..270f1e2565c7f5484e10308ce47d45a1a1805a40 100644 (file)
@@ -179,13 +179,21 @@ class config  {
     $this->level--;
   }
 
-  function get_ldap_link($sizelimit= FALSE)
+
+  function get_credentials($creds)
   {
-    if($this->ldap === NULL || !is_resource($this->ldap->cid)){
+    if (isset($_SERVER['HTTP_GOSA_KEY'])){
+      return (cred_decrypt($creds, $_SERVER['HTTP_GOSA_KEY']));
+    }
+    return ($creds);
+  }
 
+
+  function get_ldap_link($sizelimit= FALSE)
+  {
       /* Build new connection */
       $this->ldap= ldap_init ($this->current['SERVER'], $this->current['BASE'],
-          $this->current['ADMIN'], $this->current['PASSWORD']);
+          $this->current['ADMIN'], $this->get_credentials($this->current['PASSWORD']));
 
       /* Check for connection */
       if (is_null($this->ldap) || (is_int($this->ldap) && $this->ldap == 0)){
@@ -213,7 +221,7 @@ class config  {
       } else {
         $this->ldap->referrals= $this->current['REFERRAL'];
       }
-    }
+#    } 
     return ($this->ldap);
   }