Skip to content

Commit

Permalink
Log authentication failures
Browse files Browse the repository at this point in the history
  • Loading branch information
gblach committed Aug 16, 2015
1 parent fa20465 commit bd932f9
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions please.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include <pwd.h>
#include <stdio.h>
#include <string.h>
#include <syslog.h>
#include <unistd.h>
#include <security/pam_appl.h>

Expand Down Expand Up @@ -67,6 +68,11 @@ int authenticate()
PAM_RETURN_ON_FAILURE;

pam_return:
if(pam_err != PAM_SUCCESS) {
openlog("please", 0, LOG_AUTH);
syslog(LOG_NOTICE, pam_strerror(pamh, pam_err));
closelog();
}
pam_end(pamh, pam_err);
return pam_err == PAM_SUCCESS ? 0 : -1;
}
Expand Down

0 comments on commit bd932f9

Please sign in to comment.