Function: auth-source-pass--find-match-unambiguous
auth-source-pass--find-match-unambiguous is a byte-compiled function
defined in auth-source-pass.el.gz.
Signature
(auth-source-pass--find-match-unambiguous HOSTNAME USER PORT)
Documentation
Return password-store entry data matching HOSTNAME, USER and PORT.
If many matches are found, return the first one. If no match is found, return nil.
HOSTNAME should not contain any username or port number.
Source Code
;; Defined in /usr/src/emacs/lisp/auth-source-pass.el.gz
(defun auth-source-pass--find-match-unambiguous (hostname user port)
"Return password-store entry data matching HOSTNAME, USER and PORT.
If many matches are found, return the first one. If no match is found,
return nil.
HOSTNAME should not contain any username or port number."
(let ((all-entries (auth-source-pass-entries))
(suffixes (auth-source-pass--generate-entry-suffixes hostname user port)))
(auth-source-pass--do-debug "searching for entries matching hostname=%S, user=%S, port=%S"
hostname (or user "") (or port ""))
(auth-source-pass--do-debug "corresponding suffixes to search for: %S" suffixes)
(catch 'auth-source-pass-break
(dolist (suffix suffixes)
(let* ((matching-entries (auth-source-pass--entries-matching-suffix suffix all-entries))
(best-entry-data (auth-source-pass--select-from-entries matching-entries user)))
(pcase (length matching-entries)
(0 (auth-source-pass--do-debug "found no entries matching %S" suffix))
(1 (auth-source-pass--do-debug "found 1 entry matching %S: %S"
suffix
(car matching-entries)))
(_ (auth-source-pass--do-debug "found %s entries matching %S: %S"
(length matching-entries)
suffix
matching-entries)))
(when best-entry-data
(throw 'auth-source-pass-break best-entry-data)))))))