Re: Server-side functions?

2018-06-22 Thread g4-lisz
+1 Any documentation would be much appreciated! On 22.06.2018 17:04, Martin Galvan wrote: > Hi all, > > Since there's no documentation on how to write server code using > libssh, could anyone point me in the right direction? > > My server should be rather simple: it has to accept an incoming SCP

Re: Problem building 0.8.0 with VS 2015

2018-08-13 Thread g4-lisz
Cannot open include file: 'pthread.h': No such file or directory On 13.08.2018 19:20, John Dunn wrote: > On Monday, August 13, 2018 11:03 AM Andreas Schneider wrote: >> Can you share CMakeFiles/CMakeError.log > I've attached CMakeError.log and CMakeOuput.log. I'm use VS 2015 if that > matters.

Re: LIBSSH Windows Installer

2018-07-11 Thread g4-lisz
"The certificate is only valid for milliways.cryptomilk.org." I think you can trust it On 11.07.2018 16:39, Sarah Magliocca wrote: > Hi, > > > I have been attempting to install libssh for quite some time now. The > Windows installer page has been broken for a few weeks. This week, I > tried

Re: LIBSSH Windows Installer

2018-07-11 Thread g4-lisz
... but it does not solve the problem: "Object not found! The requested URL was not found on this server" On 11.07.2018 17:22, g4-l...@tonarchiv.ch wrote: > "The certificate is only valid for milliways.cryptomilk.org." > > I think you can trust it > > > On 11.07.2018 16:39, Sarah Magliocca

Working on keepalive messages while waiting for local connection

2018-04-09 Thread g4-lisz
Hi there I wrote some basic ssh client to forward a port. This involves binding a local listening socket and waiting for an application to connect. But as long as there is nothing connected to the local socket, the client is not reading from or writing to the channel. This seems to be an issue as

Re: Working on keepalive messages while waiting for local connection

2018-04-11 Thread g4-lisz
Hello all I realized that SSH servers with the keep-alive option enabled first send the keep-alive _global_ request as long as nothing had connected to the local TCP socket: $> ssh -v -N xxx@yyy -L 8088:testcom.com:80     debug1: client_input_global_request: rtype keepal...@openssh.com

Re: Working on keepalive messages while waiting for local connection

2018-04-11 Thread g4-lisz
On 11.04.2018 17:31, Andreas Schneider wrote: > On Wednesday, 11 April 2018 16:27:16 CEST g4-l...@tonarchiv.ch wrote: >> Hello all >> >> I realized that SSH servers with the keep-alive option enabled first >> send the keep-alive _global_ request as long as nothing had connected to >> the local

Re: Working on keepalive messages while waiting for local connection

2018-04-14 Thread g4-lisz
On 11.04.2018 18:09, g4-l...@tonarchiv.ch wrote: > On 11.04.2018 17:31, Andreas Schneider wrote: >> ould appreciate a lot if someone could show me some sample code. >> I think that ssh_event_dopoll() will handle it and call the appropriate >> callback. Don't use ssh_select() >> >> In master we

Re: Working on keepalive messages while waiting for local connection

2018-04-14 Thread g4-lisz
On 14.04.2018 17:58, Andreas Schneider wrote: > On Saturday, 14 April 2018 15:55:20 CEST g4-l...@tonarchiv.ch wrote: >> On 11.04.2018 18:09, g4-l...@tonarchiv.ch wrote: >>> On 11.04.2018 17:31, Andreas Schneider wrote: ould appreciate a lot if someone could show me some sample code. I

Re: Working on keepalive messages while waiting for local connection

2018-04-14 Thread g4-lisz
On 14.04.2018 18:35, g4-l...@tonarchiv.ch wrote: > > On 14.04.2018 17:58, Andreas Schneider wrote: >> On Saturday, 14 April 2018 15:55:20 CEST g4-l...@tonarchiv.ch wrote: >>> On 11.04.2018 18:09, g4-l...@tonarchiv.ch wrote: On 11.04.2018 17:31, Andreas Schneider wrote: > ould appreciate

Re: Working on keepalive messages while waiting for local connection

2018-04-16 Thread g4-lisz
On 16.04.2018 11:27, Andreas Schneider wrote: > On Saturday, 14 April 2018 18:35:10 CEST g4-l...@tonarchiv.ch wrote: >> On 14.04.2018 17:58, Andreas Schneider wrote: >>> On Saturday, 14 April 2018 15:55:20 CEST g4-l...@tonarchiv.ch wrote: On 11.04.2018 18:09, g4-l...@tonarchiv.ch wrote:

