Adding myself.
[squirrelmail.git] / functions / abook_ldap_server.php
index c668d791f59f75b08d2d6161e06f4ee8de07dd41..87bacd9a6f530ac5ac1f87b94d58d95edabf89f9 100644 (file)
@@ -12,7 +12,7 @@
  * StartTLS code by John Lane
  *   <starfry at users.sourceforge.net> (#1197703)
  *
- * @copyright &copy; 1999-2005 The SquirrelMail Project Team
+ * @copyright &copy; 1999-2006 The SquirrelMail Project Team
  * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  * @version $Id$
  * @package squirrelmail
@@ -496,12 +496,14 @@ class abook_ldap_server extends addressbook_backend {
             /* Convert search from user's charset to the one used in ldap */
             $expr = $this->charset_encode($expr);
 
-            /* Make sure that search does not contain ldap special chars */
-            $expression = '(cn=*' . $this->ldapspecialchars($expr) . '*)';
+            /* sanitize search string */
+            $expr = $this->ldapspecialchars($expr);
+
+            /* Search for same string in cn, main and sn */
+            $expression = '(|(cn=*'.$expr.'*)(mail=*'.$expr.'*)(sn=*'.$expr.'*))';
 
             /* Undo sanitizing of * symbol */
             $expression = str_replace('\2a','*',$expression);
-            /* TODO: implement any single character (?) matching */
         }
 
         /* Add search filtering */