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_NULL_H |
---|
20 | #define SBUILD_AUTH_NULL_H |
---|
21 | |
---|
22 | #include <sbuild/sbuild-auth.h> |
---|
23 | |
---|
24 | namespace sbuild |
---|
25 | { |
---|
26 | |
---|
27 | /** |
---|
28 | * Null Authentication handler. |
---|
29 | * |
---|
30 | * auth_null handles user authentication, authorisation and session |
---|
31 | * management. Unlike auth_pam, it does nothing. All attempts to |
---|
32 | * authenticate will fail. |
---|
33 | */ |
---|
34 | class auth_null : public auth |
---|
35 | { |
---|
36 | private: |
---|
37 | /** |
---|
38 | * The constructor. |
---|
39 | * |
---|
40 | * @param service_name the PAM service name. This should be a |
---|
41 | * hard-coded constant string literal for safety and security. |
---|
42 | * This is passed to pam_start() when initialising PAM, and is |
---|
43 | * used to load the correct configuration file from /etc/pam.d. |
---|
44 | */ |
---|
45 | auth_null (std::string const& service_name); |
---|
46 | |
---|
47 | public: |
---|
48 | /** |
---|
49 | * The destructor. |
---|
50 | */ |
---|
51 | virtual ~auth_null (); |
---|
52 | |
---|
53 | /** |
---|
54 | * Create an auth_null object. |
---|
55 | * |
---|
56 | * @param service_name the PAM service name. This should be a |
---|
57 | * hard-coded constant string literal for safety and security. |
---|
58 | * This is passed to pam_start() when initialising PAM, and is |
---|
59 | * used to load the correct configuration file from /etc/pam.d. |
---|
60 | */ |
---|
61 | static auth::ptr |
---|
62 | create (std::string const& service_name); |
---|
63 | |
---|
64 | /** |
---|
65 | * Get the PAM environment. This is the environment as set by PAM |
---|
66 | * modules. |
---|
67 | * |
---|
68 | * @returns an environment list. |
---|
69 | */ |
---|
70 | virtual environment |
---|
71 | get_auth_environment () const; |
---|
72 | |
---|
73 | virtual void |
---|
74 | start (); |
---|
75 | |
---|
76 | virtual void |
---|
77 | stop (); |
---|
78 | |
---|
79 | virtual void |
---|
80 | authenticate (status auth_status); |
---|
81 | |
---|
82 | virtual bool |
---|
83 | is_initialised () const; |
---|
84 | |
---|
85 | protected: |
---|
86 | /// Is the serive initialised? |
---|
87 | bool initialised; |
---|
88 | /// Minimal environment. |
---|
89 | environment auth_environment; |
---|
90 | }; |
---|
91 | |
---|
92 | } |
---|
93 | |
---|
94 | #endif /* SBUILD_AUTH_NULL_H */ |
---|
95 | |
---|
96 | /* |
---|
97 | * Local Variables: |
---|
98 | * mode:C++ |
---|
99 | * End: |
---|
100 | */ |
---|