Rudiments
|
#include <groupentry.h>
Inherits object.
Public Member Functions | |
groupentry () | |
~groupentry () | |
bool | open (const char *groupname) |
bool | open (gid_t groupid) |
const char * | getName () |
gid_t | getGroupId () |
const char * | getSidString () |
const void * | getSid () |
uint64_t | getSidSize () |
const char *const * | getMembers () |
Public Member Functions inherited from object | |
virtual | ~object () |
Static Public Member Functions | |
static gid_t | getGroupId (const char *groupname) |
static char * | getName (gid_t groupid) |
static char * | getSidString (const char *groupname) |
static bool | supportsFormalSid () |
static bool | getNeedsMutex () |
static void | setMutex (threadmutex *mtx) |
The groupentry class provides methods for retrieving information about user groups.
groupentry::groupentry | ( | ) |
Creates an instance of the groupentry class.
groupentry::~groupentry | ( | ) |
Deletes this instance of the groupentry class.
gid_t groupentry::getGroupId | ( | ) |
Returns the id of the group.
Note: On platforms (like Windows) where the supportsFormalSid method returns true, groups 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 group. It should not be passed in to functions or methods of other libraries that don't ultimately use rudiments methods.
Convenience method. Returns the id for "groupname".
Returns -1 if "groupname" was invalid or if an error occurred.
Returns a NULL-terminated list of the names of the members of the group.
Convenience method. Returns the name of "groupid". Note that the return value is allocated internally and returned. The calling program must free the buffer.
Returns NULL if "groupid" was invalid or if an error occurred.
Returns true if this class needs a mutex to operate safely in a threaded environment and false otherwise.
Returns a string representation of the SID (security id) of this group.
Note: On platforms (like non-Windows platforms) where the supportsFormalSid method returns false, the value returned is just a string representation of the number returned by getGroupId().
Convenience method. Returns a string representation of the SID (security id) of the group specified by "groupname". 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 "groupname" is invalid.
Opens a group entry by name. Returns true on success and false on failure.
bool groupentry::open | ( | gid_t | groupid | ) |
Opens a group entry by group id. Returns true on success and false on failure.
|
static |
Allows you to supply a mutex is the class needs it (see getNeedsMutex()). If your application is not multithreaded, then there is no need to supply a mutex.