[24167] | 1 | /* Copyright © 2005-2009 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_CHROOT_FACET_SOURCE_CLONABLE_H |
---|
| 20 | #define SBUILD_CHROOT_FACET_SOURCE_CLONABLE_H |
---|
| 21 | |
---|
| 22 | #include <sbuild/sbuild-chroot-facet.h> |
---|
| 23 | |
---|
| 24 | namespace sbuild |
---|
| 25 | { |
---|
| 26 | |
---|
| 27 | /** |
---|
| 28 | * Chroot support for creation of source chroots. |
---|
| 29 | * |
---|
| 30 | * A chroot may offer a "source" chroot in addition to its typical |
---|
| 31 | * session clone, to allow for maintenence of the source data. This |
---|
| 32 | * facet can be used by any chroot wishing to provide such |
---|
| 33 | * functionality. |
---|
| 34 | */ |
---|
| 35 | class chroot_facet_source_clonable : public chroot_facet |
---|
| 36 | { |
---|
| 37 | public: |
---|
| 38 | /// A shared_ptr to a chroot facet object. |
---|
| 39 | typedef std::tr1::shared_ptr<chroot_facet_source_clonable> ptr; |
---|
| 40 | |
---|
| 41 | /// A shared_ptr to a const chroot facet object. |
---|
| 42 | typedef std::tr1::shared_ptr<const chroot_facet_source_clonable> const_ptr; |
---|
| 43 | |
---|
| 44 | private: |
---|
| 45 | /// The constructor. |
---|
| 46 | chroot_facet_source_clonable (); |
---|
| 47 | |
---|
| 48 | public: |
---|
| 49 | /// The destructor. |
---|
| 50 | virtual ~chroot_facet_source_clonable (); |
---|
| 51 | |
---|
| 52 | /** |
---|
| 53 | * Create a chroot facet. |
---|
| 54 | * |
---|
| 55 | * @returns a shared_ptr to the new chroot facet. |
---|
| 56 | */ |
---|
| 57 | static ptr |
---|
| 58 | create (); |
---|
| 59 | |
---|
| 60 | virtual chroot_facet::ptr |
---|
| 61 | clone () const; |
---|
| 62 | |
---|
| 63 | virtual std::string const& |
---|
| 64 | get_name () const; |
---|
| 65 | |
---|
| 66 | /** |
---|
| 67 | * Set the defaults in the cloned sourceg chroot. |
---|
| 68 | * |
---|
| 69 | * @param clone the chroot to set up. |
---|
| 70 | */ |
---|
| 71 | virtual void |
---|
| 72 | clone_source_setup (chroot::ptr& clone) const; |
---|
| 73 | |
---|
| 74 | /** |
---|
| 75 | * Get the users allowed to access the source chroot. |
---|
| 76 | * |
---|
| 77 | * @returns a list of users. |
---|
| 78 | */ |
---|
| 79 | virtual string_list const& |
---|
| 80 | get_source_users () const; |
---|
| 81 | |
---|
| 82 | /** |
---|
| 83 | * Set the users allowed to access the source chroot. |
---|
| 84 | * |
---|
| 85 | * @param users a list of users. |
---|
| 86 | */ |
---|
| 87 | virtual void |
---|
| 88 | set_source_users (string_list const& users); |
---|
| 89 | |
---|
| 90 | /** |
---|
| 91 | * Get the groups allowed to access the source chroot. |
---|
| 92 | * |
---|
| 93 | * @returns a list of groups. |
---|
| 94 | */ |
---|
| 95 | virtual string_list const& |
---|
| 96 | get_source_groups () const; |
---|
| 97 | |
---|
| 98 | /** |
---|
| 99 | * Set the groups allowed to access the source chroot. |
---|
| 100 | * |
---|
| 101 | * @param groups a list of groups. |
---|
| 102 | */ |
---|
| 103 | virtual void |
---|
| 104 | set_source_groups (string_list const& groups); |
---|
| 105 | |
---|
| 106 | /** |
---|
| 107 | * Get the users allowed to access the source chroot as root. |
---|
| 108 | * Members of these users can switch to root without |
---|
| 109 | * authenticating themselves. |
---|
| 110 | * |
---|
| 111 | * @returns a list of users. |
---|
| 112 | */ |
---|
| 113 | virtual string_list const& |
---|
| 114 | get_source_root_users () const; |
---|
| 115 | |
---|
| 116 | /** |
---|
| 117 | * Set the users allowed to access the source chroot as root. |
---|
| 118 | * Members of these users can switch to root without |
---|
| 119 | * authenticating themselves. |
---|
| 120 | * |
---|
| 121 | * @param users a list of users. |
---|
| 122 | */ |
---|
| 123 | virtual void |
---|
| 124 | set_source_root_users (string_list const& users); |
---|
| 125 | |
---|
| 126 | /** |
---|
| 127 | * Get the groups allowed to access the source chroot as root. |
---|
| 128 | * Members of these groups can switch to root without |
---|
| 129 | * authenticating themselves. |
---|
| 130 | * |
---|
| 131 | * @returns a list of groups. |
---|
| 132 | */ |
---|
| 133 | virtual string_list const& |
---|
| 134 | get_source_root_groups () const; |
---|
| 135 | |
---|
| 136 | /** |
---|
| 137 | * Set the groups allowed to access the source chroot as root. |
---|
| 138 | * Members of these groups can switch to root without |
---|
| 139 | * authenticating themselves. |
---|
| 140 | * |
---|
| 141 | * @param groups a list of groups. |
---|
| 142 | */ |
---|
| 143 | virtual void |
---|
| 144 | set_source_root_groups (string_list const& groups); |
---|
| 145 | |
---|
| 146 | virtual void |
---|
| 147 | setup_env (chroot const& chroot, |
---|
| 148 | environment& env) const; |
---|
| 149 | |
---|
| 150 | virtual chroot::session_flags |
---|
| 151 | get_session_flags (chroot const& chroot) const; |
---|
| 152 | |
---|
| 153 | virtual void |
---|
| 154 | get_details (chroot const& chroot, |
---|
| 155 | format_detail& detail) const; |
---|
| 156 | |
---|
| 157 | virtual void |
---|
| 158 | get_keyfile (chroot const& chroot, |
---|
| 159 | keyfile& keyfile) const; |
---|
| 160 | |
---|
| 161 | virtual void |
---|
| 162 | set_keyfile (chroot& chroot, |
---|
| 163 | keyfile const& keyfile, |
---|
| 164 | string_list& used_keys); |
---|
| 165 | |
---|
| 166 | private: |
---|
| 167 | /// Users allowed to access the source chroot. |
---|
| 168 | string_list source_users; |
---|
| 169 | /// Groups allowed to access the source chroot. |
---|
| 170 | string_list source_groups; |
---|
| 171 | /// Users allowed to access the source chroot as root. |
---|
| 172 | string_list source_root_users; |
---|
| 173 | /// Groups allowed to access the source chroot as root. |
---|
| 174 | string_list source_root_groups; |
---|
| 175 | }; |
---|
| 176 | |
---|
| 177 | } |
---|
| 178 | |
---|
| 179 | #endif /* SBUILD_CHROOT_FACET_SOURCE_CLONABLE_H */ |
---|
| 180 | |
---|
| 181 | /* |
---|
| 182 | * Local Variables: |
---|
| 183 | * mode:C++ |
---|
| 184 | * End: |
---|
| 185 | */ |
---|