[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ssh_connect issue "Couldn't apply options"


On 08.04.19 15:31, Karlen Abrahamyan wrote:

> Hi. I have previously used libssh version 0.7.2 on Windows and it
> worked just fine, wanted to switch to new version 0.8.7 but I keep
> getting "Couldn't apply options" error message on ssh_connect func
> call and cant find any help in other threads.
>
> Here is my code
>
> sshSession = ssh_new();
> if (sshSession == NULL)
> exit(-1);
>
>         int port = 22;
>         ssh_options_set(sshSession, SSH_OPTIONS_HOST, "192.168.0.109");
> ssh_options_set(sshSession, SSH_OPTIONS_PORT, &port);
> int rc = ssh_connect(sshSession);
> if (rc != SSH_OK)
> {
>                 // here I keep getting the error I mentioned above
> ssh_free(sshSession);
> }
>
> This exact code worked in 0.7.2 version on Windows. Any help would be
> much appreciated. Thank you in advance.

Did you compile the lib yourself? If yes, you could try to isolate the
issue by adding some debug messages in src/options.c on each line where
-1 is returned in ssh_options_apply():

int ssh_options_apply(ssh_session session) {
 [...]
 --> ssh_set_error(session,SSH_FATAL,"Trying to XY failed"); <---
  return -1;
 [...]
}

This is called by ssh_connect(). And when it returns -1, the message
"Couldn't apply options" is printed.

Cheers,
Till



Follow-Ups:
Re: ssh_connect issue "Couldn't apply options"Karlen Abrahamyan <abkarlen@xxxxxxxxx>
References:
ssh_connect issue "Couldn't apply options"Karlen Abrahamyan <abkarlen@xxxxxxxxx>
Archive administrator: postmaster@lists.cynapses.org