From c3f7df32c68315e9c66b2a9a0f3e181771c79890 Mon Sep 17 00:00:00 2001 From: ueno Date: Mon, 4 Sep 2006 05:42:58 +0000 Subject: [PATCH] * epg.el (epg--list-keys-1): Respect epg-gpg-home-directory. (epg--clear-string): New function. (epg--status-GET_HIDDEN): Encode passphrase with terminal-coding-system. * epg-config.el (epg-gpg-minimum-version): New constant. (epg-config--parse-version): New function. (epg-config--compare-version): New function. (epg-configuration): Respect epg-gpg-home-directory. --- ChangeLog | 6 ++++++ epg-config.el | 4 +++- epg.el | 28 +++++++++++++++++++++------- 3 files changed, 30 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 359cecc..76619e5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,8 +1,14 @@ 2006-09-04 Daiki Ueno + * epg.el (epg--list-keys-1): Respect epg-gpg-home-directory. + (epg--clear-string): New function. + (epg--status-GET_HIDDEN): Encode passphrase with + terminal-coding-system. + * epg-config.el (epg-gpg-minimum-version): New constant. (epg-config--parse-version): New function. (epg-config--compare-version): New function. + (epg-configuration): Respect epg-gpg-home-directory. 2006-09-03 Daiki Ueno diff --git a/epg-config.el b/epg-config.el index 51a7460..d28fcce 100644 --- a/epg-config.el +++ b/epg-config.el @@ -52,7 +52,9 @@ (let (config type) (with-temp-buffer (apply #'call-process epg-gpg-program nil (list t nil) nil - '("--with-colons" "--list-config")) + (append (if epg-gpg-home-directory + (list "--homedir" epg-gpg-home-directory)) + '("--with-colons" "--list-config"))) (goto-char (point-min)) (while (re-search-forward "^cfg:\\([^:]+\\):\\(.*\\)" nil t) (setq type (intern (match-string 1)) diff --git a/epg.el b/epg.el index 3615cb1..6000dc5 100644 --- a/epg.el +++ b/epg.el @@ -933,7 +933,8 @@ This function is for internal use only." (string-match "\\`passphrase\\." string)) (let (inhibit-quit passphrase - passphrase-with-new-line) + passphrase-with-new-line + encoded-passphrase-with-new-line) (unwind-protect (condition-case nil (progn @@ -948,10 +949,14 @@ This function is for internal use only." (cdr (epg-context-passphrase-callback context))))) (when passphrase (setq passphrase-with-new-line (concat passphrase "\n")) - (fillarray passphrase 0) - (setq passphrase nil) + (epg--clear-string passphrase) + (setq passphrase nil + encoded-passphrase-with-new-line + (encode-coding-string passphrase-with-new-line + (terminal-coding-system))) + (process-send-string (epg-context-process context) - passphrase-with-new-line))) + encoded-passphrase-with-new-line))) (quit (epg-context-set-result-for context 'error @@ -959,9 +964,11 @@ This function is for internal use only." (epg-context-result-for context 'error))) (delete-process (epg-context-process context)))) (if passphrase - (fillarray passphrase 0)) + (epg--clear-string passphrase)) (if passphrase-with-new-line - (fillarray passphrase-with-new-line 0)))))) + (epg--clear-string passphrase-with-new-line)) + (if encoded-passphrase-with-new-line + (epg--clear-string encoded-passphrase-with-new-line)))))) (defun epg--status-GET_BOOL (context string) (let ((entry (assoc string epg-prompt-alist)) @@ -1294,7 +1301,9 @@ This function is for internal use only." (message "%s: %d%%/%d%%" what current total)) (defun epg--list-keys-1 (context name mode) - (let ((args (append (list "--with-colons" "--no-greeting" "--batch" + (let ((args (append (if epg-gpg-home-directory + (list "--homedir" epg-gpg-home-directory)) + (list "--with-colons" "--no-greeting" "--batch" "--with-fingerprint" "--with-fingerprint" (if (memq mode '(t secret)) @@ -1471,6 +1480,11 @@ You can then use `write-region' to write new data into the file." (file-directory-p tempdir) (delete-directory tempdir)))))) +(if (fboundp 'clear-string) + (defalias 'epg--clear-string 'clear-string) + (defun epg--clear-string (string) + (fillarray string 0))) + ;;;###autoload (defun epg-cancel (context) (if (buffer-live-p (process-buffer (epg-context-process context))) -- 1.7.10.4