Logo Search packages:      
Sourcecode: schroot version File versions  Download package

sbuild::auth Class Reference

#include <sbuild-auth.h>

Inheritance diagram for sbuild::auth:

sbuild::session dchroot::session

List of all members.


Detailed Description

Authentication handler.

auth handles user authentication, authorisation and session management using the Pluggable authentication Modules (PAM) library. It is essentially an object-oriented wrapper around PAM.

In order to use PAM correctly, it is important to call several of the methods in the correct order. For example, it is not possible to authorise a user before authenticating a user, and a session may not be started before either of these have occured.

The correct order is

After the session has finished, or if an error occured, the corresponding cleanup methods should be called

The run method will handle all this. The run_impl virtual function should be used to provide a session handler to open and close the session for the user. open_session and close_session must still be used.

Definition at line 75 of file sbuild-auth.h.


Public Types

typedef std::tr1::shared_ptr
< auth_conv
conv_ptr
 A shared_ptr to an auth_conv object.
typedef runtime_error_custom
< auth
error
 Exception type.
enum  status { STATUS_NONE, STATUS_USER, STATUS_FAIL }
 Authentication status. More...
enum  verbosity { VERBOSITY_QUIET, VERBOSITY_NORMAL, VERBOSITY_VERBOSE }
 Message verbosity. More...

Public Member Functions

void account ()
 auth (std::string const &service_name)
void authenticate ()
status change_auth (status oldauth, status newauth) const
void close_session ()
void cred_delete ()
void cred_establish ()
string_list const & get_command () const
conv_ptrget_conv ()
environment const & get_environment () const
gid_t get_gid () const
std::string const & get_home () const
environment get_pam_environment () const
uid_t get_ruid () const
std::string const & get_ruser () const
std::string const & get_service () const
std::string const & get_shell () const
uid_t get_uid () const
std::string const & get_user () const
verbosity get_verbosity () const
void open_session ()
void run ()
void set_command (string_list const &command)
void set_conv (conv_ptr &conv)
void set_environment (environment const &environment)
void set_environment (char **environment)
void set_user (std::string const &user)
void set_verbosity (verbosity verbosity)
void setupenv ()
void start ()
void stop ()
virtual ~auth ()

Protected Member Functions

virtual status get_auth_status () const
virtual void run_impl ()=0

Protected Attributes

pam_handle_t * pam
 The PAM handle.

Private Attributes

string_list command
 The command to run.
conv_ptr conv
 The PAM conversation handler.
gid_t gid
 The gid to run as.
std::string home
 The home directory to run in.
verbosity message_verbosity
 The message verbosity.
uid_t ruid
 The uid requesting authentication.
std::string ruser
 The user name requesting authentication.
const std::string service
 The PAM service name.
std::string shell
 The user shell to run.
uid_t uid
 The uid to run as.
std::string user
 The user name to run as.
environment user_environment
 The user environment to set.

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

Generated by  Doxygen 1.6.0   Back to index