git.fiddlerwoaroof.com
dual_control_integrate.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.
  */
 
bcf6f3d1
 /* PAM native handler entrypoints. Keep these dumb so the logic can
  * be tested.
  */
4a1812fd
 #include <security/pam_modules.h>
 #include <string>
 #include <memory>
 #include <vector>
 
a71244c0
 #include "request.h"
4a1812fd
 #include "dual_control.h"
 
58902985
 namespace {
     dual_control initialize() {
         dual_control_configuration configuration;
         // ....
         return dual_control::create(configuration);
     }
     dual_control dc = initialize();
 }
4a1812fd
 
b017a4d2
 PAM_EXTERN int pam_sm_authenticate (pam_handle_t *pamh, int flags, int argc,
                                     const char **argv)
cdf7fd74
 {
a4148e9b
     return dc.authenticate (pam_request (pamh, flags, argc, argv));
4a1812fd
 }
 
b017a4d2
 PAM_EXTERN int pam_sm_setcred (pam_handle_t *pamh, int flags, int argc,
                                const char **argv)
cdf7fd74
 {
a4148e9b
     return dc.setcred (pam_request ( pamh, flags, argc, argv));
4a1812fd
 }