Rudiments
|
00001 // Copyright (c) 2002 David Muse 00002 // See the COPYING file for more information. 00003 00004 #ifndef RUDIMENTS_PASSWDENTRY_H 00005 #define RUDIMENTS_PASSWDENTRY_H 00006 00007 #include <rudiments/private/passwdentryincludes.h> 00008 00009 #ifdef RUDIMENTS_NAMESPACE 00010 namespace rudiments { 00011 #endif 00012 00013 class passwdentryprivate; 00014 00017 class RUDIMENTS_DLLSPEC passwdentry { 00018 public: 00019 00025 static bool getName(uid_t userid, char **name); 00026 00032 static bool getPassword(uid_t userid, char **password); 00033 00038 static bool getPrimaryGroupId(uid_t userid, gid_t *groupid); 00039 00045 static bool getRealName(uid_t userid, char **realname); 00046 00053 static bool getHomeDirectory(uid_t userid, char **homedir); 00054 00061 static bool getShell(uid_t userid, char **shell); 00062 00063 00069 static bool getPassword(const char *username, 00070 char **password); 00071 00075 static bool getUserId(const char *username, 00076 uid_t *userid); 00077 00082 static bool getPrimaryGroupId(const char *username, 00083 gid_t *groupid); 00084 00090 static bool getRealName(const char *username, 00091 char **realname); 00092 00099 static bool getHomeDirectory(const char *username, 00100 char **homedir); 00101 00108 static bool getShell(const char *username, 00109 char **shell); 00110 00112 passwdentry(); 00113 00116 passwdentry(const passwdentry &p); 00117 00120 passwdentry &operator=(const passwdentry &p); 00121 00123 ~passwdentry(); 00124 00127 bool initialize(const char *username); 00128 00131 bool initialize(uid_t userid); 00132 00134 const char *getName() const; 00135 00137 const char *getPassword() const; 00138 00140 uid_t getUserId() const; 00141 00143 gid_t getPrimaryGroupId() const; 00144 00146 const char *getRealName() const; 00147 00149 const char *getHomeDirectory() const; 00150 00152 const char *getShell() const; 00153 00155 void print() const; 00156 00159 static bool needsMutex(); 00160 00164 static void setMutex(mutex *mtx); 00165 00166 #include <rudiments/private/passwdentry.h> 00167 }; 00168 00169 #ifdef RUDIMENTS_NAMESPACE 00170 } 00171 #endif 00172 00173 #endif