sbuild  1.7.2
pam-conv.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_CONV_H
20 #define SBUILD_AUTH_PAM_CONV_H
21 
22 #include <sbuild/auth/pam-message.h>
23 #include <sbuild/error.h>
24 
25 #include <memory>
26 #include <vector>
27 
28 #include <security/pam_appl.h>
29 
30 namespace sbuild
31 {
32  namespace auth
33  {
34 
35  class pam;
36 
59  class pam_conv
60  {
61  public:
63  typedef std::vector<pam_message> message_list;
65  typedef std::shared_ptr<pam> auth_ptr;
67  typedef std::weak_ptr<pam> weak_auth_ptr;
69  typedef std::shared_ptr<pam_conv> ptr;
70 
71  protected:
73  pam_conv ();
74 
75  public:
77  virtual ~pam_conv ();
78 
84  virtual auth_ptr
85  get_auth () = 0;
86 
92  virtual void
93  set_auth (auth_ptr auth) = 0;
94 
100  virtual time_t
101  get_warning_timeout () = 0;
102 
108  virtual void
109  set_warning_timeout (time_t timeout) = 0;
110 
117  virtual time_t
118  get_fatal_timeout () = 0;
119 
126  virtual void
127  set_fatal_timeout (time_t timeout) = 0;
128 
143  virtual void
144  conversation (message_list& messages) = 0;
145  };
146 
147  }
148 }
149 
150 #endif /* SBUILD_AUTH_PAM_CONV_H */
151 
152 /*
153  * Local Variables:
154  * mode:C++
155  * End:
156  */
Authentication conversation handler interface.
Definition: pam-conv.h:59
std::shared_ptr< pam_conv > ptr
A shared_ptr to an pam_conv object.
Definition: pam-conv.h:69
Debian source builder components.
Definition: ctty.cc:31
virtual ~pam_conv()
The destructor.
Definition: pam-conv.cc:32
std::weak_ptr< pam > weak_auth_ptr
A weak pointer to an pam object.
Definition: pam-conv.h:67
virtual time_t get_fatal_timeout()=0
Get the time at which the conversation will be terminated with an error.
std::shared_ptr< pam > auth_ptr
A shared pointer to an pam object.
Definition: pam-conv.h:65
virtual void set_fatal_timeout(time_t timeout)=0
Set the time at which the conversation will be terminated with an error.
virtual void set_auth(auth_ptr auth)=0
Set the auth object.
virtual time_t get_warning_timeout()=0
Get the time at which the user will be warned.
virtual void conversation(message_list &messages)=0
Hold a conversation with the user.
virtual auth_ptr get_auth()=0
Get the auth object.
std::vector< pam_message > message_list
A list of messages.
Definition: pam-conv.h:63
virtual void set_warning_timeout(time_t timeout)=0
Set the time at which the user will be warned.
Authentication handler.
Definition: auth.h:74
pam_conv()
The constructor.
Definition: pam-conv.cc:28