[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
emacs-29 fac0e2d5334: Avoid false "wrong passphrase" messages in EPA
From: |
Eli Zaretskii |
Subject: |
emacs-29 fac0e2d5334: Avoid false "wrong passphrase" messages in EPA |
Date: |
Thu, 17 Aug 2023 04:11:21 -0400 (EDT) |
branch: emacs-29
commit fac0e2d533427ba7afc2c11427f46acc57fa6be8
Author: Jens Schmidt <jschmidt4gnu@vodafonemail.de>
Commit: Eli Zaretskii <eliz@gnu.org>
Avoid false "wrong passphrase" messages in EPA
* lisp/epa-file.el (epa--wrong-password-p): Use a stricter regexp
to match "wrong passphrase" errors generated by GnuPG. (Bug#65316)
---
lisp/epa-file.el | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/lisp/epa-file.el b/lisp/epa-file.el
index 4d8ca11e809..a27f241c0c3 100644
--- a/lisp/epa-file.el
+++ b/lisp/epa-file.el
@@ -123,9 +123,16 @@ encryption is used."
(cons "Opening input file" (cdr error))))))
(defun epa--wrong-password-p (context)
+ "Return whether a wrong password caused the error in CONTEXT."
(let ((error-string (epg-context-error-output context)))
+ ;; Use a strict regexp here that really only matches "wrong
+ ;; passphrase" errors to avoid hiding diagnostic information
+ ;; (bug#65316). Below regexp also can fail to match non-English
+ ;; messages, since at least the "decryption failed" part of it
+ ;; seems to be localized. But since this means false negatives
+ ;; this is probably OK.
(and (string-match
- "decryption failed: \\(Bad session key\\|No secret key\\)"
+ "decryption failed: \\(Bad session key\\|Bad passphrase\\)"
error-string)
(match-string 1 error-string))))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- emacs-29 fac0e2d5334: Avoid false "wrong passphrase" messages in EPA,
Eli Zaretskii <=