- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Hierarchy
- Class Members

Public Member Functions | Static Public Member Functions | List of all members
G::Identity Class Reference

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

`#include <gidentity.h>`

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

## Static Public Member Functions
static Identity | effective ()
| Returns the current effective identity. More...
static Identity | real ()
| Returns the calling process's real identity. More...
static Identity | root ()
| Returns the superuser identity. More...
static Identity | invalid ()
| Returns an invalid identity. More...

## 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 39 of file gidentity_unix.cpp.

References G_ASSERT, G::limits::get_pwnam_r_buffer, and Identity().

Referenced by Identity().

## Member Function Documentation

G::Identity G::Identity::effective | ( |  | ) |
| static

Returns the current effective identity.

Definition at line 86 of file gidentity_unix.cpp.

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

G::Identity G::Identity::invalid | ( |  | ) |
| static

Returns an invalid identity.

Definition at line 102 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 122 of file gidentity_unix.cpp.

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

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

Comparison operator.

Definition at line 132 of file gidentity_unix.cpp.

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

Comparison operator.

Definition at line 127 of file gidentity_unix.cpp.

G::Identity G::Identity::real | ( |  | ) |
| static

Returns the calling process's real identity.

Definition at line 94 of file gidentity_unix.cpp.

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 107 of file gidentity_unix.cpp.

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

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

Sets the effective group id.

Definition at line 152 of file gidentity_unix.cpp.

void G::Identity::setEffectiveGroup | ( | SignalSafe |  | ) |

Sets the effective group id.

A signal-safe, reentrant overload.

Definition at line 157 of file gidentity_unix.cpp.

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

Sets the effective userid.

Definition at line 142 of file gidentity_unix.cpp.

void G::Identity::setEffectiveUser | ( | SignalSafe |  | ) |

Sets the effective userid.

A signal-safe, reentrant overload.

Definition at line 137 of file gidentity_unix.cpp.

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

Sets the real group id.

Definition at line 162 of file gidentity_unix.cpp.

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

Sets the real userid.

Definition at line 147 of file gidentity_unix.cpp.

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

Returns a string representation.

Definition at line 115 of file gidentity_unix.cpp.

Referenced by G::operator<<().

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

- gidentity.h
- gidentity_unix.cpp