Hi,
We are using the latest version of libssh (0.9.0) to create a local ssh server
in our codebase. However, we are having issues with the client, which uses
libssh2 (1.9.0), reading data from the server. We run this issue on multiple
distros, including Centos 6, Centos 7, Red Hat 6, Red Hat 7, Ubuntu 14.04,
Ubuntu 16.04, Ubuntu 18.04, Debian 8, Debian 9, SUSE LE 12. But this issue
arises primarily on Ubuntu 18.04, Debian 9 and SUSE LE 12. We also ported the
libssh2 client to libssh aswell, but the same issue still arose.
We narrowed down the issue in the “packet.c” source file in the function
“ssh_packet_register_socket_callback”. If we change
session->socket_callbacks.controlflow=ssh_packet_socket_controlflow_callback
to
session->socket_callbacks.controlflow = session->client ?
ssh_packet_socket_controlflow_callback : NULL
to only call it on the client, it works fine for us. But we’re not certain if
this workaround is viable. Can you provide any help?
Here is some extra debugging info from the ssh server on gdb:
(gdb) bt full
#0 0x0000000000000090 in ?? ()
No symbol table info available.
#1 0x0000555555588fbf in ssh_packet_socket_controlflow_callback (code=2,
userdata=0x55555580c690)
at /home/aaron/Domino/external/libssh/src/packet.c:1384
i = 0x5555558185e0
cb = 0x5555558150c0
session = 0x55555580c690
it = 0x555555814f70
channel = 0x555555815440
__func__ = "ssh_packet_socket_controlflow_callback"
#2 0x00005555555954a6 in ssh_socket_pollcallback (p=0x55555580dbf0, fd=4,
revents=4,
v_s=0x555555810290) at /home/aaron/Domino/external/libssh/src/socket.c:359
len = 0
s = 0x555555810290
buffer =
"\274\317\034\304]+l\304{\304\357W5>6\371\033\243\314\320'\235\363\372\064LVO\305\b\321\360\006\263\307\026\306\062\207\371\002\223\223\301\361+\261\263\230\037\376\063\032\064\372E\\f\366\237\020\230\302Iq\371\255\001\374B\265\023\017z\353\225\370\261Sd>J\325(H\032\b\305\021\346\233\311\356\066+\004\306Vܸ\375\003\364\250\361D\331_aV\033l`\314\377\377\377\177\000\000\020YO\366\377\177\000\000\001\200\255\373a2-n`\314\377\377\377\177\000\000`\314\377\377\377\177\000\000`\314\377\377\377\177\000\000`\314\377\377\377\177\000\000z\314\377\377\377\177\000\000\337\314\377\377\377\177\000\000`\314\377\377\377\177\000\000\337\314\070\070\067\065\066\066\000"...
nread = 0
rc = 0
err = 0
errlen = 4
__func__ = "ssh_socket_pollcallback"
#3 0x00005555555927b1 in ssh_poll_ctx_dopoll (ctx=0x555555811660, timeout=1000)
at /home/aaron/Domino/external/libssh/src/poll.c:702
ret = 0
rc = 1
i = 0
used = 2
p = 0x55555580dbf0
fd = 4
revents = 4
ts = {seconds = 11917, useconds = 198958}
#4 0x0000555555592c70 in ssh_event_dopoll (event=0x555555815030, timeout=1000)
at /home/aaron/Domino/external/libssh/src/poll.c:963
rc = 21845
#5 0x000055555556d156 in main ()
No symbol table info available.
(gdb) f 1
#1 0x0000555555588fbf in ssh_packet_socket_controlflow_callback (code=2,
userdata=0x55555580c690)
at /home/aaron/Domino/external/libssh/src/packet.c:1384
1384 ssh_callbacks_execute_list(channel->callbacks,
(gdb) p *cb
$1 = {size = 136, userdata = 0x5555558185a0,
channel_data_function = 0x55555556be11
<copy_channel_to_fd(ssh_session_struct*, ssh_channel_struct*, void*, unsigned
int, int, void*)>, channel_eof_function = 0x0, channel_close_function = 0x30,
channel_signal_function = 0x30, channel_exit_status_function = 0x555555814b70,
channel_exit_signal_function = 0x2767ec47e2d143c3,
channel_pty_request_function = 0xfa053776daf43a53,
channel_shell_request_function = 0x924d5d1d963e81ff,
channel_auth_agent_req_function = 0x60,
channel_x11_req_function = 0x30, channel_pty_window_change_function =
0x555555812430,
channel_exec_request_function = 0x5555555c2c19, channel_env_request_function
= 0x0,
channel_subsystem_request_function = 0x555555815150,
channel_write_wontblock_function = 0x90}
Regards,
Aaron