aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/auth-source-pass.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/auth-source-pass.el')
-rw-r--r--lisp/auth-source-pass.el17
1 files changed, 6 insertions, 11 deletions
diff --git a/lisp/auth-source-pass.el b/lisp/auth-source-pass.el
index e59cfa2d25f..a83c7de0cc5 100644
--- a/lisp/auth-source-pass.el
+++ b/lisp/auth-source-pass.el
@@ -39,8 +39,8 @@
39(require 'url-parse) 39(require 'url-parse)
40 40
41(cl-defun auth-source-pass-search (&rest spec 41(cl-defun auth-source-pass-search (&rest spec
42 &key backend type host user port 42 &key backend type host user port
43 &allow-other-keys) 43 &allow-other-keys)
44 "Given a property list SPEC, return search matches from the :backend. 44 "Given a property list SPEC, return search matches from the :backend.
45See `auth-source-search' for details on SPEC." 45See `auth-source-search' for details on SPEC."
46 (cl-assert (or (null type) (eq type (oref backend type))) 46 (cl-assert (or (null type) (eq type (oref backend type)))
@@ -60,7 +60,7 @@ See `auth-source-search' for details on SPEC."
60 :user (or (auth-source-pass-get "user" entry) user) 60 :user (or (auth-source-pass-get "user" entry) user)
61 :secret (lambda () (auth-source-pass-get 'secret entry))))) 61 :secret (lambda () (auth-source-pass-get 'secret entry)))))
62 (auth-source-pass--do-debug "return %s as final result (plus hidden password)" 62 (auth-source-pass--do-debug "return %s as final result (plus hidden password)"
63 (seq-subseq retval 0 -2)) ;; remove password 63 (seq-subseq retval 0 -2)) ;; remove password
64 retval)))) 64 retval))))
65 65
66;;;###autoload 66;;;###autoload
@@ -159,11 +159,6 @@ CONTENTS is the contents of a password-store formatted file."
159 (hostname hostname) 159 (hostname hostname)
160 (t host)))) 160 (t host))))
161 161
162(defun auth-source-pass--remove-directory-name (name)
163 "Remove directories from NAME.
164E.g., if NAME is \"foo/bar\", return \"bar\"."
165 (replace-regexp-in-string ".*/" "" name))
166
167(defun auth-source-pass--do-debug (&rest msg) 162(defun auth-source-pass--do-debug (&rest msg)
168 "Call `auth-source-do-debug` with MSG and a prefix." 163 "Call `auth-source-do-debug` with MSG and a prefix."
169 (apply #'auth-source-do-debug 164 (apply #'auth-source-do-debug
@@ -216,7 +211,7 @@ Only return valid entries as of `auth-source-pass--entry-valid-p'."
216 (member entryname (split-string entry "/")))) 211 (member entryname (split-string entry "/"))))
217 (and (= (length components-host-user) 2) 212 (and (= (length components-host-user) 2)
218 (string-equal user (cadr components-host-user)))) 213 (string-equal user (cadr components-host-user))))
219 (string-equal entryname (auth-source-pass--remove-directory-name entry))) 214 (string-equal entryname (file-name-nondirectory entry)))
220 (auth-source-pass--entry-valid-p entry))) 215 (auth-source-pass--entry-valid-p entry)))
221 (auth-source-pass-entries))) 216 (auth-source-pass-entries)))
222 217
@@ -225,8 +220,8 @@ Only return valid entries as of `auth-source-pass--entry-valid-p'."
225If USER is non nil, give precedence to entries containing a user field 220If USER is non nil, give precedence to entries containing a user field
226matching USER." 221matching USER."
227 (auth-source-pass--do-debug "searching for '%s' in entry names (user: %s)" 222 (auth-source-pass--do-debug "searching for '%s' in entry names (user: %s)"
228 entryname 223 entryname
229 user) 224 user)
230 (let ((matching-entries (auth-source-pass--find-all-by-entry-name entryname user))) 225 (let ((matching-entries (auth-source-pass--find-all-by-entry-name entryname user)))
231 (pcase (length matching-entries) 226 (pcase (length matching-entries)
232 (0 (auth-source-pass--do-debug "no match found") 227 (0 (auth-source-pass--do-debug "no match found")