emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 447e589: Some Tramp password fixes


From: Michael Albinus
Subject: [Emacs-diffs] master 447e589: Some Tramp password fixes
Date: Tue, 01 Sep 2015 12:57:56 +0000

branch: master
commit 447e5890a81f098881aecc099852ace466ef5925
Author: Michael Albinus <address@hidden>
Commit: Michael Albinus <address@hidden>

    Some Tramp password fixes
    
    * lisp/net/tramp.el (tramp-clear-passwd): Clear also the passwords
    of the hops.
    
    * lisp/net/tramp-sh.el (tramp-methods) <sudo>: Move "-p" "Password:"
    at the beginning of the command.  Otherwise, it could be
    interpreted as password prompt if the remote host echoes the
    command.
    (tramp-remote-coding-commands): Add "openssl enc -base64".
---
 lisp/net/tramp-sh.el |    6 +++++-
 lisp/net/tramp.el    |   10 ++++++++++
 2 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index 8cae8dc..5f96b92 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -288,7 +288,10 @@ The string is used in `tramp-methods'.")
 (add-to-list 'tramp-methods
   '("sudo"
     (tramp-login-program        "sudo")
-    (tramp-login-args           (("-u" "%u") ("-s") ("-H") ("-p" "Password:")))
+    ;; The password template must not be the last argument.
+    ;; Otherwise, it could be interpreted as password prompt if the
+    ;; remote host echoes the command.
+    (tramp-login-args           (("-p" "Password:") ("-u" "%u") ("-s") ("-H")))
     ;; Local $SHELL could be a nasty one, like zsh or fish.  Let's override it.
     (tramp-login-env            (("SHELL") ("/bin/sh")))
     (tramp-remote-shell         "/bin/sh")
@@ -4316,6 +4319,7 @@ with the encoded or decoded results, respectively.")
     ;; However, I don't know whether all base64 versions do supports
     ;; this option.
     (b64 "base64" "base64 -d")
+    (b64 "openssl enc -base64" "openssl enc -d -base64")
     (b64 "mimencode -b" "mimencode -u -b")
     (b64 "mmencode -b" "mmencode -u -b")
     (b64 "recode data..base64" "recode base64..data")
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index bf3e1c7..6bafae0 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -4258,6 +4258,16 @@ Invokes `password-read' if available, `read-passwd' 
else."
 ;;;###tramp-autoload
 (defun tramp-clear-passwd (vec)
   "Clear password cache for connection related to VEC."
+  (let ((hop (tramp-file-name-hop vec)))
+    (when hop
+      ;; Clear also the passwords of the hops.
+      (tramp-clear-passwd
+       (tramp-dissect-file-name
+       (concat
+        tramp-prefix-format
+        (tramp-compat-replace-regexp-in-string
+         (concat tramp-postfix-hop-regexp "$")
+         tramp-postfix-host-format hop))))))
   (tramp-compat-funcall
    'password-cache-remove
    (tramp-make-tramp-file-name



reply via email to

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