summaryrefslogtreecommitdiff
path: root/modules/pam_tally2
diff options
context:
space:
mode:
Diffstat (limited to 'modules/pam_tally2')
-rw-r--r--modules/pam_tally2/pam_tally2.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/modules/pam_tally2/pam_tally2.c b/modules/pam_tally2/pam_tally2.c
index e513f64c..9187cbfd 100644
--- a/modules/pam_tally2/pam_tally2.c
+++ b/modules/pam_tally2/pam_tally2.c
@@ -924,7 +924,7 @@ static void
print_one(const struct tallylog *tally, uid_t uid)
{
static int once;
- char *cp;
+ char *cp = "[UNKNOWN]";
time_t fail_time;
struct tm *tm;
struct passwd *pwent;
@@ -933,9 +933,10 @@ print_one(const struct tallylog *tally, uid_t uid)
pwent = getpwuid(uid);
fail_time = tally->fail_time;
- tm = localtime(&fail_time);
- strftime (ptime, sizeof (ptime), "%D %H:%M:%S", tm);
- cp = ptime;
+ if ((tm = localtime(&fail_time)) != NULL) {
+ strftime (ptime, sizeof (ptime), "%D %H:%M:%S", tm);
+ cp = ptime;
+ }
if (pwent) {
username = pwent->pw_name;
}