From 271f78a9bb814ed10bcc8883a60d6609e1eef500 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Wed, 31 Aug 2011 00:40:06 +0200 Subject: s3:smb2cli: pass an array of expected status/body_size pairs to smb2cli_req_recv() This gives the caller more control and correctly reports unexpected errors to the caller, instead of return NT_STATUS_INVALID_NETWOR_RESPONSE metze --- source3/libsmb/smb2cli_session.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) (limited to 'source3/libsmb/smb2cli_session.c') diff --git a/source3/libsmb/smb2cli_session.c b/source3/libsmb/smb2cli_session.c index 4ffdf13dd6..2a00593ed0 100644 --- a/source3/libsmb/smb2cli_session.c +++ b/source3/libsmb/smb2cli_session.c @@ -98,8 +98,19 @@ static void smb2cli_sesssetup_blob_done(struct tevent_req *subreq) NTSTATUS status; struct iovec *iov; uint16_t offset, length; - - status = smb2cli_req_recv(subreq, talloc_tos(), &iov, 9); + static const struct smb2cli_req_expected_response expected[] = { + { + .status = NT_STATUS_MORE_PROCESSING_REQUIRED, + .body_size = 0x09 + }, + { + .status = NT_STATUS_OK, + .body_size = 0x09 + } + }; + + status = smb2cli_req_recv(subreq, talloc_tos(), &iov, + expected, ARRAY_SIZE(expected)); if (!NT_STATUS_IS_OK(status) && !NT_STATUS_EQUAL(status, NT_STATUS_MORE_PROCESSING_REQUIRED)) { TALLOC_FREE(subreq); @@ -363,8 +374,15 @@ static void smb2cli_logoff_done(struct tevent_req *subreq) struct tevent_req); NTSTATUS status; struct iovec *iov; + static const struct smb2cli_req_expected_response expected[] = { + { + .status = NT_STATUS_OK, + .body_size = 0x04 + } + }; - status = smb2cli_req_recv(subreq, talloc_tos(), &iov, 4); + status = smb2cli_req_recv(subreq, talloc_tos(), &iov, + expected, ARRAY_SIZE(expected)); TALLOC_FREE(subreq); if (tevent_req_nterror(req, status)) { return; -- cgit