aboutsummaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorMarvin Borner2022-07-13 15:12:27 +0200
committerMarvin Borner2022-07-13 15:13:00 +0200
commit3e8f62c35fce80343b5359b45924f7bc3fc22d4f (patch)
treee80d8b8bed961e8381491ff52f50d4f0c34f5904 /main.c
Initial commit
Diffstat (limited to 'main.c')
-rw-r--r--main.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/main.c b/main.c
new file mode 100644
index 0000000..60eeec5
--- /dev/null
+++ b/main.c
@@ -0,0 +1,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/ishome", 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;
+}