diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 1996-11-09 06:39:42 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 1996-11-09 06:39:42 +0000 |
commit | cbc1c9d824017dd5559f7c811d4c26e24a1b27e3 (patch) | |
tree | d1ed99169aeb90c4b8d4837e8aa8eeebdb7cee63 /usr.bin/login | |
parent | 220cfce5d23d7e23926c1638a6697f19742bdefb (diff) |
Log failures if user closes network session while in username/password
prompt phase. Previously the SIGHUP was not catched and so failures
were not logged. Noticed by bitblt.
Diffstat (limited to 'usr.bin/login')
-rw-r--r-- | usr.bin/login/login.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/usr.bin/login/login.c b/usr.bin/login/login.c index 4148d1e4c9c..007d05d4878 100644 --- a/usr.bin/login/login.c +++ b/usr.bin/login/login.c @@ -1,4 +1,4 @@ -/* $OpenBSD: login.c,v 1.10 1996/11/05 18:23:49 deraadt Exp $ */ +/* $OpenBSD: login.c,v 1.11 1996/11/09 06:39:41 millert Exp $ */ /* $NetBSD: login.c,v 1.13 1996/05/15 23:50:16 jtc Exp $ */ /*- @@ -44,7 +44,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)login.c 8.4 (Berkeley) 4/2/94"; #endif -static char rcsid[] = "$OpenBSD: login.c,v 1.10 1996/11/05 18:23:49 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: login.c,v 1.11 1996/11/09 06:39:41 millert Exp $"; #endif /* not lint */ /* @@ -58,6 +58,7 @@ static char rcsid[] = "$OpenBSD: login.c,v 1.10 1996/11/05 18:23:49 deraadt Exp #include <sys/time.h> #include <sys/resource.h> #include <sys/file.h> +#include <sys/wait.h> #include <err.h> #include <errno.h> @@ -84,6 +85,7 @@ void getloginname __P((void)); void motd __P((void)); int rootterm __P((char *)); void sigint __P((int)); +void sighup __P((int)); void sleepexit __P((int)); char *stypeof __P((char *)); void timedout __P((int)); @@ -135,6 +137,7 @@ main(argc, argv) (void)alarm(timeout); (void)signal(SIGQUIT, SIG_IGN); (void)signal(SIGINT, SIG_IGN); + (void)signal(SIGHUP, sighup); (void)setpriority(PRIO_PROCESS, 0, 0); openlog("login", LOG_ODELAY, LOG_AUTH); @@ -374,6 +377,7 @@ main(argc, argv) ctime(&pwd->pw_expire)); /* Nothing else left to fail -- really log in. */ + (void)signal(SIGHUP, SIG_DFL); memset((void *)&utmp, 0, sizeof(utmp)); (void)time(&utmp.ut_time); (void)strncpy(utmp.ut_name, username, sizeof(utmp.ut_name)); @@ -689,3 +693,13 @@ sleepexit(eval) (void)sleep(5); exit(eval); } + +void +sighup(signum) + int signum; +{ + if (username) + badlogin(username); + + exit(W_EXITCODE(0, signum)); +} |