aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Albinus2012-01-22 13:55:36 +0100
committerMichael Albinus2012-01-22 13:55:36 +0100
commita5509865d7a0dd40bfb6217693ca2684a517d6d0 (patch)
tree34bd85d05e1aabf75862ea1d4ca742af23518e4a
parent0dc422898a3db349fd4f54ea1dae9458b004ec34 (diff)
downloademacs-a5509865d7a0dd40bfb6217693ca2684a517d6d0.tar.gz
emacs-a5509865d7a0dd40bfb6217693ca2684a517d6d0.zip
* 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)
-rw-r--r--lisp/ChangeLog12
-rw-r--r--lisp/net/tramp-cache.el11
-rw-r--r--lisp/net/tramp-sh.el24
-rw-r--r--lisp/net/tramp.el12
4 files changed, 43 insertions, 16 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 63679e1580f..8ada003d23d 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,15 @@
12012-01-22 Michael Albinus <michael.albinus@gmx.de>
2
3 * net/tramp.el (tramp-action-login): Set connection property "login-as".
4
5 * net/tramp-cache.el (tramp-dump-connection-properties): Do not dump
6 properties, when "login-as" is set.
7
8 * net/tramp-sh.el (tramp-methods): Add user spec to "pscp" and "psftp".
9 (tramp-default-user-alist): Don't add "pscp".
10 (tramp-do-copy-or-rename-file-out-of-band): Use connection
11 property "login-as", if set. (Bug#10530)
12
12012-01-21 Michael Albinus <michael.albinus@gmx.de> 132012-01-21 Michael Albinus <michael.albinus@gmx.de>
2 14
3 * net/tramp-sh.el (tramp-default-user-alist): Don't add "plink", 15 * net/tramp-sh.el (tramp-default-user-alist): Don't add "plink",
diff --git a/lisp/net/tramp-cache.el b/lisp/net/tramp-cache.el
index 03a5fe5b88e..d222dd1011d 100644
--- a/lisp/net/tramp-cache.el
+++ b/lisp/net/tramp-cache.el
@@ -243,7 +243,7 @@ PROPERTY is set persistent when KEY is a vector."
243 (aset key 3 nil)) 243 (aset key 3 nil))
244 (let ((hash (or (gethash key tramp-cache-data) 244 (let ((hash (or (gethash key tramp-cache-data)
245 (puthash key (make-hash-table :test 'equal) 245 (puthash key (make-hash-table :test 'equal)
246 tramp-cache-data)))) 246 tramp-cache-data))))
247 (puthash property value hash) 247 (puthash property value hash)
248 (setq tramp-cache-data-changed t) 248 (setq tramp-cache-data-changed t)
249 (tramp-message key 7 "%s %s" property value) 249 (tramp-message key 7 "%s %s" property value)
@@ -329,10 +329,15 @@ KEY identifies the connection, it is either a process or a vector."
329 tramp-cache-data-changed 329 tramp-cache-data-changed
330 (stringp tramp-persistency-file-name)) 330 (stringp tramp-persistency-file-name))
331 (let ((cache (copy-hash-table tramp-cache-data))) 331 (let ((cache (copy-hash-table tramp-cache-data)))
332 ;; Remove temporary data. 332 ;; Remove temporary data. If there is the key "login-as", we
333 ;; don't save either, because all other properties might
334 ;; depend on the login name, and we want to give the
335 ;; possibility to use another login name later on.
333 (maphash 336 (maphash
334 (lambda (key value) 337 (lambda (key value)
335 (if (and (vectorp key) (not (tramp-file-name-localname key))) 338 (if (and (vectorp key)
339 (not (tramp-file-name-localname key))
340 (not (gethash "login-as" value)))
336 (progn 341 (progn
337 (remhash "process-name" value) 342 (remhash "process-name" value)
338 (remhash "process-buffer" value) 343 (remhash "process-buffer" value)
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index e078a227061..38e19730a6d 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -380,7 +380,7 @@ detected as prompt when being sent on echoing hosts, therefore.")
380 (tramp-remote-shell "/bin/sh") 380 (tramp-remote-shell "/bin/sh")
381 (tramp-remote-shell-args ("-c")) 381 (tramp-remote-shell-args ("-c"))
382 (tramp-copy-program "pscp") 382 (tramp-copy-program "pscp")
383 (tramp-copy-args (("-P" "%p") ("-scp") ("-p" "%k") 383 (tramp-copy-args (("-l" "%u") ("-P" "%p") ("-scp") ("-p" "%k")
384 ("-q") ("-r"))) 384 ("-q") ("-r")))
385 (tramp-copy-keep-date t) 385 (tramp-copy-keep-date t)
386 (tramp-copy-recursive t) 386 (tramp-copy-recursive t)
@@ -394,7 +394,7 @@ detected as prompt when being sent on echoing hosts, therefore.")
394 (tramp-remote-shell "/bin/sh") 394 (tramp-remote-shell "/bin/sh")
395 (tramp-remote-shell-args ("-c")) 395 (tramp-remote-shell-args ("-c"))
396 (tramp-copy-program "pscp") 396 (tramp-copy-program "pscp")
397 (tramp-copy-args (("-P" "%p") ("-sftp") ("-p" "%k") 397 (tramp-copy-args (("-l" "%u") ("-P" "%p") ("-sftp") ("-p" "%k")
398 ("-q") ("-r"))) 398 ("-q") ("-r")))
399 (tramp-copy-keep-date t) 399 (tramp-copy-keep-date t)
400 (tramp-copy-recursive t) 400 (tramp-copy-recursive t)
@@ -419,13 +419,12 @@ detected as prompt when being sent on echoing hosts, therefore.")
419 `(,(concat "\\`" (regexp-opt '("su" "sudo" "ksu")) "\\'") 419 `(,(concat "\\`" (regexp-opt '("su" "sudo" "ksu")) "\\'")
420 nil "root")) 420 nil "root"))
421;; Do not add "ssh" based methods, otherwise ~/.ssh/config would be ignored. 421;; Do not add "ssh" based methods, otherwise ~/.ssh/config would be ignored.
422;; Do not add "plink" and "psftp", they ask interactively for the user. 422;; Do not add "plink" based methods, they ask interactively for the user.
423;;;###tramp-autoload 423;;;###tramp-autoload
424(add-to-list 'tramp-default-user-alist 424(add-to-list 'tramp-default-user-alist
425 `(,(concat 425 `(,(concat
426 "\\`" 426 "\\`"
427 (regexp-opt 427 (regexp-opt '("rcp" "remcp" "rsh" "telnet" "krlogin" "fcp"))
428 '("rcp" "remcp" "rsh" "telnet" "krlogin" "pscp" "fcp"))
429 "\\'") 428 "\\'")
430 nil ,(user-login-name))) 429 nil ,(user-login-name)))
431 430
@@ -2281,8 +2280,10 @@ The method used must be an out-of-band method."
2281 ;; Set variables for computing the prompt for reading 2280 ;; Set variables for computing the prompt for reading
2282 ;; password. 2281 ;; password.
2283 (setq tramp-current-method (tramp-file-name-method v) 2282 (setq tramp-current-method (tramp-file-name-method v)
2284 tramp-current-user (tramp-file-name-user v) 2283 tramp-current-user (or (tramp-file-name-user v)
2285 tramp-current-host (tramp-file-name-real-host v)) 2284 (tramp-get-connection-property
2285 v "login-as" nil))
2286 tramp-current-host (tramp-file-name-real-host v))
2286 2287
2287 ;; Expand hops. Might be necessary for gateway methods. 2288 ;; Expand hops. Might be necessary for gateway methods.
2288 (setq v (car (tramp-compute-multi-hops v))) 2289 (setq v (car (tramp-compute-multi-hops v)))
@@ -2309,8 +2310,15 @@ The method used must be an out-of-band method."
2309 (setq port (string-to-number (match-string 2 host)) 2310 (setq port (string-to-number (match-string 2 host))
2310 host (string-to-number (match-string 1 host)))) 2311 host (string-to-number (match-string 1 host))))
2311 2312
2313 ;; Check for user. There might be an interactive setting.
2314 (setq user (or (tramp-file-name-user v)
2315 (tramp-get-connection-property v "login-as" nil)))
2316
2312 ;; Compose copy command. 2317 ;; Compose copy command.
2313 (setq spec (format-spec-make 2318 (setq host (or host "")
2319 user (or user "")
2320 port (or port "")
2321 spec (format-spec-make
2314 ?h host ?u user ?p port 2322 ?h host ?u user ?p port
2315 ?t (tramp-get-connection-property 2323 ?t (tramp-get-connection-property
2316 (tramp-get-connection-process v) "temp-file" "") 2324 (tramp-get-connection-process v) "temp-file" "")
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 98295c6617a..f13315bc662 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -3115,13 +3115,15 @@ beginning of local filename are not substituted."
3115(defun tramp-action-login (proc vec) 3115(defun tramp-action-login (proc vec)
3116 "Send the login name." 3116 "Send the login name."
3117 (when (not (stringp tramp-current-user)) 3117 (when (not (stringp tramp-current-user))
3118 (save-window-excursion 3118 (setq tramp-current-user
3119 (let ((enable-recursive-minibuffers t)) 3119 (with-connection-property vec "login-as"
3120 (pop-to-buffer (tramp-get-connection-buffer vec)) 3120 (save-window-excursion
3121 (setq tramp-current-user (read-string (match-string 0)))))) 3121 (let ((enable-recursive-minibuffers t))
3122 (tramp-message vec 3 "Sending login name `%s'" tramp-current-user) 3122 (pop-to-buffer (tramp-get-connection-buffer vec))
3123 (read-string (match-string 0)))))))
3123 (with-current-buffer (tramp-get-connection-buffer vec) 3124 (with-current-buffer (tramp-get-connection-buffer vec)
3124 (tramp-message vec 6 "\n%s" (buffer-string))) 3125 (tramp-message vec 6 "\n%s" (buffer-string)))
3126 (tramp-message vec 3 "Sending login name `%s'" tramp-current-user)
3125 (tramp-send-string vec (concat tramp-current-user tramp-local-end-of-line))) 3127 (tramp-send-string vec (concat tramp-current-user tramp-local-end-of-line)))
3126 3128
3127(defun tramp-action-password (proc vec) 3129(defun tramp-action-password (proc vec)