Re: Help with OpenSSH Keep Alive

2018-04-25 Thread g4-lisz
ion(event, session) and later in the polling loop: ssh_event_dopoll(event, 10); I hope this helps! Till On 25.04.2018 14:25, Duff, Rob (Nokia - US/Plano) wrote: > The discussion thread sounds like it is what I need. > > I saw that g4-lisz was able to solve it by adding the session to the

Re: Sample Code for SSH Port Forwarding Server

2018-09-27 Thread g4-lisz
Thank you very much! This will help me a lot. I'll will try to do this for Windows - wish me luck ;)) Till On 25.09.2018 17:13, Skalák, Zdeněk wrote: > Hello, > > > On Tue, Sep 25, 2018 at 3:11 PM, > wrote: > > Hi there > > I need a stripped down / minimal

Re: Sample Code for SSH Port Forwarding Server

2018-09-30 Thread g4-lisz
Did you visit the GIT link of Zdenek? It seems that he got quite far with building a server... Or you are referring to port forwarding only? Till On 30.09.2018 15:28, Stefano Mtangoo wrote: > It'll be really great. Once I tried and got nowhere.  > > On Sun, Sep 30, 2018, 11:26 Andreas Schneider

Re: Sample Code for SSH Port Forwarding Server

2018-10-16 Thread g4-lisz
Hi I wanted to let you know that I have a working, very rough code for sshd, which accepts a local port forwarding and pipes it to stdout. I still have to add all the stuff for opening the net socket on the server side, and the polling for reading and writing back. But the first obstacle is

Re: Sample Code for SSH Port Forwarding Server

2018-10-19 Thread g4-lisz
Hello, I had to do the first steps by myself to understand what your code is doing.  But now it's a big help to improve my code and to steal some ideas... ;-) I made the mistake to start coding without reading any RFCs or other description of the SSH connection and channel open/close sequence.

Re: LIBSSH Windows Installer

2018-10-26 Thread g4-lisz
Hi all, I just found this project: https://github.com/ShiftMediaProject/libssh/releases It offers compiled libraries for Visual Studio. >From the README.markdown: "This repository contains code from the corresponding upstream project with additional modifications to allow it to be compiled

Re: Trouble isntalling libssh on windows

2018-11-07 Thread g4-lisz
Dear Anthony It would be incredible useful to others when you wrote a howto / step-by-step instruction for building libssh on Windows. I did not even manage to run cmake without errors... I will give it another try though as soon as I have some spare time. Cheers, Till On 07.11.18 04:08, antos

Re: libssh windows problem

2018-10-04 Thread g4-lisz
Can't you jsut add an exception to your browser (at least firefox...) to accept the wrong certificate? On 04.10.2018 11:56, Tilo Eckert wrote: > That is most likely a webserver misconfiguration. Opening > https://red.libssh.org yields SSL_ERROR_BAD_CERT_DOMAIN. The site > returns the certificate

Re: libssh windows problem

2018-10-04 Thread g4-lisz
Ignore my answer... Yes you can. But the files simply don't exist on the server. On 04.10.2018 14:34, g4-l...@tonarchiv.ch wrote: > Can't you jsut add an exception to your browser (at least firefox...) to > accept the wrong certificate? > > > On 04.10.2018 11:56, Tilo Eckert wrote: >> That is

Sample Code for SSH Port Forwarding Server

2018-09-25 Thread g4-lisz
Hi there I need a stripped down / minimal SSH server daemon with port forwarding functionality only. Does anybody know some sample code or a similar project using libssh? Cheers, Till

Re: Custom logging in libssh

2019-01-17 Thread g4-lisz
On 17.01.19 17:29, Andreas Schneider wrote: > On Thursday, January 17, 2019 5:02:24 PM CET g4-l...@tonarchiv.ch wrote: >> On 17.01.19 16:40, g4-l...@tonarchiv.ch wrote: >>> I try to accomplish two things: >>> >>> 1) My libssh client should run as a deamon. So logging should go to a file >>> 2) I

ssh_options_set value param outdated

2019-01-20 Thread g4-lisz
Hi there In options.c for function ssh_options_set(), the value @param annotation is outdated:  *  - SSH_OPTIONS_LOG_CALLBACK:  *    Set a callback to use your own logging function  *    (function pointer).  *  *  - SSH_OPTIONS_LOG_USERDATA:  * 

Re: Custom logging in libssh

2019-01-20 Thread g4-lisz
On 17.01.19 17:02, g4-l...@tonarchiv.ch wrote: > I just found  ssh_set_log_callback() , so gladly I was wrong and it's > not session-wise. But I think it still needs some sychnromization to > write to a file from several sessions? Hello again It seems that I have to set log callback and

Re: Custom logging in libssh

2019-01-19 Thread g4-lisz
On 17.01.19 18:57, g4-l...@tonarchiv.ch wrote: > On 17.01.19 17:29, Andreas Schneider wrote: >> On Thursday, January 17, 2019 5:02:24 PM CET g4-l...@tonarchiv.ch wrote: >>> On 17.01.19 16:40, g4-l...@tonarchiv.ch wrote: I try to accomplish two things: 1) My libssh client should run

Re: Quick n dirty sshd local TCP sample

2018-12-03 Thread g4-lisz
Hi Andreas, I can do this... Give me a few days. I used CVS and later SVN on SF for the last 10.. 15 years. Time to get used to GIT. ;-) Till On 30.11.18 20:14, Andreas Schneider wrote: > On Thursday, November 29, 2018 10:31:00 AM CET g4-l...@tonarchiv.ch wrote: >> Hi there, > Hi Till, > >>

Re: Create autocompletion interactive SSH shell

2018-12-10 Thread g4-lisz
Hi, this is task of the shell on the server side, not of SSH itself. All SSH does is forwarding the terminal. On 07.12.18 23:44, Alberto Garcia wrote: > Hi, > > How can I do to use libssh to create a server that allows > autocompletion using TAB when typing commands? > > Thank you > > -- >

Quick n dirty sshd local TCP sample

2018-11-29 Thread g4-lisz
Hi there, attached you find a sample code for a sshd which accepts direct TCP requests and opens a socket. Nothing else... Be warned! As already mentioned in the title, it's really quick'n'dirty: Hardly any error handling, no proper termination, no signal handling. Possible memory leaks But

Re: ssh remote enter simple txt

2018-11-19 Thread g4-lisz
If Cisco SSH allows you to execute commands remotely, you're barking up the right tree... In fact, you only need a ssh client and then you put something like that in your cron file: 04,37 * * * *  sshuser ssh root@cisco shutdown -r now My five cents... Till On 19.11.18 07:52, zi zu

Re: ssh remote enter simple txt

2018-11-19 Thread g4-lisz
Sorry, this does not solve the confirmation issue. The reboot command does not have a 'silent', 'force', -y or similar argent? Till On 19.11.18 13:26, g4-l...@tonarchiv.ch wrote: > If Cisco SSH allows you to execute commands remotely, you're barking up > the right tree... In fact, you only need

Re: Reading multiple channels under the same session

