getting details on ssh_pki_* errors

2021-05-05 Thread John Dunn
Is it possible to get more details when SSH_ERROR is returned from the various ssh_pki_* functions? For example, if I pass the wrong password into ssh_pki_import_privkey_file I see 'OpenSSH private key unpack error (correct password?)' printed out. In other cases ( like if I corrupt the file its

RE: Authenticate with pki

2021-05-05 Thread John Dunn
> Hi John... I've hit this before myself. > You need to call ssh_pki_copy_cert_to_privkey(pubKey, privateKey) after > ssh_pki_import_privkey_base64() and before ssh_userauth_publickey() to > add the public key certificate to the private key before authenticating. > Hope that helps! > Jeremy.

Authenticate with pki

2021-05-04 Thread John Dunn
I am having difficulties authenticating using pki. I have a private/public key pair that allows me to authenticate with a server via ssh -i @ The private key is password protected so I am prompted for the password but beyond that I am able to connect without any user interaction. I'm

RE: possible issue with bsd_poll() on Windows

2018-12-19 Thread John Dunn
On Monday, December 10, 2018 2:26 AM Andreas Schneider wrote: > Please check > > https://git.libssh.org/users/asn/libssh.git/log/?h=master-poll Same behavior, as far as I can tell. In the case of a connection refused exceptfds is set and events is 0x310 ( POLLWRNORM | POLLRDNORM | POLLRDBAND )

RE: possible issue with bsd_poll() on Windows

2018-12-06 Thread John Dunn
On Thursday, November 29, 2018 12:37 AM Andreas Schneider wrote: > I've pushed an update to the branch. Please check! That doesn't work. Fds[i].events ends up getting set to POLLRDBAND and since that ANDs with POLLHUP rc gets incremented to 1. From the comments it looks like ssh_poll_ctx_dopoll

RE: possible issue with bsd_poll() on Windows

2018-11-28 Thread John Dunn
On Tuesday, November 27, 2018 12:17 PM Andreas Schneider said: > I hope you understand ... :-) Oh I do - I appreciate your help. We develop a product that runs on both Linux and Windows so I understand the issues with cross platform development. It looks like adding the 2 WSA errors I mentioned

RE: possible issue with bsd_poll() on Windows

2018-11-27 Thread John Dunn
On Friday, November 23, 2018 12:54 PM Andreas Schneider said: > Can you take a look at: > > https://git.libssh.org/users/asn/libssh.git/log/?h=master-poll This code doesn't work - in the case where either the connection is refused ( WSAECONNREFUSED ) or times out ( WSAETIMEDOUT ) it continuously

RE: possible issue with bsd_poll() on Windows

2018-09-19 Thread John Dunn
On Wednesday, September 19, 2018 4:42 AM Andreas Schneider wrote: > Does the attach patch give you a useful error? Unfortunately no. At least on my machine ( Win 10 x64 ) I can't get strerror() to output anything but "Unknown error", even if I pass an error code like ECONNREFUSED directly in. I'

RE: possible issue with bsd_poll() on Windows

2018-09-12 Thread John Dunn
On: Monday, September 10, 2018 2:06 PM Andreas Schneider wrote: > Setting errno? As I said in my earlier email I tried that but errno is not checked in this path. The call stack is ssh.dll!bsd_poll(ssh_pollfd_struct * fds, unsigned long nfds, int timeout) Line 240 ssh.dll!ssh_p

RE: possible issue with bsd_poll() on Windows

2018-09-10 Thread John Dunn
I'm working on submitting a patch to fix this behavior in 0.8.2 and am still hoping to get some guidance on how best to propagate the error up from inside the bsd_poll() function up so the ssh_get_error can actual return a useful error message. Any ideas? -Original Message- From:

RE: Problem building 0.8.0 with VS 2015

2018-08-13 Thread John Dunn
On Monday, August 13, 2018 12:18 PM Andreas Schneider wrote: > This should fix it: > >https://git.libssh.org/users/asn/libssh.git/log/?h=master-fix I get the following error when loading the DLL. My guess is that the DLL_THREAD_ATTACH event is causing this issue. Initializing rc to 0 fixes the i

RE: Problem building 0.8.0 with VS 2015

2018-08-13 Thread John Dunn
On Monday, August 13, 2018 1:35 AM Andreas Schneider wrote: > Could you check if it works? Trying to build the master-constructor branch has the following error 2>C:\code\foo\libssh\include\libssh/priv.h(169): fatal error C1189: #error: "Your system must provide a __func__ macro" John

Problem building 0.8.0 with VS 2015

2018-08-10 Thread John Dunn
te__((destructor)) On Win32, defining as #define CONSTRUCTOR_ATTRIBUTE #define DESTRUCTOR_ATTRIBUTE Appears to fix the problem. I've attached a patch that addresses this issue. Please let me know if there is an issue with my change or if the patch is incorrectly formatted.

RE: possible issue with bsd_poll() on Windows

2018-07-06 Thread John Dunn
On Friday, July 6, 2018 12:22 AM Andreas Schneider wrote: > So I think this is what you need to do, setting the right errno > (ECONNREFUSED) for WSAECONNREFUSED and return -1. I don't think it's that simple. Given the code at the end of the bsd_poll loop that increments rc if any bits beyond PO

possible issue with bsd_poll() on Windows

2018-07-05 Thread John Dunn
I am seeing issues using non-blocking sockets on Windows. In particular, if I attempt to connect to either a non-reachable host or a host that doesn't have the specified port open the ssh_connect() call will never fail and will be stuck in a loop returning SSH_AGAIN. This same code behaves perfe

libssh + libevent documention / example?

2018-06-29 Thread John Dunn
I'm trying to integrate libssh into an existing libevent based application to allow my code to drive an remote shell. I'm have a couple of questions. - Is this possible? is there an example which shows how this might work? - I see the poll functions but I'm not sure how to integrate them wi