aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoão Távora2019-11-20 00:11:00 +0000
committerJoão Távora2019-11-22 09:36:58 +0000
commit92fda5a7f92162d610d57df14372bcfcee1f01b6 (patch)
treeec0b313fccb15a389a4ab41f28675955a5729250
parentc5de861af1da697b4481133e4f5f966e6a3fc859 (diff)
downloademacs-92fda5a7f92162d610d57df14372bcfcee1f01b6.tar.gz
emacs-92fda5a7f92162d610d57df14372bcfcee1f01b6.zip
Make auth-source-pass-search understand port lists
For cases such as a typical IMAP Gnus setup, auto-source-pass-search is passed a list of "port aliases" like (993 "imaps" "imap" "993" "143") in hopes of finding a matching ~/.password-store entry. This modification makes this library understand and unroll the port list so that, i.e. "domain:993", "domain:imaps"", "domain:imap", etc. are computed as potential suffixes. Previously a nonsensical string "domain:(993 imaps imap ...)" was returned. * lisp/auth-source-pass.el (auth-source-pass--generate-entry-suffixes): Allow PORT to be a list of ports.
-rw-r--r--lisp/auth-source-pass.el11
1 files changed, 8 insertions, 3 deletions
diff --git a/lisp/auth-source-pass.el b/lisp/auth-source-pass.el
index 524a72792cf..dfdb7596fae 100644
--- a/lisp/auth-source-pass.el
+++ b/lisp/auth-source-pass.el
@@ -269,10 +269,15 @@ If ENTRIES is nil, use the result of calling `auth-source-pass-entries' instead.
269 269
270Based on the supported pathname patterns for HOSTNAME, USER, & 270Based on the supported pathname patterns for HOSTNAME, USER, &
271PORT, return a list of possible suffixes for matching entries in 271PORT, return a list of possible suffixes for matching entries in
272the password-store." 272the password-store.
273
274PORT may be a list of ports."
273 (let ((domains (auth-source-pass--domains (split-string hostname "\\.")))) 275 (let ((domains (auth-source-pass--domains (split-string hostname "\\."))))
274 (seq-mapcat (lambda (n) 276 (seq-mapcat (lambda (domain)
275 (auth-source-pass--name-port-user-suffixes n user port)) 277 (seq-mapcat
278 (lambda (p)
279 (auth-source-pass--name-port-user-suffixes domain user p))
280 (if (listp port) port (list port))))
276 domains))) 281 domains)))
277 282
278(defun auth-source-pass--domains (name-components) 283(defun auth-source-pass--domains (name-components)