summaryrefslogtreecommitdiffstats
path: root/monitor.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2012-12-12 00:44:38 +0100
committerDamien Miller <djm@mindrot.org>2012-12-12 00:44:38 +0100
commit6a1937eac5da5bdcf33aaa922ce5de0c764e37ed (patch)
treec438633fdb11870f322b013ffe4c1e7b01c2dd80 /monitor.c
parent - dtucker@cvs.openbsd.org 2012/12/07 01:51:35 (diff)
downloadopenssh-6a1937eac5da5bdcf33aaa922ce5de0c764e37ed.tar.xz
openssh-6a1937eac5da5bdcf33aaa922ce5de0c764e37ed.zip
- markus@cvs.openbsd.org 2012/12/11 22:16:21
[monitor.c] drain the log messages after receiving the keystate from the unpriv child. otherwise it might block while sending. ok djm@
Diffstat (limited to '')
-rw-r--r--monitor.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/monitor.c b/monitor.c
index 1cfc48757..8006b833c 100644
--- a/monitor.c
+++ b/monitor.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: monitor.c,v 1.119 2012/12/02 20:34:10 djm Exp $ */
+/* $OpenBSD: monitor.c,v 1.120 2012/12/11 22:16:21 markus Exp $ */
/*
* Copyright 2002 Niels Provos <provos@citi.umich.edu>
* Copyright 2002 Markus Friedl <markus@openbsd.org>
@@ -438,10 +438,6 @@ monitor_child_preauth(Authctxt *_authctxt, struct monitor *pmonitor)
#endif
}
- /* Drain any buffered messages from the child */
- while (pmonitor->m_log_recvfd != -1 && monitor_read_log(pmonitor) == 0)
- ;
-
if (!authctxt->valid)
fatal("%s: authenticated invalid user", __func__);
if (strcmp(auth_method, "unknown") == 0)
@@ -452,6 +448,10 @@ monitor_child_preauth(Authctxt *_authctxt, struct monitor *pmonitor)
mm_get_keystate(pmonitor);
+ /* Drain any buffered messages from the child */
+ while (pmonitor->m_log_recvfd != -1 && monitor_read_log(pmonitor) == 0)
+ ;
+
close(pmonitor->m_sendfd);
close(pmonitor->m_log_recvfd);
pmonitor->m_sendfd = pmonitor->m_log_recvfd = -1;