On Thursday 16 July 2015 12:07:06 Raghaw Shukla wrote:
> In point C the new session should be from local PC to Remote PC?

Here is a step by step description how I would implement it.

a) Create a ssh session and connect
b) Create a forward channel
c) Create a socketpair()
d) One end of the socketpair() is used to read data and write it to the
   forward channel, and vice versa.
e) Create a new ssh session
f) Set the other fd of the socketpair() as the fd for the new session
g) Connect and exec ...

It should work just fine with a socketpair() but you can also create a tcp 
socket and connect to the port on localhost. I suggest you read the SSH RFC to 
understand port forwarding better and read the manpages about sockets and 
socketpair.

-- 
Andreas Schneider                   GPG-ID: CC014E3D
www.cryptomilk.org                [email protected]


Reply via email to