Fix problem when SSL_read() returns SSL_ERROR_WANT_WRITE. This can

happen when the socket cannot be written to immediately.
We need to set the read_instead_of_write flag in that case, _not_
write_instead_of_read.  Also sync comments with sendlog.c.
Bug #954
This commit is contained in:
Todd C. Miller
2021-01-20 11:25:23 -07:00
parent d98dd5f98d
commit eb536d8b7c

View File

@@ -1700,7 +1700,8 @@ server_msg_cb(int fd, int what, void *v)
} }
closure->temporary_write_event = true; closure->temporary_write_event = true;
} }
closure->write_instead_of_read = true; /* Redirect write event to finish SSL_read() */
closure->read_instead_of_write = true;
debug_return; debug_return;
case SSL_ERROR_SSL: case SSL_ERROR_SSL:
/* /*
@@ -1842,6 +1843,7 @@ client_msg_cb(int fd, int what, void *v)
/* ssl wants to read, read event always active */ /* ssl wants to read, read event always active */
sudo_debug_printf(SUDO_DEBUG_NOTICE|SUDO_DEBUG_LINENO, sudo_debug_printf(SUDO_DEBUG_NOTICE|SUDO_DEBUG_LINENO,
"SSL_write returns SSL_ERROR_WANT_READ"); "SSL_write returns SSL_ERROR_WANT_READ");
/* Redirect read event to finish SSL_write() */
closure->write_instead_of_read = true; closure->write_instead_of_read = true;
debug_return; debug_return;
case SSL_ERROR_WANT_WRITE: case SSL_ERROR_WANT_WRITE: