From 3d8ba9b34e34c1f3e0c1c231d6b772994b45eeaf Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 8 May 2014 21:23:22 -0700 Subject: [PATCH] s3: client : correctly fill in the struct smb_create_returns from cli_ntcreate(), cli_ntcreate_recv(), cli_nttrans_create() and cli_nttrans_create_recv(). This completes the update of the create API to return all the data returned by the server on open. We can now use this data to detect buggy servers without an extra round trip. Signed-off-by: Jeremy Allison Reviewed-by: Stefan Metzmacher --- source3/libsmb/clifile.c | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/source3/libsmb/clifile.c b/source3/libsmb/clifile.c index bd886eabab9..7f562a8061a 100644 --- a/source3/libsmb/clifile.c +++ b/source3/libsmb/clifile.c @@ -1881,14 +1881,23 @@ static void cli_ntcreate_done(struct tevent_req *subreq) uint8_t *bytes; NTSTATUS status; - status = cli_smb_recv(subreq, state, NULL, 3, &wct, &vwv, + status = cli_smb_recv(subreq, state, NULL, 34, &wct, &vwv, &num_bytes, &bytes); TALLOC_FREE(subreq); if (tevent_req_nterror(req, status)) { return; } + state->cr.oplock_level = CVAL(vwv+2, 0); state->fnum = SVAL(vwv+2, 1); - /* TODO - fill in state->cr.. */ + state->cr.create_action = IVAL(vwv+3, 1); + state->cr.creation_time = BVAL(vwv+5, 1); + state->cr.last_access_time = BVAL(vwv+9, 1); + state->cr.last_write_time = BVAL(vwv+13, 1); + state->cr.change_time = BVAL(vwv+17, 1); + state->cr.file_attributes = IVAL(vwv+21, 1); + state->cr.allocation_size = BVAL(vwv+23, 1); + state->cr.end_of_file = BVAL(vwv+27, 1); + tevent_req_done(req); } @@ -1904,7 +1913,9 @@ NTSTATUS cli_ntcreate_recv(struct tevent_req *req, return status; } *pfnum = state->fnum; - /* TODO - fill in *cr.. */ + if (cr != NULL) { + *cr = state->cr; + } return NT_STATUS_OK; } @@ -2089,8 +2100,17 @@ static void cli_nttrans_create_done(struct tevent_req *subreq) if (tevent_req_nterror(req, status)) { return; } + state->cr.oplock_level = CVAL(param, 0); state->fnum = SVAL(param, 2); - /* TODO - fill in state->cr.. */ + state->cr.create_action = IVAL(param, 4); + state->cr.creation_time = BVAL(param, 12); + state->cr.last_access_time = BVAL(param, 20); + state->cr.last_write_time = BVAL(param, 28); + state->cr.change_time = BVAL(param, 36); + state->cr.file_attributes = IVAL(param, 44); + state->cr.allocation_size = BVAL(param, 48); + state->cr.end_of_file = BVAL(param, 56); + TALLOC_FREE(param); tevent_req_done(req); } @@ -2107,7 +2127,9 @@ NTSTATUS cli_nttrans_create_recv(struct tevent_req *req, return status; } *fnum = state->fnum; - /* TODO - fill in *cr.. */ + if (cr != NULL) { + *cr = state->cr; + } return NT_STATUS_OK; } -- 2.11.4.GIT