Code

Updated gosaSupportDaemon
[gosa.git] / gosa-core / include / class_ldap.inc
index 642908017b553e236a8ca00710cc2dc60961ec5f..93686b6e63476d594db051f1edf22eb8e005d9ac 100644 (file)
@@ -1,12 +1,26 @@
 <?php
-/*****************************************************************************
-  newldap.inc - version 1.0
-  Copyright (C) 2003 Alejandro Escanero Blanco <aescanero@chaosdimension.org>
-  Copyright (C) 2004-2006 Cajus Pollmeier <pollmeier@gonicus.de>
-
-  Based in code of ldap.inc of
-  Copyright (C) 1998  Eric Kilfoil <eric@ipass.net>
- *****************************************************************************/
+/*
+ * This code is part of GOsa (http://www.gosa-project.org)
+ * Copyright (C) 2003-2008 GONICUS GmbH
+ * Copyright (C) 2003 Alejandro Escanero Blanco <aescanero@chaosdimension.org>
+ * Copyright (C) 1998  Eric Kilfoil <eric@ipass.net>
+ *
+ * ID: $$Id$$
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
 
 define("ALREADY_EXISTING_ENTRY",-10001);
 define("UNKNOWN_TOKEN_IN_LDIF_FILE",-10002);
@@ -32,6 +46,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;
@@ -184,13 +200,33 @@ class LDAP{
     return(ereg_replace("[^,]*[,]*[ ]*(.*)", "\\1", $basedn));
   }
 
+  
+# /* Checks if there is still unfetched data 
+#  */
+# function checkResult()
+# {
+#   /* Check if we have started a search before  */
+#   if($this->start != 0 && $this->re){
+#     
+#     /* Check if there are still unfetched elements */
+#     if(is_resource(@ldap_next_entry($this->cid, $this->re))){
+#       new log("debug","LDAP:: CAT/SEARCH/FETCH","A new search was initiated while an older search wasn't fetched completely.");
+#       msg_dialog::display(_("Debug"),"A new search was initiated while an older search wasn't fetched completely.",ERROR_DIALOG);
+#       trigger_error("A new search was initiated while an older search wasn't fetched completely.");
+#     }
+#   }
+# }
+#
   function search($filter, $attrs= array())
   {
     if($this->hascon){
       if ($this->reconnect) $this->connect();
 
+#      /* Check if there are still unfetched objects from last search 
+#       */
+#      $this->checkResult();
+
       $start = microtime();
-   
       $this->clearResult();
       $this->sr = @ldap_search($this->cid, LDAP::fix($this->basedn), $filter, $attrs);
       $this->error = @ldap_error($this->cid);
@@ -217,6 +253,11 @@ class LDAP{
   {
     if($this->hascon){
       if ($this->reconnect) $this->connect();
+
+#      /* Check if there are still unfetched objects from last search 
+#       */
+#      $this->checkResult();
+
       $this->clearResult();
       if ($basedn == "")
         $basedn = $this->basedn;
@@ -250,6 +291,11 @@ class LDAP{
   {
     if($this->hascon){
       if ($this->reconnect) $this->connect();
+
+#      /* Check if there are still unfetched objects from last search 
+#       */
+#      $this->checkResult();
+
       $this->clearResult();
       $filter = "(objectclass=*)";
       $this->sr = @ldap_read($this->cid, LDAP::fix($dn), $filter,$attrs);