In message <[EMAIL PROTECTED]>, Christian Ruediger Bahls writes:
> dear igor,
>
> strangely my original post did not make it to the list
> .. maybe it was in my hosts mail queue for too long
> so it got rejected as being too old by the mailing list
Hi Christian.
Indeed, sometimes mail behaviour is very difficult to understand...
...or believe! :-)
> [2007-01-31 16:27] Igor Sobrado <[EMAIL PROTECTED]> wrote:
> > debug_level++;
> > break;
> > case 'F':
> > + case 'l':
> > + addargs(&args, "-l%s", optarg);
> > + break;
> > case 'o':
> > addargs(&args, "-%c%s", ch, optarg);
> > break;
>
> hmmm .. doesn't that case: 'F' flow into your 'l' ?
> -F is for specifying an optional config file ..
Indeed, and it is a BUG... my mistake. the case for 'F' flows
into the case for 'o' instead (is the case for 'o' responsible
for changing the configuration file to be used?)
I should have carefully reviewed the patch. This is the right
one (though):
--- sftp.c Sat Jan 27 08:43:11 2007
+++ sftp.c Wed Jan 31 15:57:02 2007
@@ -1415,8 +1415,8 @@
fprintf(stderr,
"usage: %s [-1Cv] [-B buffer_size] [-b batchfile] [-F ssh_config]\n"
- " [-o ssh_option] [-P sftp_server_path] [-R
num_requests]\n"
- " [-S program] [-s subsystem | sftp_server] host\n"
+ " [-l login_name] [-o ssh_option] [-P
sftp_server_path]\n"
+ " [-R num_requests] [-S program] [-s subsystem |
sftp_server] host\n"
" %s [EMAIL PROTECTED]:file [file]]]\n"
" %s [EMAIL PROTECTED]:dir[/]]]\n"
" %s -b batchfile [EMAIL PROTECTED]", __progname, __progname,
__progname, __progname);
@@ -1450,7 +1450,7 @@
ll = SYSLOG_LEVEL_INFO;
infile = stdin;
- while ((ch = getopt(argc, argv, "1hvCo:s:S:b:B:F:P:R:")) != -1) {
+ while ((ch = getopt(argc, argv, "1hvCl:o:s:S:b:B:F:P:R:")) != -1) {
switch (ch) {
case 'C':
addargs(&args, "-C");
@@ -1461,6 +1461,9 @@
ll = SYSLOG_LEVEL_DEBUG1 + debug_level;
}
debug_level++;
+ break;
+ case 'l':
+ addargs(&args, "-l%s", optarg);
break;
case 'F':
case 'o':
The case 'F' flows to 'o', it is the current behaviour (and I suppose
it is right...). It seems that the case for 'o' manages the configuration
file to be used.
I am sorry for the mistake.
Thank you very much for the feedback on this matter and for sending
the email again!
Igor.
> PS: any positive replies so far?
No, there are no replies. Well, my patch is "highly experimental",
just an example about how implementing the "-l" option in sftp.
I suppose that people working on OpenSSH have other problems
that need to be fixed; this change is not a high priority one.
On the other hand, if options cannot be specified after the
hostname I doubt this patch will be really useful. I would like
being able to type something like "sftp hostname -l username"
(most times I type "-l username" because I missed the username
when I was typing the hostname and do not want to edit the command.)
The other patches (the ones that write -or rewrite- messages
about missing hostnames and usernames) do not work fine either,
there is some code that seems unreachable. With the patched
ssh binary sometimes a "ssh username@" should return
"ssh: missing hostname" but instead of that it returns:
$ ssh username@
ssh: : no address associated with name
(it seems that the empty string is used as hostname and, of course,
cannot be resolved, the message "ssh: missing hostname" is never
displayed.)
Thank you very much for your support and feedback!
Igor.