From: Jeremy Allison Date: Tue, 26 Nov 2019 20:14:29 +0000 (-0800) Subject: s3: smbd: Allow smbd_smb2_process_negprot() to return NTSTATUS as it can fail. X-Git-Tag: samba-4.10.13~29 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=546a2e935a54f430bb3e2642a2d552cbca666990;p=thirdparty%2Fsamba.git s3: smbd: Allow smbd_smb2_process_negprot() to return NTSTATUS as it can fail. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14205 Signed-off-by: Jeremy Allison Reviewed-by: Volker Lendecke (cherry picked from commit 868bc05cf5d575e20edcce241e3af1d0fa6d9824) --- diff --git a/source3/smbd/globals.h b/source3/smbd/globals.h index 02f1e58b77b..0a4fcd96b43 100644 --- a/source3/smbd/globals.h +++ b/source3/smbd/globals.h @@ -239,7 +239,7 @@ NTSTATUS smbd_add_connection(struct smbXsrv_client *client, int sock_fd, void reply_smb2002(struct smb_request *req, uint16_t choice); void reply_smb20ff(struct smb_request *req, uint16_t choice); -void smbd_smb2_process_negprot(struct smbXsrv_connection *xconn, +NTSTATUS smbd_smb2_process_negprot(struct smbXsrv_connection *xconn, uint64_t expected_seq_low, const uint8_t *inpdu, size_t size); diff --git a/source3/smbd/smb2_server.c b/source3/smbd/smb2_server.c index 24d96dec534..b65880a9562 100644 --- a/source3/smbd/smb2_server.c +++ b/source3/smbd/smb2_server.c @@ -3570,7 +3570,7 @@ static NTSTATUS smbd_smb2_request_next_incoming(struct smbXsrv_connection *xconn return NT_STATUS_OK; } -void smbd_smb2_process_negprot(struct smbXsrv_connection *xconn, +NTSTATUS smbd_smb2_process_negprot(struct smbXsrv_connection *xconn, uint64_t expected_seq_low, const uint8_t *inpdu, size_t size) { @@ -3584,25 +3584,25 @@ void smbd_smb2_process_negprot(struct smbXsrv_connection *xconn, status = smbd_initialize_smb2(xconn, expected_seq_low); if (!NT_STATUS_IS_OK(status)) { smbd_server_connection_terminate(xconn, nt_errstr(status)); - return; + return status; } status = smbd_smb2_request_create(xconn, inpdu, size, &req); if (!NT_STATUS_IS_OK(status)) { smbd_server_connection_terminate(xconn, nt_errstr(status)); - return; + return status; } status = smbd_smb2_request_validate(req); if (!NT_STATUS_IS_OK(status)) { smbd_server_connection_terminate(xconn, nt_errstr(status)); - return; + return status; } status = smbd_smb2_request_setup_out(req); if (!NT_STATUS_IS_OK(status)) { smbd_server_connection_terminate(xconn, nt_errstr(status)); - return; + return status; } #ifdef WITH_PROFILE @@ -3617,16 +3617,17 @@ void smbd_smb2_process_negprot(struct smbXsrv_connection *xconn, status = smbd_smb2_request_dispatch(req); if (!NT_STATUS_IS_OK(status)) { smbd_server_connection_terminate(xconn, nt_errstr(status)); - return; + return status; } status = smbd_smb2_request_next_incoming(xconn); if (!NT_STATUS_IS_OK(status)) { smbd_server_connection_terminate(xconn, nt_errstr(status)); - return; + return status; } sconn->num_requests++; + return NT_STATUS_OK; } static int socket_error_from_errno(int ret,