Skip to content

CURLOPT_SSH_KNOWNHOSTS not accepted with libssh  #3493

@felixhaedicke

Description

@felixhaedicke

When curl is compiled with libssh (not libssh2), calling curl_easy_setopt() with option CURLOPT_SSH_KNOWNHOSTS fails with error code CURLE_UNKNOWN_OPTION.

Although in lib/ssh-libssh.c, I found this:

  if(data->set.str[STRING_SSH_KNOWNHOSTS]) {
    infof(data, "Known hosts: %s\n", data->set.str[STRING_SSH_KNOWNHOSTS]);
    ssh_options_set(ssh->ssh_session, SSH_OPTIONS_KNOWNHOSTS,
                    data->set.str[STRING_SSH_KNOWNHOSTS]);
  }

example program

#include <assert.h>
#include <curl/curl.h>

int main()
{
  CURLcode status = curl_global_init(CURL_GLOBAL_ALL);
  assert(CURLE_OK == status);

  CURL* curl = curl_easy_init();
  assert(curl);

  status = curl_easy_setopt(curl, CURLOPT_SSH_KNOWNHOSTS, "/tmp/khfile");
  assert(CURLE_OK == status);
}

curl/libcurl version

curl 7.63.0 (x86_64-pc-linux-gnu) libcurl/7.63.0 OpenSSL/1.1.1a zlib/1.2.11 libidn2/2.0.5 libssh/0.8.6/openssl/zlib
Release-Date: 2018-12-12
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp 
Features: AsynchDNS Debug TrackMemory IDN IPv6 Largefile NTLM NTLM_WB SSL libz TLS-SRP UnixSockets HTTPS-proxy

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions