From 901bcf657b18066f580c9548e81a5ca500654548 Mon Sep 17 00:00:00 2001 From: ueno Date: Tue, 18 Apr 2006 23:43:12 +0000 Subject: [PATCH] Reverted. --- ChangeLog | 6 ------ epa-file.el | 8 ++++---- epg.el | 55 +++++++++++++++++++++++++++---------------------------- 3 files changed, 31 insertions(+), 38 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7e52c2a..866a960 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,11 +1,5 @@ 2006-04-18 Daiki Ueno - * epg.el (epg-status-GET_HIDDEN): Don't pass KEY-ID to - passphrase-callback-function. - (epg-process-filter): Call epg-after-status-XXXXX-function. - -2006-04-18 Daiki Ueno - * epa.el (epa-export-keys): New command. * epg.el (epg-start-export-keys): Accept a list of epg-key object instead of a regexp. diff --git a/epa-file.el b/epa-file.el index 86af182..6ba67f2 100644 --- a/epa-file.el +++ b/epa-file.el @@ -39,8 +39,8 @@ (defvar epa-file-passphrase-alist nil) -(defun epa-file-passphrase-callback-function (file) - (if (eq epg-key-id 'SYM) +(defun epa-file-passphrase-callback-function (key-id file) + (if (eq key-id 'SYM) (let ((entry (assoc file epa-file-passphrase-alist)) passphrase) (or (copy-sequence (cdr entry)) @@ -49,10 +49,10 @@ (setq entry (list file) epa-file-passphrase-alist (cons entry epa-file-passphrase-alist))) - (setq passphrase (epg-passphrase-callback-function nil)) + (setq passphrase (epg-passphrase-callback-function key-id nil)) (setcdr entry (copy-sequence passphrase)) passphrase))) - (epg-passphrase-callback-function nil))) + (epg-passphrase-callback-function key-id nil))) (defun epa-file-handler (operation &rest args) (save-match-data diff --git a/epg.el b/epg.el index 75d210f..f084237 100644 --- a/epg.el +++ b/epg.el @@ -468,12 +468,7 @@ This function is for internal use only." (setq epg-pending-status-list nil)) (if (and symbol (fboundp symbol)) - (funcall symbol process string)) - (condition-case nil - (run-hook-with-args-until-success - (intern (concat "epg-after-status-" status "-function")) - string) - (error))))) + (funcall symbol process string))))) (forward-line)) (setq epg-read-point (point))))) @@ -536,22 +531,26 @@ This function is for internal use only." (setq epg-key-id 'PIN)) (defun epg-status-GET_HIDDEN (process string) - (let ((passphrase - (funcall (if (consp (epg-context-passphrase-callback epg-context)) - (car (epg-context-passphrase-callback epg-context)) - (epg-context-passphrase-callback epg-context)) - (if (consp (epg-context-passphrase-callback epg-context)) - (cdr (epg-context-passphrase-callback epg-context))))) - string) - (if passphrase - (unwind-protect - (progn - (setq string (concat passphrase "\n")) - (fillarray passphrase 0) - (setq passphrase nil) - (process-send-string process string)) - (if string - (fillarray string 0)))))) + (if (and epg-key-id + (string-match "\\`passphrase\\." string)) + (let ((passphrase + (funcall + (if (consp (epg-context-passphrase-callback epg-context)) + (car (epg-context-passphrase-callback epg-context)) + (epg-context-passphrase-callback epg-context)) + epg-key-id + (if (consp (epg-context-passphrase-callback epg-context)) + (cdr (epg-context-passphrase-callback epg-context))))) + string) + (if passphrase + (unwind-protect + (progn + (setq string (concat passphrase "\n")) + (fillarray passphrase 0) + (setq passphrase nil) + (process-send-string process string)) + (if string + (fillarray string 0))))))) (defun epg-status-GET_BOOL (process string) (let ((entry (assoc string epg-prompt-alist))) @@ -722,16 +721,16 @@ This function is for internal use only." (cons (cons 'delete-problem (string-to-number (match-string 1 string))) (epg-context-result-for epg-context 'error))))) -(defun epg-passphrase-callback-function (handback) +(defun epg-passphrase-callback-function (key-id handback) (read-passwd - (if (eq epg-key-id 'SYM) + (if (eq key-id 'SYM) "Passphrase for symmetric encryption: " - (if (eq epg-key-id 'PIN) + (if (eq key-id 'PIN) "Passphrase for PIN: " - (let ((entry (assoc epg-key-id epg-user-id-alist))) + (let ((entry (assoc key-id epg-user-id-alist))) (if entry - (format "Passphrase for %s %s: " epg-key-id (cdr entry)) - (format "Passphrase for %s: " epg-key-id))))))) + (format "Passphrase for %s %s: " key-id (cdr entry)) + (format "Passphrase for %s: " key-id))))))) (defun epg-progress-callback-function (what char current total handback) (message "%s: %d%%/%d%%" what current total)) -- 1.7.10.4