#include <client.h>
Public Member Functions | |
int | exec (const TQCString &command, const TQCString &user, const TQCString &options=0, const QCStringList &env=QCStringList()) |
int | exitCode () |
int | setPass (const char *pass, int timeout) |
int | setHost (const TQCString &host) |
int | setPriority (int priority) |
int | setScheduler (int scheduler) |
int | delCommand (const TQCString &command, const TQCString &user) |
int | setVar (const TQCString &key, const TQCString &value, int timeout=0, const TQCString &group=0) |
TQCString | getVar (const TQCString &key) |
TQValueList< TQCString > | getKeys (const TQCString &group) |
bool | findGroup (const TQCString &group) |
int | delVar (const TQCString &key) |
int | delVars (const TQCString &special_key) |
int | delGroup (const TQCString &group) |
int | ping () |
int | stopServer () |
int | startServer () |
bool | isServerSGID () |
Detailed Description
A client class to access tdesud, the KDE su daemon.
Kdesud can assist in password caching in two ways:
- For high security passwords, like for su and ssh, it executes the password requesting command for you. It feeds the password to the command, without ever returning it to you, the user. The daemon should be installed setgid nogroup, in order to be able to act as an inaccessible, trusted 3rd party. See exec, setPass, delCommand.
- For lower security passwords, like web and ftp passwords, it can act as a persistent storage for string variables. These variables are returned to the user, and the daemon doesn't need to be setgid nogroup for this. See setVar, delVar, delGroup.
Member Function Documentation
◆ delCommand()
int TDEsuClient::delCommand | ( | const TQCString & | command, |
const TQCString & | user | ||
) |
Remove a password for a user/command.
- Parameters
-
command The command. user The user.
- Returns
- zero on success, -1 on an error
Definition at line 286 of file client.cpp.
◆ delGroup()
int TDEsuClient::delGroup | ( | const TQCString & | group | ) |
Delete all persistent variables in a group.
- Parameters
-
group the group name. See setVar.
- Returns
Definition at line 371 of file client.cpp.
◆ delVar()
int TDEsuClient::delVar | ( | const TQCString & | key | ) |
Delete a persistent variable.
- Parameters
-
key The name of the variable.
- Returns
- zero on success, -1 on failure.
Definition at line 363 of file client.cpp.
◆ delVars()
int TDEsuClient::delVars | ( | const TQCString & | special_key | ) |
Delete all persistent variables with the given key.
A specicalized variant of delVar(TQCString) that removes all subsets of the cached varaibles given by key
. In order for all cached variables related to this key to be deleted properly, the value given to the group
argument when the setVar function was called, must be a subset of the argument given here and the key
- Note
- Simply supplying the group key here WILL not necessarily work. If you only have a group key, then use delGroup instead.
- Parameters
-
special_key the name of the variable.
- Returns
- zero on success, -1 on failure.
Definition at line 379 of file client.cpp.
◆ exec()
int TDEsuClient::exec | ( | const TQCString & | command, |
const TQCString & | user, | ||
const TQCString & | options = 0 , |
||
const QCStringList & | env = QCStringList() |
||
) |
Lets tdesud execute a command.
If the daemon does not have a password for this command, this will fail and you need to call setPass().
- Parameters
-
command The command to execute. user The user to run the command as. options Extra options. env Extra environment variables.
- Returns
- Zero on success, -1 on failure.
Definition at line 242 of file client.cpp.
◆ exitCode()
int TDEsuClient::exitCode | ( | ) |
Wait for the last command to exit and return the exit code.
- Returns
- Exit code of last command, -1 on failure.
Definition at line 392 of file client.cpp.
◆ findGroup()
bool TDEsuClient::findGroup | ( | const TQCString & | group | ) |
Returns true if the specified group exists is cached.
- Parameters
-
group the group key
- Returns
- true if the group is found
Definition at line 353 of file client.cpp.
◆ getKeys()
TQValueList< TQCString > TDEsuClient::getKeys | ( | const TQCString & | group | ) |
Gets all the keys that are membes of the given group.
- Parameters
-
group the group name of the variables.
- Returns
- a list of the keys in the group.
Definition at line 320 of file client.cpp.
◆ getVar()
TQCString TDEsuClient::getVar | ( | const TQCString & | key | ) |
Get a persistent variable.
- Parameters
-
key The name of the variable.
- Returns
- Its value.
Definition at line 310 of file client.cpp.
◆ isServerSGID()
bool TDEsuClient::isServerSGID | ( | ) |
Returns true if the server is safe (installed setgid), false otherwise.
Definition at line 419 of file client.cpp.
◆ ping()
int TDEsuClient::ping | ( | ) |
Ping tdesud.
This can be used for diagnostics.
- Returns
- Zero on success, -1 on failure
Definition at line 387 of file client.cpp.
◆ setHost()
int TDEsuClient::setHost | ( | const TQCString & | host | ) |
Set the target host (optional).
Definition at line 264 of file client.cpp.
◆ setPass()
int TDEsuClient::setPass | ( | const char * | pass, |
int | timeout | ||
) |
Set root's password, lasts one session.
- Parameters
-
pass Root's password. timeout The time that a password will live.
- Returns
- Zero on success, -1 on failure.
Definition at line 232 of file client.cpp.
◆ setPriority()
int TDEsuClient::setPriority | ( | int | priority | ) |
Set the desired priority (optional), see StubProcess.
Definition at line 272 of file client.cpp.
◆ setScheduler()
int TDEsuClient::setScheduler | ( | int | scheduler | ) |
Set the desired scheduler (optional), see StubProcess.
Definition at line 279 of file client.cpp.
◆ setVar()
int TDEsuClient::setVar | ( | const TQCString & | key, |
const TQCString & | value, | ||
int | timeout = 0 , |
||
const TQCString & | group = 0 |
||
) |
Set a persistent variable.
- Parameters
-
key The name of the variable. value Its value. timeout The timeout in seconds for this key. Zero means no timeout. group Make the key part of a group. See delGroup.
- Returns
- zero on success, -1 on failure.
Definition at line 295 of file client.cpp.
◆ startServer()
int TDEsuClient::startServer | ( | ) |
Try to start up tdesud.
Definition at line 435 of file client.cpp.
◆ stopServer()
int TDEsuClient::stopServer | ( | ) |
Stop the daemon.
Definition at line 401 of file client.cpp.
The documentation for this class was generated from the following files: