+2010-04-22 Noah Lavine <noah549@gmail.com> (tiny change)
+
+ Detect ssh 'ControlMaster' argument automatically in some cases.
+
+ * net/tramp.el (tramp-detect-ssh-controlmaster): New defun.
+ (tramp-default-method): Use it.
+
2010-04-22 Michael Albinus <michael.albinus@gmx.de>
* net/tramp.el (tramp-handle-copy-file): Add new optional
parameter `preserve-selinux-context'.
(tramp-file-name-for-operation): Add `set-file-selinux-context'.
+2010-04-22 Michael Albinus <michael.albinus@gmx.de>
+
* net/tramp.el (tramp-completion-handle-file-name-all-completions):
Ensure, that non remote files are still checked. Oops.
`localhost' or the name of the local host. Another host name is
useful only in combination with `tramp-default-proxies-alist'.")
+(defun tramp-detect-ssh-controlmaster ()
+ "Call ssh to detect whether it supports the ControlMaster argument.
+This function may return nil when the argument is supported, but
+shouldn't return t when it isn't."
+ (ignore-errors
+ (with-temp-buffer
+ (call-process "ssh" nil t nil "-o" "ControlMaster")
+ (goto-char (point-min))
+ (search-forward-regexp "Missing ControlMaster argument" nil t))))
+
(defcustom tramp-default-method
;; An external copy method seems to be preferred, because it is much
;; more performant for large files, and it hasn't too serious delays
;; permanent password queries. Either a password agent like
;; "ssh-agent" or "Pageant" shall run, or the optional
;; password-cache.el or auth-sources.el packages shall be active for
- ;; password caching. "scpc" would be another good choice because of
- ;; the "ControlMaster" option, but this is a more modern alternative
- ;; in OpenSSH 4, which cannot be taken as default.
+ ;; password caching. "scpc" is chosen if we detect that the user is
+ ;; running OpenSSH 4.0 or newer.
(cond
;; PuTTY is installed.
((executable-find "pscp")
"plink"))
;; There is an ssh installation.
((executable-find "scp")
- (if (or (fboundp 'password-read)
- (fboundp 'auth-source-user-or-password)
- ;; ssh-agent is running.
- (getenv "SSH_AUTH_SOCK")
- (getenv "SSH_AGENT_PID"))
- "scp"
- "ssh"))
+ (cond
+ ((tramp-detect-ssh-controlmaster) "scpc")
+ ((or (fboundp 'password-read)
+ (fboundp 'auth-source-user-or-password)
+ ;; ssh-agent is running.
+ (getenv "SSH_AUTH_SOCK")
+ (getenv "SSH_AGENT_PID"))
+ "scp")
+ (t "ssh")))
;; Fallback.
(t "ftp"))
"*Default method to use for transferring files.