xorp

RunCommandBase::ExecId Class Reference

Class for setting the execution ID when running the command. More...

#include <run_command.hh>

List of all members.

Public Member Functions

 ExecId ()
 Default constructor.
 ExecId (uid_t uid)
 Constructor for a given user ID.
 ExecId (uid_t uid, gid_t gid)
 Constructor for a given user ID and group ID.
void save_current_exec_id ()
 Save the current execution ID.
int restore_saved_exec_id (string &error_msg) const
 Restore the previously saved execution ID.
int set_effective_exec_id (string &error_msg)
 Set the effective execution ID.
bool is_set () const
 Test if the execution ID is set.
uid_t uid () const
 Get the user ID.
gid_t gid () const
 Get the group ID.
void set_uid (uid_t v)
 Set the user ID.
void set_gid (gid_t v)
 Set the group ID.
bool is_uid_set () const
 Test if the user ID was assigned.
bool is_gid_set () const
 Test if the group ID was assigned.
void reset ()
 Reset the assigned user ID and group ID.

Private Member Functions

uid_t saved_uid () const
uid_t saved_gid () const

Private Attributes

uid_t _uid
gid_t _gid
bool _is_uid_set
bool _is_gid_set
uid_t _saved_uid
gid_t _saved_gid
bool _is_exec_id_saved

Detailed Description

Class for setting the execution ID when running the command.


Constructor & Destructor Documentation

RunCommandBase::ExecId::ExecId ( uid_t  uid)

Constructor for a given user ID.

Parameters:
uidthe user ID.
RunCommandBase::ExecId::ExecId ( uid_t  uid,
gid_t  gid 
)

Constructor for a given user ID and group ID.

Parameters:
uidthe user ID.
gidthe group ID.

Member Function Documentation

gid_t RunCommandBase::ExecId::gid ( ) const [inline]

Get the group ID.

Returns:
the group ID.
bool RunCommandBase::ExecId::is_gid_set ( ) const [inline]

Test if the group ID was assigned.

Returns:
true if the group ID was assigned, otherwise false.
bool RunCommandBase::ExecId::is_set ( ) const

Test if the execution ID is set.

Returns:
true if the execution ID is set, otherwise false.
bool RunCommandBase::ExecId::is_uid_set ( ) const [inline]

Test if the user ID was assigned.

Returns:
true if the user ID was assigned, otherwise false.
int RunCommandBase::ExecId::restore_saved_exec_id ( string &  error_msg) const

Restore the previously saved execution ID.

Parameters:
error_msgthe error message (if error).
Returns:
XORP_OK on success, otherwise XORP_ERROR.
int RunCommandBase::ExecId::set_effective_exec_id ( string &  error_msg)

Set the effective execution ID.

Parameters:
error_msgthe error message (if error).
Returns:
XORP_OK on success, otherwise XORP_ERROR.
void RunCommandBase::ExecId::set_gid ( gid_t  v) [inline]

Set the group ID.

Parameters:
vthe group ID.
void RunCommandBase::ExecId::set_uid ( uid_t  v) [inline]

Set the user ID.

Parameters:
vthe user ID.
uid_t RunCommandBase::ExecId::uid ( ) const [inline]

Get the user ID.

Returns:
the user ID.

The documentation for this class was generated from the following files:
 All Classes Namespaces Functions Variables Typedefs Enumerations