sbuild 1.4.23
sbuild-auth-pam.h
00001 /* Copyright © 2005-2007  Roger Leigh <rleigh@debian.org>
00002  *
00003  * schroot is free software: you can redistribute it and/or modify it
00004  * under the terms of the GNU General Public License as published by
00005  * the Free Software Foundation, either version 3 of the License, or
00006  * (at your option) any later version.
00007  *
00008  * schroot is distributed in the hope that it will be useful, but
00009  * WITHOUT ANY WARRANTY; without even the implied warranty of
00010  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011  * General Public License for more details.
00012  *
00013  * You should have received a copy of the GNU General Public License
00014  * along with this program.  If not, see
00015  * <http://www.gnu.org/licenses/>.
00016  *
00017  *********************************************************************/
00018 
00019 #ifndef SBUILD_AUTH_PAM_H
00020 #define SBUILD_AUTH_PAM_H
00021 
00022 #include <sbuild/sbuild-auth.h>
00023 #include <sbuild/sbuild-auth-pam-conv.h>
00024 
00025 #include <security/pam_appl.h>
00026 
00027 namespace sbuild
00028 {
00029 
00037   class auth_pam : public auth
00038   {
00039   private:
00048     auth_pam (std::string const& service_name);
00049 
00050   public:
00054     virtual ~auth_pam ();
00055 
00065     static auth::ptr
00066     create (std::string const& service_name);
00067 
00068     virtual environment
00069     get_auth_environment () const;
00070 
00076     auth_pam_conv::ptr&
00077     get_conv ();
00078 
00084     void
00085     set_conv (auth_pam_conv::ptr& conv);
00086 
00087     virtual void
00088     start ();
00089 
00090     virtual void
00091     stop ();
00092 
00093     virtual void
00094     authenticate (status auth_status);
00095 
00096     virtual void
00097     setupenv ();
00098 
00099     virtual void
00100     account ();
00101 
00102     virtual void
00103     cred_establish ();
00104 
00105     virtual void
00106     cred_delete ();
00107 
00108     virtual void
00109     open_session ();
00110 
00111     virtual void
00112     close_session ();
00113 
00118     virtual bool
00119     is_initialised () const;
00120 
00121   private:
00128     const char *
00129     pam_strerror (int pam_error);
00130 
00132     pam_handle_t       *pam;
00134     auth_pam_conv::ptr  conv;
00135   };
00136 
00137 }
00138 
00139 #endif /* SBUILD_AUTH_PAM_H */
00140 
00141 /*
00142  * Local Variables:
00143  * mode:C++
00144  * End:
00145  */