diff options
| author | Ian C <ianc@noddybox.co.uk> | 2025-12-05 09:01:30 +0000 |
|---|---|---|
| committer | Ian C <ianc@noddybox.co.uk> | 2025-12-05 09:01:30 +0000 |
| commit | 4e30282b85b28d56d0a0d42c8e8be93af5f3919a (patch) | |
| tree | e7b085ff0c118e26fd630b8d748998eaa8e0af2c /pam_file.c | |
| parent | 6c7ccd0fd56de27a7987bdb2b8d3a352b39acd14 (diff) | |
Diffstat (limited to 'pam_file.c')
| -rw-r--r-- | pam_file.c | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -23,6 +23,9 @@ #include <stdlib.h> #include <stdio.h> #include <string.h> + +#include <syslog.h> + #include <security/pam_appl.h> #include <security/pam_modules.h> @@ -43,8 +46,10 @@ PAM_EXTERN int pam_sm_authenticate(pam_handle_t *pam, { static const char *file_arg="file="; static const char *mode_arg="mode="; + static const char *syslog_arg="syslog"; const char *file = NULL; const char *mode = NULL; + int do_syslog = 0; const char *user; char buff[1024]; FILE *fp; @@ -68,6 +73,11 @@ PAM_EXTERN int pam_sm_authenticate(pam_handle_t *pam, { mode = argv[f] + strlen(mode_arg); } + + if (strcmp(syslog_arg, argv[f]) == 0) + { + do_syslog = 1; + } } if (!file && !mode) @@ -108,6 +118,13 @@ PAM_EXTERN int pam_sm_authenticate(pam_handle_t *pam, } } + if (do_syslog) + { + syslog(LOG_INFO, "pam_file %s user %s", + result == PAM_SUCCESS ? "allowed":"blocked", + user); + } + fclose(fp); return result; |
