Rudiments
|
Public Member Functions | |
userentry () | |
userentry (const userentry &u) | |
userentry & | operator= (const userentry &u) |
~userentry () | |
bool | initialize (const char *username) |
bool | initialize (uid_t userid) |
const char * | getName () const |
const char * | getPassword () const |
uid_t | getUserId () const |
const char * | getSidString () const |
const void * | getSid () const |
uint64_t | getSidSize () const |
gid_t | getPrimaryGroupId () const |
const char * | getRealName () const |
const char * | getHomeDirectory () const |
const char * | getShell () const |
const char * | getEncryptedPassword () const |
long | getLastChangeDate () const |
int32_t | getDaysBeforeChangeAllowed () const |
int32_t | getDaysBeforeChangeRequired () const |
int32_t | getDaysBeforeExpirationWarning () const |
int32_t | getDaysOfInactivityAllowed () const |
int32_t | getExpirationDate () const |
int32_t | getFlag () const |
Static Public Member Functions | |
static char * | getName (uid_t userid) |
static uid_t | getUserId (const char *username) |
static char * | getSidString (const char *username) |
static bool | platformSupportsFormalSid () |
static bool | needsMutex () |
static void | setMutex (threadmutex *mtx) |
The userentry class provides methods for retrieving information about users.
userentry::userentry | ( | ) |
Creates an instance of the userentry class.
userentry::userentry | ( | const userentry & | u | ) |
Creates an instance of the userentry class. that is a copy of "u".
userentry::~userentry | ( | ) |
Deletes this instance of the userentry class.
int32_t userentry::getDaysBeforeChangeAllowed | ( | ) | const |
Returns the number of days before the password for the user may be changed.
int32_t userentry::getDaysBeforeChangeRequired | ( | ) | const |
Returns the number of days before the password for the user is required to be changed.
int32_t userentry::getDaysBeforeExpirationWarning | ( | ) | const |
Returns the number of days before a warning that the password for the user will expire should be displayed.
int32_t userentry::getDaysOfInactivityAllowed | ( | ) | const |
Returns the number of days of inactivity that are allowed for the user before the password will expire.
const char* userentry::getEncryptedPassword | ( | ) | const |
Returns the encrypted password of this user.
int32_t userentry::getExpirationDate | ( | ) | const |
Returns the expiration date of the user. The date is returned as the number of seconds since 1970.
int32_t userentry::getFlag | ( | ) | const |
Returns the system-specific set of flags for the user.
const char* userentry::getHomeDirectory | ( | ) | const |
Returns the home directory of this user.
long userentry::getLastChangeDate | ( | ) | const |
Returns the last time that the password for the user was changed. The time is given as the number of seconds since 1970.
const char* userentry::getName | ( | ) | const |
Returns the name of this user.
|
static |
Convenience method. Returns the name of the user specified by "userid".
Note that the return value is allocated internally and returned. The calling program must free the buffer.
Returns NULL if an error occurred or if "userid" is invalid.
const char* userentry::getPassword | ( | ) | const |
Returns the encrypted password of this user.
gid_t userentry::getPrimaryGroupId | ( | ) | const |
Returns the primary group id of this user.
const char* userentry::getRealName | ( | ) | const |
Returns the real name of this user.
const char* userentry::getShell | ( | ) | const |
Returns the shell of this user.
const void* userentry::getSid | ( | ) | const |
Returns a binary representation of the SID (security id) of this user.
Note: On platforms (like non-Windows platforms) where the platformSupportsFormalSid method returns false, the value returned is just a string representation of the number returned by getUserId().
uint64_t userentry::getSidSize | ( | ) | const |
Returns the length of the binary representation of the SID (security id) of this user, returned by getSid().
const char* userentry::getSidString | ( | ) | const |
Returns a string representation of the SID (security id) of this user.
Note: On platforms (like non-Windows platforms) where the platformSupportsFormalSid method returns false, the value returned is just a string representation of the number returned by getUserId().
|
static |
Convenience method. Returns a string representation of the SID (security id) of the user specified by "username". See non-static version of this method for more information.
Note that the return value is allocated internally and returned. The calling program must free the buffer.
Returns NULL if an error occurred or if "username" is invalid.
uid_t userentry::getUserId | ( | ) | const |
Returns the id of this user.
Note: On platforms (like Windows) where the platformSupportsFormalSid method returns true, users don't have simple numeric ids. On those platforms, the value returned by this method is simply an index into an internal structure that methods of other rudiments classes know how to access and ultimately translate to a user. It should not be passed in to functions or methods of other libraries that don't ultimately use rudiments methods.
|
static |
Convenience method. Returns the id of the user specified by "username". See non-static version of this method for more information.
Returns -1 if an error occurred or if "username" is invalid.
bool userentry::initialize | ( | const char * | username | ) |
Looks up a user entry by name. Returns true on success and false on failure.
bool userentry::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.
Makes this instance of the userentry class identical to "u".
|
static |
Returns true if the platform supports a formal user SID (security id) and false if not.
Windows and windows-like platforms do. Unix and unix-like platforms (including Mac OS X) do not.
|
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.