]> git.eshelyaron.com Git - emacs.git/commitdiff
Improve robustness of auth-source-pass.el
authorMichael Albinus <michael.albinus@gmx.de>
Sat, 23 Nov 2024 11:49:56 +0000 (12:49 +0100)
committerEshel Yaron <me@eshelyaron.com>
Wed, 27 Nov 2024 19:52:47 +0000 (20:52 +0100)
* lisp/auth-source-pass.el (auth-source-pass--read-entry):
Ensure, that `epa-file-handler' is active.  (Bug#67937)

(cherry picked from commit 1b33c00f4c28d730b17293f94ce5325f7e916bc8)

lisp/auth-source-pass.el

index dd93d414d5ee2b6dd8477321c84ba22ee37fab79..383325a7cfa1ec1699266f4c4a74935bb448c1a7 100644 (file)
@@ -195,10 +195,15 @@ See `auth-source-pass-get'."
 (defun auth-source-pass--read-entry (entry)
   "Return a string with the file content of ENTRY."
   (with-temp-buffer
-    (insert-file-contents (expand-file-name
-                           (format "%s.gpg" entry)
-                           auth-source-pass-filename))
-    (buffer-substring-no-properties (point-min) (point-max))))
+    ;; `file-name-handler-alist' could be nil, or miss the
+    ;; `epa-file-handler' entry.  We ensure, that it does exist.
+    ;; (Bug#67937)
+    (let ((file-name-handler-alist
+           (cons epa-file-handler file-name-handler-alist)))
+      (insert-file-contents (expand-file-name
+                             (format "%s.gpg" entry)
+                             auth-source-pass-filename))
+      (buffer-substring-no-properties (point-min) (point-max)))))
 
 (defun auth-source-pass-parse-entry (entry)
   "Return an alist of the data associated with ENTRY.