Rudiments
Public Member Functions | Static Public Member Functions
groupentry Class Reference

List of all members.

Public Member Functions

 groupentry ()
 groupentry (const groupentry &g)
groupentryoperator= (const groupentry &g)
 ~groupentry ()
bool initialize (const char *groupname)
bool initialize (gid_t groupid)
const char * getName () const
const char * getPassword () const
gid_t getGroupId () const
const char *const getMembers () const
void print () const

Static Public Member Functions

static bool getPassword (const char *groupname, char **password)
static bool getGroupId (const char *groupname, gid_t *groupid)
static bool getMembers (const char *groupname, char ***members)
static bool getName (gid_t groupid, char **name)
static bool getPassword (gid_t groupid, char **password)
static bool getMembers (gid_t groupid, char ***members)
static bool needsMutex ()
static void setMutex (mutex *mtx)

Detailed Description

The groupentry class provides methods for retrieving information about user groups.


Constructor & Destructor Documentation

groupentry::groupentry ( )

Creates an instance of the groupentry class.

groupentry::groupentry ( const groupentry g)

Creates an instance of the groupentry class that is a copy of "g".

groupentry::~groupentry ( )

Deletes this instance of the groupentry class.


Member Function Documentation

static bool groupentry::getGroupId ( const char *  groupname,
gid_t *  groupid 
) [static]

Sets "groupid" to the id for "groupname".

Returns true on success and false otherwise.

gid_t groupentry::getGroupId ( ) const

Returns the id of the group.

static bool groupentry::getMembers ( const char *  groupname,
char ***  members 
) [static]

Sets "members" to a NULL-terminated list of the names of the users in "groupname". Note that "members" is allocated internally and returned. The calling program must free each element and the array itself.

Returns true on success and false otherwise.

static bool groupentry::getMembers ( gid_t  groupid,
char ***  members 
) [static]

Sets "members" to a NULL-terminated list of the names of the users in "groupid". Note that "members" is allocated internally and returned. The calling program must free each element and the array itself.

Returns true on success and false otherwise.

const char* const groupentry::getMembers ( ) const

Returns a NULL-terminated list of the names of the members of the group.

static bool groupentry::getName ( gid_t  groupid,
char **  name 
) [static]

Sets "name" to the name of "groupid". Note that "name" is allocated internally and returned. The calling program must free the buffer.

Returns true on success and false otherwise.

const char* groupentry::getName ( ) const

Returns the name of the group.

const char* groupentry::getPassword ( ) const

Returns the password for the group.

static bool groupentry::getPassword ( const char *  groupname,
char **  password 
) [static]

Sets "password" to the password for "groupname". Note that "password" is allocated internally and returned. The calling program must free the buffer.

Returns true on success and false otherwise.

static bool groupentry::getPassword ( gid_t  groupid,
char **  password 
) [static]

Sets "password" to the password for "groupid". Note that "password" is allocated internally and returned. The calling program must free the buffer.

Returns true on success and false otherwise.

bool groupentry::initialize ( const char *  groupname)

Looks up a group entry by name. Returns true on success and false on failure.

bool groupentry::initialize ( gid_t  groupid)

Looks up a group entry by group id. Returns true on success and false on failure.

static bool groupentry::needsMutex ( ) [static]

Returns true if this class needs a mutex to operate safely in a threaded environment and false otherwise.

groupentry& groupentry::operator= ( const groupentry g)

Makes this instance of the groupentry class identical to "g".

void groupentry::print ( ) const

Prints out a representation of the group entry.

static void groupentry::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.