emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 2e4b0c9: plstore.el: Don't cache wrong passphrase


From: Daiki Ueno
Subject: [Emacs-diffs] master 2e4b0c9: plstore.el: Don't cache wrong passphrase
Date: Tue, 31 Mar 2015 01:15:36 +0000

branch: master
commit 2e4b0c98a77657e787e04ae680403b187b271c21
Author: Daiki Ueno <address@hidden>
Commit: Daiki Ueno <address@hidden>

    plstore.el: Don't cache wrong passphrase
    
    * plstore.el (plstore--decrypt): Clear entry in
    `plstore-passphrase-alist' if decryption failed (bug#20030).
---
 lisp/gnus/ChangeLog  |    5 +++++
 lisp/gnus/plstore.el |   13 ++++++++++---
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index 574b2e8..5b10d45 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -1,3 +1,8 @@
+2015-03-31  Daiki Ueno  <address@hidden>
+
+       * plstore.el (plstore--decrypt): Clear entry in
+       `plstore-passphrase-alist' if decryption failed (bug#20030).
+
 2015-03-28  Adam Sjøgren  <address@hidden>
 
        * gnus-sum.el (gnus-summary-make-menu-bar): Add "Display HTML images"
diff --git a/lisp/gnus/plstore.el b/lisp/gnus/plstore.el
index 12a0413..175e272 100644
--- a/lisp/gnus/plstore.el
+++ b/lisp/gnus/plstore.el
@@ -270,9 +270,16 @@ symmetric encryption will be used.")
         context
         (cons #'plstore-progress-callback-function
               (format "Decrypting %s" (plstore-get-file plstore))))
-       (setq plain
-             (epg-decrypt-string context
-                                 (plstore--get-encrypted-data plstore)))
+       (condition-case error
+           (setq plain
+                 (epg-decrypt-string context
+                                     (plstore--get-encrypted-data plstore)))
+         (error
+          (let ((entry (assoc (plstore-get-file plstore)
+                              plstore-passphrase-alist)))
+            (if entry
+                (setcdr entry nil)))
+          (signal (car error) (cdr error))))
        (plstore--set-secret-alist plstore (car (read-from-string plain)))
        (plstore--merge-secret plstore)
        (plstore--set-encrypted-data plstore nil))))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]