[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: ssh_connect issue "Couldn't apply options"
[Thread Prev] | [Thread Next]
- Subject: Re: ssh_connect issue "Couldn't apply options"
- From: g4-lisz@xxxxxxxxxxxx
- Reply-to: libssh@xxxxxxxxxx
- Date: Wed, 10 Apr 2019 12:01:21 +0200
- To: libssh@xxxxxxxxxx
Thanks for the reply. I'm glad to hear that you were able to solve the problem. We really needed a Wiki or similar for libssh on Windows. A few things are different there than on Linux, and it's not documented. On 09.04.19 17:55, Karlen Abrahamyan wrote: > > > Oh Thank you I solved the problem. The issue was the following. I use > libssh in Windows, and in 7.2 SSH_OPTIONS_SSH_DIR was automatically > set by default with path something like this "C:/Users/my_user". This > is the path where .ssh folder would be created with known_hosts file > inside. In version 8.7 this path is not being set and it stays NULL > and you have to set it by yourself. This problem occures only in > Windows as in Linux it will set users home directory by default. I > couldnt find anything anywhere about this until I debugged the code > and found the issue by myself. And btw you need to > set SSH_OPTIONS_USER before ssh_connect as well. So this was the > issue. Thank you for your help once more. :) > > On Tuesday, April 9, 2019, 3:48:37 PM GMT+4, g4-lisz@xxxxxxxxxxxx > <g4-lisz@xxxxxxxxxxxx> wrote: > > > 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 > > >
Re: ssh_connect issue "Couldn't apply options" | Andreas Schneider <asn@xxxxxxxxxxxxxx> |
ssh_connect issue "Couldn't apply options" | Karlen Abrahamyan <abkarlen@xxxxxxxxx> |
Re: ssh_connect issue "Couldn't apply options" | g4-lisz@xxxxxxxxxxxx |
Re: ssh_connect issue "Couldn't apply options" | Karlen Abrahamyan <abkarlen@xxxxxxxxx> |