Subject: [libssh2] libssh2 problem, not execute commands

[libssh2] libssh2 problem, not execute commands

From: Vasiliy G Tolstov <v.tolstov_at_selfip.ru>
Date: Tue, 15 Jan 2008 17:50:25 +0300

Hello! Sorry for stupid question (maybe..) I'm writing application that
connect to server and execute cat /etc/passwd
Code part:

Glib::ustring Ssh::Send(Glib::ustring Command)
    {
        char tmpResponse[LIBSSH2_CHANNEL_PACKET_DEFAULT]="";
        Glib::ustring Response;
        libssh2_channel_write(Channel, (const char * )Command.c_str(),
Command.size());
        libssh2_channel_set_blocking(Channel, 1);
        
libssh2_channel_handle_extended_data(Channel,LIBSSH2_CHANNEL_EXTENDED_DATA_IGNORE);

   
        while(libssh2_channel_read(Channel, tmpResponse,
LIBSSH2_CHANNEL_PACKET_DEFAULT)!=0){
            Response=Response+tmpResponse;
        }

        return Response;
    };

I do not see correct result (like cat /etc/passwd on server), if debug
code with std::cerr << tmpResponse << std::endl;
i see following output. I'm not understand why =( What's wrong ?

vase_at_vase ~/Projects/gpanel/src $ ./gpanel
tmpResponse = Last login: Tue Jan 15 17:37:03 2008 from 85.235.196.138
Copyright (c) 1980, 1983, 1986, 1988, 1990, 1991, 1993, 1994
    The Regents of the University of California. All rights reserved.

FreeBSD 6.2-RELEASE-p5 (ZEON) #1: Tue Jun 26 12:29:42 MSD 2007

tmpResponse = [vase_at_bashregion ~]$ 5 17:37:03 2008 from 85.235.196.138
Copyright (c) 1980, 1983, 1986, 1988, 1990, 1991, 1993, 1994
    The Regents of the University of California. All rights reserved.

FreeBSD 6.2-RELEASE-p5 (ZEON) #1: Tue Jun 26 12:29:42 MSD 2007

tmpResponse = cat /etc/passwd
~]$ 5 17:37:03 2008 from 85.235.196.138
Copyright (c) 1980, 1983, 1986, 1988, 1990, 1991, 1993, 1994
    The Regents of the University of California. All rights reserved.

FreeBSD 6.2-RELEASE-p5 (ZEON) #1: Tue Jun 26 12:29:42 MSD 2007

tmpResponse = # $FreeBSD: src/etc/master.passwd,v 1.40 2005/06/06
20:19:56 brooks Exp $
#

-- 
С уважением, Vasiliy G Tolstov
http://www.selfip.ru


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

_______________________________________________
libssh2-devel mailing list
libssh2-devel_at_lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libssh2-devel

Received on 2008-01-15