sbuild  1.6.10
sbuild-auth-pam-conv.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_CONV_H
20 #define SBUILD_AUTH_PAM_CONV_H
21 
22 #include <sbuild/sbuild-auth-pam-message.h>
23 #include <sbuild/sbuild-error.h>
24 #include <sbuild/sbuild-tr1types.h>
25 
26 #include <vector>
27 
28 #include <security/pam_appl.h>
29 
30 namespace sbuild
31 {
32 
33  class auth_pam;
34 
58  {
59  public:
61  typedef std::vector<auth_pam_message> message_list;
63  typedef std::shared_ptr<auth_pam> auth_ptr;
65  typedef std::weak_ptr<auth_pam> weak_auth_ptr;
67  typedef std::shared_ptr<auth_pam_conv> ptr;
68 
69  protected:
71  auth_pam_conv ();
72 
73  public:
75  virtual ~auth_pam_conv ();
76 
82  virtual auth_ptr
83  get_auth () = 0;
84 
90  virtual void
91  set_auth (auth_ptr auth) = 0;
92 
98  virtual time_t
99  get_warning_timeout () = 0;
100 
106  virtual void
107  set_warning_timeout (time_t timeout) = 0;
108 
115  virtual time_t
116  get_fatal_timeout () = 0;
117 
124  virtual void
125  set_fatal_timeout (time_t timeout) = 0;
126 
141  virtual void
142  conversation (message_list& messages) = 0;
143  };
144 
145 }
146 
147 #endif /* SBUILD_AUTH_PAM_CONV_H */
148 
149 /*
150  * Local Variables:
151  * mode:C++
152  * End:
153  */
virtual void set_auth(auth_ptr auth)=0
Set the auth object.
virtual void set_warning_timeout(time_t timeout)=0
Set the time at which the user will be warned.
TR1 type substitution.
Debian source builder components.
Definition: sbuild-auth-null.h:24
Authentication handler.
Definition: sbuild-auth.h:69
Authentication conversation handler interface.
Definition: sbuild-auth-pam-conv.h:57
virtual time_t get_warning_timeout()=0
Get the time at which the user will be warned.
virtual void set_fatal_timeout(time_t timeout)=0
Set the time at which the conversation will be terminated with an error.
virtual auth_ptr get_auth()=0
Get the auth object.
auth_pam_conv()
The constructor.
Definition: sbuild-auth-pam-conv.cc:25
std::shared_ptr< auth_pam_conv > ptr
A shared_ptr to an auth_pam_conv object.
Definition: sbuild-auth-pam-conv.h:67
std::weak_ptr< auth_pam > weak_auth_ptr
A weak pointer to an auth_pam object.
Definition: sbuild-auth-pam-conv.h:65
std::vector< auth_pam_message > message_list
A list of messages.
Definition: sbuild-auth-pam-conv.h:61
virtual time_t get_fatal_timeout()=0
Get the time at which the conversation will be terminated with an error.
virtual ~auth_pam_conv()
The destructor.
Definition: sbuild-auth-pam-conv.cc:29
std::shared_ptr< auth_pam > auth_ptr
A shared pointer to an auth_pam object.
Definition: sbuild-auth-pam-conv.h:63
virtual void conversation(message_list &messages)=0
Hold a conversation with the user.