Detailed Description
User & Group Information.
Get / Set User ID |
bool | ola::SupportsUIDs () |
| Check whether the current platform supports User and Group IDs.
|
bool | ola::GetUID (uid_t *uid) |
| Get the real UID of the process.
|
bool | ola::GetEUID (uid_t *euid) |
| Get the effective UID of the process.
|
bool | ola::SetUID (uid_t new_uid) |
| Set the effective UID of the process.
|
Get / Set Group ID |
bool | ola::GetGID (gid_t *gid) |
| Get the real Group ID.
|
bool | ola::GetEGID (gid_t *egid) |
| Get the effective group ID.
|
bool | ola::SetGID (gid_t new_gid) |
| Set the effective Group ID of the process.
|
Lookup User Information |
bool | ola::GetPasswdName (const std::string &name, PasswdEntry *passwd) |
| Lookup a user account by username.
|
bool | ola::GetPasswdUID (uid_t uid, PasswdEntry *passwd) |
| Lookup a user account by UID.
|
Lookup Group Information. |
bool | ola::GetGroupName (const std::string &name, GroupEntry *passwd) |
| Lookup a group account by name.
|
bool | ola::GetGroupGID (gid_t gid, GroupEntry *passwd) |
| Lookup a group account by GID.
|
Function Documentation
bool ola::GetEGID |
( |
gid_t * |
egid | ) |
|
Get the effective group ID.
- Parameters
-
egid | is the variable to receive the effective Group ID |
- Returns
- true on success, false otherwise
bool ola::GetEUID |
( |
uid_t * |
euid | ) |
|
Get the effective UID of the process.
- Parameters
-
euid | is the variable to receive the effective UID |
- Returns
- true on success, false otherwise
bool ola::GetGID |
( |
gid_t * |
gid | ) |
|
Get the real Group ID.
- Parameters
-
gid | is the variable to receive the real Group ID |
- Returns
- true on success, false otherwise
bool ola::GetGroupGID |
( |
gid_t |
gid, |
|
|
GroupEntry * |
passwd |
|
) |
| |
Lookup a group account by GID.
- Note
- This is only thread safe & reentrant if the underlying OS supports it.
- Wraps getgrpid()/getgrpid_r().
- Parameters
-
[in] | gid | is the Group ID to match against |
[out] | passwd | is a GroupEntry to be populated upon success |
- Returns
- true on success and false otherwise
bool ola::GetGroupName |
( |
const std::string & |
name, |
|
|
GroupEntry * |
passwd |
|
) |
| |
Lookup a group account by name.
- Note
- This is only thread safe & reentrant if the underlying OS supports it.
- Wraps getgrnam()/getgrnam_r().
- Parameters
-
[in] | name | the name of the group to match |
[out] | passwd | is a GroupEntry to be populated upon success |
- Returns
- true on success and false otherwise
bool ola::GetPasswdName |
( |
const std::string & |
name, |
|
|
PasswdEntry * |
passwd |
|
) |
| |
Lookup a user account by username.
- Note
- Only thread safe and reentrant if the underlying OS supports it.
- Wraps getpwnam() / getpwnam_r().
- Parameters
-
[in] | name | username to search for. |
[out] | passwd | struct to hold information for username name |
- Returns
- true on success, false otherwise
bool ola::GetPasswdUID |
( |
uid_t |
uid, |
|
|
PasswdEntry * |
passwd |
|
) |
| |
Lookup a user account by UID.
- Note
- Only thread safe and reentrant if the underlying OS supports it.
- Wraps getpwuid()/getpwuid_r().
- Parameters
-
[in] | uid | is the User ID to match against |
[out] | passwd | struct to hold information for uid |
- Returns
- true on success, false otherwise
bool ola::GetUID |
( |
uid_t * |
uid | ) |
|
Get the real UID of the process.
- Parameters
-
uid | is the variable to receive the real UID |
- Returns
- true on success, false otherwise
bool ola::SetGID |
( |
gid_t |
new_gid | ) |
|
Set the effective Group ID of the process.
- Note
- This is a one way street. Only valid if the current egid is 0, or egid == new_gid
- Parameters
-
new_gid | new Group ID to set process group to |
- Returns
- true on success, false otherwise
bool ola::SetUID |
( |
uid_t |
new_uid | ) |
|
Set the effective UID of the process.
- Note
- This is a one way street, and is only valid if the current euid is 0, or euid == new_uid
- Parameters
-
new_uid | is the user id to set the processes to |
- Returns
- true on success, false otherwise
bool ola::SupportsUIDs |
( |
| ) |
|
Check whether the current platform supports User and Group IDs.
- Returns
- true on *nix, false on Windows