[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: X11 Forwarding example
[Thread Prev] | [Thread Next]
- Subject: Re: X11 Forwarding example
- From: lucky62 <lucky62@xxxxxxxxxx>
- Reply-to: libssh@xxxxxxxxxx
- Date: Thu, 19 Nov 2020 00:32:54 +0100
- To: libssh@xxxxxxxxxx
Program was executed with highest log level and this is my observation.*Seems that after succesful EXEC polling-in is blocked, and incomming request SSH_MSG_CHANNEL_OPEN (90) is waiting somewhere in buffer...*
When waiting loop is out, then program calls ssh_channel_free (internally ssh_channel_close). Messages SSH_MSG_CHANNEL_EOF (96) and SSH_MSG_CHANNEL_CLOSE (97) are sent, polling is enabled and simultaneously the incoming message SSH_MSG_CHANNEL_OPEN (90) is received.
[2020/11/18 15:13:42.539242, 3] ssh_packet_need_rekey: packet: [data_rekey_needed=0, out_blocks=44, in_blocks=67 [2020/11/18 15:13:42.539250, 3] ssh_packet_need_rekey: packet: [data_rekey_needed=0, out_blocks=44, in_blocks=67 [2020/11/18 15:13:42.539259, 2] channel_request: Channel request*exec success* *polling is blocked?...****after 5s timeout ssh_channel_free is sending EOF and CLOSE * [2020/11/18 15:13:53.568543, 3] ssh_packet_need_rekey: packet: [data_rekey_needed=0, out_blocks=44, in_blocks=67 [2020/11/18 15:13:53.568656, 3] ssh_socket_unbuffered_write: Enabling POLLOUT for socket [2020/11/18 15:13:53.568687, 3] packet_send2: packet: wrote [type=96, len=16, padding_size=10, comp=5, payload=5] [2020/11/18 15:13:53.568702, 3] ssh_channel_send_eof:*Sent a EOF* on client channel (43:0) [2020/11/18 15:13:53.568714, 3] ssh_packet_need_rekey: packet: [data_rekey_needed=0, out_blocks=44, in_blocks=67 [2020/11/18 15:13:53.568733, 3] packet_send2: packet: wrote [type=97, len=16, padding_size=10, comp=5, payload=5] [2020/11/18 15:13:53.568751, 3] ssh_channel_close:*Sent a close* on client channel (43:0) [2020/11/18 15:13:53.568769, 4] ssh_socket_pollcallback: Poll callback on socket 3 (*POLLIN POLLOUT *), out buffer 36 [2020/11/18 15:13:53.568800, 3] ssh_packet_socket_callback: packet:*read type 90* [len=48,padding=10,comp=37,payload=37] [2020/11/18 15:13:53.568816, 3] ssh_packet_process: Dispatching handler for packet type 90 [2020/11/18 15:13:53.568857, 3] ssh_packet_channel_open: Clients wants to open a x11 channel x11callback: OrigAddr: |127.0.0.1| OrigPort: |55312| [2020/11/18 15:13:53.568915, 4] ssh_message_channel_request_open_reply_default: Refusing a channel So need I call some function to enable polling? Or is this a library bug?... Jan On 18. 11. 2020 16:35, lucky62 wrote:
really I don't understand... "stdout from remote" ?I think that X app connected to display (which is set by server when x11 forwarding is requested) will send the output through the x11 channel. But this channel still not exists. It will be created when SSH server will send the x11 channel request.In my case this request is detected after 5s delay is out... Jan On 18. 11. 2020 15:36, Alexander Grotewohl wrote:I believe after you call the exec, and in your code you just wait, the program should actually be reading stdout from the remote. In that case, your code would read from there until the x11 programterminated and subsequently the read would fail.Alex -- Alexander Grotewohl https://dcclost.com ------------------------------------------------------------------------ *From:* lucky62 <lucky62@xxxxxxxxxx> *Sent:* Wednesday, November 18, 2020 8:33:10 AM *To:* libssh@xxxxxxxxxx <libssh@xxxxxxxxxx> *Subject:* Re: X11 Forwarding example Hi, I am trying to create x11 example by myself. I have already created example skeleton with these steps: * create the session * set callbacks * set options (host,...) * connect to host * authenticate * create and open channel * send x11-req * send exec request (start X app on server) o here the program is just sleeping for 5 seconds to wait for server response... (in while loop 5000 x 1ms)This is my x11 callback, which is currently doing nothing - just to see that is called:static ssh_channel x11_callback( ssh_session session, const char * originator_address, int originator_port, void *userdata ) { fprintf( stderr, "x11callback:\n" ); fprintf( stderr, " OrigAddr: |%s|\n", originator_address ); fprintf( stderr, " OrigPort: |%d|\n", originator_port ); return NULL; }But when exec request is sent to the server and success confirmed then nothing happens immediately.Program is waiting 5 seconds and x11 callback is called then. Why? [2020/11/18 13:33:12.599888, 3] channel_request: Sent a SSH_MSG_CHANNEL_REQUEST exec [2020/11/18 13:33:12.602802, 3] ssh_packet_socket_callback: packet: read type 93 [len=16,padding=6,comp=9,payload=9] [2020/11/18 13:33:12.602862, 3] ssh_packet_process: Dispatching handler for packet type 93 [2020/11/18 13:33:12.602897, 2] channel_rcv_change_window: Adding 2097152 bytes to channel (43:0) (from 0 bytes) [2020/11/18 13:33:12.602921, 3] ssh_packet_socket_callback: Processing 36 bytes left in socket buffer [2020/11/18 13:33:12.602944, 3] ssh_packet_socket_callback: packet: read type 99 [len=16,padding=10,comp=5,payload=5] [2020/11/18 13:33:12.602964, 3] ssh_packet_process: Dispatching handler for packet type 99 [2020/11/18 13:33:12.602985, 3] ssh_packet_channel_success: Received SSH_CHANNEL_SUCCESS on channel (43:0) [2020/11/18 13:33:12.603006, 3] ssh_packet_need_rekey: packet: [data_rekey_needed=0, out_blocks=44, in_blocks=67 [2020/11/18 13:33:12.603026, 3] ssh_packet_need_rekey: packet: [data_rekey_needed=0, out_blocks=44, in_blocks=67 [2020/11/18 13:33:*12*.603049, 2]*channel_request: Channel request exec success 5 seconds delay... *[2020/11/18 13:33:*17*.603149, 3] ssh_packet_need_rekey: packet: [data_rekey_needed=0, out_blocks=44, in_blocks=67 [2020/11/18 13:33:17.603358, 3] ssh_socket_unbuffered_write: Enabling POLLOUT for socket [2020/11/18 13:33:17.603381, 3] packet_send2: packet: wrote [type=96, len=16, padding_size=10, comp=5, payload=5] [2020/11/18 13:33:17.603452, 3] ssh_channel_send_eof: Sent a EOF on client channel (43:0) [2020/11/18 13:33:17.603486, 3] ssh_packet_need_rekey: packet: [data_rekey_needed=0, out_blocks=44, in_blocks=67 [2020/11/18 13:33:17.603521, 3] packet_send2: packet: wrote [type=97, len=16, padding_size=10, comp=5, payload=5] [2020/11/18 13:33:17.603543, 3] ssh_channel_close: Sent a close on client channel (43:0) [2020/11/18 13:33:17.603578, 3] ssh_packet_socket_callback: packet: read type 90 [len=48,padding=10,comp=37,payload=37] [2020/11/18 13:33:17.603601, 3] ssh_packet_process: Dispatching handler for packet type 90 [2020/11/18 13:33:*17*.603624, 3]*ssh_packet_channel_open: Clients wants to open a x11 channel* x11callback: OrigAddr: |127.0.0.1| OrigPort: |55280| [2020/11/18 13:33:17.603672, 3] ssh_packet_need_rekey: packet: [data_rekey_needed=0, out_blocks=45, in_blocks=70 [2020/11/18 13:33:17.603703, 3] packet_send2: packet: wrote [type=92, len=32, padding_size=14, comp=17, payload=17] [2020/11/18 13:33:17.603733, 3] ssh_packet_need_rekey: packet: [data_rekey_needed=0, out_blocks=45, in_blocks=69 [2020/11/18 13:33:17.603772, 3] ssh_socket_unbuffered_write: Enabling POLLOUT for socket [2020/11/18 13:33:17.603796, 3] ssh_packet_need_rekey: packet: [data_rekey_needed=0, out_blocks=46, in_blocks=70 [2020/11/18 13:33:17.603831, 3] packet_send2: packet: wrote [type=1, len=32, padding_size=11, comp=20, payload=20] *How to correctly wait for server response?* Any help is appreciated. thx in advance JanP.S.: My monolithic program is attached. Many things are hardcoded (auth, host, ..) Compiled on my Linux Mint 20 by command: /gcc -o my_x11_client my_x11_client.c -lssh/
Re: X11 Forwarding example | lucky62 <lucky62@xxxxxxxxxx> |
X11 Forwarding example | lucky62 <lucky62@xxxxxxxxxx> |
Re: X11 Forwarding example | lucky62 <lucky62@xxxxxxxxxx> |
Re: X11 Forwarding example | Alexander Grotewohl <alex@xxxxxxxxxxx> |
Re: X11 Forwarding example | lucky62 <lucky62@xxxxxxxxxx> |