summaryrefslogtreecommitdiffstats
path: root/monitor_wrap.c
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2024-06-20 01:24:47 +0200
committerDamien Miller <djm@mindrot.org>2024-06-20 02:19:10 +0200
commitd9336d344eb2a1e898c5e66147b3f108c7214694 (patch)
tree27f68702e33d48d86f059d367fd5386f54c12798 /monitor_wrap.c
parentupstream: remove one more mention of DSA (diff)
downloadopenssh-d9336d344eb2a1e898c5e66147b3f108c7214694.tar.xz
openssh-d9336d344eb2a1e898c5e66147b3f108c7214694.zip
upstream: put back reaping of preauth child process when writes
from the monitor fail. Not sure how this got lost in the avalanche of patches. OpenBSD-Commit-ID: eb7eb36371e1ac01050b32b70fb2b3e5d98e72f5
Diffstat (limited to 'monitor_wrap.c')
-rw-r--r--monitor_wrap.c43
1 files changed, 24 insertions, 19 deletions
diff --git a/monitor_wrap.c b/monitor_wrap.c
index d88c33d1f..5358c77a1 100644
--- a/monitor_wrap.c
+++ b/monitor_wrap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: monitor_wrap.c,v 1.135 2024/06/11 02:54:51 djm Exp $ */
+/* $OpenBSD: monitor_wrap.c,v 1.136 2024/06/19 23:24:47 djm Exp $ */
/*
* Copyright 2002 Niels Provos <provos@citi.umich.edu>
* Copyright 2002 Markus Friedl <markus@openbsd.org>
@@ -121,24 +121,6 @@ mm_is_monitor(void)
return (pmonitor && pmonitor->m_pid > 0);
}
-void
-mm_request_send(int sock, enum monitor_reqtype type, struct sshbuf *m)
-{
- size_t mlen = sshbuf_len(m);
- u_char buf[5];
-
- debug3_f("entering, type %d", type);
-
- if (mlen >= 0xffffffff)
- fatal_f("bad length %zu", mlen);
- POKE_U32(buf, mlen + 1);
- buf[4] = (u_char) type; /* 1st byte of payload is mesg-type */
- if (atomicio(vwrite, sock, buf, sizeof(buf)) != sizeof(buf))
- fatal_f("write: %s", strerror(errno));
- if (atomicio(vwrite, sock, sshbuf_mutable_ptr(m), mlen) != mlen)
- fatal_f("write: %s", strerror(errno));
-}
-
static void
mm_reap(void)
{
@@ -171,6 +153,29 @@ mm_reap(void)
}
void
+mm_request_send(int sock, enum monitor_reqtype type, struct sshbuf *m)
+{
+ size_t mlen = sshbuf_len(m);
+ u_char buf[5];
+
+ debug3_f("entering, type %d", type);
+
+ if (mlen >= 0xffffffff)
+ fatal_f("bad length %zu", mlen);
+ POKE_U32(buf, mlen + 1);
+ buf[4] = (u_char) type; /* 1st byte of payload is mesg-type */
+ if (atomicio(vwrite, sock, buf, sizeof(buf)) != sizeof(buf) ||
+ atomicio(vwrite, sock, sshbuf_mutable_ptr(m), mlen) != mlen) {
+ if (errno == EPIPE) {
+ debug3_f("monitor fd closed");
+ mm_reap();
+ cleanup_exit(255);
+ }
+ fatal_f("write: %s", strerror(errno));
+ }
+}
+
+void
mm_request_receive(int sock, struct sshbuf *m)
{
u_char buf[4], *p = NULL;