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

Re: Fwd: [Patch] Add forward-listening feature (tcpip-forward)


Vic,

Doing as you proposed is okay. There are no garanties that packet_wait
won't return anything different later (if we don't rewrite it meanwhile).
I was already convinced this function could return SSH_AGAIN

Aris
Vic Lee a écrit :
> Hi Aris,
>
> I just check packet_wait function, it seems that it will only return
> SSH_OK or SSH_ERROR. So I assume "if (rc) { ..." is checking for
> SSH_ERROR. Do you think it should be changed to "if (rc == SSH_ERROR)"
> instead?
>
> I was able to capture incoming connections because of the call to
> function ssh_handle_packets, which will push incoming channel requests
> into ssh_message_list, then a loop to poll the message list.
>
> Thanks,
>
> Vic
>
>   
>> Hello Vic,
>>
>> The patch is almost perfect. Just these lines :
>> +  rc = packet_wait(session, SSH2_MSG_REQUEST_SUCCESS, 1);
>> +  if (rc) {
>> +    if (session->in_packet.type == SSH2_MSG_REQUEST_FAILURE) {
>> Could you please check rc for SSH_ERROR and return it to the caller ?
>>
>> I also wonder how you catch the incoming connections from the server.
>>
>> Thanks,
>>
>> Aris
>>
>> Vic Lee a écrit : 
>>
>>
>>         Hi,
>>         
>>         So I complete another feature I need for libssh. For your
>>         review, this
>>         patch added three new API:
>>         
>>         o channel_forward_listen : send tcpip-forward global request
>>         
>>         o channel_forward_accept : accept/poll an incoming connection
>>         (the codes
>>         were merge with channel_accept_x11 with a static function
>>         channel_accept)
>>         
>>         o channel_forward_cancel : send cancel-tcpip-forward global
>>         request
>>         
>>         During testing I also encounter openssh server sending back a
>>         SSH2_MSG_DEBUG message, and I have to modify packet.c to
>>         bypass this
>>         message.
>>         
>>         The only thing that I am not able to test is to use 0 as port
>>         number,
>>         and the server is supposed to return an available port number,
>>         but
>>         openssh server simply reject it. Anyway, I don't need to use 0
>>         port
>>         number and all the rest are working fine for me.
>>         
>>         Thanks,
>>         
>>         Vic
>>
>>
>>
>>     
>
>
>
>   


Archive administrator: postmaster@lists.cynapses.org