cURL / Mailing Lists / curl-library / Single Mail


Re: Autodetecting sshd options (was Re: Unavailable sshd when not in PATH)

From: Yang Tse <>
Date: Mon, 2 Apr 2007 21:24:53 +0200

2007/4/2, Dan Fandrich wrote:

> It's working for me, although it looks like the -V option isn't designed
> to show the version information; I get messages "option requires an
> argument" and "illegal option" depending on the sshd version, but it works
> anyway. As long as some future version of OpenSSH doesn't change -V to mean
> "delete all accessible files under $HOME", we'll be ok.

Yes you're right the -V option is an invalid option for OpenSSH's
sshd. Any invalid option will equally work, as it seems that all
versions of sshd output its version upon an invalid option. The reason
for using -V is that in OpenSSH's ssh that option is the one which
returns the version info, who knows if some day they also adopt it for
sshd. I think it is reasonable to hope they don't do the "delete all
files" stuff on -V ;-)

> I also discovered a problem in the option checking code, where leading
> whitespace from the wc command messed up the return code. Here's a patch
> to fix that, plus speed things up by eliminating the command pipeline.
> [...]
> + my $err = grep /$option/, qx($sshd -t -o $option=no 2>&1);
> [...]

Yep, too much pipeline'ing

> There is still a problem in that when sshd is run in this way it will load
> all its normal configuration files and if those files are invalid
> this will return the wrong results. Also, this will pick up
> deprecated option warnings and incorrectly treat those options as unusable.
> A better approach would be to write the entire curl_sshd_config file each
> time and use that to do the test.

And using the following to avoid both problems ?

my $err = grep /Unsupported .* $option/, qx($sshd -t -f /dev/null -o
$option=no 2>&1);

Or even better, using a testsuite generated empty config file ?

Both work here.

> As long as 3.7 works with the requuirements of the current test suite, let's
> leave it at that for now.

Its Ok for me.

Received on 2007-04-02