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

  1. Sibras commented on Jun 27, 2019

    @Sibras
    Member

    Have you tried other libssh binaries such as the one from vcpkg?
    If its an issue with the binaries provided here then i can help but if its an issue with libssh itself then you should try the libssh upstream developers instead.

  2. nrathaus commented on Jun 27, 2019

    @nrathaus
    Author
  3. Sibras commented on Jun 30, 2019

    @Sibras
    Member

    There is new 0.9.0 version of libssh now available. See if that fixes your issues.

  4. self-assigned this
    on Sep 12, 2019
  5. added a commit that references this issue on Oct 19, 2024
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