Rudiments
|
Public Member Functions | |
shadowentry () | |
shadowentry (const shadowentry &s) | |
shadowentry & | operator= (const shadowentry &s) |
~shadowentry () | |
bool | initialize (const char *username) |
const char * | getName () 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 |
void | print () const |
Static Public Member Functions | |
static bool | getEncryptedPassword (const char *username, char **password) |
static bool | getLastChangeDate (const char *username, long *lstchg) |
static bool | getDaysBeforeChangeAllowed (const char *username, int32_t *min) |
static bool | getDaysBeforeChangeRequired (const char *username, int32_t *max) |
static bool | getDaysBeforeExpirationWarning (const char *username, int32_t *warn) |
static bool | getDaysOfInactivityAllowed (const char *username, int32_t *inact) |
static bool | getExpirationDate (const char *username, int32_t *expire) |
static bool | getFlag (const char *username, int32_t *flag) |
static bool | needsMutex () |
static void | setMutex (mutex *mtx) |
The shadowentry class provides methods for retrieving entries from the shadow password file (/etc/shadow on unix).
shadowentry::shadowentry | ( | ) |
Creates an instance of the shadowentry class.
shadowentry::shadowentry | ( | const shadowentry & | s | ) |
Creates an instance of the shadowentry class that is a copy of "s".
shadowentry::~shadowentry | ( | ) |
Deletes this instance of the shadowentry class.
static bool shadowentry::getDaysBeforeChangeAllowed | ( | const char * | username, |
int32_t * | min | ||
) | [static] |
Sets "min" to the number of days before the password may be changed for "username".
Returns true on success and false otherwise.
int32_t shadowentry::getDaysBeforeChangeAllowed | ( | ) | const |
Returns the number of days before the password for the shadow entry may be changed.
static bool shadowentry::getDaysBeforeChangeRequired | ( | const char * | username, |
int32_t * | max | ||
) | [static] |
Sets "min" to the number of days before the password is required to be changed for "username".
Returns true on success and false otherwise.
int32_t shadowentry::getDaysBeforeChangeRequired | ( | ) | const |
Returns the number of days before the password for the shadow entry is required to be changed.
int32_t shadowentry::getDaysBeforeExpirationWarning | ( | ) | const |
Returns the number of days before a warning that the password for the shadow entry will expire should be displayed.
static bool shadowentry::getDaysBeforeExpirationWarning | ( | const char * | username, |
int32_t * | warn | ||
) | [static] |
Sets "min" to the number of days before a warning should be displayed that the password for "username" will expire.
Returns true on success and false otherwise.
int32_t shadowentry::getDaysOfInactivityAllowed | ( | ) | const |
Returns the number of days of inactivity that are allowed for the shadow entry before the password will expire.
static bool shadowentry::getDaysOfInactivityAllowed | ( | const char * | username, |
int32_t * | inact | ||
) | [static] |
Sets "inact" to the number of days of inactivity that are allowed for "username" before the password will expire.
Returns true on success and false otherwise.
static bool shadowentry::getEncryptedPassword | ( | const char * | username, |
char ** | password | ||
) | [static] |
Sets "password" to the encrypted password for "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* shadowentry::getEncryptedPassword | ( | ) | const |
Returns the encrypted password of the shadow entry.
int32_t shadowentry::getExpirationDate | ( | ) | const |
Returns the expiration date of the shadown entry. The date is returned as the number of seconds since 1970.
static bool shadowentry::getExpirationDate | ( | const char * | username, |
int32_t * | expire | ||
) | [static] |
Sets "expire" to the date that the password for "username" will expire. The date is given as the number of seconds since 1970.
Returns true on success and false otherwise.
static bool shadowentry::getFlag | ( | const char * | username, |
int32_t * | flag | ||
) | [static] |
Sets "flag" to the system-specific set of flags that are set for "username".
Returns true on success and false otherwise.
int32_t shadowentry::getFlag | ( | ) | const |
Returns the system-specific set of flags for the shadow entry.
static bool shadowentry::getLastChangeDate | ( | const char * | username, |
long * | lstchg | ||
) | [static] |
Sets "lstchg" to the last time the password for "username" was changed. The time is returned as the number of seconds since 1970.
Returns true on success and false otherwise.
long shadowentry::getLastChangeDate | ( | ) | const |
Returns the last time that the password for the shadow entry was changed. The time is given as the number of seconds since 1970.
const char* shadowentry::getName | ( | ) | const |
Returns the name of the shadow entry.
bool shadowentry::initialize | ( | const char * | username | ) |
Looks up a shadow entry by name. Returns true on success and false on failure.
static bool shadowentry::needsMutex | ( | ) | [static] |
Returns true if this class needs a mutex to operate safely in a threaded environment and false otherwise.
shadowentry& shadowentry::operator= | ( | const shadowentry & | s | ) |
Makes this instance of the shadowentry class identical to "s".
void shadowentry::print | ( | ) | const |
Prints out a representation of the shadow entry.
static void shadowentry::setMutex | ( | mutex * | mtx | ) | [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.