From: Thomas Fitzsimmons Date: Thu, 13 Nov 2014 06:34:35 +0000 (-0500) Subject: Append LDAP wildcard character to end of search string X-Git-Tag: emacs-25.0.90~2582^2~2^2~6 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=1e1f5b9cef289f3458455362cef9425e591c7666;p=emacs.git 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. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 30e584a0121..192302228e7 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,11 @@ +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 diff --git a/lisp/net/eudc.el b/lisp/net/eudc.el index 54a41f02fb0..2a215810ede 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 1b01d21be8c..e43e5701eb1 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))))) ;;}}}