su.h

00001 /* vi: ts=8 sts=4 sw=4
00002  *
00003  * $Id: su.h 363273 2004-11-15 22:43:23Z mueller $
00004  *
00005  * This file is part of the KDE project, module kdesu.
00006  * Copyright (C) 1999,2000 Geert Jansen <jansen@kde.org>
00007  *
00008  * This is free software; you can use this library under the GNU Library 
00009  * General Public License, version 2. See the file "COPYING.LIB" for the 
00010  * exact licensing terms.
00011  */
00012 
00013 #ifndef __SU_h_Included__
00014 #define __SU_h_Included__
00015 
00016 #include <qcstring.h>
00017 
00018 #include <kdelibs_export.h>
00019 
00020 #include "stub.h"
00021 
00026 class KDESU_EXPORT SuProcess: public StubProcess
00027 {
00028 public:
00029     SuProcess(const QCString &user=0, const QCString &command=0);
00030     ~SuProcess();
00031 
00032     enum Errors { SuNotFound=1, SuNotAllowed, SuIncorrectPassword };
00033 
00037     enum checkMode { NoCheck=0, Install=1, NeedPassword=2 } ;
00038     int exec(const char *password, int check=NoCheck);
00039 
00044     int checkInstall(const char *password);
00045 
00049     int checkNeedPassword();
00050 
00051 private:
00052     enum SuErrors { error=-1, ok=0, killme=1, notauthorized=2 } ;
00053     int ConverseSU(const char *password);
00054 
00055 protected:
00056     virtual void virtual_hook( int id, void* data );
00057 private:
00058     class SuProcessPrivate;
00059     SuProcessPrivate *d;
00060 };
00061 
00062 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys