[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r99991: Detect ssh 'ControlMaster' ar
From: |
Michael Albinus |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r99991: Detect ssh 'ControlMaster' argument automatically in some cases. |
Date: |
Thu, 22 Apr 2010 13:21:39 +0200 |
User-agent: |
Bazaar (2.0.3) |
------------------------------------------------------------
revno: 99991
committer: Michael Albinus <address@hidden>
branch nick: trunk
timestamp: Thu 2010-04-22 13:21:39 +0200
message:
Detect ssh 'ControlMaster' argument automatically in some cases.
* net/tramp.el (tramp-detect-ssh-controlmaster): New defun.
(tramp-default-method): Use it.
modified:
lisp/ChangeLog
lisp/net/tramp.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2010-04-22 09:15:27 +0000
+++ b/lisp/ChangeLog 2010-04-22 11:21:39 +0000
@@ -1,9 +1,18 @@
+2010-04-22 Noah Lavine <address@hidden> (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 <address@hidden>
* 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 <address@hidden>
+
* net/tramp.el (tramp-completion-handle-file-name-all-completions):
Ensure, that non remote files are still checked. Oops.
=== modified file 'lisp/net/tramp.el'
--- a/lisp/net/tramp.el 2010-04-22 09:15:27 +0000
+++ b/lisp/net/tramp.el 2010-04-22 11:21:39 +0000
@@ -723,6 +723,16 @@
`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
@@ -730,9 +740,8 @@
;; 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")
@@ -744,13 +753,15 @@
"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.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r99991: Detect ssh 'ControlMaster' argument automatically in some cases.,
Michael Albinus <=