From: ueno Date: Mon, 17 Apr 2006 07:46:36 +0000 (+0000) Subject: Fixed passphrase caching. X-Git-Tag: epgsm-branchpoint~48 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ba4aabffde23b88b9e7e87019977f3f68ccf097e;p=elisp%2Fepg.git Fixed passphrase caching. --- diff --git a/epa-file.el b/epa-file.el index d0d194f..9232426 100644 --- a/epa-file.el +++ b/epa-file.el @@ -34,18 +34,18 @@ :type 'regexp :group 'epa-file) -(defvar epa-passphrase-alist nil) +(defvar epa-file-passphrase-alist nil) -(defun epa-file-passphrase-callback-function (key-id buffer) +(defun epa-file-passphrase-callback-function (key-id file) (if (eq key-id 'SYM) - (let ((entry (assoc buffer epa-passphrase-alist)) + (let ((entry (assoc file epa-file-passphrase-alist)) passphrase) - (or (cdr entry) + (or (copy-sequence (cdr entry)) (progn (unless entry - (setq entry (list buffer) - epa-passphrase-alist (cons entry - epa-passphrase-alist))) + (setq entry (list file) + epa-file-passphrase-alist (cons entry + epa-file-passphrase-alist))) (setq passphrase (epg-passphrase-callback-function key-id nil)) (setcdr entry (copy-sequence passphrase)) passphrase))) @@ -80,7 +80,7 @@ (epg-context-set-passphrase-callback context (cons #'epa-file-passphrase-callback-function - (current-buffer))) + file)) (unwind-protect (progn (if replace @@ -120,7 +120,7 @@ (epg-context-set-passphrase-callback context (cons #'epa-file-passphrase-callback-function - (current-buffer))) + file)) (epa-file-run-real-handler #'write-region (list (epg-encrypt-string @@ -128,7 +128,7 @@ (encode-coding-string (buffer-string) coding-system) (mapcar (lambda (key) (epg-sub-key-id (car (epg-key-sub-key-list key)))) - (unless (assoc (current-buffer) epa-passphrase-alist) + (unless (assoc file epa-file-passphrase-alist) (epa-select-keys "Select recipents for encryption. If no one is selected, symmetric encryption will be performed. "))))