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 00064 static auth::ptr 00065 create (std::string const& service_name); 00066 00067 virtual environment 00068 get_auth_environment () const; 00069 00070 auth_pam_conv::ptr& 00071 get_conv (); 00072 00073 void 00074 set_conv (auth_pam_conv::ptr& conv); 00075 00076 virtual void 00077 start (); 00078 00079 virtual void 00080 stop (); 00081 00082 virtual void 00083 authenticate (status auth_status); 00084 00085 virtual void 00086 setupenv (); 00087 00088 virtual void 00089 account (); 00090 00091 virtual void 00092 cred_establish (); 00093 00094 virtual void 00095 cred_delete (); 00096 00097 virtual void 00098 open_session (); 00099 00100 virtual void 00101 close_session (); 00102 00107 virtual bool 00108 is_initialised () const; 00109 00110 private: 00117 const char * 00118 pam_strerror (int pam_error); 00119 00121 pam_handle_t *pam; 00123 auth_pam_conv::ptr conv; 00124 }; 00125 00126 } 00127 00128 #endif /* SBUILD_AUTH_PAM_H */ 00129 00130 /* 00131 * Local Variables: 00132 * mode:C++ 00133 * End: 00134 */