emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r106910: * net/tramp.el (tramp-action


From: Michael Albinus
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r106910: * net/tramp.el (tramp-action-login): Set connection property "login-as".
Date: Sun, 22 Jan 2012 13:55:36 +0100
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 106910
committer: Michael Albinus <address@hidden>
branch nick: trunk
timestamp: Sun 2012-01-22 13:55:36 +0100
message:
  * net/tramp.el (tramp-action-login): Set connection property "login-as".
  
  * net/tramp-cache.el (tramp-dump-connection-properties): Do not dump
  properties, when "login-as" is set.
  
  * net/tramp-sh.el (tramp-methods): Add user spec to "pscp" and "psftp".
  (tramp-default-user-alist): Don't add "pscp".
  (tramp-do-copy-or-rename-file-out-of-band): Use connection
  property "login-as", if set.  (Bug#10530)
modified:
  lisp/ChangeLog
  lisp/net/tramp-cache.el
  lisp/net/tramp-sh.el
  lisp/net/tramp.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2012-01-21 16:02:53 +0000
+++ b/lisp/ChangeLog    2012-01-22 12:55:36 +0000
@@ -1,3 +1,15 @@
+2012-01-22  Michael Albinus  <address@hidden>
+
+       * net/tramp.el (tramp-action-login): Set connection property "login-as".
+
+       * net/tramp-cache.el (tramp-dump-connection-properties): Do not dump
+       properties, when "login-as" is set.
+
+       * net/tramp-sh.el (tramp-methods): Add user spec to "pscp" and "psftp".
+       (tramp-default-user-alist): Don't add "pscp".
+       (tramp-do-copy-or-rename-file-out-of-band): Use connection
+       property "login-as", if set.  (Bug#10530)
+
 2012-01-21  Michael Albinus  <address@hidden>
 
        * net/tramp-sh.el (tramp-default-user-alist): Don't add "plink",

=== modified file 'lisp/net/tramp-cache.el'
--- a/lisp/net/tramp-cache.el   2012-01-19 07:21:25 +0000
+++ b/lisp/net/tramp-cache.el   2012-01-22 12:55:36 +0000
@@ -243,7 +243,7 @@
     (aset key 3 nil))
   (let ((hash (or (gethash key tramp-cache-data)
                  (puthash key (make-hash-table :test 'equal)
-                           tramp-cache-data))))
+                          tramp-cache-data))))
     (puthash property value hash)
     (setq tramp-cache-data-changed t)
     (tramp-message key 7 "%s %s" property value)
