* libmisc/failure.c: Ignore the return value of strftime() and
printf(). * libmisc/failure.c: Fix syslog call. The UID is not available. User the username specified in the utmp/utmpx entry.
This commit is contained in:
parent
f42160862a
commit
52fe9f62f6
@ -1,3 +1,10 @@
|
||||
2008-06-15 Nicolas François <nicolas.francois@centraliens.net>
|
||||
|
||||
* libmisc/failure.c: Ignore the return value of strftime() and
|
||||
printf().
|
||||
* libmisc/failure.c: Fix syslog call. The UID is not available.
|
||||
User the username specified in the utmp/utmpx entry.
|
||||
|
||||
2008-06-15 Nicolas François <nicolas.francois@centraliens.net>
|
||||
|
||||
* lib/defines.h: Avoid implicit conversion of pointers to
|
||||
|
@ -250,7 +250,7 @@ void failprint (const struct faillog *fail)
|
||||
/*
|
||||
* Print all information we have.
|
||||
*/
|
||||
strftime (lasttimeb, sizeof lasttimeb, "%c", tp);
|
||||
(void) strftime (lasttimeb, sizeof lasttimeb, "%c", tp);
|
||||
#else
|
||||
|
||||
/*
|
||||
@ -271,12 +271,12 @@ void failprint (const struct faillog *fail)
|
||||
lasttime++;
|
||||
}
|
||||
#endif
|
||||
printf (ngettext ("%d failure since last login.\n"
|
||||
"Last was %s on %s.\n",
|
||||
"%d failures since last login.\n"
|
||||
"Last was %s on %s.\n",
|
||||
(unsigned long) fail->fail_cnt),
|
||||
fail->fail_cnt, lasttime, fail->fail_line);
|
||||
(void) printf (ngettext ("%d failure since last login.\n"
|
||||
"Last was %s on %s.\n",
|
||||
"%d failures since last login.\n"
|
||||
"Last was %s on %s.\n",
|
||||
(unsigned long) fail->fail_cnt),
|
||||
fail->fail_cnt, lasttime, fail->fail_line);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -318,9 +318,13 @@ void failtmp (
|
||||
|
||||
fd = open (ftmp, O_WRONLY | O_APPEND);
|
||||
if (-1 == fd) {
|
||||
char ut_user[sizeof failent->ut_user];
|
||||
(void) strncpy (&ut_user[0], failent->ut_user, sizeof ut_user);
|
||||
ut_user[sizeof ut_user - 1] = '\0';
|
||||
|
||||
SYSLOG ((LOG_WARN,
|
||||
"Can't append failure of UID %lu to %s.",
|
||||
(unsigned long) uid, ftmp));
|
||||
"Can't append failure of user %s to %s.",
|
||||
ut_user, ftmp));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -330,9 +334,13 @@ void failtmp (
|
||||
|
||||
if ( (write (fd, (const void *) failent, sizeof *failent) != (ssize_t) sizeof *failent)
|
||||
|| (close (fd) != 0)) {
|
||||
char ut_user[sizeof failent->ut_user];
|
||||
(void) strncpy (&ut_user[0], failent->ut_user, sizeof ut_user);
|
||||
ut_user[sizeof ut_user - 1] = '\0';
|
||||
|
||||
SYSLOG ((LOG_WARN,
|
||||
"Can't append failure of UID %lu to %s.",
|
||||
(unsigned long) uid, ftmp));
|
||||
"Can't append failure of user %s to %s.",
|
||||
ut_user, ftmp));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user