1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
|
//
// C++ Interface: sshprocess
//
// Description:
//
//
// Author: Oleksandr Shneyder <oleksandr.shneyder@obviously-nice.de>, (C) 2006
//
// Copyright: See COPYING file that comes with this distribution
//
//
#include "x2goclientconfig.h"
#ifndef SSHPROCESS_H
#define SSHPROCESS_H
#include <QProcess>
/**
@author Oleksandr Shneyder <oleksandr.shneyder@obviously-nice.de>
*/
class QLocalServer;
class QLocalSocket;
struct SshProxy;
class sshProcess : public QProcess
{
Q_OBJECT
public:
sshProcess ( QObject* parent, const SshProxy* proxy,
const QString& user,
const QString& host,const QString& pt,
const QString& cmd, const QString& pass,
const QString& key=QString::null,
bool acc=false );
virtual ~sshProcess();
void startNormal ( bool accept=false );
QString getResponce();
void startTunnel ( QString host,QString localPort,QString remotePort,
bool reverse=false,bool accept=false );
void start_cp ( QString src, QString dst, bool accept=false );
QString getSource() {return source;}
QString setsid();
void setErrorString ( const QString& str );
void setFwX ( bool s ) {fwX=s;}
virtual void setEnvironment ( QStringList newEnv );
private:
QString askpass;
QString user;
QString host;
QString command;
QString pass;
QString key;
QString errorString;
QString outputString;
QString passcookie;
QLocalServer* serverSocket;
QLocalSocket* localSocket;
bool needPass;
bool autoAccept;
bool isTunnel;
bool isCopy;
QString sshPort;
QString tunnelHost;
QString localPort;
QString source;
QString destination;
QString remotePort;
QStringList env;
bool reverse;
bool fwX;
bool sudoErr;
QString extraOptions;
private slots:
void slot_error ( QProcess::ProcessError );
void slot_finished ( int, QProcess::ExitStatus );
void slot_stderr();
void slot_stdout();
void hidePass();
void slot_pass_connection();
void slot_read_cookie_from_socket();
private:
void printPass ( bool accept=false );
void printKey ( bool accept=false );
QString cookie();
void cleanEnv ( bool all=false );
signals:
void sshFinished ( bool,QString,sshProcess* );
void sudoConfigError ( QString,sshProcess* );
void sshTunnelOk();
};
#endif
|