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

KDEsu

  • KDESu
  • KDEsuClient
Public Member Functions | List of all members
KDESu::KDEsuClient Class Reference

#include <kdesu/client.h>

Public Member Functions

 KDEsuClient ()
 
 ~KDEsuClient ()
 
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 ()
 
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 ()
 

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 56 of file client.cpp.

KDESu::KDEsuClient::~KDEsuClient ( )

Definition at line 81 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
commandThe command.
userThe user.
Returns
zero on success, -1 on an error

Definition at line 280 of file client.cpp.

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

Delete all persistent variables in a group.

Parameters
groupthe group name. See setVar.
Returns

Definition at line 365 of file client.cpp.

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

Delete a persistent variable.

Parameters
keyThe name of the variable.
Returns
zero on success, -1 on failure.

Definition at line 357 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_keythe name of the variable.
Returns
zero on success, -1 on failure.

Definition at line 373 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
commandThe command to execute.
userThe user to run the command as.
optionsExtra options.
envExtra environment variables.
Returns
Zero on success, -1 on failure.

Definition at line 233 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 386 of file client.cpp.

bool KDESu::KDEsuClient::findGroup ( const QByteArray &  group)

Returns true if the specified group exists is cached.

Parameters
groupthe group key
Returns
true if the group is found

Definition at line 347 of file client.cpp.

QList< QByteArray > KDESu::KDEsuClient::getKeys ( const QByteArray &  group)

Gets all the keys that are membes of the given group.

Parameters
groupthe group name of the variables.
Returns
a list of the keys in the group.

Definition at line 314 of file client.cpp.

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

Get a persistent variable.

Parameters
keyThe name of the variable.
Returns
Its value.

Definition at line 304 of file client.cpp.

bool KDESu::KDEsuClient::isServerSGID ( )

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

Definition at line 413 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 381 of file client.cpp.

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

Set the target host (optional).

Definition at line 254 of file client.cpp.

int KDESu::KDEsuClient::setPass ( const char *  pass,
int  timeout 
)

Set root's password, lasts one session.

Parameters
passRoot's password.
timeoutThe time that a password will live.
Returns
Zero on success, -1 on failure.

Definition at line 223 of file client.cpp.

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

Set the desired priority (optional), see StubProcess.

Definition at line 262 of file client.cpp.

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

Set the desired scheduler (optional), see StubProcess.

Definition at line 271 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
keyThe name of the variable.
valueIts value.
timeoutThe timeout in seconds for this key. Zero means no timeout.
groupMake the key part of a group. See delGroup.
Returns
zero on success, -1 on failure.

Definition at line 289 of file client.cpp.

int KDESu::KDEsuClient::startServer ( )

Try to start up kdesud.

Definition at line 429 of file client.cpp.

int KDESu::KDEsuClient::stopServer ( )

Stop the daemon.

Definition at line 395 of file client.cpp.


The documentation for this class was generated from the following files:
  • client.h
  • client.cpp
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:24:36 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KDEsu

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

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal