s3:smbd: Check return code of set_blocking()
authorAndreas Schneider <asn@samba.org>
Tue, 24 Nov 2020 16:40:33 +0000 (17:40 +0100)
committerStefan Metzmacher <metze@samba.org>
Thu, 26 Nov 2020 06:52:41 +0000 (06:52 +0000)
Found by covscan.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source3/smbd/smb2_server.c

index ba9cbd173023f1d36c4c436b087d99599795a055..1322cf3ba0831d6ad005d9a143c9a8efc5cf14a3 100644 (file)
@@ -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;
 }