summaryrefslogtreecommitdiff
path: root/libcli
diff options
context:
space:
mode:
Diffstat (limited to 'libcli')
-rw-r--r--libcli/smb/smb2_create_blob.h12
-rw-r--r--libcli/smb/smb2cli_create.c39
-rw-r--r--libcli/smb/smbXcli_base.h7
3 files changed, 35 insertions, 23 deletions
diff --git a/libcli/smb/smb2_create_blob.h b/libcli/smb/smb2_create_blob.h
index 008befe41a..2f915b3afe 100644
--- a/libcli/smb/smb2_create_blob.h
+++ b/libcli/smb/smb2_create_blob.h
@@ -33,6 +33,18 @@ struct smb2_create_blobs {
struct smb2_create_blob *blobs;
};
+struct smb2_create_returns {
+ uint8_t oplock_level;
+ uint32_t create_action;
+ NTTIME creation_time;
+ NTTIME last_access_time;
+ NTTIME last_write_time;
+ NTTIME change_time;
+ uint64_t allocation_size;
+ uint64_t end_of_file;
+ uint32_t file_attributes;
+};
+
/*
parse a set of SMB2 create blobs
*/
diff --git a/libcli/smb/smb2cli_create.c b/libcli/smb/smb2cli_create.c
index 627bdcb935..020a4685cb 100644
--- a/libcli/smb/smb2cli_create.c
+++ b/libcli/smb/smb2cli_create.c
@@ -27,17 +27,9 @@
struct smb2cli_create_state {
uint8_t fixed[56];
- uint8_t oplock_level;
- uint32_t create_action;
- NTTIME creation_time;
- NTTIME last_access_time;
- NTTIME last_write_time;
- NTTIME change_time;
- uint64_t allocation_size;
- uint64_t end_of_file;
- uint32_t file_attributes;
uint64_t fid_persistent;
uint64_t fid_volatile;
+ struct smb2_create_returns cr;
struct smb2_create_blobs blobs;
};
@@ -179,15 +171,15 @@ static void smb2cli_create_done(struct tevent_req *subreq)
body = (uint8_t *)iov[1].iov_base;
- state->oplock_level = CVAL(body, 2);
- state->create_action = IVAL(body, 4);
- state->creation_time = BVAL(body, 8);
- state->last_access_time = BVAL(body, 16);
- state->last_write_time = BVAL(body, 24);
- state->change_time = BVAL(body, 32);
- state->allocation_size = BVAL(body, 40);
- state->end_of_file = BVAL(body, 48);
- state->file_attributes = IVAL(body, 56);
+ state->cr.oplock_level = CVAL(body, 2);
+ state->cr.create_action = IVAL(body, 4);
+ state->cr.creation_time = BVAL(body, 8);
+ state->cr.last_access_time = BVAL(body, 16);
+ state->cr.last_write_time = BVAL(body, 24);
+ state->cr.change_time = BVAL(body, 32);
+ state->cr.allocation_size = BVAL(body, 40);
+ state->cr.end_of_file = BVAL(body, 48);
+ state->cr.file_attributes = IVAL(body, 56);
state->fid_persistent = BVAL(body, 64);
state->fid_volatile = BVAL(body, 72);
@@ -213,7 +205,8 @@ static void smb2cli_create_done(struct tevent_req *subreq)
NTSTATUS smb2cli_create_recv(struct tevent_req *req,
uint64_t *fid_persistent,
- uint64_t *fid_volatile)
+ uint64_t *fid_volatile,
+ struct smb2_create_returns *cr)
{
struct smb2cli_create_state *state =
tevent_req_data(req,
@@ -225,6 +218,9 @@ NTSTATUS smb2cli_create_recv(struct tevent_req *req,
}
*fid_persistent = state->fid_persistent;
*fid_volatile = state->fid_volatile;
+ if (cr) {
+ *cr = state->cr;
+ }
return NT_STATUS_OK;
}
@@ -242,7 +238,8 @@ NTSTATUS smb2cli_create(struct smbXcli_conn *conn,
uint32_t create_options,
struct smb2_create_blobs *blobs,
uint64_t *fid_persistent,
- uint64_t *fid_volatile)
+ uint64_t *fid_volatile,
+ struct smb2_create_returns *cr)
{
TALLOC_CTX *frame = talloc_stackframe();
struct tevent_context *ev;
@@ -273,7 +270,7 @@ NTSTATUS smb2cli_create(struct smbXcli_conn *conn,
if (!tevent_req_poll_ntstatus(req, ev, &status)) {
goto fail;
}
- status = smb2cli_create_recv(req, fid_persistent, fid_volatile);
+ status = smb2cli_create_recv(req, fid_persistent, fid_volatile, cr);
fail:
TALLOC_FREE(frame);
return status;
diff --git a/libcli/smb/smbXcli_base.h b/libcli/smb/smbXcli_base.h
index 997869ba07..a497e1376f 100644
--- a/libcli/smb/smbXcli_base.h
+++ b/libcli/smb/smbXcli_base.h
@@ -28,6 +28,7 @@ struct smb_trans_enc_state;
struct GUID;
struct iovec;
struct smb2_create_blobs;
+struct smb2_create_returns;
struct smbXcli_conn *smbXcli_conn_create(TALLOC_CTX *mem_ctx,
int fd,
@@ -353,7 +354,8 @@ struct tevent_req *smb2cli_create_send(
struct smb2_create_blobs *blobs);
NTSTATUS smb2cli_create_recv(struct tevent_req *req,
uint64_t *fid_persistent,
- uint64_t *fid_volatile);
+ uint64_t *fid_volatile,
+ struct smb2_create_returns *cr);
NTSTATUS smb2cli_create(struct smbXcli_conn *conn,
uint32_t timeout_msec,
struct smbXcli_session *session,
@@ -368,7 +370,8 @@ NTSTATUS smb2cli_create(struct smbXcli_conn *conn,
uint32_t create_options,
struct smb2_create_blobs *blobs,
uint64_t *fid_persistent,
- uint64_t *fid_volatile);
+ uint64_t *fid_volatile,
+ struct smb2_create_returns *cr);
struct tevent_req *smb2cli_close_send(TALLOC_CTX *mem_ctx,
struct tevent_context *ev,