Code

Added alternative password reading
[gosa.git] / gosa-core / include / class_ldap.inc
index 560f809cfe44c98ba0bb6bbc6338fef1619a5119..bfd429c529920d3c7fa9f55978a2682ea5446a20 100644 (file)
@@ -36,6 +36,7 @@ class LDAP{
   var $cid;
   var $hasres   = array();
   var $sr       = array();
+  var $re       = array();
   var $basedn   ="";
   var $start    = array(); // 0 if we are fetching the first entry, otherwise 1
   var $error    = ""; // Any error messages to be returned can be put here
@@ -48,8 +49,6 @@ 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;
@@ -316,17 +315,17 @@ class LDAP{
         {
           if ($this->sr[$srp]){
             $this->start[$srp] = 1;
-            $this->re= @ldap_first_entry($this->cid, $this->sr[$srp]);
+            $this->re[$srp]= @ldap_first_entry($this->cid, $this->sr[$srp]);
           } else {
             return array();
           }
         } else {
-          $this->re= @ldap_next_entry($this->cid, $this->re);
+          $this->re[$srp]= @ldap_next_entry($this->cid, $this->re[$srp]);
         }
-        if ($this->re)
+        if ($this->re[$srp])
         {
-          $att= @ldap_get_attributes($this->cid, $this->re);
-          $att['dn']= trim(LDAP::convert(@ldap_get_dn($this->cid, $this->re)));
+          $att= @ldap_get_attributes($this->cid, $this->re[$srp]);
+          $att['dn']= trim(LDAP::convert(@ldap_get_dn($this->cid, $this->re[$srp])));
         }
         $this->error = @ldap_error($this->cid);
         if (!isset($att)){
@@ -361,13 +360,13 @@ class LDAP{
     if($this->hascon){
       if($this->hasres[$srp]){
 
-        if(!$this->re)
+        if(!$this->re[$srp])
           {
           $this->error = "Perform a Fetch with no valid Result";
           }
           else
           {
-          $rv = @ldap_get_dn($this->cid, $this->re);
+          $rv = @ldap_get_dn($this->cid, $this->re[$srp]);
         
           $this->error = @ldap_error($this->cid);
           return(trim(LDAP::convert($rv)));
@@ -589,7 +588,7 @@ class LDAP{
 
           /* Bail out, if we've nothing to do... */
           if ($ocname == ""){
-            msg_dialog::display(_("Internal error"), sprintf(_("Cannot automatically create subtrees with RDN '%s': no object class found"),$type), FATAL_ERROR_DIALOG);
+            msg_dialog::display(_("Internal error"), sprintf(_("Cannot automatically create subtrees with RDN '%s': no object class found!"),$type), FATAL_ERROR_DIALOG);
             exit();
           }
 
@@ -862,7 +861,7 @@ class LDAP{
       if JustMofify id false the destination dn will be overwritten by the new ldif. 
     */
 
-  function import_complete_ldif($srp, $str_attr,&$error,$JustModify,$DeleteOldEntries)
+  function import_complete_ldif($srp, $str_attr,$error,$JustModify,$DeleteOldEntries)
   {
     if($this->reconnect) $this->connect();