]> git.eshelyaron.com Git - emacs.git/commitdiff
Append LDAP wildcard character to end of search string
authorThomas Fitzsimmons <fitzsim@fitzsim.org>
Thu, 13 Nov 2014 06:34:35 +0000 (01:34 -0500)
committerThomas Fitzsimmons <fitzsim@fitzsim.org>
Thu, 13 Nov 2014 07:32:12 +0000 (02:32 -0500)
* 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
lisp/net/eudc.el
lisp/net/eudcb-ldap.el

index 30e584a0121347a1fdf7e3b1496c97891b66c683..192302228e77ed6a3827518d66bc88baafea52ee 100644 (file)
@@ -1,3 +1,11 @@
+2014-11-13  Thomas Fitzsimmons  <fitzsim@fitzsim.org>
+
+       * 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  <fitzsim@fitzsim.org>
 
        * net/eudcb-ldap.el (eudc-ldap-cleanup-record-simple): Downcase
index 54a41f02fb02102c1d58aa9fcf970a3de64b4f5d..2a215810ede01c2e43820a845cd09c6d859e35f4 100644 (file)
@@ -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)
index 1b01d21be8c874cc092c1ff5bd250075eddc9297..e43e5701eb12b3bc20c882972c74f1656ad8f9a9 100644 (file)
@@ -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)))))
 
 ;;}}}