cURL / Mailing Lists / curl-library / Single Mail


Re: SFTP with unknown host (was Re: CURLOPT_SSH_KEYFUNCTION never gets called?)

From: <>
Date: Wed, 23 Feb 2011 22:47:50 -0800

Sorry for the top-posted posting. Let me try again.

On Feb 21, 2011, at 1:02 PM, Daniel Stenberg wrote:

> On Mon, 21 Feb 2011, wrote:
>>> ... and if you read that example source code again, you'll see that it makes no effort at all to verify that the server is indeed a known host...
>> Indeed, that is the behavior I am trying to emulate. Not possible with libcurl?
> Now you're confusing me. That was the behavior you started with that you seemed to not be content with when the callback was not called at all.
> I think you're mixing failed authentication with failed knownhost matching.
> Or else I'm missing something here...

Here's something I don't understand:

libssh2_knownhost_readfile() "Returns a negative value for error or number of successfully added hosts."

So if it successfully adds a host, it will return 1.

But inside ssh_connect() (curl's ssh.c), we have this:

/* read all known hosts from there */
rc = libssh2_knownhost_readfile(ssh->kh, data->set.str[STRING_SSH_KNOWNHOSTS], LIBSSH2_KNOWNHOST_FILE_OPENSSH);

if(rc) {
 infof(data, "Failed to read known hosts from %s\n", data->set.str[STRING_SSH_KNOWNHOSTS]);

The test of rc should be "if (rc < 0)", no?


List admin:
Received on 2011-02-24