From: Kai Großjohann Date: Tue, 25 Jun 2002 20:11:34 +0000 (+0000) Subject: (tramp-open-connection-rsh): Support a kludgy feature for the X-Git-Tag: ttn-vms-21-2-B4~14450 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=8e3a1104c1ca8300e60a86ac9a2fcc4b9a859b56;p=emacs.git (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 --git a/lisp/ChangeLog b/lisp/ChangeLog index 59545cc56dc..dca8dba17de 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -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 --git a/lisp/net/tramp.el b/lisp/net/tramp.el index ae487fc81bb..1c53f21ddb0 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -3484,6 +3484,10 @@ password! You must use an inline transfer method in this case. 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 @@ must specify the right method in the file name. (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 --git a/man/tramp.texi b/man/tramp.texi index 55bcacf2a32..c90fbadcb55 100644 --- a/man/tramp.texi +++ b/man/tramp.texi @@ -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 @@ There are also two variants, @option{sm1} and @option{sm2} that use the @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 @@ Connect to the remote host with @command{ssh} and use the @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 @@ invoked from an Emacs buffer, tells them that it is not allocating a 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 @@ remote host. 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 @@ The cost of the cryptographic handshake at the start of an @command{scp} 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 @@ The @command{rsync} based method may be considerably faster than the @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 @@ invoked from an Emacs buffer, tells them that it is not allocating a 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 @@ This method is similar to @option{scp}, but it uses the @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}