emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 21f5bd6: Support PuTTY's antispoof message in Tramp


From: Michael Albinus
Subject: [Emacs-diffs] master 21f5bd6: Support PuTTY's antispoof message in Tramp
Date: Sat, 19 Oct 2019 08:23:29 -0400 (EDT)

branch: master
commit 21f5bd6154f254a53942a9823c9c708ffa4b22a4
Author: Michael Albinus <address@hidden>
Commit: Michael Albinus <address@hidden>

    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.
---
 lisp/net/tramp-sh.el |  1 +
 lisp/net/tramp.el    | 17 +++++++++++++++++
 2 files changed, 18 insertions(+)

diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index e92b9d7..26254f8 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 6ff313e..6c17ef0 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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]