cURL / Mailing Lists / curl-library / Single Mail

curl-library

bug: spurious error message when connecting via ssh with non-empty known hosts file

From: <mlist0987_at_gmail.com>
Date: Sat, 26 Feb 2011 00:29:37 -0800

If:

(a) the CURLOPT_VERBOSE option is enabled, and

(b) there are one or more hosts in the ssh known hosts file, and

(c) an attempt is made to connect via ssh (indirectly via SFTP in my case),

then a spurious error message is printed to the console:

"* Failed to read known hosts from /<snip>/.ssh/known_hosts"

I've tracked this down to the following bit of code in ssh_connect() [ssh.c]:

/* 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]);
}

rc should be tested for negativity, not zero, ie.

if(rc<0) {

since libssh2_knownhost_readfile() returns negative values for errors, and non-negative values otherwise.

_murat
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-02-26