Running a console application with libssh doesn't ssh_connect, rather returns "Couldn't apply options" - which isn't very informative.
int main()
{
ssh_session my_ssh_session = ssh_new();
if (my_ssh_session == NULL)
return -1;
int verbosity = SSH_LOG_PROTOCOL;
int port = 22;
int rc = ssh_options_set(my_ssh_session, SSH_OPTIONS_HOST, "192.168.15.1");
rc = ssh_options_set(my_ssh_session, SSH_OPTIONS_LOG_VERBOSITY, &verbosity);
rc = ssh_options_set(my_ssh_session, SSH_OPTIONS_PORT, &port);
rc = ssh_connect(my_ssh_session);
if (rc != SSH_OK)
{
fprintf(stderr, "Error connecting to localhost: %s\n",
ssh_get_error(my_ssh_session));
exit(-1);
}
ssh_free(my_ssh_session);
return 0;
}
But it returns "Couldn't apply options" error to ssh_connect(), all the ssh_options_set work (return a value of 0)