openssh continues to process dash arguements after hostname

Damien Miller djm at mindrot.org
Wed Apr 28 10:51:38 EST 2004


On Wed, 28 Apr 2004, Mark Andrews wrote:

> 
> Processing dash arguments after the hostname is inconsistant with 
> getopt() usage.  It is also inconsistant with other ssh/rsh 
> implementations.  It is also not documented.
> 
> openssh accepts treats "ssh host -l user" as "ssh -l user host"
> when infact it should be attemption to execute "-l user" on "host"
> as the original user.

I agree that the current argument processing isn't standard, but I'm not 
sure that trying to "execute" - options on the server side is either.

The commands are executed on the server with the user's shell, so any - 
arguments will be treated as arguments to that shell.

If you really want this, you can use this patch:

Index: ssh.c
===================================================================
RCS file: /cvs/src/usr.bin/ssh/ssh.c,v
retrieving revision 1.212
diff -u -r1.212 ssh.c
--- ssh.c	27 Apr 2004 09:46:37 -0000	1.212
+++ ssh.c	28 Apr 2004 00:47:40 -0000
@@ -449,10 +449,6 @@
 			host = ++cp;
 		} else
 			host = *av;
-		if (ac > 1) {
-			optind = optreset = 1;
-			goto again;
-		}
 		ac--, av++;
 	}
 




More information about the openssh-unix-dev mailing list