all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [patch] Tramp Scpc Autodetection
@ 2010-04-08 14:56 Noah Lavine
  2010-04-08 19:35 ` Davis Herring
  2010-04-09  1:30 ` Glenn Morris
  0 siblings, 2 replies; 3+ messages in thread
From: Noah Lavine @ 2010-04-08 14:56 UTC (permalink / raw)
  To: emacs-devel

I recently noticed that Tramp won't use the "scpc" method of transfer
by default when it detects an ssh installation, even though it's
somewhat superior to the "ssh" method. It can't do this because only
OpenSSH 4.0 and greater have the ability to share SSH connections with
other programs. This patch gives Emacs the ability to check whether
OpenSSH 4.0 or greater is installed, and if so, to use the scpc
mechanism automatically.

I'd like to do whatever is necessary to contribute this patch to
emacs. What is necessary for that?

More generally, I couldn't find any information on the emacs website
or in the manual about how to contribute to Emacs. Is this list the
right place to send things like this?

Thank you
Noah Lavine

--- tramp-old.el	2010-04-08 10:40:26.000000000 -0400
+++ tramp.el	2010-04-08 10:41:03.000000000 -0400
@@ -653,38 +653,49 @@
 `localhost' or the name of the local host.  Another host name is
 useful only in combination with `tramp-default-proxies-alist'.")

-
+(defun detect-scpc ()
+  (with-temp-buffer
+    (let ((ssh-call (condition-case nil
+                        (call-process "ssh" nil t nil "-V")
+                      (error nil))))
+      (and ssh-call
+           (goto-char (point-min))
+           (search-forward "OpenSSH_" nil t)
+           (looking-at "[0-9.]*")
+           (let ((ssl-version (read (match-string 0))))
+             (>= ssl-version 4.0))))))

 (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
   ;; for small files.  But it must be ensured that there aren't
   ;; permanent password queries.  Either a password agent like
-  ;; "ssh-agent" or "Pageant" shall run, or the optional password.el
-  ;; package 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.
-  (cond
-   ;; PuTTY is installed.
-   ((executable-find "pscp")
-    (if	(or (fboundp 'password-read)
+  ;; "ssh-agent" or "Pageant" shall run, or the optional
+  ;; password-cache.el or auth-sources.el packages shall be active for
+  ;; 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")
+   (if	(or (fboundp 'password-read)
+	    (fboundp 'auth-source-user-or-password)
 	    ;; Pageant is running.
-	    (and (fboundp 'w32-window-exists-p)
-		 (funcall (symbol-function 'w32-window-exists-p)
-			  "Pageant" "Pageant")))
-	"pscp"
-      "plink"))
-   ;; There is an ssh installation.
-   ((executable-find "scp")
-    (if	(or (fboundp 'password-read)
-	    ;; ssh-agent is running.
-	    (getenv "SSH_AUTH_SOCK")
-	    (getenv "SSH_AGENT_PID"))
-	"scp"
-      "ssh"))
-   ;; Fallback.
-   (t "ftp"))
+	    (tramp-compat-process-running-p "Pageant"))
+       "pscp"
+     "plink"))
+  ;; There is an ssh installation.
+  ((executable-find "scp")
+   (cond
+    ((detect-scpc) "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.
 See `tramp-methods' for possibilities.
 Also see `tramp-default-method-alist'."




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-04-09  1:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-08 14:56 [patch] Tramp Scpc Autodetection Noah Lavine
2010-04-08 19:35 ` Davis Herring
2010-04-09  1:30 ` Glenn Morris

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.