Skip to content

Commit 7650e93

Browse files
committed
Fix sending error messages to the client when relaying.
We need to disable the relay I/O events to make sure the error is sent to the client immediately since we are about to close the connection.
1 parent 00e6686 commit 7650e93

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

logsrvd/logsrvd.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,8 +458,15 @@ schedule_error_message(const char *errstr, struct connection_closure *closure)
458458
sudo_debug_printf(SUDO_DEBUG_ERROR|SUDO_DEBUG_LINENO,
459459
"send error to client: %s", errstr ? errstr : "none");
460460

461-
/* Prevent further reads from the client, just write the error. */
461+
/*
462+
* Prevent further reads from the client and any relay I/O.
463+
* Just write the error to the client.
464+
*/
462465
sudo_ev_del(closure->evbase, closure->read_ev);
466+
if (closure->relay_closure != NULL) {
467+
sudo_ev_del(closure->evbase, closure->relay_closure->read_ev);
468+
sudo_ev_del(closure->evbase, closure->relay_closure->write_ev);
469+
}
463470

464471
if (errstr == NULL || closure->error || closure->write_ev == NULL)
465472
goto done;

0 commit comments

Comments
 (0)