KDESu::SuProcess Class
Executes a command under elevated privileges, using su. More...
Header: | #include <KDESu/SuProcess> |
CMake: | find_package(KF6 REQUIRED COMPONENTS Su) target_link_libraries(mytarget PRIVATE KF6::Su) |
Inherits: | KDESu::StubProcess |
Public Types
enum | Errors { SuNotFound, SuNotAllowed, SuIncorrectPassword } |
enum | checkMode { NoCheck, Install, NeedPassword } |
Public Functions
SuProcess(const QByteArray &user = nullptr, const QByteArray &command = nullptr) | |
int | checkInstall(const char *password) |
int | checkNeedPassword() |
int | exec(const char *password, int check = NoCheck) |
QString | superUserCommand() |
bool | useUsersOwnPassword() |
Detailed Description
Member Type Documentation
enum SuProcess::Errors
Constant | Value |
---|---|
KDESu::SuProcess::SuNotFound | 1 |
KDESu::SuProcess::SuNotAllowed | 2 |
KDESu::SuProcess::SuIncorrectPassword | 3 |
enum SuProcess::checkMode
Executes the command. This will wait for the command to finish.
Constant | Value |
---|---|
KDESu::SuProcess::NoCheck | 0 |
KDESu::SuProcess::Install | 1 |
KDESu::SuProcess::NeedPassword | 2 |
Member Function Documentation
[explicit]
SuProcess::SuProcess(const QByteArray &user = nullptr, const QByteArray &command = nullptr)
int SuProcess::checkInstall(const char *password)
Checks if the stub is installed and the password is correct.
Returns zero if everything is correct, nonzero otherwise.
int SuProcess::checkNeedPassword()
Checks if a password is needed.
int SuProcess::exec(const char *password, int check = NoCheck)
QString SuProcess::superUserCommand()
Checks what the default super user command is, e.g. sudo, su, etc
Returns the default super user command
bool SuProcess::useUsersOwnPassword()
Checks whether or not the user's password is being asked for or another user's password. Due to usage of systems such as sudo, even when attempting to switch to another user one may need to enter their own password.