git.fiddlerwoaroof.com
pam.h
7684972a
 /* Copyright (C) CJ Affiliate
  *
  * You may use, distribute and modify this code under  the
  * terms of the  GNU General Public License  version 2  or
  * later.
  *
  * You should have received a copy of the license with this
  * file. If not, you will find a copy in the "LICENSE" file
  * at https://github.com/cjdev/dual-control.
  */
 
01c00cfe
 #ifndef _PAM_H
 #define _PAM_H
 #include <memory>
2fade7af
 #include <vector>
01c00cfe
 #include <security/pam_modules.h>
 
f46fb7b6
 class pam_ifc
cdf7fd74
 {
 public:
2fade7af
     virtual int get_conv (pam_handle *handle, const pam_conv **out)
     {
         return PAM_SERVICE_ERR;
     }
01c00cfe
 };
 
f46fb7b6
 class pam : public pam_ifc
cdf7fd74
 {
f46fb7b6
     typedef std::shared_ptr<pam_ifc> delegate;
 private:
     delegate delegate_;
cdf7fd74
 public:
f46fb7b6
     pam (const delegate &delegate) : delegate_ (delegate) {}
     pam() : pam (delegate (new pam_ifc)) {}
2fade7af
     int get_conv (pam_handle *handle, const pam_conv **out)
f46fb7b6
     {
2fade7af
         return delegate_->get_conv (handle, out);
f46fb7b6
     }
01c00cfe
 };
 
f46fb7b6
 pam system_pam();
01c00cfe
 
 #endif
92957308