emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 1e1f5b9 10/17: Append LDAP wildcard character to en


From: Stefan Monnier
Subject: [Emacs-diffs] master 1e1f5b9 10/17: Append LDAP wildcard character to end of search string
Date: Fri, 23 Jan 2015 22:20:34 +0000

branch: master
commit 1e1f5b9cef289f3458455362cef9425e591c7666
Author: Thomas Fitzsimmons <address@hidden>
Commit: Thomas Fitzsimmons <address@hidden>

    Append LDAP wildcard character to end of search string
    
    * net/eudc.el (eudc-format-query): Preserve the
    eudc-inline-query-format ordering of attributes in the returned
    list.
    * net/eudcb-ldap.el (eudc-ldap-format-query-as-rfc1558): Append
    the LDAP wildcard character to the last attribute value.
---
 lisp/ChangeLog         |    8 ++++++++
 lisp/net/eudc.el       |    1 -
 lisp/net/eudcb-ldap.el |   18 ++++++++++--------
 3 files changed, 18 insertions(+), 9 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 30e584a..1923022 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,13 @@
 2014-11-13  Thomas Fitzsimmons  <address@hidden>
 
+       * net/eudc.el (eudc-format-query): Preserve the
+       eudc-inline-query-format ordering of attributes in the returned
+       list.
+       * net/eudcb-ldap.el (eudc-ldap-format-query-as-rfc1558): Append
+       the LDAP wildcard character to the last attribute value.
+
+2014-11-13  Thomas Fitzsimmons  <address@hidden>
+
        * net/eudcb-ldap.el (eudc-ldap-cleanup-record-simple): Downcase
        field names of LDAP results.
        (eudc-ldap-cleanup-record-filtering-addresses): Likewise.
diff --git a/lisp/net/eudc.el b/lisp/net/eudc.el
index 54a41f0..2a21581 100644
--- a/lisp/net/eudc.el
+++ b/lisp/net/eudc.el
@@ -763,7 +763,6 @@ otherwise a list of symbols is returned."
                  format (cdr format)))
          ;; If the same attribute appears more than once, merge
          ;; the corresponding values
-         (setq query-alist (nreverse query-alist))
          (while query-alist
            (setq key (eudc-caar query-alist)
                  val (eudc-cdar query-alist)
diff --git a/lisp/net/eudcb-ldap.el b/lisp/net/eudcb-ldap.el
index 1b01d21..e43e570 100644
--- a/lisp/net/eudcb-ldap.el
+++ b/lisp/net/eudcb-ldap.el
@@ -174,14 +174,16 @@ attribute names are returned. Default to `person'"
 
 (defun eudc-ldap-format-query-as-rfc1558 (query)
   "Format the EUDC QUERY list as a RFC1558 LDAP search filter."
-  (format "(&%s)"
-         (apply 'concat
-                (mapcar (lambda (item)
-                           (format "(%s=%s)"
-                                   (car item)
-                                   (eudc-ldap-escape-query-special-chars (cdr 
item))))
-                        query))))
-
+  (let ((formatter (lambda (item &optional wildcard)
+                    (format "(%s=%s)"
+                            (car item)
+                            (concat
+                             (eudc-ldap-escape-query-special-chars
+                              (cdr item)) (if wildcard "*" ""))))))
+    (format "(&%s)"
+           (concat
+            (mapconcat formatter (butlast query) "")
+            (funcall formatter (car (last query)) t)))))
 
 ;;}}}
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]