@@ -329,10 +329,15 @@
               tramp-cache-data-changed
               (stringp tramp-persistency-file-name))
       (let ((cache (copy-hash-table tramp-cache-data)))
-       ;; Remove temporary data.
+       ;; Remove temporary data.  If there is the key "login-as", we
+       ;; don't save either, because all other properties might
+       ;; depend on the login name, and we want to give the
+       ;; possibility to use another login name later on.
        (maphash
         (lambda (key value)
-          (if (and (vectorp key) (not (tramp-file-name-localname key)))
+          (if (and (vectorp key)
+                   (not (tramp-file-name-localname key))
+                   (not (gethash "login-as" value)))
               (progn
                 (remhash "process-name" value)
                 (remhash "process-buffer" value)

=== modified file 'lisp/net/tramp-sh.el'
--- a/lisp/net/tramp-sh.el      2012-01-21 16:02:53 +0000
+++ b/lisp/net/tramp-sh.el      2012-01-22 12:55:36 +0000
@@ -380,7 +380,7 @@
     (tramp-remote-shell         "/bin/sh")
     (tramp-remote-shell-args    ("-c"))
     (tramp-copy-program         "pscp")
-    (tramp-copy-args            (("-P" "%p") ("-scp") ("-p" "%k")
+    (tramp-copy-args            (("-l" "%u") ("-P" "%p") ("-scp") ("-p" "%k")
                                 ("-q") ("-r")))
     (tramp-copy-keep-date       t)
     (tramp-copy-recursive       t)
@@ -394,7 +394,7 @@
     (tramp-remote-shell         "/bin/sh")
     (tramp-remote-shell-args    ("-c"))
     (tramp-copy-program         "pscp")
-    (tramp-copy-args            (("-P" "%p") ("-sftp") ("-p" "%k")
+    (tramp-copy-args            (("-l" "%u") ("-P" "%p") ("-sftp") ("-p" "%k")
                                 ("-q") ("-r")))
     (tramp-copy-keep-date       t)
     (tramp-copy-recursive       t)
@@ -419,13 +419,12 @@
             `(,(concat "\\`" (regexp-opt '("su" "sudo" "ksu")) "\\'")
               nil "root"))
 ;; Do not add "ssh" based methods, otherwise ~/.ssh/config would be ignored.
-;; Do not add "plink" and "psftp", they ask interactively for the user.
+;; Do not add "plink" based methods, they ask interactively for the user.
 ;;;###tramp-autoload
 (add-to-list 'tramp-default-user-alist
             `(,(concat
                 "\\`"
-                (regexp-opt
-                 '("rcp" "remcp" "rsh" "telnet" "krlogin" "pscp" "fcp"))
+                (regexp-opt '("rcp" "remcp" "rsh" "telnet" "krlogin" "fcp"))
                 "\\'")
               nil ,(user-login-name)))
 
@@ -2281,8 +2280,10 @@
        ;; Set variables for computing the prompt for reading
        ;; password.
        (setq tramp-current-method (tramp-file-name-method v)
-             tramp-current-user   (tramp-file-name-user v)
-             tramp-current-host   (tramp-file-name-real-host v))
+             tramp-current-user (or (tramp-file-name-user v)
+                                    (tramp-get-connection-property
+                                     v "login-as" nil))
+             tramp-current-host (tramp-file-name-real-host v))
 
        ;; Expand hops.  Might be necessary for gateway methods.
        (setq v (car (tramp-compute-multi-hops v)))
@@ -2309,8 +2310,15 @@
          (setq port (string-to-number (match-string 2 host))
                host (string-to-number (match-string 1 host))))
 
+       ;; Check for user.  There might be an interactive setting.
+       (setq user (or (tramp-file-name-user v)
+                      (tramp-get-connection-property v "login-as" nil)))
+
        ;; Compose copy command.
-       (setq spec (format-spec-make
+       (setq host (or host "")
+             user (or user "")
+             port (or port "")
+             spec (format-spec-make
                    ?h host ?u user ?p port
                    ?t (tramp-get-connection-property
                        (tramp-get-connection-process v) "temp-file" "")

=== modified file 'lisp/net/tramp.el'
--- a/lisp/net/tramp.el 2012-01-19 07:21:25 +0000
+++ b/lisp/net/tramp.el 2012-01-22 12:55:36 +0000
@@ -3115,13 +3115,15 @@
 (defun tramp-action-login (proc vec)
   "Send the login name."
   (when (not (stringp tramp-current-user))
-    (save-window-excursion
-      (let ((enable-recursive-minibuffers t))
-       (pop-to-buffer (tramp-get-connection-buffer vec))
-       (setq tramp-current-user (read-string (match-string 0))))))
+    (setq tramp-current-user
+         (with-connection-property vec "login-as"
+           (save-window-excursion
+             (let ((enable-recursive-minibuffers t))
+               (pop-to-buffer (tramp-get-connection-buffer vec))
+               (read-string (match-string 0)))))))
+  (with-current-buffer (tramp-get-connection-buffer vec)
+    (tramp-message vec 6 "\n%s" (buffer-string)))
   (tramp-message vec 3 "Sending login name `%s'" tramp-current-user)
-  (with-current-buffer (tramp-get-connection-buffer vec)
-    (tramp-message vec 6 "\n%s" (buffer-string)))
   (tramp-send-string vec (concat tramp-current-user tramp-local-end-of-line)))
 
 (defun tramp-action-password (proc vec)


reply via email to

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