• Skip to content
  • Skip to link menu
KDE 4.3 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • Contact Us
 

KDEsu

KDESu::KDEsuClient

KDESu::KDEsuClient Class Reference

A client class to access kdesud, the KDE su daemon. More...

#include <kdesu/client.h>

List of all members.

Public Member Functions

int delCommand (const QByteArray &command, const QByteArray &user)
int delGroup (const QByteArray &group)
int delVar (const QByteArray &key)
int delVars (const QByteArray &special_key)
int exec (const QByteArray &command, const QByteArray &user, const QByteArray &options=0, const QList< QByteArray > &env=QList< QByteArray >())
int exitCode ()
bool findGroup (const QByteArray &group)
QList< QByteArray > getKeys (const QByteArray &group)
QByteArray getVar (const QByteArray &key)
bool isServerSGID ()
 KDEsuClient ()
int ping ()
int setHost (const QByteArray &host)
int setPass (const char *pass, int timeout)
int setPriority (int priority)
int setScheduler (int scheduler)
int setVar (const QByteArray &key, const QByteArray &value, int timeout=0, const QByteArray &group=0)
int startServer ()
int stopServer ()
 ~KDEsuClient ()

Detailed Description

A client class to access kdesud, 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.

Definition at line 48 of file client.h.


Constructor & Destructor Documentation

KDESu::KDEsuClient::KDEsuClient (  ) 

Definition at line 54 of file client.cpp.

KDESu::KDEsuClient::~KDEsuClient (  ) 

Definition at line 79 of file client.cpp.


Member Function Documentation

int KDESu::KDEsuClient::delCommand ( const QByteArray &  command,
const QByteArray &  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 267 of file client.cpp.

int KDESu::KDEsuClient::delGroup ( const QByteArray &  group  ) 

Delete all persistent variables in a group.

Parameters:
group the group name. See setVar.
Returns:

Definition at line 352 of file client.cpp.

int KDESu::KDEsuClient::delVar ( const QByteArray &  key  ) 

Delete a persistent variable.

Parameters:
key The name of the variable.
Returns:
zero on success, -1 on failure.

Definition at line 344 of file client.cpp.

int KDESu::KDEsuClient::delVars ( const QByteArray &  special_key  ) 

Delete all persistent variables with the given key.

A specicalized variant of delVar(QByteArray) 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 360 of file client.cpp.

int KDESu::KDEsuClient::exec ( const QByteArray &  command,
const QByteArray &  user,
const QByteArray &  options = 0,
const QList< QByteArray > &  env = QList<QByteArray>() 
)

Lets kdesud 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 220 of file client.cpp.

int KDESu::KDEsuClient::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 373 of file client.cpp.

bool KDESu::KDEsuClient::findGroup ( const QByteArray &  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 334 of file client.cpp.

QList< QByteArray > KDESu::KDEsuClient::getKeys ( const QByteArray &  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 301 of file client.cpp.

QByteArray KDESu::KDEsuClient::getVar ( const QByteArray &  key  ) 

Get a persistent variable.

Parameters:
key The name of the variable.
Returns:
Its value.

Definition at line 291 of file client.cpp.

bool KDESu::KDEsuClient::isServerSGID (  ) 

Returns true if the server is safe (installed setgid), false otherwise.

Definition at line 400 of file client.cpp.

int KDESu::KDEsuClient::ping (  ) 

Ping kdesud.

This can be used for diagnostics.

Returns:
Zero on success, -1 on failure

Definition at line 368 of file client.cpp.

int KDESu::KDEsuClient::setHost ( const QByteArray &  host  ) 

Set the target host (optional).

Definition at line 241 of file client.cpp.

int KDESu::KDEsuClient::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 210 of file client.cpp.

int KDESu::KDEsuClient::setPriority ( int  priority  ) 

Set the desired priority (optional), see StubProcess.

Definition at line 249 of file client.cpp.

int KDESu::KDEsuClient::setScheduler ( int  scheduler  ) 

Set the desired scheduler (optional), see StubProcess.

Definition at line 258 of file client.cpp.

int KDESu::KDEsuClient::setVar ( const QByteArray &  key,
const QByteArray &  value,
int  timeout = 0,
const QByteArray &  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 276 of file client.cpp.

int KDESu::KDEsuClient::startServer (  ) 

Try to start up kdesud.

Definition at line 416 of file client.cpp.

int KDESu::KDEsuClient::stopServer (  ) 

Stop the daemon.

Definition at line 382 of file client.cpp.


The documentation for this class was generated from the following files:
  • client.h
  • client.cpp

KDEsu

Skip menu "KDEsu"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.6.1
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal