diff options
author | Allen Li <darkfeline@felesatra.moe> | 2018-08-01 03:04:26 -0700 |
---|---|---|
committer | Noam Postavsky <npostavs@gmail.com> | 2018-09-16 21:15:21 -0400 |
commit | 3bbf21b9139e203d7254a9434c88bd38238ed57e (patch) | |
tree | 81a3c94cbe2813c8a3d320abf0c61bbc12641b6f /lisp/net/nsm.el | |
parent | 6f2c471689ef57d992ee48bbcdeb8b90f0a1d78a (diff) | |
download | emacs-3bbf21b9139e203d7254a9434c88bd38238ed57e.tar.gz |
Add choice to reshow certificate information (Bug#31877)
In various situations, the window displaying the certificate
information can be hidden (such as if the user accidentally presses ?,
which causes the read-multiple-choice help window to replace it).
Instead of leaving the user to make a choice blindly, add a choice to
reshow the certification information.
* lisp/net/nsm.el (nsm-query-user): Add reshow choice.
Diffstat (limited to 'lisp/net/nsm.el')
-rw-r--r-- | lisp/net/nsm.el | 51 |
1 files changed, 28 insertions, 23 deletions
diff --git a/lisp/net/nsm.el b/lisp/net/nsm.el index d6fe967fc70..3f33e822d04 100644 --- a/lisp/net/nsm.el +++ b/lisp/net/nsm.el @@ -319,29 +319,34 @@ unencrypted." t)))) (defun nsm-query-user (message args cert) - (let ((buffer (get-buffer-create "*Network Security Manager*"))) - (save-window-excursion - ;; First format the certificate and warnings. - (with-help-window buffer - (with-current-buffer buffer - (erase-buffer) - (when (> (length cert) 0) - (insert cert "\n")) - (let ((start (point))) - (insert (apply #'format-message message args)) - (goto-char start) - ;; Fill the first line of the message, which usually - ;; contains lots of explanatory text. - (fill-region (point) (line-end-position))))) - ;; Then ask the user what to do about it. - (unwind-protect - (cadr - (read-multiple-choice - "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))))) + (catch 'return + (while t + (let ((buffer (get-buffer-create "*Network Security Manager*"))) + (save-window-excursion + ;; First format the certificate and warnings. + (with-help-window buffer + (with-current-buffer buffer + (erase-buffer) + (when (> (length cert) 0) + (insert cert "\n")) + (let ((start (point))) + (insert (apply #'format-message message args)) + (goto-char start) + ;; Fill the first line of the message, which usually + ;; contains lots of explanatory text. + (fill-region (point) (line-end-position))))) + ;; Then ask the user what to do about it. + (pcase (unwind-protect + (cadr + (read-multiple-choice + "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.") + (?r "reshow" "Reshow certificate information.")))) + (kill-buffer buffer)) + ("reshow") + (val (throw 'return val)))))))) (defun nsm-save-host (host port status what permanency) (let* ((id (nsm-id host port)) |