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

SSH server: Problem with polling of pipes created for reading stdout/stderr of child process using libssh API


Dear libssh community,

After two days of debugging, I turn to your advice for solving this issue.

The code for my SSH server, which is based on ssh_server_fork.c in the
examples directory:

https://pastebin.com/i5QLf1Gn

If the client requests either shell through a pty or execution of a command
line everything works OK, and the polling in the handle_session() functions
works as it should and receive input (when ready) from the client process
(in this case *sh*).

However, if I receive a shell without pty then after setting the pipes
properly and adding them to the event using ssh_event_add_fd() then nothing
happens in ssh_event_dopoll().

In the exec_nopty() function, I've commented out code that verifies that
the shell, indeed, outputs on the channel_data->child_stdin pipe.

What could be wrong in this case? Why doesn't polling the event show any
data available for reading on child_stdin or child_stderr, when everything
works in the case of a pty (or command-line execution using option -c)?

I would be grateful for an explanation.

Please, ask for more context/explanation if my description doesn't suffice.

Best regards,
Nicolas Lykke Iversen

Archive administrator: postmaster@lists.cynapses.org