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

Re: TCP/IP Port Forwarding + Patch


On Friday 10 January 2014 17:50:24 Oleksandr Shneyder wrote:
> Hello,
> here is a patch to fix problem with port forwarding.

Hi,

that's great. Thank you very much for your contribution.

Could you create a patch for master and send a git format-patch?

It is described under "Public Large Project" here:

http://www.git-scm.com/book/en/Distributed-Git-Contributing-to-a-Project


Please name the function ssh_channel_accept_forward()


Thanks!

> Problem description:
> 
> //forward port 9080
> ssh_forward_listen(session, NULL, 9080, NULL);
> //forward port 9090
> ssh_forward_listen(session, NULL, 9090, NULL);
> //accept connections
> while(1){
> ssh_channel channel = ssh_forward_accept(session, 1000);
> //channel created, but we don't know if it from port 9080 or 9090 !!!
> }
> 
> Solution - use function, that return destination port (see patch)
> 
> //forward port 9080
> ssh_forward_listen(session, NULL, 9080, NULL);
> //forward port 9090
> ssh_forward_listen(session, NULL, 9090, NULL);
> //accept connections
> while(1){
> int port;
> ssh_channel channel = ssh_forward_accept_ex(session, 1000, &port);
> fprintf(stderr, "forwarding channel from port %d\n", port);
> }
> 
> As we need multiply port forwarding in our project (X2Go), please accept
> my patch or suggest your own solution to solve this problem. We will
> take care about patching old versions of libssh used by Debian and
> possible other Linux distributions.
> 
> regards,
> Alex

-- 
Andreas Schneider                   GPG-ID: CC014E3D
www.cryptomilk.org                asn@xxxxxxxxxxxxxx

Attachment: signature.asc
Description: This is a digitally signed message part.


Follow-Ups:
Re: TCP/IP Port Forwarding + PatchOleksandr Shneyder <o.shneyder@xxxxxxxxxxxxx>
References:
TCP/IP Port Forwarding + PatchOleksandr Shneyder <o.shneyder@xxxxxxxxxxxxx>
Archive administrator: postmaster@lists.cynapses.org