From c79b3e2e8a77401a094e6c2de3a3182573c6a9fd Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Tue, 24 Nov 2020 17:40:33 +0100 Subject: [PATCH] s3:smbd: Check return code of set_blocking() Found by covscan. Signed-off-by: Andreas Schneider Reviewed-by: Andrew Bartlett --- source3/smbd/smb2_server.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/source3/smbd/smb2_server.c b/source3/smbd/smb2_server.c index ba9cbd17302..1322cf3ba08 100644 --- a/source3/smbd/smb2_server.c +++ b/source3/smbd/smb2_server.c @@ -231,6 +231,8 @@ bool smbd_smb2_is_compound(const struct smbd_smb2_request *req) static NTSTATUS smbd_initialize_smb2(struct smbXsrv_connection *xconn, uint64_t expected_seq_low) { + int rc; + xconn->smb2.credits.seq_low = expected_seq_low; xconn->smb2.credits.seq_range = 1; xconn->smb2.credits.granted = 1; @@ -259,7 +261,11 @@ static NTSTATUS smbd_initialize_smb2(struct smbXsrv_connection *xconn, tevent_fd_set_auto_close(xconn->transport.fde); /* Ensure child is set to non-blocking mode */ - set_blocking(xconn->transport.sock, false); + rc = set_blocking(xconn->transport.sock, false); + if (rc < 0) { + return NT_STATUS_INTERNAL_ERROR; + } + return NT_STATUS_OK; }