Test suites with dirty autoconf. Closes #20
This commit is contained in:
@ -8,8 +8,10 @@ LICENSE : GNU-GPLv3
|
||||
|
||||
#include <stdint.h>
|
||||
#include <unistd.h>
|
||||
#include <security/pam_modules.h>
|
||||
#include <security/pam_ext.h>
|
||||
#ifndef TEST
|
||||
#include <security/pam_modules.h>
|
||||
#include <security/pam_ext.h>
|
||||
#endif
|
||||
#include <syslog.h>
|
||||
#include "pam_panic_reject.h"
|
||||
|
||||
@ -17,20 +19,34 @@ LICENSE : GNU-GPLv3
|
||||
|
||||
int authDevice(pam_handle_t *pamh, char *allowed, char *rejected, char *serious_dev, int8_t bSerious, int8_t bReboot, int8_t bPoweroff){
|
||||
|
||||
int8_t counter = 0;
|
||||
while(access(allowed, F_OK) == -1 && access(rejected, F_OK) == -1){
|
||||
pam_prompt(pamh, PAM_PROMPT_ECHO_OFF, NULL, ASK);
|
||||
if(++counter >= 3){
|
||||
pam_syslog(pamh, LOG_NOTICE, "Couldn't identify any keys. 3 tries.");
|
||||
return (PAM_MAXTRIES);
|
||||
#ifndef TEST
|
||||
int8_t counter = 0;
|
||||
while(access(allowed, F_OK) == -1 && access(rejected, F_OK) == -1){
|
||||
pam_prompt(pamh, PAM_PROMPT_ECHO_OFF, NULL, ASK);
|
||||
if(++counter >= 3){
|
||||
pam_syslog(pamh, LOG_NOTICE, "Couldn't identify any keys. 3 tries.");
|
||||
return (PAM_MAXTRIES);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if(access(allowed, F_OK) != -1)
|
||||
return (PAM_SUCCESS);
|
||||
#ifndef TEST
|
||||
return (PAM_SUCCESS);
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
if(access(rejected, F_OK) != -1)
|
||||
return reject(serious_dev, bSerious, bReboot, bPoweroff);
|
||||
#ifndef TEST
|
||||
return reject(serious_dev, bSerious, bReboot, bPoweroff);
|
||||
#else
|
||||
return 99;
|
||||
#endif
|
||||
|
||||
return (PAM_MAXTRIES);
|
||||
#ifndef TEST
|
||||
return (PAM_MAXTRIES);
|
||||
#else
|
||||
return 1;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user