summaryrefslogtreecommitdiff
path: root/monitor.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2012-12-12 10:44:38 +1100
committerDamien Miller <djm@mindrot.org>2012-12-12 10:44:38 +1100
commit6a1937eac5da5bdcf33aaa922ce5de0c764e37ed (patch)
treec438633fdb11870f322b013ffe4c1e7b01c2dd80 /monitor.c
parent3e1027cd1fff4b3b6320f186ccc69efe06a50466 (diff)
- 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 'monitor.c')
-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 @@
1/* $OpenBSD: monitor.c,v 1.119 2012/12/02 20:34:10 djm Exp $ */ 1/* $OpenBSD: monitor.c,v 1.120 2012/12/11 22:16:21 markus Exp $ */
2/* 2/*
3 * Copyright 2002 Niels Provos <provos@citi.umich.edu> 3 * Copyright 2002 Niels Provos <provos@citi.umich.edu>
4 * Copyright 2002 Markus Friedl <markus@openbsd.org> 4 * Copyright 2002 Markus Friedl <markus@openbsd.org>
@@ -438,10 +438,6 @@ monitor_child_preauth(Authctxt *_authctxt, struct monitor *pmonitor)
438#endif 438#endif
439 } 439 }
440 440
441 /* Drain any buffered messages from the child */
442 while (pmonitor->m_log_recvfd != -1 && monitor_read_log(pmonitor) == 0)
443 ;
444
445 if (!authctxt->valid) 441 if (!authctxt->valid)
446 fatal("%s: authenticated invalid user", __func__); 442 fatal("%s: authenticated invalid user", __func__);
447 if (strcmp(auth_method, "unknown") == 0) 443 if (strcmp(auth_method, "unknown") == 0)
@@ -452,6 +448,10 @@ monitor_child_preauth(Authctxt *_authctxt, struct monitor *pmonitor)
452 448
453 mm_get_keystate(pmonitor); 449 mm_get_keystate(pmonitor);
454 450
451 /* Drain any buffered messages from the child */
452 while (pmonitor->m_log_recvfd != -1 && monitor_read_log(pmonitor) == 0)
453 ;
454
455 close(pmonitor->m_sendfd); 455 close(pmonitor->m_sendfd);
456 close(pmonitor->m_log_recvfd); 456 close(pmonitor->m_log_recvfd);
457 pmonitor->m_sendfd = pmonitor->m_log_recvfd = -1; 457 pmonitor->m_sendfd = pmonitor->m_log_recvfd = -1;