Re: Windows threads with libssh

2019-01-29 Thread Andreas Schneider
On Tuesday, 29 January 2019 03:21:24 CET Alberto Garcia wrote: > Hi, > > I've read the info at http://api.libssh.org/master/libssh_tutor_threads.html > . > > I'm writing a program that uses libssh and implements a shell and SOCKS > capabiliities(SSH_CHANNEL_DIRECT_TCPIP). > > When using ssh -D .

[patch] ssh_options_set value param outdated

2019-01-29 Thread g4-lisz
Hi all, Attached you find the patch to remove the outdated annotations in options.c Regards, Till >From cea3216eb7040351f04bca536285a36bf732432c Mon Sep 17 00:00:00 2001 From: Till Wimmer Date: Tue, 29 Jan 2019 10:21:07 +0100 Subject: [PATCH] Removed outdated param annotations of ssh_options_se

Re: [patch] SIGSEGV when adding Connector to Event

2019-01-29 Thread g4-lisz
On 29.01.19 09:49, Andreas Schneider wrote: > On Monday, 28 January 2019 23:10:09 CET g4-l...@tonarchiv.ch wrote: >> Hi all >> >> There's a bug in the connector API when subsequently adding to and >> removing connectors from an event loop. >> >> Here's some dummy code to reproduce it (I will add r

Re: [patch] SIGSEGV when adding Connector to Event

2019-01-29 Thread Andreas Schneider
On Tuesday, 29 January 2019 12:05:28 CET g4-l...@tonarchiv.ch wrote: > On 29.01.19 09:49, Andreas Schneider wrote: > > On Monday, 28 January 2019 23:10:09 CET g4-l...@tonarchiv.ch wrote: > >> Hi all > >> > >> There's a bug in the connector API when subsequently adding to and > >> removing connecto

[patch] ssh_handle_packets_termination() ignores timeout=0

2019-01-29 Thread g4-lisz
Hi there, I found some logic in ssh_handle_packets_termination() which probably should be a different: int ssh_handle_packets_termination(ssh_session session,    long timeout,    ssh_termination_function fct,

Re: Reading multiple channels under the same session

2019-01-29 Thread Alberto Garcia
Hi Till, I was finally able to adapt your code to make it work with mine. So now I get a channel per every socks connection i'm trying to do and it works fine and I can proxy through the session (created with -D). the problem that I'm facing is that the proxy doesn't work when used proxying the tr

Re: Reading multiple channels under the same session

2019-01-29 Thread g4-lisz
Hi Alberto On 29.01.19 20:58, Alberto Garcia wrote: > Hi Till, > > I was finally able to adapt your code to make it work with mine. So > now I get a channel per every socks connection i'm trying to do and it > works fine and I can proxy through the session (created with -D). the > problem that I'

Re: Reading multiple channels under the same session

2019-01-29 Thread Alberto Garcia
Hi, First of all I want to clarify that I'm doing my tests in Windows so I had to adapt the code to work in it (I modified the minimum possible from your code). I'm worried that the problem may be in the windows support of libssh. I've been able to reproduce in a "consistent" way the crash. I wro

Re: Reading multiple channels under the same session

2019-01-29 Thread g4-lisz
On 29.01.19 23:23, Alberto Garcia wrote: > Hi, > > First of all I want to clarify that I'm doing my tests in Windows so I > had to adapt the code to work in it (I modified the minimum possible > from your code). I'm worried that the problem may be in the windows > support of libssh.  > > I've been

Re: Reading multiple channels under the same session

2019-01-29 Thread g4-lisz
On 29.01.19 22:50, g4-l...@tonarchiv.ch wrote: > Why at cb_readsock do you ssh_set_blocking(session, 0);? I revised my code... Actuall this setting to non-blocking is essential to make it work for more than one channel without threads. If ssh_channel_write() would block, the main loop would stal

[PATCH] libcrypto: reorder valgrind.h include

2019-01-29 Thread Jon Simons
Before this change on my local system, libcrypto.c will fail to build citing problems with `__unused__`. After moving the header up, I no longer encounter the error. Signed-off-by: Jon Simons --- src/libcrypto.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/

[PATCH 0/2] pki: fix one segfault and some memory leaks

2019-01-29 Thread Jon Simons
Here are two fixes for the pki area. The first resolves a potential segfault, and the second plugs some memory leaks which could be encountered in some error paths. Also available here: * https://github.com/simonsj/libssh/tree/simonsj/patch/1-29-2019/pki-fixes * https://gitlab.com/simonsj1/li

[PATCH 1/2] pki: NULL check pki_signature_from_rsa_blob result

2019-01-29 Thread Jon Simons
Check for a potential NULL result from `pki_signature_from_rsa_blob` in `pki_signature_from_blob`. Otherwise the following `sig->type_c` will result in a segfault. Introduced in 7f83a1efae6a7da19e18268d6298fc11b4e68c57. Signed-off-by: Jon Simons --- src/pki_crypto.c | 3 +++ src/pki_mbedcr

[PATCH 2/2] pki_crypto: plug pki_signature_from_blob leaks

2019-01-29 Thread Jon Simons
In 3341f49a49a07cbce003e487ef24a2042e800f01, some direct assignments to OpenSSL structures was replaced with usage of getter and setter macros. Ensure to `bignum_safe_free` a couple of intermediate values in error paths for `pki_signature_from_blob` DSS and ECDSA cases. Signed-off-by: Jon Simons

[PATCH 4/4] dh: harden error handling in 'ssh_dh_init_common'

2019-01-29 Thread Jon Simons
Harden the error path in 'ssh_dh_init_common' such that all potential allocations are free'd upon exit. Signed-off-by: Jon Simons --- src/dh.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/dh.c b/src/dh.c index b4b988d9..c40aef5a 100644 --- a/src/dh.c +++ b/src/dh.c @@ -350,6 +350,9

[PATCH 2/4] dh-gex: fix double-ssh_dh_init_common memory leak

2019-01-29 Thread Jon Simons
Fix a memory leak whereby the x, y, and k bignum fields within a session's next_crypto structure were being unintentionally initialized twice. The leak can be seen before the fix with valgrind and the pkd tests with: valgrind \ --leak-check=full \ --show-leak-kinds=definite \

[PATCH 3/4] dh: plug pubkey_blob leak in ssh_server_dh_process_init

2019-01-29 Thread Jon Simons
Ensure to `SSH_STRING_FREE` the pubkey_blob local in `ssh_server_dh_process_init`. The leak can be seen with valgrind and the pkd tests with: valgrind \ --leak-check=full \ --show-leak-kinds=definite \ ./pkd_hello -i1 -t torture_pkd_openssh_rsa_rsa_diffie_hellman_group14_sha

[PATCH 1/4] dh-gex: fix moduli file stream leak

2019-01-29 Thread Jon Simons
Ensure to close the moduli file stream in `ssh_retrieve_dhgroup`. The leak is observable with the pkd tests and valgrind with: valgrind \ --track-fds=yes \ ./pkd_hello -i1 \ -t torture_pkd_openssh_rsa_rsa_diffie_hellman_group_exchange_sha256 Signed-off-by: Jon Simons --- s

[PATCH 0/4] dh-gex + dh: fix a couple of leaks

2019-01-29 Thread Jon Simons
Included here are some patches to the dh-gex and dh areas to fix a few leaks and harden some error handling. Also available here: * https://github.com/simonsj/libssh/tree/simonsj/patch/1-29-2019/dh-fixes * https://gitlab.com/simonsj1/libssh-mirror/tree/simonsj/patch/1-29-2019/dh-fixes Jon Simo

unsubscribe

2019-01-29 Thread zhengfish
On Wed, Jan 30, 2019 at 10:13 AM Jon Simons wrote: > Included here are some patches to the dh-gex and dh areas to fix > a few leaks and harden some error handling. > > Also available here: > * https://github.com/simonsj/libssh/tree/simonsj/patch/1-29-2019/dh-fixes > * > https://gitlab.com/simon