2019-01-24 Thread g4-lisz
On 24.01.19 21:12, Alberto Garcia wrote: > Hi, > > How can I read multiple new incoming channels under the same session > in a libssh server? I need this since when using dynamic port > forwarding and per every SOCKS5 request it creates a new channel as > you can see in this log (gotten with

Re: Reading multiple channels under the same session

2019-01-26 Thread g4-lisz
Hi Alberto Glad I could help! I advice to not use the code in production without having tested it extensiveley. I did not check for memory leaks. If you made any improvements to the code, I would appreciate when you post them here. Cheers, Till On 25.01.19 23:46, Alberto Garcia wrote: > Hi, >

Re: Issues with Connector on net sockets

2019-01-27 Thread g4-lisz
On 24.01.19 15:56, g4-l...@tonarchiv.ch wrote: > First of all: Is this supposed to work with more than one channel in a > single event loop? > Short answer: NO. Longer answer: I don't know if it was supposed to work, but it doesn't. At least it does not work when connectors are removed who

Re: Issues with Connector on net sockets

2019-01-28 Thread g4-lisz
On 27.01.19 19:10, g4-l...@tonarchiv.ch wrote: > > On 24.01.19 15:56, g4-l...@tonarchiv.ch wrote: > >> First of all: Is this supposed to work with more than one channel in >> a single event loop? >> > Short answer: NO. > > Longer answer: I don't know if it was supposed to work, but it doesn't. >

Bugfix T124 connector: Fallback on the socket output callback leads to SIGSEGV

2019-03-24 Thread g4-lisz
Hi there, The commit https://git.libssh.org/projects/libssh.git/commit/?id=b73ffb3f91ea26412482d145512e4261df903df7 to fix ticket T124 introduces a new issue. On certain constellations, calling ssh_event_dopoll() leads to a SIGSEGV: #0  0x0090 in ?? () #1  0x77b6c272 in

Re: Bugfix T124 connector: Fallback on the socket output callback leads to SIGSEGV

2019-03-24 Thread g4-lisz
On 24.03.19 12:49, g4-l...@tonarchiv.ch wrote: > Hi there, > > The commit > https://git.libssh.org/projects/libssh.git/commit/?id=b73ffb3f91ea26412482d145512e4261df903df7 > to fix ticket T124 introduces a new issue. > > On certain constellations, calling ssh_event_dopoll() leads to a SIGSEGV: > >

[patch]: Stop connector socket-to-channel EOF flooding

2019-04-01 Thread g4-lisz
Hi there, I'm using connectors for a direct-tcp client. So this creates two connectors FD in --> channel out and vice versa. Now when the socket forwarding peer (not the ssh server) closes the connection, i.e. reading on the socket returns 0 = EOF, we end up in some loop with sending EOFs on the

ssh_pki_import_pubkey_file checks for OPENSSH_HEADER_BEGIN

2019-02-24 Thread g4-lisz
... which IMHO does not make much sense: #define OPENSSH_HEADER_BEGIN "-BEGIN OPENSSH PRIVATE KEY-" So if we import a public key this code block will never be used:     /* Test for new OpenSSH key format first */     cmp = strncmp(key_buf, OPENSSH_HEADER_BEGIN,

How to read authorized_keys

2019-02-24 Thread g4-lisz
Hi there, Correct me if I'm wrong: There's no method in libssh to read authorized_keys, i.e. more than one key from a file? The nearest we get is ssh_pki_import_pubkey_file() - but this returns only the first key in file... Maybe someone has already written an auth_pubkey_function callback to

Re: vcpkg libssh 0.8.x version isn't available

2019-02-28 Thread g4-lisz
On 28.02.19 10:10, Tilo Eckert wrote: > Since you are already building on Linux, you could cross-compile your > desired version of libssh for Windows using MingW GCC I can confirm that this works fine. And you need less switches in the code for Windows, because MinGW also supports pthreads for

Re: Issues with channel callbacks

2019-02-25 Thread g4-lisz
On 25.02.19 11:18, Tilo Eckert wrote: > 3) My data callback is executed exactly once for every received channel > data packet. I think this should be changed to be more user-friendly: > The data callback should be executed repeatedly until it consumed all > available bytes or 0 (i.e. the callback

Re: ssh_pki_import_pubkey_file checks for OPENSSH_HEADER_BEGIN

2019-02-25 Thread g4-lisz
On 25.02.19 09:57, Jakub Jelen wrote: > On Sun, 2019-02-24 at 18:38 +0100, g4-l...@tonarchiv.ch wrote: >> ... which IMHO does not make much sense: >> >> #define OPENSSH_HEADER_BEGIN "-BEGIN OPENSSH PRIVATE KEY-" >> >> So if we import a public key this code block will never be used: >> >>

Re: Issues with channel callbacks

2019-02-25 Thread g4-lisz
On 25.02.19 11:51, g4-l...@tonarchiv.ch wrote: > At least this is how I understand it... ... and I have to admit that I don't have any knowledge of the buffering mechanisms in libssh...

Re: Server API: How to communicate connection failures to client

2019-02-22 Thread g4-lisz
On 22.02.19 01:15, g4-l...@tonarchiv.ch wrote: > On 21.02.19 19:32, Stef Bon wrote: > >> Hi, >> I've written my own ssh client, and a sftp server. >> >> The client can connect to the sftp server via a socket (using >> direct-streamlo...@openssh.com).Now my client get's a >>

[patch] ssh_event_dopoll returns SSH_AGAIN annotation

2019-02-25 Thread g4-lisz
Hi there, Just a small addition to the ssh_event_dopoll() annotations: It can also return SSH_AGAIN. Cheers, Till >From 860079f22f5f7ae38c28d6783af97c1d4289d2d8 Mon Sep 17 00:00:00 2001 From: Till Wimmer Date: Mon, 25 Feb 2019 17:09:45 +0100 Subject: [PATCH] ssh_event_dopoll can also return

Re: Server API: How to communicate connection failures to client

2019-02-21 Thread g4-lisz
On 21.02.19 19:32, Stef Bon wrote: > Hi, > I've written my own ssh client, and a sftp server. > > The client can connect to the sftp server via a socket (using > direct-streamlo...@openssh.com).Now my client get's a > SSH_MSG_CHANNEL_OPEN_FAILURE msg when the sftp server is not running > (and

Re: [BUG] ssh_bind_listen() does not fail in windows when port is in use

2019-03-21 Thread g4-lisz
On 22.03.19 00:15, Alberto Garcia wrote: > The socket has the SO_REUSEADDR so it does not fail when it is in use. > I don't know why that's set. Does anyone knows what is the intention > of it? Look here: https://stackoverflow.com/questions/577885/what-are-the-use-cases-of-so-reuseaddr I think

Re: [BUG] ssh_bind_listen() does not fail in windows when port is in use

2019-03-21 Thread g4-lisz
Ok, but in case of a restart, you have to wait quite a while. I don't know what's the equivalent of lock files in Windows. But maybe you wrap it as a service - then you can't start it twice at least. But still, another application could open a socket for the same address / port of course... > >

Re: libssh Installation

2019-02-06 Thread g4-lisz
On 06.02.19 15:45, Andreas Schneider wrote: > On Wednesday, February 6, 2019 1:39:45 PM CET Bijnen, Jeroen van (Calco) > wrote: >> Dear LibSSH, > Hi Jeroen, > >> I've read the GIT guide, and it describes the requirements of libssh, I've >> attempted to install CMake and such on my Windows 10,

Re: [BUG] Recursion crash when calling ssh_channel_write()

2019-02-13 Thread g4-lisz
On 14.02.19 01:22, Alberto Garcia wrote: > Forgot to add the callstack so you understand the code path the > execution takes when calling  *ssh_channel_write*() .  > *my_fd_data_function*  is the callback set with  ssh_event_add_fd() >         [crash] >         [.. more...] >  

Re: [patch] SIGSEGV when adding Connector to Event

2019-02-11 Thread g4-lisz
On 30.01.19 15:33, g4-l...@tonarchiv.ch wrote: > Hi all, > > You finally find the test code attached. It's a bit complicated, but > it can reproduce the issue: > > 1. Connect to an ssh server which supports direct socket tunnelling: > > > ./multichannelfw root myserver.com 22 > > This opens a

Re: [patch] SIGSEGV when adding Connector to Event

2019-02-11 Thread g4-lisz
On 11.02.19 09:04, g4-l...@tonarchiv.ch wrote: > Hi there > > Could someone reproduce this? You need something else to accept the patch? > Ignore this mail... I should check Git more often :-))

