Function: auth-source-pass--find-match-many
auth-source-pass--find-match-many is a byte-compiled function defined
in auth-source-pass.el.gz.
Signature
(auth-source-pass--find-match-many HOSTS USERS PORTS REQUIRE MAX)
Documentation
Return plists for valid combinations of HOSTS, USERS, PORTS.
Source Code
;; Defined in /usr/src/emacs/lisp/auth-source-pass.el.gz
(defun auth-source-pass--find-match-many (hosts users ports require max)
"Return plists for valid combinations of HOSTS, USERS, PORTS."
(let ((seen (make-hash-table :test #'equal))
(entries (auth-source-pass-entries))
out suffixed suffixedp)
(catch 'done
(dolist (host hosts out)
(pcase-let ((`(,_ ,u ,p) (auth-source-pass--disambiguate host)))
(unless (or (not (equal "443" p)) (string-prefix-p "https://" host))
(setq p nil))
(dolist (user (or users (list u)))
(dolist (port (or ports (list p)))
(dolist (e entries)
(when-let*
((m (or (gethash e seen) (auth-source-pass--retrieve-parsed
seen e (integerp port))))
((equal host (plist-get m :host)))
((auth-source-pass--match-parts m :port port require))
((auth-source-pass--match-parts m :user user require))
;; For now, ignore body-content pairs, if any,
;; from `auth-source-pass--parse-data'.
(secret (let ((parsed (auth-source-pass-parse-entry e)))
(or (auth-source-pass--get-attr 'secret parsed)
(not (memq :secret require))))))
(push
`( :host ,host ; prefer user-provided :host over h
,@(and-let* ((u (plist-get m :user))) (list :user u))
,@(and-let* ((p (plist-get m :port))) (list :port p))
,@(and secret (not (eq secret t)) (list :secret secret)))
(if (setq suffixedp (plist-get m :suffix)) suffixed out))
(unless suffixedp
(when (or (zerop (decf max))
(null (setq entries (delete e entries))))
(throw 'done out)))))
(setq suffixed (nreverse suffixed))
(while suffixed
(push (pop suffixed) out)
(when (zerop (decf max))
(throw 'done out))))))))))