Public Member Functions | Static Public Member Functions | Protected Attributes | Private Member Functions

sbuild::auth_null Class Reference

Null Authentication handler. More...

#include <sbuild-auth-null.h>

Inheritance diagram for sbuild::auth_null:
Inheritance graph
[legend]
Collaboration diagram for sbuild::auth_null:
Collaboration graph
[legend]

List of all members.

Public Member Functions

virtual ~auth_null ()
 The destructor.
virtual environment get_auth_environment () const
 Get the PAM environment.
virtual void start ()
 Start the PAM system.
virtual void stop ()
 Stop the PAM system.
virtual void authenticate (status auth_status)
 Perform PAM authentication.
virtual bool is_initialised () const
 Check if PAM is initialised (i.e.

Static Public Member Functions

static auth::ptr create (std::string const &service_name)
 Create an auth_null object.

Protected Attributes

bool initialised
 Is the serive initialised?
environment auth_environment
 Minimal environment.

Private Member Functions

 auth_null (std::string const &service_name)
 The constructor.

Detailed Description

Null Authentication handler.

auth_null handles user authentication, authorisation and session management. Unlike auth_pam, it does nothing. All attempts to authenticate will fail.


Constructor & Destructor Documentation

auth_null::auth_null ( std::string const &  service_name  )  [private]

The constructor.

Parameters:
service_name the PAM service name. This should be a hard-coded constant string literal for safety and security. This is passed to pam_start() when initialising PAM, and is used to load the correct configuration file from /etc/pam.d.

Referenced by create().

auth_null::~auth_null (  )  [virtual]

The destructor.

References sbuild::log_exception_error(), and stop().


Member Function Documentation

void auth_null::authenticate ( status  auth_status  )  [virtual]

Perform PAM authentication.

If auth_status is set to AUTH_USER, the user will be prompted to authenticate themselves. If auth_status is AUTH_NONE, no authentication is required, and if AUTH_FAIL, authentication will fail.

An error will be thrown on failure.

Parameters:
auth_status initial authentication status.
Todo:
Use sysconf(_SC_HOST_NAME_MAX) when libc in a stable release supports it.

Reimplemented from sbuild::auth.

References sbuild::_(), sbuild::auth::AUTHENTICATION, sbuild::auth::AUTHORISATION, sbuild::DEBUG_INFO, initialised, sbuild::log_debug(), sbuild::auth::ruid, sbuild::auth::ruser, sbuild::auth::service, sbuild::auth::STATUS_FAIL, sbuild::auth::STATUS_NONE, sbuild::auth::STATUS_USER, and sbuild::auth::user.

auth::ptr auth_null::create ( std::string const &  service_name  )  [static]

Create an auth_null object.

Parameters:
service_name the PAM service name. This should be a hard-coded constant string literal for safety and security. This is passed to pam_start() when initialising PAM, and is used to load the correct configuration file from /etc/pam.d.

References auth_null().

environment auth_null::get_auth_environment (  )  const [virtual]

Get the PAM environment.

This is the environment as set by PAM modules.

Returns:
an environment list.

Implements sbuild::auth.

References sbuild::auth::get_minimal_environment().

bool auth_null::is_initialised (  )  const [virtual]

Check if PAM is initialised (i.e.

start has been called).

Returns:
true if initialised, otherwise false.

Implements sbuild::auth.

References initialised.

void auth_null::start (  )  [virtual]

Start the PAM system.

No other PAM functions may be called before calling this function.

An error will be thrown on failure.

Reimplemented from sbuild::auth.

References sbuild::DEBUG_CRITICAL, initialised, sbuild::log_debug(), sbuild::auth::PAM_DOUBLE_INIT, and sbuild::auth::user.

void auth_null::stop (  )  [virtual]

Stop the PAM system.

No other PAM functions may be used after calling this function.

An error will be thrown on failure.

Reimplemented from sbuild::auth.

References initialised.

Referenced by ~auth_null().


Member Data Documentation

Minimal environment.

Is the serive initialised?

Referenced by authenticate(), is_initialised(), start(), and stop().


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