diff options
author | Lars Ingebrigtsen <larsi@gnus.org> | 2022-08-04 16:50:06 +0200 |
---|---|---|
committer | Lars Ingebrigtsen <larsi@gnus.org> | 2022-08-04 16:50:06 +0200 |
commit | d92c11845a28f017d86471b523a3270e3345c707 (patch) | |
tree | 12752b6c8ae433a85f41172757184bfc1cfe62be /lisp/auth-source.el | |
parent | f038695085d872124cbb87f2a0382d572014c540 (diff) | |
download | emacs-d92c11845a28f017d86471b523a3270e3345c707.tar.gz |
Add new function auth-source-netrc-parse-all
* lisp/auth-source.el (auth-source-netrc-parse-all): New function
(bug#56976).
(auth-source-netrc-parse): Partially revert behaviour in previous
change -- require :allow-null to match.
Diffstat (limited to 'lisp/auth-source.el')
-rw-r--r-- | lisp/auth-source.el | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/lisp/auth-source.el b/lisp/auth-source.el index 55dbaab3eed..48f9517683d 100644 --- a/lisp/auth-source.el +++ b/lisp/auth-source.el @@ -909,10 +909,16 @@ Remove trailing \": \"." (defun auth-source--aget (alist key) (cdr (assoc key alist))) +(defun auth-source-netrc-parse-all (file) + "Parse FILE and return all entries." + (auth-source-netrc-parse :file file :allow-null t)) + ;; (auth-source-netrc-parse :file "~/.authinfo.gpg") (cl-defun auth-source-netrc-parse (&key file max host user port require - &allow-other-keys) - "Parse FILE and return a list of all entries in the file. + allow-null &allow-other-keys) + "Parse FILE and return a list of matching entries in the file. +If ALLOW-NULL, allow nil values of HOST, USER and PORT to match. + Note that the MAX parameter is used so we can exit the parse early." (if (listp file) ;; We got already parsed contents; just return it. @@ -928,7 +934,7 @@ Note that the MAX parameter is used so we can exit the parse early." (check (lambda (alist) (and alist (or - (null host) + (and allow-null (null host)) (auth-source-search-collection host (or @@ -936,7 +942,7 @@ Note that the MAX parameter is used so we can exit the parse early." (auth-source--aget alist "host") t))) (or - (null user) + (and allow-null (null user)) (auth-source-search-collection user (or @@ -945,7 +951,7 @@ Note that the MAX parameter is used so we can exit the parse early." (auth-source--aget alist "user") t))) (or - (null port) + (and allow-null (null port)) (auth-source-search-collection port (or |