Greetings libssh,
I'm having trouble getting started using the C++ wrapper. I'd like to
start a session+channel to do commands on a remote machine.
Can't get it to work. What am I missing? Also, I've shown in the
comments where a disconnect call causes a seg fault.
Thank you!
Code:
#include <iostream>
using namespace std;
#include <libssh/libsshpp.hpp>
int main()
{
ssh::Session session;
try
{
session.setOption( SSH_OPTIONS_USER, "user" );
session.setOption( SSH_OPTIONS_HOST, "192.168.200.101" );
session.connect();
session.userauthPassword( "password" );
ssh::Channel channel( session );
channel.openSession();
channel.requestExec( "psync-manager stop" );
channel.close();
channel.sendEof();
// This causes a seg fault in ssh_channel_free() ???
// session.disconnect();
}
catch (ssh::SshException e)
{
std::cout << "Error during connection : ";
std::cout << e.getError() << std::endl;
}
return 0;
}
--
Dave Miller
Software Engineer | *Harbrick LLC*
926 Public Ave | Moscow, ID 83843
*c* 888.810.4284 x702 | *e* [email protected] | *w* www.harbrick.com
<http://www.habrick.com>
The preceding e-mail message (including any attachments) contains
information that may be confidential, may be protected by the
attorney-client or other applicable privileges, or may constitute
non-public information. It is intended to be conveyed only to the
designated recipient(s) named above. If you are not an intended
recipient of this message, please notify the sender by replying to this
message and then delete all copies of it from your computer system. Any
use, dissemination, distribution, or reproduction of this message by
unintended recipients is not authorized and may be unlawful.