summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormarkus <markus@openbsd.org>2006-08-18 09:15:20 +0000
committermarkus <markus@openbsd.org>2006-08-18 09:15:20 +0000
commitcfa11ce7c2c0749a8c4e6d73b7f801420af86f9a (patch)
tree940a6b3784a22eb880741b0a040582de09251f77
parentmake signal handler termination path shorter; risky code pointed out by (diff)
downloadwireguard-openbsd-cfa11ce7c2c0749a8c4e6d73b7f801420af86f9a.tar.xz
wireguard-openbsd-cfa11ce7c2c0749a8c4e6d73b7f801420af86f9a.zip
delay authentication related cleanups until we're authenticated and
all alarms have been cancelled; ok deraadt
-rw-r--r--usr.bin/ssh/auth.h3
-rw-r--r--usr.bin/ssh/session.c4
-rw-r--r--usr.bin/ssh/sshd.c3
3 files changed, 6 insertions, 4 deletions
diff --git a/usr.bin/ssh/auth.h b/usr.bin/ssh/auth.h
index 39c9e532271..bbef7fbe20f 100644
--- a/usr.bin/ssh/auth.h
+++ b/usr.bin/ssh/auth.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: auth.h,v 1.57 2006/08/03 03:34:41 deraadt Exp $ */
+/* $OpenBSD: auth.h,v 1.58 2006/08/18 09:15:20 markus Exp $ */
/*
* Copyright (c) 2000 Markus Friedl. All rights reserved.
@@ -48,6 +48,7 @@ typedef struct KbdintDevice KbdintDevice;
struct Authctxt {
sig_atomic_t success;
+ int authenticated; /* authenticated and alarms cancelled */
int postponed; /* authentication needs another step */
int valid; /* user exists and is allowed to login */
int attempt;
diff --git a/usr.bin/ssh/session.c b/usr.bin/ssh/session.c
index 0dd09cdfc07..9183c951d8e 100644
--- a/usr.bin/ssh/session.c
+++ b/usr.bin/ssh/session.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: session.c,v 1.217 2006/08/04 20:46:05 stevesk Exp $ */
+/* $OpenBSD: session.c,v 1.218 2006/08/18 09:15:20 markus Exp $ */
/*
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
* All rights reserved
@@ -2020,7 +2020,7 @@ do_cleanup(Authctxt *authctxt)
return;
called = 1;
- if (authctxt == NULL)
+ if (authctxt == NULL || !authctxt->authenticated)
return;
#ifdef KRB5
if (options.kerberos_ticket_cleanup &&
diff --git a/usr.bin/ssh/sshd.c b/usr.bin/ssh/sshd.c
index 043b502381e..23f9fd66922 100644
--- a/usr.bin/ssh/sshd.c
+++ b/usr.bin/ssh/sshd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sshd.c,v 1.346 2006/08/18 09:13:26 deraadt Exp $ */
+/* $OpenBSD: sshd.c,v 1.347 2006/08/18 09:15:20 markus Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -1705,6 +1705,7 @@ main(int ac, char **av)
*/
alarm(0);
signal(SIGALRM, SIG_DFL);
+ authctxt->authenticated = 1;
if (startup_pipe != -1) {
close(startup_pipe);
startup_pipe = -1;