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

void auth::run (  )  [inherited]

Run a session. The user will be asked for authentication if required, and then the run_impl virtual method will be called.

An error will be thrown on failure.

Definition at line 272 of file sbuild-auth.cc.

References sbuild::auth::account(), sbuild::auth::authenticate(), sbuild::auth::cred_delete(), sbuild::auth::cred_establish(), sbuild::auth::pam, sbuild::auth::run_impl(), sbuild::auth::setupenv(), sbuild::auth::start(), and sbuild::auth::stop().

{
  try
    {
      start();
      authenticate();
      setupenv();
      account();
      try
      {
        cred_establish();

        const char *authuser = 0;
        const void *tmpcast = static_cast<const void *>(authuser);
        pam_get_item(this->pam, PAM_USER, &tmpcast);
        log_debug(DEBUG_INFO)
          << format("PAM authentication succeeded for user %1%") % authuser
          << endl;

        run_impl();

        /* The session is now finished, either
           successfully or not.  All PAM operations are
           now for cleanup and shutdown, and we must
           clean up whether or not errors were raised at
           any previous point.  This means only the
           first error is reported back to the user. */

        /* Don't cope with failure, since we are now
           already bailing out, and an error may already
           have been raised */
      }
      catch (error const& e)
      {
        try
          {
            cred_delete();
          }
        catch (error const& discard)
          {
          }
        throw;
      }
    }
  catch (error const& e)
    {
      try
      {
        /* Don't cope with failure, since we are now already bailing out,
           and an error may already have been raised */
        stop();
      }
      catch (error const& discard)
      {
      }
      throw;
    }
}


Generated by  Doxygen 1.6.0   Back to index