* maintains a record of all login failures.
*/
-void failtmp (
+void failtmp (const char *username,
#ifdef HAVE_UTMPX_H
const struct utmpx *failent
#else
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 user %s to %s.",
- ut_user, ftmp));
+ username, ftmp));
return;
}
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 user %s to %s.",
- ut_user, ftmp));
+ username, ftmp));
(void) close (fd);
}
}
* Copyright (c) 1990 - 1994, Julianne Frances Haugh
* Copyright (c) 1997 - 2000, Marek Michałkiewicz
* Copyright (c) 2005 , Tomasz Kłoczko
- * Copyright (c) 2008 , Nicolas François
+ * Copyright (c) 2008 - 2009, Nicolas François
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* maintains a record of all login failures.
*/
#ifdef HAVE_UTMPX_H
-extern void failtmp (const struct utmpx *);
+extern void failtmp (const char *username, const struct utmpx *);
#else
-extern void failtmp (const struct utmp *);
+extern void failtmp (const char *username, const struct utmp *);
#endif
#endif
strncpy (failent.ut_user, failent_user,
sizeof (failent.ut_user));
failent.ut_type = USER_PROCESS;
- failtmp (&failent);
+ failtmp (failent_user, &failent);
}
retries--;