=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/login/failedlogin.c,v retrieving revision 1.1 retrieving revision 1.2 diff -c -r1.1 -r1.2 *** src/usr.bin/login/failedlogin.c 1996/11/09 20:17:15 1.1 --- src/usr.bin/login/failedlogin.c 1996/12/04 04:04:41 1.2 *************** *** 1,4 **** ! /* $OpenBSD: failedlogin.c,v 1.1 1996/11/09 20:17:15 millert Exp $ */ /* * Copyright (c) 1996 Todd C. Miller --- 1,4 ---- ! /* $OpenBSD: failedlogin.c,v 1.2 1996/12/04 04:04:41 millert Exp $ */ /* * Copyright (c) 1996 Todd C. Miller *************** *** 31,37 **** */ #ifndef lint ! static char rcsid[] = "$OpenBSD: failedlogin.c,v 1.1 1996/11/09 20:17:15 millert Exp $"; #endif /* not lint */ /* --- 31,37 ---- */ #ifndef lint ! static char rcsid[] = "$OpenBSD: failedlogin.c,v 1.2 1996/12/04 04:04:41 millert Exp $"; #endif /* not lint */ /* *************** *** 54,72 **** #include "pathnames.h" struct badlogin { - size_t count; /* number of bad logins */ - time_t bl_time; /* time of the login attempt */ char bl_line[UT_LINESIZE]; /* tty used */ char bl_host[UT_HOSTSIZE]; /* remote host */ }; /* * Log a bad login to the failedlogin file. */ void ! log_failedlogin(uid, host, tty) uid_t uid; ! char *host, *tty; { struct badlogin failedlogin; int fd; --- 54,73 ---- #include "pathnames.h" struct badlogin { char bl_line[UT_LINESIZE]; /* tty used */ + char bl_name[UT_NAMESIZE]; /* remote username */ char bl_host[UT_HOSTSIZE]; /* remote host */ + time_t bl_time; /* time of the login attempt */ + size_t count; /* number of bad logins */ }; /* * Log a bad login to the failedlogin file. */ void ! log_failedlogin(uid, host, name, tty) uid_t uid; ! char *host, *name, *tty; { struct badlogin failedlogin; int fd; *************** *** 89,94 **** --- 90,99 ---- strncpy(failedlogin.bl_host, host, sizeof(failedlogin.bl_host)); else *failedlogin.bl_host = '\0'; /* NULL host field */ + if (name) + strncpy(failedlogin.bl_name, name, sizeof(failedlogin.bl_name)); + else + *failedlogin.bl_name = '\0'; /* NULL name field */ (void)write(fd, (char *)&failedlogin, sizeof(failedlogin)); (void)close(fd); } *************** *** 125,133 **** (int)sizeof(failedlogin.bl_line), failedlogin.bl_line); if (*failedlogin.bl_host != '\0') ! (void)printf(" from %.*s", ! (int)sizeof(failedlogin.bl_host), ! failedlogin.bl_host); (void)putchar('\n'); /* Reset since this is a good login and write record */ --- 130,145 ---- (int)sizeof(failedlogin.bl_line), failedlogin.bl_line); if (*failedlogin.bl_host != '\0') ! if (*failedlogin.bl_name != '\0') ! (void)printf(" from %.*s@%.*s", ! (int)sizeof(failedlogin.bl_name), ! failedlogin.bl_name, ! (int)sizeof(failedlogin.bl_host), ! failedlogin.bl_host); ! else ! (void)printf(" from %.*s", ! (int)sizeof(failedlogin.bl_host), ! failedlogin.bl_host); (void)putchar('\n'); /* Reset since this is a good login and write record */