E-MailRelay
|
A combination of user-id and group-id, with a very low-level interface to the get/set/e/uid/gid functions. More...
#include <gidentity.h>
Public Member Functions | |
Identity (const std::string &username, const std::string &group_name_override=std::string()) | |
Constructor for the named identity. More... | |
bool | isRoot () const noexcept |
Returns true if the userid is zero. More... | |
std::string | str () const |
Returns a string representation. More... | |
uid_t | userid () const noexcept |
Returns the user part. More... | |
gid_t | groupid () const noexcept |
Returns the group part. More... | |
bool | operator== (const Identity &) const noexcept |
Comparison operator. More... | |
bool | operator!= (const Identity &) const noexcept |
Comparison operator. More... | |
Static Public Member Functions | |
static Identity | effective () noexcept |
Returns the current effective identity. More... | |
static Identity | real (bool with_cache=true) noexcept |
Returns the calling process's real identity. More... | |
static Identity | root () noexcept |
Returns the superuser identity. More... | |
static Identity | invalid () noexcept |
Returns an invalid identity. More... | |
static Identity | invalid (SignalSafe) noexcept |
Returns an invalid identity, with a signal-safe guarantee. More... | |
static std::pair< uid_t, gid_t > | lookupUser (const std::string &user) |
Does a username lookup. Throws on error. More... | |
static gid_t | lookupGroup (const std::string &group) |
Does a groupname lookup. Throws on error. More... | |
A combination of user-id and group-id, with a very low-level interface to the get/set/e/uid/gid functions.
Uses getpwnam() to do username lookups.
Definition at line 42 of file gidentity.h.
|
explicit |
Constructor for the named identity.
Throws NoSuchUser on error.
Definition at line 55 of file gidentity_unix.cpp.
|
staticnoexcept |
Returns the current effective identity.
Definition at line 133 of file gidentity_unix.cpp.
|
noexcept |
Returns the group part.
Definition at line 189 of file gidentity_unix.cpp.
|
staticnoexcept |
Returns an invalid identity.
Definition at line 159 of file gidentity_unix.cpp.
|
staticnoexcept |
Returns an invalid identity, with a signal-safe guarantee.
Definition at line 164 of file gidentity_unix.cpp.
|
noexcept |
Returns true if the userid is zero.
Definition at line 194 of file gidentity_unix.cpp.
|
static |
Does a groupname lookup. Throws on error.
Definition at line 106 of file gidentity_unix.cpp.
|
static |
Does a username lookup. Throws on error.
Definition at line 67 of file gidentity_unix.cpp.
|
noexcept |
Comparison operator.
Definition at line 204 of file gidentity_unix.cpp.
|
noexcept |
Comparison operator.
Definition at line 199 of file gidentity_unix.cpp.
|
staticnoexcept |
Returns the calling process's real identity.
Definition at line 142 of file gidentity_unix.cpp.
|
staticnoexcept |
Returns the superuser identity.
Definition at line 169 of file gidentity_unix.cpp.
std::string G::Identity::str | ( | ) | const |
Returns a string representation.
Definition at line 177 of file gidentity_unix.cpp.
|
noexcept |
Returns the user part.
Definition at line 184 of file gidentity_unix.cpp.