KDESu 5.99.0
suprocess.h
1/*
2 This file is part of the KDE project, module kdesu.
3 SPDX-FileCopyrightText: 1999, 2000 Geert Jansen <jansen@kde.org>
4
5 SPDX-License-Identifier: GPL-2.0-only
6*/
7
8#ifndef KDESUSUPROCESS_H
9#define KDESUSUPROCESS_H
10
11#include <kdesu/kdesu_export.h>
12
13#include "stubprocess.h"
14
15namespace KDESu
16{
17class SuProcessPrivate;
18
23class KDESU_EXPORT SuProcess : public StubProcess
24{
25public:
26 enum Errors {
27 SuNotFound = 1,
28 SuNotAllowed,
29 SuIncorrectPassword,
30 };
31
35 enum checkMode {
36 NoCheck = 0,
37 Install = 1,
38 NeedPassword = 2,
39 };
40
41 explicit SuProcess(const QByteArray &user = nullptr, const QByteArray &command = nullptr);
42 ~SuProcess() override;
43
44 int exec(const char *password, int check = NoCheck);
45
50 int checkInstall(const char *password);
51
56
62
69
70protected:
71 void virtual_hook(int id, void *data) override;
72
73private:
74 enum SuErrors {
75 error = -1,
76 ok = 0,
77 killme = 1,
78 notauthorized = 2,
79 };
80
81 int converseSU(const char *password);
82
83private:
84 Q_DECLARE_PRIVATE_D(PtyProcess::d, SuProcess)
85#if KDESU_BUILD_DEPRECATED_SINCE(5, 79)
86 // Unused, kept for ABI compatibility
87 const void *__kdesu_d_do_not_use;
88#endif
89};
90
91}
92
93#endif // KDESUSUPROCESS_H
Chat with kdesu_stub.
Definition: stubprocess.h:33
Executes a command under elevated privileges, using su.
Definition: suprocess.h:24
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 the password is correct.
bool useUsersOwnPassword()
Checks whether or not the user's password is being asked for or another user's password.
QString superUserCommand()
Checks what the default super user command is, e.g.
int checkNeedPassword()
Checks if a password is needed.
checkMode
Executes the command.
Definition: suprocess.h:35