>From e2639d7cb42118a5b70ed619a774a89e376d36e2 Mon Sep 17 00:00:00 2001 From: Thomas Fitzsimmons Date: Thu, 13 Nov 2014 01:34:35 -0500 Subject: [PATCH 10/16] 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 3d41760..1ef74a6 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,13 @@ 2014-11-13 Thomas Fitzsimmons + * 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 + * 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))))) ;;}}} -- 1.8.1.4