summaryrefslogtreecommitdiff
path: root/lisp/net/tramp.el
diff options
context:
space:
mode:
authorMichael Albinus <michael.albinus@gmx.de>2021-07-24 13:58:03 +0200
committerMichael Albinus <michael.albinus@gmx.de>2021-07-24 13:58:03 +0200
commit9ad1f71c39eda81237df048cc170bee6e4216d97 (patch)
tree2ce8af8e91a6e60e91d54fdd7ba5d98f95d54d2c /lisp/net/tramp.el
parentd8a4a5ac7c3cbccf938febc4cafb521a1daa165a (diff)
downloademacs-9ad1f71c39eda81237df048cc170bee6e4216d97.tar.gz
emacs-9ad1f71c39eda81237df048cc170bee6e4216d97.tar.bz2
emacs-9ad1f71c39eda81237df048cc170bee6e4216d97.zip
Add Tramp support for yubikey (bug#49714)
* lisp/net/tramp.el (tramp-yubikey-regexp): New defcustom. (tramp-action-show-and-confirm-message): New defun. * lisp/net/tramp-sh.el (tramp-actions-before-shell) (tramp-actions-copy-out-of-band): Add `tramp-yubikey-regexp' action.
Diffstat (limited to 'lisp/net/tramp.el')
-rw-r--r--lisp/net/tramp.el23
1 files changed, 23 insertions, 0 deletions
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 093335a77b5..24953f751e9 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -698,6 +698,15 @@ The regexp should match at end of buffer."
:version "27.1"
:type 'regexp)
+;; Yubikey requires the user physically to touch the device with their
+;; finger. We must tell it to the user.
+(defcustom tramp-yubikey-regexp
+ (regexp-quote "Confirm user presence for key .*")
+ "Regular expression matching yubikey confirmation message.
+The regexp should match at end of buffer."
+ :version "28.1"
+ :type 'regexp)
+
(defcustom tramp-operation-not-permitted-regexp
(concat "\\(" "preserving times.*" "\\|" "set mode" "\\)" ":\\s-*"
(regexp-opt '("Operation not permitted") t))
@@ -4669,6 +4678,20 @@ The terminal type can be configured with `tramp-terminal-type'."
(tramp-send-string vec tramp-local-end-of-line)
t)
+(defun tramp-action-show-and-confirm-message (_proc vec)
+ "Show the user a message for confirmation.
+Wait, until the user has entered RET."
+ (save-window-excursion
+ (let ((enable-recursive-minibuffers t)
+ (stimers (with-timeout-suspend)))
+ (with-current-buffer (tramp-get-connection-buffer vec)
+ (tramp-message vec 6 "\n%s" (buffer-string))
+ (pop-to-buffer (current-buffer)))
+ (read-string "Press ENTER to continue")
+ ;; Reenable the timers.
+ (with-timeout-unsuspend stimers)))
+ t)
+
(defun tramp-action-process-alive (proc _vec)
"Check, whether a process has finished."
(unless (process-live-p proc)