[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 2a2617f 04/11: Revert "pinentry.el: Support external passp
From: |
Nicolas Petton |
Subject: |
[elpa] master 2a2617f 04/11: Revert "pinentry.el: Support external passphrase cache" |
Date: |
Tue, 16 Jan 2018 08:01:45 -0500 (EST) |
branch: master
commit 2a2617fe7c0d0b61284694bd43d23f25b35dbc73
Author: Daiki Ueno <address@hidden>
Commit: Nicolas Petton <address@hidden>
Revert "pinentry.el: Support external passphrase cache"
This reverts commit e086e55a664ec27fbca7b3231c4b32cb78a89337.
packages/pinentry/pinentry.el shouldn't directly interact with the secrets
service,
but ask the caller to cache the passphrase.
---
packages/pinentry/pinentry.el | 151 +++++++++++++-----------------------------
1 file changed, 46 insertions(+), 105 deletions(-)
diff --git a/packages/pinentry/pinentry.el b/packages/pinentry/pinentry.el
index aee8647..13a15c9 100644
--- a/packages/pinentry/pinentry.el
+++ b/packages/pinentry/pinentry.el
@@ -63,11 +63,6 @@
:type 'integer
:group 'pinentry)
-(defcustom pinentry-use-secrets nil
- "If non-nil, use secrets.el to store passwords in login keyring."
- :type 'boolean
- :group 'pinentry)
-
(defvar pinentry--server-process nil)
(defvar pinentry--connection-process-list nil)
@@ -75,10 +70,6 @@
(put 'pinentry-read-point 'permanent-local t)
(defvar pinentry--read-point nil)
(put 'pinentry--read-point 'permanent-local t)
-(defvar pinentry--allow-external-password-cache nil)
-(put 'pinentry--allow-external-password-cache 'permanent-local t)
-(defvar pinentry--key-info nil)
-(put 'pinentry--key-info 'permanent-local t)
(defvar pinentry--prompt-buffer nil)
@@ -152,10 +143,6 @@ If local sockets are not supported, this is nil.")
(concat prompt (substring short-prompt -2))
query-args)))
-(defvar secrets-enabled)
-(declare-function secrets-search-items "secrets" (collection &rest attributes))
-(declare-function secrets-get-secret "secrets" (collection item))
-
;;;###autoload
(defun pinentry-start ()
"Start a Pinentry service.
@@ -290,23 +277,6 @@ Assuan protocol."
(defun pinentry--send-error (process error)
(process-send-string process (format "ERR %d %s\n" (car error) (cdr error))))
-(defun pinentry--send-passphrase (process passphrase)
- (let (escaped-passphrase encoded-passphrase)
- (unwind-protect
- (condition-case nil
- (progn
- (setq escaped-passphrase (pinentry--escape-string passphrase))
- (setq encoded-passphrase (encode-coding-string escaped-passphrase
- 'utf-8))
- (pinentry--send-data process encoded-passphrase)
- (process-send-string process "OK\n"))
- (error
- (pinentry--send-error process pinentry--error-cancelled)))
- (if escaped-passphrase
- (clear-string escaped-passphrase))
- (if encoded-passphrase
- (clear-string encoded-passphrase)))))
-
(defun pinentry--process-filter (process input)
(unless (buffer-live-p (process-buffer process))
(let ((buffer (generate-new-buffer " *pinentry*")))
@@ -316,9 +286,7 @@ Assuan protocol."
(set-buffer-multibyte nil))
(make-local-variable 'pinentry--read-point)
(setq pinentry--read-point (point-min))
- (make-local-variable 'pinentry--labels)
- (make-local-variable 'pinentry--allow-external-password-cache)
- (make-local-variable 'pinentry--key-info))))
+ (make-local-variable 'pinentry--labels))))
(with-current-buffer (process-buffer process)
(save-excursion
(goto-char (point-max))
@@ -343,79 +311,52 @@ Assuan protocol."
("NOP"
(ignore-errors
(process-send-string process "OK\n")))
- ("OPTION"
- (if (and pinentry-use-secrets
- (require 'secrets)
- secrets-enabled
- (equal string "allow-external-password-cache"))
- (setq pinentry--allow-external-password-cache t))
- (ignore-errors
- (process-send-string process "OK\n")))
- ("SETKEYINFO"
- (setq pinentry--key-info string)
- (ignore-errors
- (process-send-string process "OK\n")))
("GETPIN"
- (let (passphrase-sent)
- (when (and pinentry--allow-external-password-cache
- pinentry--key-info)
- (let ((items
- (secrets-search-items "login"
- :keygrip
pinentry--key-info)))
- (if items
- (let (passphrase)
- (unwind-protect
- (progn
- (setq passphrase (secrets-get-secret
- "login"
- (car items)))
- (ignore-errors
- (process-send-string
- process
- "S PASSWORD_FROM_CACHE\n")
- (pinentry--send-passphrase
- process passphrase)
- (setq passphrase-sent t)))
- (if passphrase
- (clear-string passphrase)))))))
- (unless passphrase-sent
- (let ((prompt
- (or (cdr (assq 'desc pinentry--labels))
- (cdr (assq 'prompt pinentry--labels))
- ""))
- (confirm
- (not (null (assq 'repeat pinentry--labels))))
- entry)
- (if (setq entry (assq 'error pinentry--labels))
- (setq prompt (concat "Error: "
- (propertize
- (copy-sequence (cdr entry))
- 'face 'error)
- "\n"
- prompt)))
- (if (setq entry (assq 'title pinentry--labels))
- (setq prompt (format "[%s] %s"
- (cdr entry) prompt)))
- (let (passphrase)
- (unwind-protect
- (condition-case nil
- (progn
- (setq passphrase
- (pinentry--prompt prompt "Password: "
- #'read-passwd
- confirm))
- (ignore-errors
- (pinentry--send-passphrase process
- passphrase)
- (process-send-string process "OK\n")))
- (error
- (ignore-errors
- (pinentry--send-error
- process
- pinentry--error-cancelled))))
- (if passphrase
- (clear-string passphrase))))
- (setq pinentry--labels nil)))))
+ (let ((prompt
+ (or (cdr (assq 'desc pinentry--labels))
+ (cdr (assq 'prompt pinentry--labels))
+ ""))
+ (confirm (not (null (assq 'repeat pinentry--labels))))
+ entry)
+ (if (setq entry (assq 'error pinentry--labels))
+ (setq prompt (concat "Error: "
+ (propertize
+ (copy-sequence (cdr entry))
+ 'face 'error)
+ "\n"
+ prompt)))
+ (if (setq entry (assq 'title pinentry--labels))
+ (setq prompt (format "[%s] %s"
+ (cdr entry) prompt)))
+ (let (passphrase escaped-passphrase encoded-passphrase)
+ (unwind-protect
+ (condition-case nil
+ (progn
+ (setq passphrase
+ (pinentry--prompt prompt "Password: "
+ #'read-passwd confirm))
+ (setq escaped-passphrase
+ (pinentry--escape-string
+ passphrase))
+ (setq encoded-passphrase (encode-coding-string
+ escaped-passphrase
+ 'utf-8))
+ (ignore-errors
+ (pinentry--send-data
+ process encoded-passphrase)
+ (process-send-string process "OK\n")))
+ (error
+ (ignore-errors
+ (pinentry--send-error
+ process
+ pinentry--error-cancelled))))
+ (if passphrase
+ (clear-string passphrase))
+ (if escaped-passphrase
+ (clear-string escaped-passphrase))
+ (if encoded-passphrase
+ (clear-string encoded-passphrase))))
+ (setq pinentry--labels nil)))
("CONFIRM"
(let ((prompt
(or (cdr (assq 'desc pinentry--labels))
- [elpa] master updated (8d079d3 -> dcc9ba0), Nicolas Petton, 2018/01/16
- [elpa] master adc04d8 03/11: pinentry.el: Support external passphrase cache, Nicolas Petton, 2018/01/16
- [elpa] master efb0175 09/11: Change the default socket location for pinentry, Nicolas Petton, 2018/01/16
- [elpa] master b2dbb4c 10/11: Revert "Change the default socket location for pinentry", Nicolas Petton, 2018/01/16
- [elpa] master 19227a0 02/11: ; pinentry.el: Update header comment and fix typos, Nicolas Petton, 2018/01/16
- [elpa] master 1cfcece 01/11: packages/pinentry/pinentry.el: Popup window for multiline prompt, Nicolas Petton, 2018/01/16
- [elpa] master 2a2617f 04/11: Revert "pinentry.el: Support external passphrase cache",
Nicolas Petton <=
- [elpa] master 32bec2a 06/11: pinentry.el: Add debugging support, Nicolas Petton, 2018/01/16
- [elpa] master 7154adf 05/11: pinentry.el: Improve multiline prompt, Nicolas Petton, 2018/01/16
- [elpa] master cd62826 08/11: Mention how to enable pinentry feature, Nicolas Petton, 2018/01/16
- [elpa] master 952dd9f 07/11: Suppress redundant Pinentry startup messages, Nicolas Petton, 2018/01/16
- [elpa] master dcc9ba0 11/11: Set file modes of pinentry socket for extra safety, Nicolas Petton, 2018/01/16