27 G::Root * G::Root::m_this = NULL ;
28 bool G::Root::m_initialised = false ;
33 m_change_group(change_group)
35 if( m_this == NULL && m_initialised )
46 if( m_this ==
this && m_initialised )
52 catch( std::exception & e )
54 G_ERROR(
"G::Root: cannot release root privileges: " << e.what() ) ;
58 G_ERROR(
"G::Root: cannot release root privileges" ) ;
79 m_initialised = true ;
Root(bool change_group=true)
Constructor.
An empty structure that is used to indicate a signal-safe, reentrant implementation.
static Identity nobody()
Returns the 'nobody' identity.
static Identity invalid()
Returns an invalid identity.
A very low-level interface to getpwnam() and the get/set/e/uid/gid functions.
A class which acquires the process's special privileges on construction and releases them on destruct...
static Identity start(SignalSafe)
A signal-safe alternative to construction.
static void stop(SignalSafe, Identity)
A signal-safe alternative to destruction.
static Identity beOrdinary(Identity nobody, bool change_group=true)
Revokes special privileges (root or suid).
static Identity beSpecial(Identity special, bool change_group=true)
Re-acquires special privileges (either root or suid).
static void revokeExtraGroups()
Revokes secondary group memberships if really root or if suid.
static void init(const std::string &nobody)
Initialises this class on process start-up by releasing root or suid privileges.