KDESu 5.99.0
sshprocess.h
1/*
2 This file is part of the KDE project, module kdesu.
3 SPDX-FileCopyrightText: 2000 Geert Jansen <jansen@kde.org>
4
5 SPDX-License-Identifier: GPL-2.0-only
6*/
7
8#ifndef KDESUSSHPROCESS_H
9#define KDESUSSHPROCESS_H
10
11#include "stubprocess.h"
12
13#include <kdesu/kdesu_export.h>
14
15namespace KDESu
16{
17class SshProcessPrivate;
18
23class KDESU_EXPORT SshProcess : public StubProcess
24{
25public:
26 enum Errors {
27 SshNotFound = 1,
28 SshNeedsPassword,
29 SshIncorrectPassword,
30 };
31
32 explicit SshProcess(const QByteArray &host = QByteArray(), const QByteArray &user = QByteArray(), const QByteArray &command = QByteArray());
33 ~SshProcess() override;
34
38 void setHost(const QByteArray &host);
39
43 void setStub(const QByteArray &stub);
44
53
58 int checkInstall(const char *password);
59
63 int exec(const char *password, int check = 0);
64
65 QByteArray prompt() const;
66 QByteArray error() const;
67
68protected:
69 void virtual_hook(int id, void *data) override;
70 QByteArray display() override;
71 QByteArray displayAuth() override;
72
73private:
74 int converseSsh(const char *password, int check);
75
76private:
77 Q_DECLARE_PRIVATE_D(PtyProcess::d, SshProcess)
78#if KDESU_BUILD_DEPRECATED_SINCE(5, 79)
79 // Unused, kept for ABI compatibility
80 const void *__kdesu_d_do_not_use;
81#endif
82};
83
84}
85
86#endif // KDESUSSHPROCESS_H
Executes a remote command, using ssh.
Definition: sshprocess.h:24
QByteArray display() override
This virtual function can be overloaded when special behavior is desired.
void setStub(const QByteArray &stub)
Sets the location of the remote stub.
QByteArray displayAuth() override
See display.
int checkNeedPassword()
Checks if the current user@host needs a password.
void setHost(const QByteArray &host)
Sets the target host.
int exec(const char *password, int check=0)
Executes the command.
void virtual_hook(int id, void *data) override
Standard hack to add virtual methods in a BC way.
int checkInstall(const char *password)
Checks if the stub is installed and if the password is correct.
Chat with kdesu_stub.
Definition: stubprocess.h:33