Skip to content
This repository was archived by the owner on Jan 26, 2026. It is now read-only.
This repository was archived by the owner on Jan 26, 2026. It is now read-only.

"Couldn't apply options" on a minimal test case console app #1

Description

@nrathaus

Running a console application with libssh doesn't ssh_connect, rather returns "Couldn't apply options" - which isn't very informative.

Context

I tried to run the following code:

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)

Expected Behavior

Connect to the SSH server

Actual Behavior

Returns an error

Steps to Reproduce

  1. Take the above code
  2. Compile it as a Console Application, x86, Multibyte (I also tried Unicode)
  3. Run

Your Environment

  • Version Used: 0.8.7
  • Operating System and Version: Windows 10 RS5 (1903)
  • Compiler and Version(s): Visual Studio 2015

Possible Fix

:Shrug:

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

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