Re: [patch] added direct-tcpip server example

2019-02-11 Thread g4-lisz
On 05.02.19 02:08, g4-l...@tonarchiv.ch wrote: > He there, > > The patch adds an example implementation of a simple direct-tcpip > server. It's single thead, for one client with simultaneous forward > channels. You need something else to approve this new sample? Cheers, Till

Re: Server API: How to communicate connection failures to client

2019-02-10 Thread g4-lisz
On 06.02.19 17:41, g4-l...@tonarchiv.ch wrote: > Hi there, > > My server implementation accepts direct-tcpip requests. > > In the message CB function, after receiving a message of type > SSH_REQUEST_CHANNEL_OPEN, subtype SSH_CHANNEL_DIRECT_TCPIP, we try to > open a local socket. If this is

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

[patch] SIGSEGV when adding Connector to Event

2019-01-28 Thread g4-lisz
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 real code later): event = ssh_event_new(); /* ADD FIRST connector pair (in/out) */ ssh_connector in1 =

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

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

Re: Reading multiple channels under the same session

2019-01-25 Thread g4-lisz
On 24.01.19 22:09, Alberto Garcia wrote: > Can you please post the link to the mentioned code? > Thanks Here you go. Till > > On Thu, Jan 24, 2019, 12:47 PM wrote: > > On 24.01.19 21:12, Alberto Garcia wrote: > > > Hi, > > > > How can I read

Re: ssh_options_set value param outdated

