From 028734b25cfa2ee30a129710db0440617f9f3095 Mon Sep 17 00:00:00 2001
From: Thomas Bruederli <thomas@roundcube.net>
Date: Mon, 18 Aug 2014 11:21:03 -0400
Subject: [PATCH] Make LDAP errors available to the application

---
 program/lib/Roundcube/rcube_ldap.php |   20 ++++++++++++++++++--
 1 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/program/lib/Roundcube/rcube_ldap.php b/program/lib/Roundcube/rcube_ldap.php
index 274616a..6805c49 100644
--- a/program/lib/Roundcube/rcube_ldap.php
+++ b/program/lib/Roundcube/rcube_ldap.php
@@ -906,7 +906,6 @@
         return $this->result;
     }
 
-
     /**
      * Get a specific contact record
      *
@@ -946,6 +945,23 @@
         }
 
         return $assoc ? $res : $this->result;
+    }
+
+    /**
+     * Returns the last error occurred (e.g. when updating/inserting failed)
+     *
+     * @return array Hash array with the following fields: type, message
+     */
+    function get_error()
+    {
+        $err = $this->error;
+
+        // check ldap connection for errors
+        if (!$err && $this->ldap->get_error()) {
+            $err = array(self::ERROR_SEARCH, $this->ldap->get_error());
+        }
+
+        return $err;
     }
 
 
@@ -1609,7 +1625,7 @@
 
         if ($search) {
             foreach ($group_cache as $group) {
-                if ($this->compare_search_value('name', $group['name'], $search, $mode)) {
+                if ($this->compare_search_value('name', $group['name'], mb_strtolower($search), $mode)) {
                     $groups[] = $group;
                 }
             }

--
Gitblit v1.9.1