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

void auth::start (  )  [inherited]

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

An error will be thrown on failure.

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

References sbuild::auth::pam, sbuild::auth::service, and sbuild::auth::user.

Referenced by sbuild::auth::run().

{
  assert(!this->user.empty());

  if (this->pam != 0)
    {
      log_debug(DEBUG_CRITICAL)
      << "pam_start FAIL (already initialised)" << endl;
      throw error(_("PAM error: PAM is already initialised"));
    }

  struct pam_conv conv_hook =
    {
      auth_conv_hook,
      static_cast<void *>(this->conv.get())
    };

  int pam_status;

  if ((pam_status =
       pam_start(this->service.c_str(), this->user.c_str(),
             &conv_hook, &this->pam)) != PAM_SUCCESS)
    {
      log_debug(DEBUG_WARNING) << "pam_start FAIL" << endl;
      format fmt(_("PAM error: %1%"));
      fmt % pam_strerror(this->pam, pam_status);
      throw error(fmt);
    }

  log_debug(DEBUG_NOTICE) << "pam_start OK" << endl;
}


Generated by  Doxygen 1.6.0   Back to index