Rudiments
|
Public Member Functions | |
passwdentry () | |
passwdentry (const passwdentry &p) | |
passwdentry & | operator= (const passwdentry &p) |
~passwdentry () | |
bool | initialize (const char *username) |
bool | initialize (uid_t userid) |
const char * | getName () const |
const char * | getPassword () const |
uid_t | getUserId () const |
gid_t | getPrimaryGroupId () const |
const char * | getRealName () const |
const char * | getHomeDirectory () const |
const char * | getShell () const |
void | print () const |
Static Public Member Functions | |
static bool | getName (uid_t userid, char **name) |
static bool | getPassword (uid_t userid, char **password) |
static bool | getPrimaryGroupId (uid_t userid, gid_t *groupid) |
static bool | getRealName (uid_t userid, char **realname) |
static bool | getHomeDirectory (uid_t userid, char **homedir) |
static bool | getShell (uid_t userid, char **shell) |
static bool | getPassword (const char *username, char **password) |
static bool | getUserId (const char *username, uid_t *userid) |
static bool | getPrimaryGroupId (const char *username, gid_t *groupid) |
static bool | getRealName (const char *username, char **realname) |
static bool | getHomeDirectory (const char *username, char **homedir) |
static bool | getShell (const char *username, char **shell) |
static bool | needsMutex () |
static void | setMutex (mutex *mtx) |
The passwdentry class provides methods for retrieving information about users.
passwdentry::passwdentry | ( | ) |
Creates an instance of the passwdentry class.
passwdentry::passwdentry | ( | const passwdentry & | p | ) |
Creates an instance of the passwdentry class. that is a copy of "p".
passwdentry::~passwdentry | ( | ) |
Deletes this instance of the passwdentry class.
|
static |
Sets "homedir" to the full pathname of the home directory of the user specified by "userid". Note that "homedir" is allocated internally and returned. The calling program must free the buffer.
Returns true on success and false otherwise.
|
static |
Sets "homedir" to the full pathname of the home directory of the user specified by "username". Note that "homedir" is allocated internally and returned. The calling program must free the buffer.
Returns true on success and false otherwise.
const char* passwdentry::getHomeDirectory | ( | ) | const |
Returns the home directory of this user.
|
static |
Sets "name" to the name of the user specified by "userid". Note that "name" is allocated internally and returned. The calling program must free the buffer.
Returns true on success and false otherwise.
const char* passwdentry::getName | ( | ) | const |
Returns the name of this user.
|
static |
Sets "password" to the password of the user specified by "userid". Note that "password" is allocated internally and returned. The calling program must free the buffer.
Returns true on success and false otherwise.
|
static |
Sets "password" to the password of the user specified by "username". Note that "password" is allocated internally and returned. The calling program must free the buffer.
Returns true on success and false otherwise.
const char* passwdentry::getPassword | ( | ) | const |
Returns the encrypted password of this user.
|
static |
Sets "groupid" to the primary group id of the user specified by "userid".
Returns true on success and false otherwise.
|
static |
Sets "groupid" to the primary group id of the user specified by "username".
Returns true on success and false otherwise.
gid_t passwdentry::getPrimaryGroupId | ( | ) | const |
Returns the primary group id of this user.
|
static |
Sets "realname" to the real name of the user specified by "userid". Note that "realname" is allocated internally and returned. The calling program must free the buffer.
Returns true on success and false otherwise.
|
static |
Sets "realname" to the real name of the user specified by "username". Note that "realname" is allocated internally and returned. The calling program must free the buffer.
Returns true on success and false otherwise.
const char* passwdentry::getRealName | ( | ) | const |
Returns the real name of this user.
|
static |
Sets "shell" to the full pathname of the shell program of the user specified by "userid". Note that "shell" is allocated internally and returned. The calling program must free the buffer.
Returns true on success and false otherwise.
|
static |
Sets "shell" to the full pathname of the shell program of the user specified by "username". Note that "shell" is allocated internally and returned. The calling program must free the buffer.
Returns true on success and false otherwise.
const char* passwdentry::getShell | ( | ) | const |
Returns the shell of this user.
|
static |
Sets "userid" to the id of the user specified by "username".
Returns true on success and false otherwise.
uid_t passwdentry::getUserId | ( | ) | const |
Returns the id of this user.
bool passwdentry::initialize | ( | const char * | username | ) |
Looks up a user entry by name. Returns true on success and false on failure.
bool passwdentry::initialize | ( | uid_t | userid | ) |
Looks up a user entry by user id. Returns true on success and false on failure.
|
static |
Returns true if this class needs a mutex to operate safely in a threaded environment and false otherwise.
passwdentry& passwdentry::operator= | ( | const passwdentry & | p | ) |
Makes this instance of the passwdentry class identical to "p".
void passwdentry::print | ( | ) | const |
Prints out a representation of the user entry.
|
static |
Allows you to supply a mutex is the class needs it (see needsMutex()). If your application is not multithreaded, then there is no need to supply a mutex.