aboutsummaryrefslogtreecommitdiff
path: root/main.c
blob: df9047db8e8958c2e8f776d1dad7bb1fbc25b1c1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include <security/pam_modules.h>
#include <security/pam_ext.h>
#include <unistd.h>
#include <stdio.h>
#include <sys/wait.h>

PAM_EXTERN int pam_sm_authenticate(pam_handle_t *handle, int flags, int argc,
				   const char **argv)
{
	if (fork() == 0) {
		execl("/etc/security/isbypass", NULL);
	} else {
		int stat;
		wait(&stat);
		if (WIFEXITED(stat) && WEXITSTATUS(stat) == 0)
			return PAM_SUCCESS;
	}
	return PAM_ABORT;
}

PAM_EXTERN int pam_sm_acct_mgmt(pam_handle_t *pamh, int flags, int argc,
				const char **argv)
{
	return PAM_SUCCESS;
}

PAM_EXTERN int pam_sm_setcred(pam_handle_t *pamh, int flags, int argc,
			      const char **argv)
{
	return PAM_SUCCESS;
}

PAM_EXTERN int pam_sm_open_session(pam_handle_t *pamh, int flags, int argc,
				   const char **argv)
{
	return PAM_SUCCESS;
}

PAM_EXTERN int pam_sm_close_session(pam_handle_t *pamh, int flags, int argc,
				    const char **argv)
{
	return PAM_SUCCESS;
}

PAM_EXTERN int pam_sm_chauthtok(pam_handle_t *pamh, int flags, int argc,
				const char **argv)
{
	return PAM_SUCCESS;
}