<?php
+
/**
* abook_ldap_server.php
*
- * Copyright (c) 1999-2005 The SquirrelMail Project Team
- * Licensed under the GNU GPL. For full terms see the file COPYING.
- *
* Address book backend for LDAP server
*
* LDAP filtering code by Tim Bell
* StartTLS code by John Lane
* <starfry at users.sourceforge.net> (#1197703)
*
+ * @copyright © 1999-2006 The SquirrelMail Project Team
+ * @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @version $Id$
* @package squirrelmail
* @subpackage addressbook
/* 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 */