Skip to content

Commit 92fda5a

Browse files
committed
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.
1 parent c5de861 commit 92fda5a

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

lisp/auth-source-pass.el

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -269,10 +269,15 @@ If ENTRIES is nil, use the result of calling `auth-source-pass-entries' instead.
269269
270270
Based on the supported pathname patterns for HOSTNAME, USER, &
271271
PORT, return a list of possible suffixes for matching entries in
272-
the password-store."
272+
the password-store.
273+
274+
PORT may be a list of ports."
273275
(let ((domains (auth-source-pass--domains (split-string hostname "\\."))))
274-
(seq-mapcat (lambda (n)
275-
(auth-source-pass--name-port-user-suffixes n user port))
276+
(seq-mapcat (lambda (domain)
277+
(seq-mapcat
278+
(lambda (p)
279+
(auth-source-pass--name-port-user-suffixes domain user p))
280+
(if (listp port) port (list port))))
276281
domains)))
277282

278283
(defun auth-source-pass--domains (name-components)

0 commit comments

Comments
 (0)