# HG changeset patch # User Kai Grojohann # Date 1025035894 0 # Node ID d07b0e5f80b9e73c0e3b15932ab8a29ff5aea579 # Parent 72200622ada86fff661734ccdc13fd8c809f80de (tramp-open-connection-rsh): Support a kludgy feature for the "-p" option to ssh. If host name is given as "host#42", uses the "-p 42" option. diff -r 72200622ada8 -r d07b0e5f80b9 lisp/ChangeLog --- a/lisp/ChangeLog Tue Jun 25 18:15:03 2002 +0000 +++ b/lisp/ChangeLog Tue Jun 25 20:11:34 2002 +0000 @@ -3,6 +3,9 @@ * net/tramp.el (tramp-ftp-method): New user option. (tramp-invoke-ange-ftp): New function to forward calls to Ange-FTP. + (tramp-open-connection-rsh): Support a kludgy feature for the + "-p" option to ssh. If host name is given as "host#42", uses the + "-p 42" option. (with-parsed-tramp-file-name): New macro for the usual big `let' statement to dissect a file-name. diff -r 72200622ada8 -r d07b0e5f80b9 lisp/net/tramp.el --- a/lisp/net/tramp.el Tue Jun 25 18:15:03 2002 +0000 +++ b/lisp/net/tramp.el Tue Jun 25 20:11:34 2002 +0000 @@ -3484,6 +3484,10 @@ Sadly, the transfer method cannot be switched on the fly, instead you must specify the right method in the file name. +Kludgy feature: if HOST has the form \"xx#yy\", then yy is assumed to +be a port number for ssh, and \"-p yy\" will be added to the list of +arguments, and xx will be used as the host name to connect to. + * Actually, the rsh program to be used can be specified in the method parameters, see the variable `tramp-methods'." (save-match-data @@ -3494,25 +3498,26 @@ (tramp-message 7 "Opening connection for %s@%s using %s..." user host method) (tramp-message 7 "Opening connection at %s using %s..." host method)) - (let ((process-environment (copy-sequence process-environment))) + (let ((process-environment (copy-sequence process-environment)) + (bufnam (tramp-buffer-name multi-method method user host)) + (buf (tramp-get-buffer multi-method method user host)) + (rsh-program (tramp-get-rsh-program multi-method method)) + (rsh-args (tramp-get-rsh-args multi-method method))) + ;; The following should be changed. We need a more general + ;; mechanism to parse extra host args. + (when (string-match "\\([^#]*\\)#\\(.*\\)" host) + (setq rsh-args (cons "-p" (cons (match-string 2 host) rsh-args))) + (setq host (match-string 1 host))) (setenv "TERM" tramp-terminal-type) (let* ((default-directory (tramp-temporary-file-directory)) (coding-system-for-read (unless (and (not (featurep 'xemacs)) (> emacs-major-version 20)) tramp-dos-coding-system)) (p (if user - (apply #'start-process - (tramp-buffer-name multi-method method user host) - (tramp-get-buffer multi-method method user host) - (tramp-get-rsh-program multi-method method) - host "-l" user - (tramp-get-rsh-args multi-method method)) - (apply #'start-process - (tramp-buffer-name multi-method method user host) - (tramp-get-buffer multi-method method user host) - (tramp-get-rsh-program multi-method method) - host - (tramp-get-rsh-args multi-method method)))) + (apply #'start-process bufnam buf rsh-program + host "-l" user rsh-args) + (apply #'start-process bufnam buf rsh-program + host rsh-args))) (found nil)) (process-kill-without-query p) (tramp-message 9 "Waiting 60s for shell or passwd prompt from %s" host) diff -r 72200622ada8 -r d07b0e5f80b9 man/tramp.texi --- a/man/tramp.texi Tue Jun 25 18:15:03 2002 +0000 +++ b/man/tramp.texi Tue Jun 25 20:11:34 2002 +0000 @@ -11,7 +11,7 @@ @c Version values, for easy modification @c NOTE: The 'UPDATED' value is updated by the 'time-stamp' function. @c If you change it by hand, the modifications will not stay. -@set VERSION $Revision: 1.2 $ +@set VERSION $Revision: 1.3 $ @set UPDATED Monday, 17 June, 2002 @@ -639,6 +639,12 @@ @command{ssh1} and @command{ssh2} commands explicitly. If you don't know what these are, you do not need these options. +All the methods based on @command{ssh} have an additional kludgy +feature: you can specify a host name which looks like @file{host#42} +(the real host name, then a hash sign, then a port number). This +means to connect to the given host but to also pass @code{-p 42} as +arguments to the @command{ssh} command. + @item @option{tm} --- @command{telnet} with @command{mimencode} @@ -662,13 +668,15 @@ @command{uuencode} and @command{uudecode} commands to transfer files between the machines. -As with the @command{ssh} and base64 option above, this provides the -@option{su1} and @option{su2} methods to explicitly select an ssh -version. +As with the @command{ssh} and base64 option (@option{sm}) above, this +provides the @option{su1} and @option{su2} methods to explicitly +select an ssh version. Note that this method does not invoke the @command{su} program, see below for methods which use that. +This supports the @command{-p} kludge. + @item @option{tu} --- @command{telnet} with @command{uuencode} @@ -723,6 +731,8 @@ pseudo tty. When this happens, the login shell is wont to not print any shell prompt, which confuses @tramp{} mightily. +This supports the @command{-p} kludge. + @item @option{km} --- @command{krlogin} with @command{mimencode} @@ -739,6 +749,9 @@ CCC: Do we have to connect to the remote host once from the command line to accept the SSH key? Maybe this can be made automatic? +CCC: Does @command{plink} support the @command{-p} option? Tramp +will support that, anyway. + @item @option{plinkm} --- @command{plink} with @command{mimencode} Like @option{plinku}, but uses base64 encoding instead of uu encoding. @@ -793,6 +806,11 @@ session can begin to absorb the advantage that the lack of encoding and decoding presents. +All the @command{ssh} based methods support the kludgy @command{-p} +feature where you can specify a port number to connect to in the host +name. For example, the host name @file{host#42} tells Tramp to +specify @command{-p 42} in the argument list for @command{ssh}. + @item @option{rsync} --- @command{ssh} and @command{rsync} @@ -808,6 +826,8 @@ @command{rcp} based methods when writing to the remote system. Reading files to the local machine is no faster than with a direct copy. +This method supports the @command{-p} hack. + @item @option{scpx} --- @command{ssh} and @command{scp} @@ -824,6 +844,8 @@ pseudo tty. When this happens, the login shell is wont to not print any shell prompt, which confuses @tramp{} mightily. +This method supports the @command{-p} hack. + @item @option{pscp} --- @command{plink} and @command{pscp} @@ -832,6 +854,8 @@ @command{pscp} for transferring the files. These programs are part of PuTTY, an SSH implementation for Windows. +CCC: Does @command{plink} support the @command{-p} hack? + @item @option{fcp} --- @command{fsh} and @command{fcp}