summaryrefslogtreecommitdiff
path: root/lisp/net/eudcb-ldap.el
diff options
context:
space:
mode:
authorThomas Fitzsimmons <fitzsim@fitzsim.org>2014-11-13 01:34:35 -0500
committerThomas Fitzsimmons <fitzsim@fitzsim.org>2014-11-13 02:32:12 -0500
commit1e1f5b9cef289f3458455362cef9425e591c7666 (patch)
treeaebf200bca858e5c836282717636f2b64ef14abc /lisp/net/eudcb-ldap.el
parent6a3a3b0e1061c54e400b54ac5bec7c300c5565ae (diff)
downloademacs-1e1f5b9cef289f3458455362cef9425e591c7666.tar.gz
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.
Diffstat (limited to 'lisp/net/eudcb-ldap.el')
-rw-r--r--lisp/net/eudcb-ldap.el18
1 files changed, 10 insertions, 8 deletions
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)))))
;;}}}