emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 92fda5a: Make auth-source-pass-search understand port lists


From: Joo Tvora
Subject: master 92fda5a: Make auth-source-pass-search understand port lists
Date: Fri, 22 Nov 2019 04:37:02 -0500 (EST)

branch: master
commit 92fda5a7f92162d610d57df14372bcfcee1f01b6
Author: João Távora <address@hidden>
Commit: João Távora <address@hidden>

    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.
---
 lisp/auth-source-pass.el | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/lisp/auth-source-pass.el b/lisp/auth-source-pass.el
index 524a727..dfdb759 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.
 
 Based on the supported pathname patterns for HOSTNAME, USER, &
 PORT, return a list of possible suffixes for matching entries in
-the password-store."
+the password-store.
+
+PORT may be a list of ports."
   (let ((domains (auth-source-pass--domains (split-string hostname "\\."))))
-    (seq-mapcat (lambda (n)
-                  (auth-source-pass--name-port-user-suffixes n user port))
+    (seq-mapcat (lambda (domain)
+                  (seq-mapcat
+                   (lambda (p)
+                     (auth-source-pass--name-port-user-suffixes domain user p))
+                   (if (listp port) port (list port))))
                 domains)))
 
 (defun auth-source-pass--domains (name-components)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]