git.fiddlerwoaroof.com
sys_pam.cc
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.
  */
 
da1b9b25
 #include <memory>
01c00cfe
 #include <vector>
 #include <security/pam_modules.h>
 #include <security/pam_appl.h>
 
d4af7e88
 #include "sys_pam.h"
01c00cfe
 
a35decfc
 namespace
 {
da1b9b25
 class impl : public pam_ifc
cdf7fd74
 {
 public:
55d92c45
     int get_conv (pam_handle *handle, const pam_conv **out) const override
a35decfc
     {
         return ::pam_get_item (handle, PAM_CONV, (const void **)out);
da1b9b25
     }
55d92c45
     int get_user (pam_handle *handle, const char **out) const override
a3ac9ba7
     {
         return ::pam_get_item (handle, PAM_USER, (const void **)out);
     }
01c00cfe
 };
 }
92957308
 
a35decfc
 pam pam::create()
 {
     static pam singleton (std::shared_ptr<pam_ifc> (new impl));
da1b9b25
     return singleton;
 }
a35decfc