G::Identity Class Reference

A very low-level interface to getpwnam() and the get/set/e/uid/gid functions. More...

#include <gidentity.h>

List of all members.

Public Member Functions

 Identity (const std::string &login_name)
 Constructor for the named identity.
bool isRoot () const
 Returns true if the userid is zero.
std::string str () const
 Returns a string representation.
void setRealUser (bool do_throw=true)
 Sets the real userid.
void setEffectiveUser (bool do_throw=true)
 Sets the effective userid.
void setEffectiveUser (SignalSafe)
 Sets the effective userid.
void setRealGroup (bool do_throw=true)
 Sets the real group id.
void setEffectiveGroup (bool do_throw=true)
 Sets the effective group id.
void setEffectiveGroup (SignalSafe)
 Sets the effective group id.
bool operator== (const Identity &) const
 Comparison operator.
bool operator!= (const Identity &) const
 Comparison operator.

Static Public Member Functions

static Identity effective ()
 Returns the current effective identity.
static Identity real ()
 Returns the calling process's real identity.
static Identity root ()
 Returns the superuser identity.
static Identity invalid ()
 Returns an invalid identity.


Detailed Description

A very low-level interface to getpwnam() and the get/set/e/uid/gid functions.

See also:
G::Process, G::Root

Definition at line 41 of file gidentity.h.


Constructor & Destructor Documentation

G::Identity::Identity ( const std::string &  login_name  )  [explicit]

Constructor for the named identity.

Throws if NoSuchUser.

Definition at line 35 of file gidentity_unix.cpp.

References Identity().

Referenced by Identity().


Member Function Documentation

G::Identity G::Identity::effective (  )  [static]

Returns the current effective identity.

Definition at line 60 of file gidentity_unix.cpp.

References m_uid.

Referenced by G::Process::beOrdinary(), G::Process::beSpecial(), G::Process::revokeExtraGroups(), and G::NewProcess::spawn().

G::Identity G::Identity::real (  )  [static]

Returns the calling process's real identity.

Definition at line 68 of file gidentity_unix.cpp.

References m_uid.

Referenced by G::Process::beNobody(), G::Process::beOrdinary(), G::Process::beSpecial(), and G::Process::revokeExtraGroups().

G::Identity G::Identity::root (  )  [static]

Returns the superuser identity.

Definition at line 81 of file gidentity_unix.cpp.

References m_uid.

Referenced by G::Process::beNobody(), and G::Process::beOrdinary().

G::Identity G::Identity::invalid (  )  [static]

Returns an invalid identity.

Definition at line 76 of file gidentity_unix.cpp.

Referenced by G::Root::start(), and G::Root::stop().

bool G::Identity::isRoot (  )  const

Returns true if the userid is zero.

Definition at line 96 of file gidentity_unix.cpp.

Referenced by G::Process::beSpecial(), and G::NewProcess::spawn().

std::string G::Identity::str (  )  const

Returns a string representation.

Definition at line 89 of file gidentity_unix.cpp.

Referenced by G::operator<<().

void G::Identity::setRealUser ( bool  do_throw = true  ) 

Sets the real userid.

Definition at line 121 of file gidentity_unix.cpp.

void G::Identity::setEffectiveUser ( bool  do_throw = true  ) 

Sets the effective userid.

Definition at line 116 of file gidentity_unix.cpp.

void G::Identity::setEffectiveUser ( SignalSafe   ) 

Sets the effective userid.

A signal-safe, reentrant overload.

Definition at line 111 of file gidentity_unix.cpp.

void G::Identity::setRealGroup ( bool  do_throw = true  ) 

Sets the real group id.

Definition at line 136 of file gidentity_unix.cpp.

void G::Identity::setEffectiveGroup ( bool  do_throw = true  ) 

Sets the effective group id.

Definition at line 126 of file gidentity_unix.cpp.

void G::Identity::setEffectiveGroup ( SignalSafe   ) 

Sets the effective group id.

A signal-safe, reentrant overload.

Definition at line 131 of file gidentity_unix.cpp.

bool G::Identity::operator== ( const Identity other  )  const

Comparison operator.

Definition at line 101 of file gidentity_unix.cpp.

References m_gid, and m_uid.

Referenced by operator!=().

bool G::Identity::operator!= ( const Identity other  )  const

Comparison operator.

Definition at line 106 of file gidentity_unix.cpp.

References operator==().


The documentation for this class was generated from the following files:

Generated on Fri Apr 18 15:56:13 2008 for E-MailRelay by  doxygen 1.5.5