diff options
| author | Michael Albinus | 2010-04-22 13:21:39 +0200 |
|---|---|---|
| committer | Michael Albinus | 2010-04-22 13:21:39 +0200 |
| commit | a92375d91a09ba71abd7d9d4668e7a96fd8d61fa (patch) | |
| tree | cce25723115e310b59c3462acb700cf191204dc5 | |
| parent | 25f14cdb5a3608adb3d71e15ff15cdafe5a52434 (diff) | |
| download | emacs-a92375d91a09ba71abd7d9d4668e7a96fd8d61fa.tar.gz emacs-a92375d91a09ba71abd7d9d4668e7a96fd8d61fa.zip | |
Detect ssh 'ControlMaster' argument automatically in some cases.
* net/tramp.el (tramp-detect-ssh-controlmaster): New defun.
(tramp-default-method): Use it.
| -rwxr-xr-x | lisp/ChangeLog | 9 | ||||
| -rwxr-xr-x | lisp/net/tramp.el | 31 |
2 files changed, 30 insertions, 10 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index d7c32848543..dd14ff9e77c 100755 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,9 +1,18 @@ | |||
| 1 | 2010-04-22 Noah Lavine <noah549@gmail.com> (tiny change) | ||
| 2 | |||
| 3 | Detect ssh 'ControlMaster' argument automatically in some cases. | ||
| 4 | |||
| 5 | * net/tramp.el (tramp-detect-ssh-controlmaster): New defun. | ||
| 6 | (tramp-default-method): Use it. | ||
| 7 | |||
| 1 | 2010-04-22 Michael Albinus <michael.albinus@gmx.de> | 8 | 2010-04-22 Michael Albinus <michael.albinus@gmx.de> |
| 2 | 9 | ||
| 3 | * net/tramp.el (tramp-handle-copy-file): Add new optional | 10 | * net/tramp.el (tramp-handle-copy-file): Add new optional |
| 4 | parameter `preserve-selinux-context'. | 11 | parameter `preserve-selinux-context'. |
| 5 | (tramp-file-name-for-operation): Add `set-file-selinux-context'. | 12 | (tramp-file-name-for-operation): Add `set-file-selinux-context'. |
| 6 | 13 | ||
| 14 | 2010-04-22 Michael Albinus <michael.albinus@gmx.de> | ||
| 15 | |||
| 7 | * net/tramp.el (tramp-completion-handle-file-name-all-completions): | 16 | * net/tramp.el (tramp-completion-handle-file-name-all-completions): |
| 8 | Ensure, that non remote files are still checked. Oops. | 17 | Ensure, that non remote files are still checked. Oops. |
| 9 | 18 | ||
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 6959879e677..af5d526bfc6 100755 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el | |||
| @@ -723,6 +723,16 @@ started on the local host. You should specify a remote host | |||
| 723 | `localhost' or the name of the local host. Another host name is | 723 | `localhost' or the name of the local host. Another host name is |
| 724 | useful only in combination with `tramp-default-proxies-alist'.") | 724 | useful only in combination with `tramp-default-proxies-alist'.") |
| 725 | 725 | ||
| 726 | (defun tramp-detect-ssh-controlmaster () | ||
| 727 | "Call ssh to detect whether it supports the ControlMaster argument. | ||
| 728 | This function may return nil when the argument is supported, but | ||
| 729 | shouldn't return t when it isn't." | ||
| 730 | (ignore-errors | ||
| 731 | (with-temp-buffer | ||
| 732 | (call-process "ssh" nil t nil "-o" "ControlMaster") | ||
| 733 | (goto-char (point-min)) | ||
| 734 | (search-forward-regexp "Missing ControlMaster argument" nil t)))) | ||
| 735 | |||
| 726 | (defcustom tramp-default-method | 736 | (defcustom tramp-default-method |
| 727 | ;; An external copy method seems to be preferred, because it is much | 737 | ;; An external copy method seems to be preferred, because it is much |
| 728 | ;; more performant for large files, and it hasn't too serious delays | 738 | ;; more performant for large files, and it hasn't too serious delays |
| @@ -730,9 +740,8 @@ useful only in combination with `tramp-default-proxies-alist'.") | |||
| 730 | ;; permanent password queries. Either a password agent like | 740 | ;; permanent password queries. Either a password agent like |
| 731 | ;; "ssh-agent" or "Pageant" shall run, or the optional | 741 | ;; "ssh-agent" or "Pageant" shall run, or the optional |
| 732 | ;; password-cache.el or auth-sources.el packages shall be active for | 742 | ;; password-cache.el or auth-sources.el packages shall be active for |
| 733 | ;; password caching. "scpc" would be another good choice because of | 743 | ;; password caching. "scpc" is chosen if we detect that the user is |
| 734 | ;; the "ControlMaster" option, but this is a more modern alternative | 744 | ;; running OpenSSH 4.0 or newer. |
| 735 | ;; in OpenSSH 4, which cannot be taken as default. | ||
| 736 | (cond | 745 | (cond |
| 737 | ;; PuTTY is installed. | 746 | ;; PuTTY is installed. |
| 738 | ((executable-find "pscp") | 747 | ((executable-find "pscp") |
| @@ -744,13 +753,15 @@ useful only in combination with `tramp-default-proxies-alist'.") | |||
| 744 | "plink")) | 753 | "plink")) |
| 745 | ;; There is an ssh installation. | 754 | ;; There is an ssh installation. |
| 746 | ((executable-find "scp") | 755 | ((executable-find "scp") |
| 747 | (if (or (fboundp 'password-read) | 756 | (cond |
| 748 | (fboundp 'auth-source-user-or-password) | 757 | ((tramp-detect-ssh-controlmaster) "scpc") |
| 749 | ;; ssh-agent is running. | 758 | ((or (fboundp 'password-read) |
| 750 | (getenv "SSH_AUTH_SOCK") | 759 | (fboundp 'auth-source-user-or-password) |
| 751 | (getenv "SSH_AGENT_PID")) | 760 | ;; ssh-agent is running. |
| 752 | "scp" | 761 | (getenv "SSH_AUTH_SOCK") |
| 753 | "ssh")) | 762 | (getenv "SSH_AGENT_PID")) |
| 763 | "scp") | ||
| 764 | (t "ssh"))) | ||
| 754 | ;; Fallback. | 765 | ;; Fallback. |
| 755 | (t "ftp")) | 766 | (t "ftp")) |
| 756 | "*Default method to use for transferring files. | 767 | "*Default method to use for transferring files. |