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

Re: ssh_connect issue "Couldn't apply options"


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, "");
   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
  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.



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