~ubuntu-branches/ubuntu/trusty/schroot/trusty

« back to all changes in this revision

Viewing changes to bin/schroot/schroot-main.cc

  • Committer: Bazaar Package Importer
  • Author(s): Roger Leigh
  • Date: 2009-11-07 10:46:54 UTC
  • mfrom: (1.1.20 upstream) (2.1.6 experimental)
  • Revision ID: james.westby@ubuntu.com-20091107104654-kk1fp1icv8dzfyfi
* New upstream development release.
* schroot:
  - Return success when ending a session and the operation
    succeeded (Closes: #554907).

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 
19
19
#include <config.h>
20
20
 
 
21
#include <sbuild/sbuild-config.h>
 
22
#ifdef SBUILD_FEATURE_PAM
 
23
#include <sbuild/sbuild-auth-pam.h>
 
24
#include <sbuild/sbuild-auth-pam-conv-tty.h>
 
25
#endif
 
26
 
21
27
#include "schroot-main.h"
22
28
 
23
29
#include <cstdlib>
77
83
  this->session = sbuild::session::ptr
78
84
    (new sbuild::session("schroot", this->config, sess_op, this->chroots));
79
85
 
 
86
#ifdef SBUILD_FEATURE_PAM
 
87
  sbuild::auth::ptr auth = sbuild::auth_pam::create("schroot");
 
88
 
 
89
  sbuild::auth_pam_conv_tty::auth_ptr auth_ptr =
 
90
    std::tr1::dynamic_pointer_cast<sbuild::auth_pam>(auth);
 
91
 
 
92
  sbuild::auth_pam_conv::ptr conv = sbuild::auth_pam_conv_tty::create(auth_ptr);
 
93
 
 
94
  /* Set up authentication timeouts. */
 
95
  time_t curtime = 0;
 
96
  time(&curtime);
 
97
  conv->set_warning_timeout(curtime + 15);
 
98
  conv->set_fatal_timeout(curtime + 20);
 
99
 
 
100
  this->session->set_auth(auth);
 
101
#endif // SBUILD_FEATURE_PAM
 
102
 
80
103
  if (!this->options->user.empty())
81
 
    this->session->set_user(this->options->user);
 
104
    this->session->get_auth()->set_user(this->options->user);
82
105
}