summaryrefslogtreecommitdiff
path: root/lisp/net
diff options
context:
space:
mode:
authorMichael Albinus <michael.albinus@gmx.de>2019-10-19 14:23:21 +0200
committerMichael Albinus <michael.albinus@gmx.de>2019-10-19 14:23:21 +0200
commit21f5bd6154f254a53942a9823c9c708ffa4b22a4 (patch)
treefd4bd7ac8e4043a363ea78151961d5a3493f80e9 /lisp/net
parentba8944bba8aaa58d60af955a8ea676a5260af346 (diff)
downloademacs-21f5bd6154f254a53942a9823c9c708ffa4b22a4.tar.gz
Support PuTTY's antispoof message in Tramp
* lisp/net/tramp-sh.el (tramp-actions-before-shell): Add respective entry for PuTTY's antispoof message. * lisp/net/tramp.el (tramp-antispoof-regexp): New defcustom. (tramp-action-confirm-message): New defun.
Diffstat (limited to 'lisp/net')
-rw-r--r--lisp/net/tramp-sh.el1
-rw-r--r--lisp/net/tramp.el17
2 files changed, 18 insertions, 0 deletions
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index e92b9d7729b..26254f87fe1 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -556,6 +556,7 @@ shell from reading its init file."
(tramp-yesno-prompt-regexp tramp-action-yesno)
(tramp-yn-prompt-regexp tramp-action-yn)
(tramp-terminal-prompt-regexp tramp-action-terminal)
+ (tramp-antispoof-regexp tramp-action-confirm-message)
(tramp-process-alive-regexp tramp-action-process-alive))
"List of pattern/action pairs.
Whenever a pattern matches, the corresponding action is performed.
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 6ff313e8fb3..6c17ef0b344 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -636,6 +636,16 @@ The regexp should match at end of buffer.
The answer will be provided by `tramp-action-terminal', which see."
:type 'regexp)
+;; Plink 0.71 has added an additional anti-spoofing prompt after
+;; authentication. This could be discarded with the argument
+;; \"-no-antispoof\". However, since we don't know which PuTTY
+;; version is installed, we must react interactively.
+(defcustom tramp-antispoof-regexp
+ (regexp-quote "Access granted. Press Return to begin session. ")
+ "Regular expression matching plink's anti-spoofing message."
+ :version 27.1
+ :type 'regexp)
+
(defcustom tramp-operation-not-permitted-regexp
(concat "\\(" "preserving times.*" "\\|" "set mode" "\\)" ":\\s-*"
(regexp-opt '("Operation not permitted") t))
@@ -3935,6 +3945,13 @@ The terminal type can be configured with `tramp-terminal-type'."
(tramp-send-string vec (concat tramp-terminal-type tramp-local-end-of-line))
t)
+(defun tramp-action-confirm-message (_proc vec)
+ "Return RET in order to confirm the message."
+ (with-current-buffer (tramp-get-connection-buffer vec)
+ (tramp-message vec 6 "\n%s" (buffer-string)))
+ (tramp-send-string vec tramp-local-end-of-line)
+ t)
+
(defun tramp-action-process-alive (proc _vec)
"Check, whether a process has finished."
(unless (process-live-p proc)