Yes I agree that in below case using " libssh2_channel_direct_tcpip_ex "
I would only get raw TCP connection to "calih1" port 22 .
Here is what I am tring to achieve which I can easily do through putty .
I want to make two SSH connections, one to "calis1", and another through
that to "calih1", which is presumably not
directly reachable. But for that I would need two "plink" invocations,
as there is only ever at most one SSH connection per invocation of
"plink" .
I create a session called "calih1". It needs the following
settings:
Host Name: calih1
Connection type: SSH
Proxy tab:
Proxy type: Local
Telnet command: "\path\to\plink.exe -pw %pass %user@%proxyhost -nc
%host:%port"
Proxy hostname: calis1
Proxy port: 22
Proxy username: root
Proxy password: <root_at_calis1's password>
Having created this session, you should now be able to execute
plink calih1 "ls -l"
and get the results of running "ls -l" on calih1.
How do I accomplish this using libssh2 .
Thanks
Ashish
-----Original Message-----
From: libssh2-devel-bounces_at_cool.haxx.se
[mailto:libssh2-devel-bounces_at_cool.haxx.se] On Behalf Of Peter Stuge
Sent: Tuesday, February 16, 2010 11:43 PM
To: libssh2-devel_at_cool.haxx.se
Subject: Re: Help with libssh2_channel_direct_tcpip_ex
Kumar, Ashish wrote:
> while( ( channel = libssh2_channel_direct_tcpip_ex(
> session,targethostname , 22 , hostname, 22 ) ) == NULL)
..
> When I use the channel for below purpose
..
> while( (rc = libssh2_channel_exec(channel, commandline)) ==
> LIBSSH2_ERROR_EAGAIN );
> Can you give me hint to explore further into where could I be going
> wrong ?
You seem to be confusing the purpose of these function calls.
libssh2_channel_exec() can only be used with a channel that was
created by libssh2_channel_open_session().
libssh2_channel_direct_tcpip_ex() creates a different type of
channel. Please read RFC4254 to learn more about direct-tcpip
channels.
//Peter
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2010-02-17