1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-05 19:31:02 -08:00

Fix another inconsistency in auth-source.el

* lisp/auth-source.el (auth-source-backends): Filter out backends
with type `ignore'.
(auth-source-search-spec): Use `_' in `and-let*'
This commit is contained in:
Michael Albinus 2025-10-08 16:09:15 +02:00
parent fb58ccfdc4
commit ebcebaed69

View file

@ -376,8 +376,14 @@ soon as a function returns non-nil.")
(defmacro auth-source-backends ()
"List of usable backends from `auth-sources'.
Filter out backends with type `ignore'.
A fallback backend is added to ensure, that at least `read-passwd' is called."
`(or (mapcar #'auth-source-backend-parse auth-sources)
`(or (seq-keep
(lambda (entry)
(and-let* ((backend (auth-source-backend-parse entry))
((not (eq (slot-value backend 'type) 'ignore)))
backend)))
auth-sources)
;; Fallback.
(list (auth-source-backend
:source ""
@ -407,9 +413,9 @@ A fallback backend is added to ensure, that at least `read-passwd' is called."
If a search key is nil or t (match anything), skip it."
`(apply #'append (mapcar
(lambda (k)
(and-let* ((v (plist-get ,spec k))
((not (eq t v)))
((list k (auth-source-ensure-strings v))))))
(when-let* ((v (plist-get ,spec k))
(_ (not (eq t v))))
(list k (auth-source-ensure-strings v))))
(auth-source-search-keys ,spec))))
(defcustom auth-source-ignore-non-existing-file t