sbuild  1.6.10
sbuild-auth-pam.h
1 /* Copyright © 2005-2007 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/sbuild-auth.h>
23 #include <sbuild/sbuild-auth-pam-conv.h>
24 
25 #include <security/pam_appl.h>
26 
27 namespace sbuild
28 {
29 
37  class auth_pam : public auth
38  {
39  private:
48  auth_pam (std::string const& service_name);
49 
50  public:
54  virtual ~auth_pam ();
55 
65  static auth::ptr
66  create (std::string const& service_name);
67 
68  virtual environment
69  get_auth_environment () const;
70 
77  get_conv ();
78 
84  void
86 
87  virtual void
88  start ();
89 
90  virtual void
91  stop ();
92 
93  virtual void
94  authenticate (status auth_status);
95 
96  virtual void
97  setupenv ();
98 
99  virtual void
100  account ();
101 
102  virtual void
103  cred_establish ();
104 
105  virtual void
106  cred_delete ();
107 
108  virtual void
109  open_session ();
110 
111  virtual void
112  close_session ();
113 
118  virtual bool
119  is_initialised () const;
120 
121  private:
128  const char *
129  pam_strerror (int pam_error);
130 
132  pam_handle_t *pam;
135  };
136 
137 }
138 
139 #endif /* SBUILD_AUTH_PAM_H */
140 
141 /*
142  * Local Variables:
143  * mode:C++
144  * End:
145  */
virtual void cred_delete()
Use PAM to delete credentials.
Definition: sbuild-auth-pam.cc:401
virtual void start()
Start the PAM system.
Definition: sbuild-auth-pam.cc:182
virtual void stop()
Stop the PAM system.
Definition: sbuild-auth-pam.cc:213
Debian source builder components.
Definition: sbuild-auth-null.h:24
virtual void open_session()
Open a PAM session.
Definition: sbuild-auth-pam.cc:418
auth_pam(std::string const &service_name)
The constructor.
Definition: sbuild-auth-pam.cc:137
Authentication handler.
Definition: sbuild-auth.h:69
Container of environment variables.
Definition: sbuild-environment.h:38
virtual bool is_initialised() const
Check if PAM is initialised (i.e.
Definition: sbuild-auth-pam.cc:452
Authentication handler.
Definition: sbuild-auth-pam.h:37
const char * pam_strerror(int pam_error)
Get a description of a PAM error.
Definition: sbuild-auth-pam.cc:458
auth_pam_conv::ptr & get_conv()
Get the conversation handler.
Definition: sbuild-auth-pam.cc:170
virtual void account()
Do PAM account management (authorisation).
Definition: sbuild-auth-pam.cc:358
static auth::ptr create(std::string const &service_name)
Create an auth_pam object.
Definition: sbuild-auth-pam.cc:158
virtual environment get_auth_environment() const
Get the PAM environment.
Definition: sbuild-auth-pam.cc:164
void set_conv(auth_pam_conv::ptr &conv)
Set the conversation handler.
Definition: sbuild-auth-pam.cc:176
virtual ~auth_pam()
The destructor.
Definition: sbuild-auth-pam.cc:144
auth_pam_conv::ptr conv
The PAM conversation handler.
Definition: sbuild-auth-pam.h:134
std::shared_ptr< auth_pam_conv > ptr
A shared_ptr to an auth_pam_conv object.
Definition: sbuild-auth-pam-conv.h:67
status
Authentication status.
Definition: sbuild-auth.h:73
std::shared_ptr< auth > ptr
A shared_ptr to a auth object.
Definition: sbuild-auth.h:97
virtual void close_session()
Close a PAM session.
Definition: sbuild-auth-pam.cc:435
virtual void authenticate(status auth_status)
Perform PAM authentication.
Definition: sbuild-auth-pam.cc:232
virtual void cred_establish()
Use PAM to establish credentials.
Definition: sbuild-auth-pam.cc:377
pam_handle_t * pam
The PAM handle.
Definition: sbuild-auth-pam.h:132
virtual void setupenv()
Import the user environment into PAM.
Definition: sbuild-auth-pam.cc:329