2019-01-24 Thread g4-lisz
On 20.01.19 14:41, g4-l...@tonarchiv.ch wrote: > Hi there > > In options.c for function ssh_options_set(), the value @param annotation > is outdated: > >  *  - SSH_OPTIONS_LOG_CALLBACK: >  *    Set a callback to use your own logging function >  *    (function

Re: Issues with Connector on net sockets

2019-01-25 Thread g4-lisz
On 24.01.19 15:56, g4-l...@tonarchiv.ch wrote: > Hi there > > I rewrote my socket forward client code so it uses the "new" connector > API now. But sadly there are a few issues. > > First of all: Is this supposed to work with more than one channel in a > single event loop? > > Here some pseudo

Issues with Connector on net sockets

2019-01-24 Thread g4-lisz
Hi there I rewrote my socket forward client code so it uses the "new" connector API now. But sadly there are a few issues. First of all: Is this supposed to work with more than one channel in a single event loop? Here some pseudo code to understand what I'm doing: id =0; ope_cnt=0; do {

Re: [patch] SIGSEGV when adding Connector to Event

2019-01-30 Thread g4-lisz
Hi all, You finally find the test code attached. It's a bit complicated, but it can reproduce the issue: 1. Connect to an ssh server which supports direct socket tunnelling: > ./multichannelfw root myserver.com 22 This opens a local listening port at 20021 2. Open two or more simultaneous ssh

Re: Reading multiple channels under the same session

2019-01-30 Thread g4-lisz
On 30.01.19 22:50, Alberto Garcia wrote: > Hi, > > what about waiting to call ssh_event_remove_fd() > until my_channel_close_function() is reached? We have to remove the socket fd from the poll event in the same loop round when it's closed. We should avoid polling on a closed handle. It's all a

Re: Reading multiple channels under the same session

2019-01-30 Thread g4-lisz
I think we face two different problems: One is related to my shaky code only. But the second one could be indeed related to polling and blocking on Windows. Till On 30.01.19 19:18, Alberto Garcia wrote: > We think it is because of a problem with libssh. Andreas maybe you can > bring some light

Re: Reading multiple channels under the same session

2019-01-30 Thread g4-lisz
I have found the issue. And I have an idea how to solve it... But it needs a bit of a redesign of the whole channel / data handling. The problem is that I call  ssh_event_remove_fd() in the callback function, which in turn de-registers this very callback function... This could have worked in a

Re: Reading multiple channels under the same session

2019-01-30 Thread g4-lisz
On 30.01.19 20:09, Alberto Garcia wrote: > Andreas, You can use Till example in this thread along with this > commands for the  ssh client: >  ssh -vvv -o StrictHostKeyChecking=no -D 0.0.0.0:11223 >  10.104.1.115 -p -N > > and to make it crash just run: > > import

Re: [patch] SIGSEGV when adding Connector to Event

2019-02-02 Thread g4-lisz
Hi Andreas, did you test it? It would be great if this patch could go to the lib. At the moment I have to statically link my ssh app with my own libssh version... Cheers, Till On 30.01.19 15:33, g4-l...@tonarchiv.ch wrote: > > Hi all, > > You finally find the test code attached. It's a bit

Re: Reading multiple channels under the same session

2019-01-30 Thread g4-lisz
till@elite:~/libssh$ ssh user@localhost -p2022 -D 11223 -N user@localhost's password: accept: Too many open files accept: Too many open files accept: Too many open files I call this a success... Don't ask me how many sessions were open at the same time. But it's probably also because not all

Re: Reading multiple channels under the same session

2019-01-30 Thread g4-lisz
On 30.01.19 09:27, Andreas Schneider wrote: > On Friday, January 25, 2019 3:26:10 PM CET g4-l...@tonarchiv.ch wrote: >> On 24.01.19 22:09, Alberto Garcia wrote: >>> Can you please post the link to the mentioned code? >>> Thanks >> Here you go. > Hi Till, > > if you send it as a patch I'm happy to

When it's safe to free callback userdata for channels and events?

2019-02-04 Thread g4-lisz
Hi there, In my server application several channels are handled simultaneously. Each channel has his individual CB function set with userdata, which is allocated at runtime (malloc). The server keeps running for an undefined time, so the allocated memory should be freed individually per channel

[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

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

[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: Quick n dirty sshd local TCP sample

2019-01-24 Thread g4-lisz
On 24.01.19 17:06, Andreas Schneider wrote: > On Monday, 3 December 2018 17:31:02 CET g4-l...@tonarchiv.ch wrote: >> Hi Andreas, >> >> I can do this... Give me a few days. I used CVS and later SVN on SF for >> the last 10.. 15 years. Time to get used to GIT. ;-) > Did you already send a patch or

Re: When it's safe to free callback userdata for channels and events?

2019-02-04 Thread g4-lisz
On 04.02.19 13:04, g4-l...@tonarchiv.ch wrote: > After one side has sent a EOF on a channel, I run ssh_channel_close() > and then test in the main event loop for ssh_channel_is_closed(). When > it's considered closed, I run ssh_channel_free(). > > Now the problem is that

Re: [patch]: Stop connector socket-to-channel EOF flooding

2019-04-08 Thread g4-lisz
On 01.04.19 13:29, g4-l...@tonarchiv.ch wrote: > Hi there, > > I'm using connectors for a direct-tcp client. So this creates two > connectors FD in --> channel out and vice versa. > > Now when the socket forwarding peer (not the ssh server) closes the > connection, i.e. reading on the socket

Re: ssh_connect issue "Couldn't apply options"

2019-04-10 Thread g4-lisz
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.

Re: ssh_channel_read seems to randomly close the channel

2019-05-26 Thread g4-lisz
Hi Alex I dont't have an answer. But please consider that this behavior can depend a lot on both sides of the connection. So please enable debugging / high verbosity also on the server side. Without knowing what's going on there it's hard to find out where the problem is. I'm not sure, but I

Re: [PATCH] Don't send EOF on channel more than once

2019-04-27 Thread g4-lisz
On 09.04.19 15:59, g4-l...@tonarchiv.ch wrote: > Attached you find a patch for channels.c which prevents sending EOF on a > channel more then once. > > Please comment. > > Till Hi there It's been a while, and wonder if this patch is under review... Also my other ones: "ssh_options_set

Re: ssh_connect issue "Couldn't apply options"

2019-04-09 Thread g4-lisz
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.

Re: [patch]: Stop connector socket-to-channel EOF flooding

2019-04-09 Thread g4-lisz
On 09.04.19 10:03, Tilo Eckert wrote: > Am 08.04.2019 um 20:54 schrieb g4-l...@tonarchiv.ch: >>> I'm using connectors for a direct-tcp client. So this creates two >>> connectors FD in --> channel out and vice versa. >>> >>> Now when the socket forwarding peer (not the ssh server) closes the >>>

Re: [patch]: Stop connector socket-to-channel EOF flooding

2019-04-09 Thread g4-lisz
On 09.04.19 11:50, g4-l...@tonarchiv.ch wrote: > On 09.04.19 10:03, Tilo Eckert wrote: >> Your callback sends an EOF for every received EOF from the server. If >> your server does the same, you end up with EOF ping pong. You might want >> to check whether you already sent it before:

[PATCH] Don't send EOF on channel more than once

2019-04-09 Thread g4-lisz
Attached you find a patch for channels.c which prevents sending EOF on a channel more then once. Please comment. Till >From f8651e1831cf5273a3de2d22e2f4d7edf0fb457a Mon Sep 17 00:00:00 2001 From: Till Wimmer Date: Tue, 9 Apr 2019 15:57:03 +0200 Subject: [PATCH] Don't send EOF on channel more

[patch] ssh_options_set annotations: SSH_OPTIONS_PORT is pointer to int

2019-04-09 Thread g4-lisz
Hi there, a small patch to correct the ssh_options_set() param annotation for SSH_OPTIONS_PORT. Cheers, Till >From 1673002767e2231b7633fbd95671312685e3ed34 Mon Sep 17 00:00:00 2001 From: Till Wimmer Date: Tue, 9 Apr 2019 12:56:39 +0200 Subject: [PATCH] ssh_options_set annotations:

Re: [patch]: Stop connector socket-to-channel EOF flooding

2019-04-09 Thread g4-lisz
On 09.04.19 11:50, g4-l...@tonarchiv.ch wrote: > check whether you already sent it before: channel->local_eof != 0 BTW channel properties are not exposed to client code. So maybe this check should be added directly to channel_send_eof()?

Re: Multithreading with libssh

2019-09-26 Thread g4-lisz
H Simon, OK I understand now what you want to do. But I doubt that several threads in parallel are faster when each thread has to open the session. This is a lot of communication overhead, when it's to the same destionation. Last but not least it also depends on how the server side handles these

Re: Multithreading with libssh

2019-09-26 Thread g4-lisz
Hi Simon. You want to open the 1500 channels simultaneously? If not, then why you need more than one thread? And each channel is to a different destination? If not, then why opening a new session each time? You can't share the session between threads, but you can re-use it... IMHO it's simpler

Re: using ssh_channel_write for command execution problem

2019-11-07 Thread g4-lisz
On 07.11.19 15:27, Karah Sekir wrote: > Hi Andreas, > > I tried with ssh_channel_exec() (removing the PTY) and I am getting > the same behaviour. > > I should also mention, that I am executing the executable from within > a docker container. The libssh logs show as if everything would be > sent

Re: Simple non-interactive shell

2019-11-26 Thread g4-lisz
On 25.11.19 12:04, Aloys Delobel wrote: > Hi everybody, > I'm trying to set a simple non-interactive shell, between my program > (which sends commands to the remote shell) and the server. Here's my > program : > [.] > And the problem is : the line "pass_instruction(channel, MV_FILE, >

Re: Simple non-interactive shell

2019-11-28 Thread g4-lisz
On 28.11.19 09:09, Aloys Delobel wrote: > Hi, > thanks for your help ! However, when I add the while loop (as in the > tutorial, the program stops there). Any ideas ? Moreover, I don't really need > the result of the remote command for now... (just hope there won't be any > errors :) ) I

