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_tcon.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'source3/libsmb/smb2cli_tcon.c') diff --git a/source3/libsmb/smb2cli_tcon.c b/source3/libsmb/smb2cli_tcon.c index 9cf73e3a4b..dee9140ce6 100644 --- a/source3/libsmb/smb2cli_tcon.c +++ b/source3/libsmb/smb2cli_tcon.c @@ -105,8 +105,15 @@ static void smb2cli_tcon_done(struct tevent_req *subreq) NTSTATUS status; struct iovec *iov; uint8_t *body; + static const struct smb2cli_req_expected_response expected[] = { + { + .status = NT_STATUS_OK, + .body_size = 0x10 + } + }; - status = smb2cli_req_recv(subreq, talloc_tos(), &iov, 16); + status = smb2cli_req_recv(subreq, talloc_tos(), &iov, + expected, ARRAY_SIZE(expected)); if (!NT_STATUS_IS_OK(status)) { TALLOC_FREE(subreq); tevent_req_nterror(req, status); @@ -202,8 +209,15 @@ static void smb2cli_tdis_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