Relax transport checks, allow invalid socket
When no real RDP connection is in use, the SSL socket might be invalid.
Do not assert here but allow the parsing to continue
@@ -163,9 +163,17 @@ static BOOL transport_default_attach(rdpTransport* transport, int sockfd)
const rdpSettings* settings;
rdpContext* context = transport_get_context(transport);
+ if (sockfd < 0)
+ {
+ WLog_WARN(TAG, "Running peer without socket (sockfd=%d)", sockfd);
+ return TRUE;
+ }
+
settings = context->settings;
WINPR_ASSERT(settings);
+ if (sockfd >= 0)
+ {
if (!freerdp_tcp_set_keep_alive_mode(settings, sockfd))
goto fail;
@@ -175,11 +183,13 @@ static BOOL transport_default_attach(rdpTransport* transport, int sockfd)
goto fail;
BIO_set_fd(socketBio, sockfd, BIO_CLOSE);
- bufferedBio = BIO_new(BIO_s_buffered_socket());
+ }
+ bufferedBio = BIO_new(BIO_s_buffered_socket());
if (!bufferedBio)
goto fail;
+ if (socketBio)
bufferedBio = BIO_push(bufferedBio, socketBio);
WINPR_ASSERT(bufferedBio);
transport->frontBio = bufferedBio;
@@ -1193,9 +1203,11 @@ BOOL transport_set_blocking_mode(rdpTransport* transport, BOOL blocking)
transport->blocking = blocking;
- WINPR_ASSERT(transport->frontBio);
+ if (transport->frontBio)
+ {
if (!BIO_set_nonblock(transport->frontBio, blocking ? FALSE : TRUE))
return FALSE;
+ }
return TRUE;
}
