]> git.eshelyaron.com Git - emacs.git/commitdiff
plstore.el: Don't cache wrong passphrase
authorDaiki Ueno <ueno@gnu.org>
Tue, 31 Mar 2015 01:14:13 +0000 (10:14 +0900)
committerDaiki Ueno <ueno@gnu.org>
Tue, 31 Mar 2015 01:14:13 +0000 (10:14 +0900)
* plstore.el (plstore--decrypt): Clear entry in
`plstore-passphrase-alist' if decryption failed (bug#20030).

lisp/gnus/ChangeLog
lisp/gnus/plstore.el

index 574b2e825c6bd2d748201f57e23e2229b20719db..5b10d45e8140f15f5d84536266fa7be72cd1c3e8 100644 (file)
@@ -1,3 +1,8 @@
+2015-03-31  Daiki Ueno  <ueno@gnu.org>
+
+       * plstore.el (plstore--decrypt): Clear entry in
+       `plstore-passphrase-alist' if decryption failed (bug#20030).
+
 2015-03-28  Adam Sjøgren  <asjo@koldfront.dk>
 
        * gnus-sum.el (gnus-summary-make-menu-bar): Add "Display HTML images"
index 12a0413dcaf40464914cc46668541784f40332c8..175e272cb9a5d915aed9bb82f54ebecadea8380b 100644 (file)
@@ -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))))