sbuild  1.7.2
pam.h
1 /* Copyright © 2005-2013 Roger Leigh <rleigh@debian.org>
2  *
3  * schroot is free software: you can redistribute it and/or modify it
4  * under the terms of the GNU General Public License as published by
5  * the Free Software Foundation, either version 3 of the License, or
6  * (at your option) any later version.
7  *
8  * schroot is distributed in the hope that it will be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  * General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see
15  * <http://www.gnu.org/licenses/>.
16  *
17  *********************************************************************/
18 
19 #ifndef SBUILD_AUTH_PAM_H
20 #define SBUILD_AUTH_PAM_H
21 
22 #include <sbuild/auth/auth.h>
23 #include <sbuild/auth/pam-conv.h>
24 
25 #include <security/pam_appl.h>
26 
27 namespace sbuild
28 {
29  namespace auth
30  {
31 
39  class pam : public auth
40  {
41  private:
50  pam (const std::string& service_name);
51 
52  public:
56  virtual ~pam ();
57 
67  static auth::ptr
68  create (const std::string& service_name);
69 
70  virtual environment
71  get_auth_environment () const;
72 
79  get_conv ();
80 
86  void
88 
89  virtual void
90  start ();
91 
92  virtual void
93  stop ();
94 
95  virtual void
96  authenticate (status auth_status);
97 
98  virtual void
99  setupenv ();
100 
101  virtual void
102  account ();
103 
104  virtual void
105  cred_establish ();
106 
107  virtual void
108  cred_delete ();
109 
110  virtual void
111  open_session ();
112 
113  virtual void
114  close_session ();
115 
120  virtual bool
121  is_initialised () const;
122 
123  private:
130  const char *
131  pam_strerror (int pam_error);
132 
134  pam_handle_t *pamh;
137  };
138 
139  }
140 }
141 
142 #endif /* SBUILD_AUTH_PAM_H */
143 
144 /*
145  * Local Variables:
146  * mode:C++
147  * End:
148  */
std::shared_ptr< pam_conv > ptr
A shared_ptr to an pam_conv object.
Definition: pam-conv.h:69
virtual environment get_auth_environment() const
Get the PAM environment.
Definition: pam.cc:167
const char * pam_strerror(int pam_error)
Get a description of a PAM error.
Definition: pam.cc:459
Debian source builder components.
Definition: ctty.cc:31
virtual void authenticate(status auth_status)
Perform PAM authentication.
Definition: pam.cc:235
virtual void open_session()
Open a PAM session.
Definition: pam.cc:419
virtual bool is_initialised() const
Check if PAM is initialised (i.e.
Definition: pam.cc:453
virtual void start()
Start the PAM system.
Definition: pam.cc:185
Container of environment variables.
Definition: environment.h:38
virtual ~pam()
The destructor.
Definition: pam.cc:147
virtual void stop()
Stop the PAM system.
Definition: pam.cc:216
virtual void close_session()
Close a PAM session.
Definition: pam.cc:436
static auth::ptr create(const std::string &service_name)
Create an pam object.
Definition: pam.cc:161
pam(const std::string &service_name)
The constructor.
Definition: pam.cc:140
pam_handle_t * pamh
The PAM handle.
Definition: pam.h:134
std::shared_ptr< auth > ptr
A shared_ptr to a auth object.
Definition: auth.h:102
virtual void cred_delete()
Use PAM to delete credentials.
Definition: pam.cc:402
status
Authentication status.
Definition: auth.h:78
void set_conv(pam_conv::ptr &conv)
Set the conversation handler.
Definition: pam.cc:179
Authentication handler.
Definition: pam.h:39
virtual void setupenv()
Import the user environment into PAM.
Definition: pam.cc:332
virtual void account()
Do PAM account management (authorisation).
Definition: pam.cc:359
virtual void cred_establish()
Use PAM to establish credentials.
Definition: pam.cc:378
Authentication handler.
Definition: auth.h:74
pam_conv::ptr & get_conv()
Get the conversation handler.
Definition: pam.cc:173
pam_conv::ptr conv
The PAM conversation handler.
Definition: pam.h:136