45 G_EXCEPTION( NoSuchUser ,
"no such user" ) ;
46 G_EXCEPTION( UidError ,
"cannot set uid" ) ;
47 G_EXCEPTION( GidError ,
"cannot set gid" ) ;
49 explicit Identity(
const std::string & login_name ) ;
72 std::string
str()
const ;
143 std::ostream & operator<<( std::ostream & stream ,
const G::Identity & identity )
145 return stream << identity.
str() ;
bool isRoot() const
Returns true if the userid is zero.
An empty structure that is used to indicate a signal-safe, reentrant implementation.
static Identity root()
Returns the superuser identity.
static Identity real()
Returns the calling process's real identity.
static Identity invalid()
Returns an invalid identity.
A combination of user-id and group-id, with a very low-level interface to the get/set/e/uid/gid funct...
static void setRealGroupTo(Identity, bool do_throw=true)
Sets the real group id.
static Identity effective()
Returns the current effective identity.
void setRealUser(bool do_throw=true)
Sets the real userid.
void setRealGroup(bool do_throw=true)
Sets the real group id.
A convenience class which, when used as a private base, can improve readability when calling Identity...
static void setEffectiveUserTo(Identity, bool do_throw=true)
Sets the effective userid.
void setEffectiveGroup(bool do_throw=true)
Sets the effective group id.
bool operator==(const Identity &) const
Comparison operator.
static void setEffectiveGroupTo(Identity, bool do_throw=true)
Sets the effective group id.
std::string str() const
Returns a string representation.
static void setRealUserTo(Identity, bool do_throw=true)
Sets the real userid.
bool operator!=(const Identity &) const
Comparison operator.
void setEffectiveUser(bool do_throw=true)
Sets the effective userid.