summaryrefslogtreecommitdiff
path: root/pam_file.c
diff options
context:
space:
mode:
Diffstat (limited to 'pam_file.c')
-rw-r--r--pam_file.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/pam_file.c b/pam_file.c
index 72cd877..7c05aa5 100644
--- a/pam_file.c
+++ b/pam_file.c
@@ -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;