瀏覽代碼

search for string in cn, sn and mail fields

tokul 19 年之前
父節點
當前提交
1cf3b09485
共有 2 個文件被更改,包括 7 次插入3 次删除
  1. 2 0
      ChangeLog
  2. 5 3
      functions/abook_ldap_server.php

+ 2 - 0
ChangeLog

@@ -512,6 +512,8 @@ Version 1.5.1 -- CVS
     Issue is specific to sqBodyWrap() and string function wrappers introduced in 
     Issue is specific to sqBodyWrap() and string function wrappers introduced in 
     1.5.1.
     1.5.1.
   - MagicHTML fix for comments in styles.
   - MagicHTML fix for comments in styles.
+  - Added 'mail' and 'sn' attributes to address book LDAP backend search
+    expression (#1368154).
 
 
 Version 1.5.0 - 2 February 2004
 Version 1.5.0 - 2 February 2004
 -------------------------------
 -------------------------------

+ 5 - 3
functions/abook_ldap_server.php

@@ -496,12 +496,14 @@ class abook_ldap_server extends addressbook_backend {
             /* Convert search from user's charset to the one used in ldap */
             /* Convert search from user's charset to the one used in ldap */
             $expr = $this->charset_encode($expr);
             $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 */
             /* Undo sanitizing of * symbol */
             $expression = str_replace('\2a','*',$expression);
             $expression = str_replace('\2a','*',$expression);
-            /* TODO: implement any single character (?) matching */
         }
         }
 
 
         /* Add search filtering */
         /* Add search filtering */