summaryrefslogtreecommitdiff
path: root/source3/libsmb/clifile.c
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2008-08-25 13:33:41 +0200
committerVolker Lendecke <vl@samba.org>2008-08-28 17:53:37 +0200
commit128524930d490fb5ea637d99bffb36157c80869b (patch)
treeac12973877b56e5117ead320c5528a037da48770 /source3/libsmb/clifile.c
parent2650207d4adbfd68974fc2b342dd2af079a2552c (diff)
downloadsamba-128524930d490fb5ea637d99bffb36157c80869b.tar.gz
samba-128524930d490fb5ea637d99bffb36157c80869b.tar.bz2
samba-128524930d490fb5ea637d99bffb36157c80869b.zip
Add cli_pull_reply
Along the lines of cli_request_send this abstracts away the smb-level buffer handling when parsing replies we got from the server. (This used to be commit 253134d3aaa359fdfb665709dd5686f69af7f8fd)
Diffstat (limited to 'source3/libsmb/clifile.c')
-rw-r--r--source3/libsmb/clifile.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/source3/libsmb/clifile.c b/source3/libsmb/clifile.c
index dfb0ce8c11..b3032a08eb 100644
--- a/source3/libsmb/clifile.c
+++ b/source3/libsmb/clifile.c
@@ -902,7 +902,10 @@ struct async_req *cli_open_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
NTSTATUS cli_open_recv(struct async_req *req, int *fnum)
{
- struct cli_request *cli_req = cli_request_get(req);
+ uint8_t wct;
+ uint16_t *vwv;
+ uint16_t num_bytes;
+ uint8_t *bytes;
NTSTATUS status;
SMB_ASSERT(req->state >= ASYNC_REQ_DONE);
@@ -910,12 +913,16 @@ NTSTATUS cli_open_recv(struct async_req *req, int *fnum)
return req->status;
}
- status = cli_pull_error(cli_req->inbuf);
+ status = cli_pull_reply(req, &wct, &vwv, &num_bytes, &bytes);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
- *fnum = SVAL(cli_req->inbuf, smb_vwv2);
+ if (wct < 3) {
+ return NT_STATUS_INVALID_NETWORK_RESPONSE;
+ }
+
+ *fnum = SVAL(vwv+2, 0);
return NT_STATUS_OK;
}
@@ -974,14 +981,17 @@ struct async_req *cli_close_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
NTSTATUS cli_close_recv(struct async_req *req)
{
- struct cli_request *cli_req = cli_request_get(req);
+ uint8_t wct;
+ uint16_t *vwv;
+ uint16_t num_bytes;
+ uint8_t *bytes;
SMB_ASSERT(req->state >= ASYNC_REQ_DONE);
if (req->state == ASYNC_REQ_ERROR) {
return req->status;
}
- return cli_pull_error(cli_req->inbuf);
+ return cli_pull_reply(req, &wct, &vwv, &num_bytes, &bytes);
}
bool cli_close(struct cli_state *cli, int fnum)