git.fiddlerwoaroof.com
dual_control_test.c
dd920112
 
 #include <security/pam_appl.h>
 #include <security/pam_modules.h>
 #include <stdio.h>
 
 int pam_sm_acct_mgmt_returns_successs() {
     // given
 
     // when
     int result = pam_sm_acct_mgmt(NULL, 0, 0, NULL);
 
     // then
     return result == PAM_SUCCESS;
 }
 
9404cc1a
 int pam_sm_authenticate_returns_success() {
     //given
 
     //when
     int result = pam_sm_authenticate(NULL, 0, 0, NULL);
 
     //then
     return result == PAM_SUCCESS;
 }
 
df73f11d
 int pam_sm_setcred_returns_success() {
     //when
     int result = pam_sm_setcred(NULL, 0, 0, NULL);
 
     //then
     return result == PAM_SUCCESS;
 }
 
dd920112
 int main(int argc, char* argv[]) {
9404cc1a
     int test1_result = pam_sm_acct_mgmt_returns_successs();
     if (!test1_result) {
         printf("acct management failed\n");
     }
 
     int test2_result = pam_sm_authenticate_returns_success();
     if (!test2_result) {
         printf("acct auth failed\n");
     }
 
df73f11d
     int test3_result = pam_sm_setcred_returns_success();
     if (!test3_result) {
         printf("set cred failed\n");
     }
 
 
     if (test1_result && test2_result && test3_result) {
9404cc1a
         printf("success!\n");
dd920112
     } else {
9404cc1a
         printf("fail\n");
dd920112
     }
     return 0;
 }
 
9404cc1a