dtlsconnection: Ignore OpenSSL system call errors

OpenSSL shouldn't be making real system calls, so we can safely
ignore syscall errors. System interactions should happen through
our BIO. So especially don't look at the system's errno, as it
should be meaningless.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1656>
This commit is contained in:
Olivier Crête 2020-10-05 16:40:55 -04:00 committed by GStreamer Merge Bot
parent 3ea6387f96
commit 8a0d1d85cf

View file

@ -1001,35 +1001,13 @@ handle_error (GstDtlsConnection * self, int ret, GstResourceError error_type,
case SSL_ERROR_WANT_WRITE: case SSL_ERROR_WANT_WRITE:
GST_LOG_OBJECT (self, "SSL wants write"); GST_LOG_OBJECT (self, "SSL wants write");
return GST_FLOW_OK; return GST_FLOW_OK;
case SSL_ERROR_SYSCALL:{ case SSL_ERROR_SYSCALL:
gchar message[1024] = "<unknown>"; /* OpenSSL shouldn't be making real system calls, so we can safely
gint syserror; * ignore syscall errors. System interactions should happen through
#ifdef G_OS_WIN32 * our BIO.
syserror = WSAGetLastError (); */
FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM, NULL, syserror, 0, message, GST_DEBUG_OBJECT (self, "OpenSSL reported a syscall error, ignoring.");
sizeof message, NULL); return GST_FLOW_OK;
#else
syserror = errno;
strerror_r (syserror, message, sizeof message);
#endif
if (syserror == 0) {
GST_TRACE_OBJECT (self, "No error");
return GST_FLOW_OK;
} else {
GST_ERROR_OBJECT (self, "Fatal SSL syscall error: errno %d: %s",
syserror, message);
if (err)
*err =
g_error_new (GST_RESOURCE_ERROR, error_type,
"Fatal SSL syscall error: errno %d: %s", syserror, message);
if (self->priv->connection_state != GST_DTLS_CONNECTION_STATE_FAILED) {
self->priv->connection_state = GST_DTLS_CONNECTION_STATE_FAILED;
*notify_state = TRUE;
}
return GST_FLOW_ERROR;
}
}
default: default:
if (self->priv->connection_state != GST_DTLS_CONNECTION_STATE_FAILED) { if (self->priv->connection_state != GST_DTLS_CONNECTION_STATE_FAILED) {
self->priv->connection_state = GST_DTLS_CONNECTION_STATE_FAILED; self->priv->connection_state = GST_DTLS_CONNECTION_STATE_FAILED;