Re: asynchronous channel write

2020-01-25 Thread g4-lisz
On 15.01.20 23:45, Torsten Kuehnel wrote: > On Wed, 15 Jan 2020 00:53:51 +0100 > g4-l...@tonarchiv.ch wrote: > >> On 13.01.20 22:54, Torsten Kuehnel wrote: >> >>> Looks to me your loop does not cope with partial writes correctly as >>> you pass the initial (channel, buf, len) parameters

Re: Strange Segfault with V 0.9.3 an MinGW Cross Compile

2020-01-15 Thread g4-lisz
On 15.01.20 08:27, Andreas Schneider wrote: > On Wednesday, 15 January 2020 01:22:13 CET g4-l...@tonarchiv.ch wrote: >> I cross compiled V 0.9.3 with MinGW on Ubuntu. The compilation worked >> flawlessly. >> >> But when I run my code linked to the resulting libssh.dll, it crashes >> immediately

[patch] Use inttypes macros for size_t format string

2020-01-15 Thread g4-lisz
Hi there, here's a patch for fixing a printf format string issue when compiling with MinGW (and possibly other "architectures"...). A big thanks to Zdenek OGAR Skalak for the hint! Till >From 0ba494ba61269478a3a822610e18ef66395ef656 Mon Sep 17 00:00:00 2001 From: Till Wimmer Date: Wed, 15 Jan

Re: [patch] Use inttypes macros for size_t format string

2020-01-15 Thread g4-lisz
On 15.01.20 14:35, Jakub Jelen wrote: > On Wed, 2020-01-15 at 13:01 +0100, g4-l...@tonarchiv.ch wrote: >> Hi there, here's a patch for fixing a printf format string issue when >> compiling with MinGW (and possibly other "architectures"...). >> >> A big thanks to Zdenek OGAR Skalak for the hint! >

[patch ] (Now complete) Use inttypes macros for size_t format string

2020-01-15 Thread g4-lisz
Hi there, I changed all `%zu` into `PRIuS` makro. Compiles on Linux glibc and MinGW... My server linked against the MinGW lib / DLL works fine. I didn't do more tests though. Should be tested on real Win, OS X, and ... ? Best regards, Till >From 9253a8609f1716b8c5173822710d3c7710af51f7 Mon

Re: Strange Segfault with V 0.9.3 an MinGW Cross Compile

2020-01-15 Thread g4-lisz
Hi, On 15.01.20 10:02, Skalák, Zdeněk wrote: > Hello, > > On Wed, Jan 15, 2020 at 9:48 AM > wrote: > > On 15.01.20 08:27, Andreas Schneider wrote: > > > On Wednesday, 15 January 2020 01:22:13 CET g4-l...@tonarchiv.ch >

Linking issue when using MinGW with Posix Threads

2020-01-16 Thread g4-lisz
Hi there, cmake detects pthreads and compiling goes well. But on linking, there are unresolved references: CMakeFiles/ssh.dir/objects.a(pthread.c.obj):pthread.c:(.text+0x43): undefined reference to `pthread_mutex_destroy' ... and so on. This can be solved by adding `-lpthread `at the end of

Re: [patch] Use inttypes macros for size_t format string

2020-01-16 Thread g4-lisz
On 16.01.20 13:41, Andreas Schneider wrote: > On Thursday, 16 January 2020 12:30:24 CET Jakub Jelen wrote: > It's not really a compiler bug. See here: > https://stackoverflow.com/questions/44382862/how-to-printf-a-size-t-wi > thou > t-> warning-in-mingw-w64-gcc-7-1 According

Re: asynchronous channel write

2020-01-13 Thread g4-lisz
Hi Torsten, the "trick" is called ssh_set_blocking(session, 0); But be careful, this affects everything in the session. My write loop looks lile this:     blocking = ssh_is_blocking(session);     ssh_set_blocking(session, 0);     if (len > 0) {     if (ssh_channel_is_open(channel)) {  

  1   2   >