Commit e49c46f7 authored by Lars Ingebrigtsen's avatar Lars Ingebrigtsen
Browse files

Make NSM prompting clearer

* lisp/net/nsm.el (nsm-query-user): Use read-multiple-choice
to prompt in a nicer way (bug#19368).
parent cbcc3b79
......@@ -297,7 +297,11 @@ unencrypted."
(let ((response
(condition-case nil
(nsm-query-user message args (nsm-format-certificate status))
(car (split-string
(nsm-query-user message args
(nsm-format-certificate status))))
;; Make sure we manage to close the process if the user hits
;; `C-g'.
(quit 'no)
......@@ -309,6 +313,7 @@ unencrypted."
(defun nsm-query-user (message args cert)
(let ((buffer (get-buffer-create "*Network Security Manager*")))
;; First format the certificate and warnings.
(with-help-window buffer
(with-current-buffer buffer
......@@ -320,28 +325,15 @@ unencrypted."
;; Fill the first line of the message, which usually
;; contains lots of explanatory text.
(fill-region (point) (line-end-position)))))
(let ((responses '((?n . no)
(?s . session)
(?a . always)))
(prefix "")
(cursor-in-echo-area t)
(while (not response)
(setq response
(assq (downcase
(concat prefix
"Continue connecting? (No, Session only, Always) ")))
(unless response
(setq prefix "Invalid choice. ")))
(kill-buffer buffer)
;; If called from a callback, `read-char' will insert things
;; into the pending input. Clear that.
;; Then ask the user what to do about it.
"Continue connecting?"
'((?a "always" "Accept this certificate this session and for all future sessions.")
(?s "session only" "Accept this certificate this session only.")
(?n "no" "Refuse to use this certificate, and close the connection."))))
(kill-buffer buffer))))
(defun nsm-save-host (host port status what permanency)
(let* ((id (nsm-id host port))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment