aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/net
diff options
context:
space:
mode:
authorJoakim Verona2012-01-23 15:10:06 +0100
committerJoakim Verona2012-01-23 15:10:06 +0100
commit0322b140eead7c94de7f0f6d19a90bd15690b4eb (patch)
tree950c011783cc896d0450084cb5155e54548bfe5b /lisp/net
parentd5114bfea3ea4c37c57e2af0f3b095be9fcd8bac (diff)
parentcb5850f27c1b4d26957d58e2da2314dd12498671 (diff)
downloademacs-0322b140eead7c94de7f0f6d19a90bd15690b4eb.tar.gz
emacs-0322b140eead7c94de7f0f6d19a90bd15690b4eb.zip
upstream
Diffstat (limited to 'lisp/net')
-rw-r--r--lisp/net/tramp-cache.el11
-rw-r--r--lisp/net/tramp-sh.el24
-rw-r--r--lisp/net/tramp.el28
3 files changed, 42 insertions, 21 deletions
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 2478253841f..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" based methods, they ask interactively for the user.
422;;;###tramp-autoload 423;;;###tramp-autoload
423(add-to-list 'tramp-default-user-alist 424(add-to-list 'tramp-default-user-alist
424 `(,(concat 425 `(,(concat
425 "\\`" 426 "\\`"
426 (regexp-opt 427 (regexp-opt '("rcp" "remcp" "rsh" "telnet" "krlogin" "fcp"))
427 '("rcp" "remcp" "rsh" "telnet" "krlogin"
428 "plink" "plink1" "pscp" "psftp" "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 afb7ab4312b..f13315bc662 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -460,6 +460,12 @@ usually suffice.")
460 "Regexp which matches `tramp-echo-mark' as it gets echoed by 460 "Regexp which matches `tramp-echo-mark' as it gets echoed by
461the remote shell.") 461the remote shell.")
462 462
463(defcustom tramp-local-end-of-line
464 (if (memq system-type '(windows-nt)) "\r\n" "\n")
465 "*String used for end of line in local processes."
466 :group 'tramp
467 :type 'string)
468
463(defcustom tramp-rsh-end-of-line "\n" 469(defcustom tramp-rsh-end-of-line "\n"
464 "*String used for end of line in rsh connections. 470 "*String used for end of line in rsh connections.
465I don't think this ever needs to be changed, so please tell me about it 471I don't think this ever needs to be changed, so please tell me about it
@@ -1902,7 +1908,7 @@ Falls back to normal file name handler if no Tramp file name handler exists."
1902 ;; operations shall return at least a default value 1908 ;; operations shall return at least a default value
1903 ;; in order to give the user a chance to correct the 1909 ;; in order to give the user a chance to correct the
1904 ;; file name in the minibuffer. 1910 ;; file name in the minibuffer.
1905 ;; We cannot use 'debug as error handler. In order 1911 ;; We cannot use `debug' as error handler. In order
1906 ;; to get a full backtrace, one could apply 1912 ;; to get a full backtrace, one could apply
1907 ;; (setq debug-on-error t debug-on-signal t) 1913 ;; (setq debug-on-error t debug-on-signal t)
1908 (error 1914 (error
@@ -3109,14 +3115,16 @@ beginning of local filename are not substituted."
3109(defun tramp-action-login (proc vec) 3115(defun tramp-action-login (proc vec)
3110 "Send the login name." 3116 "Send the login name."
3111 (when (not (stringp tramp-current-user)) 3117 (when (not (stringp tramp-current-user))
3112 (save-window-excursion 3118 (setq tramp-current-user
3113 (let ((enable-recursive-minibuffers t)) 3119 (with-connection-property vec "login-as"
3114 (pop-to-buffer (tramp-get-connection-buffer vec)) 3120 (save-window-excursion
3115 (setq tramp-current-user (read-string (match-string 0)))))) 3121 (let ((enable-recursive-minibuffers t))
3116 (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)))))))
3117 (with-current-buffer (tramp-get-connection-buffer vec) 3124 (with-current-buffer (tramp-get-connection-buffer vec)
3118 (tramp-message vec 6 "\n%s" (buffer-string))) 3125 (tramp-message vec 6 "\n%s" (buffer-string)))
3119 (tramp-send-string vec tramp-current-user)) 3126 (tramp-message vec 3 "Sending login name `%s'" tramp-current-user)
3127 (tramp-send-string vec (concat tramp-current-user tramp-local-end-of-line)))
3120 3128
3121(defun tramp-action-password (proc vec) 3129(defun tramp-action-password (proc vec)
3122 "Query the user for a password." 3130 "Query the user for a password."
@@ -3148,7 +3156,7 @@ See also `tramp-action-yn'."
3148 (throw 'tramp-action 'permission-denied)) 3156 (throw 'tramp-action 'permission-denied))
3149 (with-current-buffer (tramp-get-connection-buffer vec) 3157 (with-current-buffer (tramp-get-connection-buffer vec)
3150 (tramp-message vec 6 "\n%s" (buffer-string))) 3158 (tramp-message vec 6 "\n%s" (buffer-string)))
3151 (tramp-send-string vec "yes")))) 3159 (tramp-send-string vec (concat "yes" tramp-local-end-of-line)))))
3152 3160
3153(defun tramp-action-yn (proc vec) 3161(defun tramp-action-yn (proc vec)
3154 "Ask the user for confirmation using `y-or-n-p'. 3162 "Ask the user for confirmation using `y-or-n-p'.
@@ -3162,7 +3170,7 @@ See also `tramp-action-yesno'."
3162 (throw 'tramp-action 'permission-denied)) 3170 (throw 'tramp-action 'permission-denied))
3163 (with-current-buffer (tramp-get-connection-buffer vec) 3171 (with-current-buffer (tramp-get-connection-buffer vec)
3164 (tramp-message vec 6 "\n%s" (buffer-string))) 3172 (tramp-message vec 6 "\n%s" (buffer-string)))
3165 (tramp-send-string vec "y")))) 3173 (tramp-send-string vec (concat "y" tramp-local-end-of-line)))))
3166 3174
3167(defun tramp-action-terminal (proc vec) 3175(defun tramp-action-terminal (proc vec)
3168 "Tell the remote host which terminal type to use. 3176 "Tell the remote host which terminal type to use.
@@ -3170,7 +3178,7 @@ The terminal type can be configured with `tramp-terminal-type'."
3170 (tramp-message vec 5 "Setting `%s' as terminal type." tramp-terminal-type) 3178 (tramp-message vec 5 "Setting `%s' as terminal type." tramp-terminal-type)
3171 (with-current-buffer (tramp-get-connection-buffer vec) 3179 (with-current-buffer (tramp-get-connection-buffer vec)
3172 (tramp-message vec 6 "\n%s" (buffer-string))) 3180 (tramp-message vec 6 "\n%s" (buffer-string)))
3173 (tramp-send-string vec tramp-terminal-type)) 3181 (tramp-send-string vec (concat tramp-terminal-type tramp-local-end-of-line)))
3174 3182
3175(defun tramp-action-process-alive (proc vec) 3183(defun tramp-action-process-alive (proc vec)
3176 "Check, whether a process has finished." 3184 "Check, whether a process has finished."