mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
libcli/smb: pass smbXcli_tcon to smb2cli_req_create/send()
metze
This commit is contained in:
parent
57fda88dfb
commit
7de4ae7f9f
@ -42,7 +42,6 @@ struct tevent_req *smb2cli_close_send(TALLOC_CTX *mem_ctx,
|
|||||||
struct tevent_req *req, *subreq;
|
struct tevent_req *req, *subreq;
|
||||||
struct smb2cli_close_state *state;
|
struct smb2cli_close_state *state;
|
||||||
uint8_t *fixed;
|
uint8_t *fixed;
|
||||||
uint32_t tcon_id = 0;
|
|
||||||
|
|
||||||
req = tevent_req_create(mem_ctx, &state,
|
req = tevent_req_create(mem_ctx, &state,
|
||||||
struct smb2cli_close_state);
|
struct smb2cli_close_state);
|
||||||
@ -55,15 +54,11 @@ struct tevent_req *smb2cli_close_send(TALLOC_CTX *mem_ctx,
|
|||||||
SBVAL(fixed, 8, fid_persistent);
|
SBVAL(fixed, 8, fid_persistent);
|
||||||
SBVAL(fixed, 16, fid_volatile);
|
SBVAL(fixed, 16, fid_volatile);
|
||||||
|
|
||||||
if (tcon) {
|
|
||||||
tcon_id = smb2cli_tcon_current_id(tcon);
|
|
||||||
}
|
|
||||||
|
|
||||||
subreq = smb2cli_req_send(state, ev, conn, SMB2_OP_CLOSE,
|
subreq = smb2cli_req_send(state, ev, conn, SMB2_OP_CLOSE,
|
||||||
0, 0, /* flags */
|
0, 0, /* flags */
|
||||||
timeout_msec,
|
timeout_msec,
|
||||||
0xFEFF, /* pid */
|
0xFEFF, /* pid */
|
||||||
tcon_id,
|
tcon,
|
||||||
session,
|
session,
|
||||||
state->fixed, sizeof(state->fixed),
|
state->fixed, sizeof(state->fixed),
|
||||||
NULL, 0);
|
NULL, 0);
|
||||||
|
@ -70,7 +70,6 @@ struct tevent_req *smb2cli_create_send(
|
|||||||
size_t blobs_offset;
|
size_t blobs_offset;
|
||||||
uint8_t *dyn;
|
uint8_t *dyn;
|
||||||
size_t dyn_len;
|
size_t dyn_len;
|
||||||
uint32_t tcon_id = 0;
|
|
||||||
|
|
||||||
req = tevent_req_create(mem_ctx, &state,
|
req = tevent_req_create(mem_ctx, &state,
|
||||||
struct smb2cli_create_state);
|
struct smb2cli_create_state);
|
||||||
@ -138,15 +137,11 @@ struct tevent_req *smb2cli_create_send(
|
|||||||
data_blob_free(&blob);
|
data_blob_free(&blob);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tcon) {
|
|
||||||
tcon_id = smb2cli_tcon_current_id(tcon);
|
|
||||||
}
|
|
||||||
|
|
||||||
subreq = smb2cli_req_send(state, ev, conn, SMB2_OP_CREATE,
|
subreq = smb2cli_req_send(state, ev, conn, SMB2_OP_CREATE,
|
||||||
0, 0, /* flags */
|
0, 0, /* flags */
|
||||||
timeout_msec,
|
timeout_msec,
|
||||||
0xFEFF, /* pid */
|
0xFEFF, /* pid */
|
||||||
tcon_id,
|
tcon,
|
||||||
session,
|
session,
|
||||||
state->fixed, sizeof(state->fixed),
|
state->fixed, sizeof(state->fixed),
|
||||||
dyn, dyn_len);
|
dyn, dyn_len);
|
||||||
|
@ -41,7 +41,6 @@ struct tevent_req *smb2cli_flush_send(TALLOC_CTX *mem_ctx,
|
|||||||
struct tevent_req *req, *subreq;
|
struct tevent_req *req, *subreq;
|
||||||
struct smb2cli_flush_state *state;
|
struct smb2cli_flush_state *state;
|
||||||
uint8_t *fixed;
|
uint8_t *fixed;
|
||||||
uint32_t tcon_id = 0;
|
|
||||||
|
|
||||||
req = tevent_req_create(mem_ctx, &state,
|
req = tevent_req_create(mem_ctx, &state,
|
||||||
struct smb2cli_flush_state);
|
struct smb2cli_flush_state);
|
||||||
@ -53,15 +52,11 @@ struct tevent_req *smb2cli_flush_send(TALLOC_CTX *mem_ctx,
|
|||||||
SBVAL(fixed, 8, fid_persistent);
|
SBVAL(fixed, 8, fid_persistent);
|
||||||
SBVAL(fixed, 16, fid_volatile);
|
SBVAL(fixed, 16, fid_volatile);
|
||||||
|
|
||||||
if (tcon) {
|
|
||||||
tcon_id = smb2cli_tcon_current_id(tcon);
|
|
||||||
}
|
|
||||||
|
|
||||||
subreq = smb2cli_req_send(state, ev, conn, SMB2_OP_FLUSH,
|
subreq = smb2cli_req_send(state, ev, conn, SMB2_OP_FLUSH,
|
||||||
0, 0, /* flags */
|
0, 0, /* flags */
|
||||||
timeout_msec,
|
timeout_msec,
|
||||||
0xFEFF, /* pid */
|
0xFEFF, /* pid */
|
||||||
tcon_id,
|
tcon,
|
||||||
session,
|
session,
|
||||||
state->fixed, sizeof(state->fixed),
|
state->fixed, sizeof(state->fixed),
|
||||||
NULL, 0);
|
NULL, 0);
|
||||||
|
@ -61,7 +61,6 @@ struct tevent_req *smb2cli_ioctl_send(TALLOC_CTX *mem_ctx,
|
|||||||
uint32_t output_buffer_offset = 0;
|
uint32_t output_buffer_offset = 0;
|
||||||
uint32_t output_buffer_length = 0;
|
uint32_t output_buffer_length = 0;
|
||||||
uint32_t pad_length = 0;
|
uint32_t pad_length = 0;
|
||||||
uint32_t tcon_id = 0;
|
|
||||||
|
|
||||||
req = tevent_req_create(mem_ctx, &state,
|
req = tevent_req_create(mem_ctx, &state,
|
||||||
struct smb2cli_ioctl_state);
|
struct smb2cli_ioctl_state);
|
||||||
@ -134,15 +133,11 @@ struct tevent_req *smb2cli_ioctl_send(TALLOC_CTX *mem_ctx,
|
|||||||
dyn_len = sizeof(state->dyn_pad);
|
dyn_len = sizeof(state->dyn_pad);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tcon) {
|
|
||||||
tcon_id = smb2cli_tcon_current_id(tcon);
|
|
||||||
}
|
|
||||||
|
|
||||||
subreq = smb2cli_req_send(state, ev, conn, SMB2_OP_IOCTL,
|
subreq = smb2cli_req_send(state, ev, conn, SMB2_OP_IOCTL,
|
||||||
0, 0, /* flags */
|
0, 0, /* flags */
|
||||||
timeout_msec,
|
timeout_msec,
|
||||||
0xFEFF, /* pid */
|
0xFEFF, /* pid */
|
||||||
tcon_id,
|
tcon,
|
||||||
session,
|
session,
|
||||||
state->fixed, sizeof(state->fixed),
|
state->fixed, sizeof(state->fixed),
|
||||||
dyn, dyn_len);
|
dyn, dyn_len);
|
||||||
|
@ -52,7 +52,6 @@ struct tevent_req *smb2cli_query_directory_send(TALLOC_CTX *mem_ctx,
|
|||||||
uint8_t *fixed;
|
uint8_t *fixed;
|
||||||
uint8_t *dyn;
|
uint8_t *dyn;
|
||||||
size_t dyn_len;
|
size_t dyn_len;
|
||||||
uint32_t tcon_id = 0;
|
|
||||||
|
|
||||||
req = tevent_req_create(mem_ctx, &state,
|
req = tevent_req_create(mem_ctx, &state,
|
||||||
struct smb2cli_query_directory_state);
|
struct smb2cli_query_directory_state);
|
||||||
@ -88,15 +87,11 @@ struct tevent_req *smb2cli_query_directory_send(TALLOC_CTX *mem_ctx,
|
|||||||
dyn_len = sizeof(state->dyn_pad);
|
dyn_len = sizeof(state->dyn_pad);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tcon) {
|
|
||||||
tcon_id = smb2cli_tcon_current_id(tcon);
|
|
||||||
}
|
|
||||||
|
|
||||||
subreq = smb2cli_req_send(state, ev, conn, SMB2_OP_FIND,
|
subreq = smb2cli_req_send(state, ev, conn, SMB2_OP_FIND,
|
||||||
0, 0, /* flags */
|
0, 0, /* flags */
|
||||||
timeout_msec,
|
timeout_msec,
|
||||||
0xFEFF, /* pid */
|
0xFEFF, /* pid */
|
||||||
tcon_id,
|
tcon,
|
||||||
session,
|
session,
|
||||||
state->fixed, sizeof(state->fixed),
|
state->fixed, sizeof(state->fixed),
|
||||||
dyn, dyn_len);
|
dyn, dyn_len);
|
||||||
|
@ -55,7 +55,6 @@ struct tevent_req *smb2cli_query_info_send(TALLOC_CTX *mem_ctx,
|
|||||||
size_t dyn_len;
|
size_t dyn_len;
|
||||||
uint16_t input_buffer_offset = 0;
|
uint16_t input_buffer_offset = 0;
|
||||||
uint32_t input_buffer_length = 0;
|
uint32_t input_buffer_length = 0;
|
||||||
uint32_t tcon_id = 0;
|
|
||||||
|
|
||||||
req = tevent_req_create(mem_ctx, &state,
|
req = tevent_req_create(mem_ctx, &state,
|
||||||
struct smb2cli_query_info_state);
|
struct smb2cli_query_info_state);
|
||||||
@ -91,15 +90,11 @@ struct tevent_req *smb2cli_query_info_send(TALLOC_CTX *mem_ctx,
|
|||||||
dyn_len = sizeof(state->dyn_pad);
|
dyn_len = sizeof(state->dyn_pad);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tcon) {
|
|
||||||
tcon_id = smb2cli_tcon_current_id(tcon);
|
|
||||||
}
|
|
||||||
|
|
||||||
subreq = smb2cli_req_send(state, ev, conn, SMB2_OP_GETINFO,
|
subreq = smb2cli_req_send(state, ev, conn, SMB2_OP_GETINFO,
|
||||||
0, 0, /* flags */
|
0, 0, /* flags */
|
||||||
timeout_msec,
|
timeout_msec,
|
||||||
0xFEFF, /* pid */
|
0xFEFF, /* pid */
|
||||||
tcon_id,
|
tcon,
|
||||||
session,
|
session,
|
||||||
state->fixed, sizeof(state->fixed),
|
state->fixed, sizeof(state->fixed),
|
||||||
dyn, dyn_len);
|
dyn, dyn_len);
|
||||||
|
@ -49,7 +49,6 @@ struct tevent_req *smb2cli_read_send(TALLOC_CTX *mem_ctx,
|
|||||||
struct tevent_req *req, *subreq;
|
struct tevent_req *req, *subreq;
|
||||||
struct smb2cli_read_state *state;
|
struct smb2cli_read_state *state;
|
||||||
uint8_t *fixed;
|
uint8_t *fixed;
|
||||||
uint32_t tcon_id = 0;
|
|
||||||
|
|
||||||
req = tevent_req_create(mem_ctx, &state,
|
req = tevent_req_create(mem_ctx, &state,
|
||||||
struct smb2cli_read_state);
|
struct smb2cli_read_state);
|
||||||
@ -67,15 +66,11 @@ struct tevent_req *smb2cli_read_send(TALLOC_CTX *mem_ctx,
|
|||||||
SBVAL(fixed, 32, minimum_count);
|
SBVAL(fixed, 32, minimum_count);
|
||||||
SBVAL(fixed, 40, remaining_bytes);
|
SBVAL(fixed, 40, remaining_bytes);
|
||||||
|
|
||||||
if (tcon) {
|
|
||||||
tcon_id = smb2cli_tcon_current_id(tcon);
|
|
||||||
}
|
|
||||||
|
|
||||||
subreq = smb2cli_req_send(state, ev, conn, SMB2_OP_READ,
|
subreq = smb2cli_req_send(state, ev, conn, SMB2_OP_READ,
|
||||||
0, 0, /* flags */
|
0, 0, /* flags */
|
||||||
timeout_msec,
|
timeout_msec,
|
||||||
0xFEFF, /* pid */
|
0xFEFF, /* pid */
|
||||||
tcon_id,
|
tcon,
|
||||||
session,
|
session,
|
||||||
state->fixed, sizeof(state->fixed),
|
state->fixed, sizeof(state->fixed),
|
||||||
state->dyn_pad, sizeof(state->dyn_pad));
|
state->dyn_pad, sizeof(state->dyn_pad));
|
||||||
|
@ -100,7 +100,7 @@ struct tevent_req *smb2cli_session_setup_send(TALLOC_CTX *mem_ctx,
|
|||||||
0, 0, /* flags */
|
0, 0, /* flags */
|
||||||
timeout_msec,
|
timeout_msec,
|
||||||
0xFEFF,
|
0xFEFF,
|
||||||
0, /* tid */
|
NULL, /* tcon */
|
||||||
session,
|
session,
|
||||||
state->fixed, sizeof(state->fixed),
|
state->fixed, sizeof(state->fixed),
|
||||||
dyn, dyn_len);
|
dyn, dyn_len);
|
||||||
@ -257,7 +257,7 @@ struct tevent_req *smb2cli_logoff_send(TALLOC_CTX *mem_ctx,
|
|||||||
0, 0, /* flags */
|
0, 0, /* flags */
|
||||||
timeout_msec,
|
timeout_msec,
|
||||||
0xFEFF, /* pid */
|
0xFEFF, /* pid */
|
||||||
0, /* tid */
|
NULL, /* tcon */
|
||||||
session,
|
session,
|
||||||
state->fixed, sizeof(state->fixed),
|
state->fixed, sizeof(state->fixed),
|
||||||
NULL, 0);
|
NULL, 0);
|
||||||
|
@ -50,7 +50,6 @@ struct tevent_req *smb2cli_set_info_send(TALLOC_CTX *mem_ctx,
|
|||||||
size_t dyn_len;
|
size_t dyn_len;
|
||||||
uint16_t input_buffer_offset = 0;
|
uint16_t input_buffer_offset = 0;
|
||||||
uint32_t input_buffer_length = 0;
|
uint32_t input_buffer_length = 0;
|
||||||
uint32_t tcon_id = 0;
|
|
||||||
|
|
||||||
req = tevent_req_create(mem_ctx, &state,
|
req = tevent_req_create(mem_ctx, &state,
|
||||||
struct smb2cli_set_info_state);
|
struct smb2cli_set_info_state);
|
||||||
@ -83,15 +82,11 @@ struct tevent_req *smb2cli_set_info_send(TALLOC_CTX *mem_ctx,
|
|||||||
dyn_len = sizeof(state->dyn_pad);
|
dyn_len = sizeof(state->dyn_pad);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tcon) {
|
|
||||||
tcon_id = smb2cli_tcon_current_id(tcon);
|
|
||||||
}
|
|
||||||
|
|
||||||
subreq = smb2cli_req_send(state, ev, conn, SMB2_OP_SETINFO,
|
subreq = smb2cli_req_send(state, ev, conn, SMB2_OP_SETINFO,
|
||||||
0, 0, /* flags */
|
0, 0, /* flags */
|
||||||
timeout_msec,
|
timeout_msec,
|
||||||
0xFEFF, /* pid */
|
0xFEFF, /* pid */
|
||||||
tcon_id,
|
tcon,
|
||||||
session,
|
session,
|
||||||
state->fixed, sizeof(state->fixed),
|
state->fixed, sizeof(state->fixed),
|
||||||
dyn, dyn_len);
|
dyn, dyn_len);
|
||||||
|
@ -49,7 +49,6 @@ struct tevent_req *smb2cli_write_send(TALLOC_CTX *mem_ctx,
|
|||||||
uint8_t *fixed;
|
uint8_t *fixed;
|
||||||
const uint8_t *dyn;
|
const uint8_t *dyn;
|
||||||
size_t dyn_len;
|
size_t dyn_len;
|
||||||
uint32_t tcon_id = 0;
|
|
||||||
|
|
||||||
req = tevent_req_create(mem_ctx, &state,
|
req = tevent_req_create(mem_ctx, &state,
|
||||||
struct smb2cli_write_state);
|
struct smb2cli_write_state);
|
||||||
@ -76,15 +75,11 @@ struct tevent_req *smb2cli_write_send(TALLOC_CTX *mem_ctx,
|
|||||||
dyn_len = sizeof(state->dyn_pad);
|
dyn_len = sizeof(state->dyn_pad);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tcon) {
|
|
||||||
tcon_id = smb2cli_tcon_current_id(tcon);
|
|
||||||
}
|
|
||||||
|
|
||||||
subreq = smb2cli_req_send(state, ev, conn, SMB2_OP_WRITE,
|
subreq = smb2cli_req_send(state, ev, conn, SMB2_OP_WRITE,
|
||||||
0, 0, /* flags */
|
0, 0, /* flags */
|
||||||
timeout_msec,
|
timeout_msec,
|
||||||
0xFEFF, /* pid */
|
0xFEFF, /* pid */
|
||||||
tcon_id,
|
tcon,
|
||||||
session,
|
session,
|
||||||
state->fixed, sizeof(state->fixed),
|
state->fixed, sizeof(state->fixed),
|
||||||
dyn, dyn_len);
|
dyn, dyn_len);
|
||||||
|
@ -2366,9 +2366,9 @@ static bool smb2cli_req_cancel(struct tevent_req *req)
|
|||||||
struct smbXcli_req_state);
|
struct smbXcli_req_state);
|
||||||
uint32_t flags = IVAL(state->smb2.hdr, SMB2_HDR_FLAGS);
|
uint32_t flags = IVAL(state->smb2.hdr, SMB2_HDR_FLAGS);
|
||||||
uint32_t pid = IVAL(state->smb2.hdr, SMB2_HDR_PID);
|
uint32_t pid = IVAL(state->smb2.hdr, SMB2_HDR_PID);
|
||||||
uint32_t tid = IVAL(state->smb2.hdr, SMB2_HDR_TID);
|
|
||||||
uint64_t mid = BVAL(state->smb2.hdr, SMB2_HDR_MESSAGE_ID);
|
uint64_t mid = BVAL(state->smb2.hdr, SMB2_HDR_MESSAGE_ID);
|
||||||
uint64_t aid = BVAL(state->smb2.hdr, SMB2_HDR_ASYNC_ID);
|
uint64_t aid = BVAL(state->smb2.hdr, SMB2_HDR_ASYNC_ID);
|
||||||
|
struct smbXcli_tcon *tcon = state->tcon;
|
||||||
struct smbXcli_session *session = state->session;
|
struct smbXcli_session *session = state->session;
|
||||||
uint8_t *fixed = state->smb2.pad;
|
uint8_t *fixed = state->smb2.pad;
|
||||||
uint16_t fixed_len = 4;
|
uint16_t fixed_len = 4;
|
||||||
@ -2384,7 +2384,7 @@ static bool smb2cli_req_cancel(struct tevent_req *req)
|
|||||||
SMB2_OP_CANCEL,
|
SMB2_OP_CANCEL,
|
||||||
flags, 0,
|
flags, 0,
|
||||||
0, /* timeout */
|
0, /* timeout */
|
||||||
pid, tid, session,
|
pid, tcon, session,
|
||||||
fixed, fixed_len,
|
fixed, fixed_len,
|
||||||
NULL, 0);
|
NULL, 0);
|
||||||
if (subreq == NULL) {
|
if (subreq == NULL) {
|
||||||
@ -2398,7 +2398,6 @@ static bool smb2cli_req_cancel(struct tevent_req *req)
|
|||||||
|
|
||||||
SIVAL(substate->smb2.hdr, SMB2_HDR_FLAGS, flags);
|
SIVAL(substate->smb2.hdr, SMB2_HDR_FLAGS, flags);
|
||||||
SIVAL(substate->smb2.hdr, SMB2_HDR_PID, pid);
|
SIVAL(substate->smb2.hdr, SMB2_HDR_PID, pid);
|
||||||
SIVAL(substate->smb2.hdr, SMB2_HDR_TID, tid);
|
|
||||||
SBVAL(substate->smb2.hdr, SMB2_HDR_MESSAGE_ID, mid);
|
SBVAL(substate->smb2.hdr, SMB2_HDR_MESSAGE_ID, mid);
|
||||||
SBVAL(substate->smb2.hdr, SMB2_HDR_ASYNC_ID, aid);
|
SBVAL(substate->smb2.hdr, SMB2_HDR_ASYNC_ID, aid);
|
||||||
|
|
||||||
@ -2427,7 +2426,7 @@ struct tevent_req *smb2cli_req_create(TALLOC_CTX *mem_ctx,
|
|||||||
uint32_t clear_flags,
|
uint32_t clear_flags,
|
||||||
uint32_t timeout_msec,
|
uint32_t timeout_msec,
|
||||||
uint32_t pid,
|
uint32_t pid,
|
||||||
uint32_t tid,
|
struct smbXcli_tcon *tcon,
|
||||||
struct smbXcli_session *session,
|
struct smbXcli_session *session,
|
||||||
const uint8_t *fixed,
|
const uint8_t *fixed,
|
||||||
uint16_t fixed_len,
|
uint16_t fixed_len,
|
||||||
@ -2437,6 +2436,7 @@ struct tevent_req *smb2cli_req_create(TALLOC_CTX *mem_ctx,
|
|||||||
struct tevent_req *req;
|
struct tevent_req *req;
|
||||||
struct smbXcli_req_state *state;
|
struct smbXcli_req_state *state;
|
||||||
uint32_t flags = 0;
|
uint32_t flags = 0;
|
||||||
|
uint32_t tid = 0;
|
||||||
uint64_t uid = 0;
|
uint64_t uid = 0;
|
||||||
|
|
||||||
req = tevent_req_create(mem_ctx, &state,
|
req = tevent_req_create(mem_ctx, &state,
|
||||||
@ -2448,6 +2448,7 @@ struct tevent_req *smb2cli_req_create(TALLOC_CTX *mem_ctx,
|
|||||||
state->ev = ev;
|
state->ev = ev;
|
||||||
state->conn = conn;
|
state->conn = conn;
|
||||||
state->session = session;
|
state->session = session;
|
||||||
|
state->tcon = tcon;
|
||||||
|
|
||||||
if (session) {
|
if (session) {
|
||||||
uid = session->smb2.session_id;
|
uid = session->smb2.session_id;
|
||||||
@ -2455,8 +2456,6 @@ struct tevent_req *smb2cli_req_create(TALLOC_CTX *mem_ctx,
|
|||||||
state->smb2.should_sign = session->smb2.should_sign;
|
state->smb2.should_sign = session->smb2.should_sign;
|
||||||
state->smb2.should_encrypt = session->smb2.should_encrypt;
|
state->smb2.should_encrypt = session->smb2.should_encrypt;
|
||||||
|
|
||||||
/* TODO: turn on encryption based on the tree connect. */
|
|
||||||
|
|
||||||
if (cmd == SMB2_OP_SESSSETUP &&
|
if (cmd == SMB2_OP_SESSSETUP &&
|
||||||
session->smb2.signing_key.length != 0) {
|
session->smb2.signing_key.length != 0) {
|
||||||
state->smb2.should_sign = true;
|
state->smb2.should_sign = true;
|
||||||
@ -2466,10 +2465,16 @@ struct tevent_req *smb2cli_req_create(TALLOC_CTX *mem_ctx,
|
|||||||
session->smb2.channel_signing_key.length == 0) {
|
session->smb2.channel_signing_key.length == 0) {
|
||||||
state->smb2.should_encrypt = false;
|
state->smb2.should_encrypt = false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (state->smb2.should_encrypt) {
|
if (tcon) {
|
||||||
state->smb2.should_sign = false;
|
tid = tcon->smb2.tcon_id;
|
||||||
}
|
|
||||||
|
/* TODO: turn on encryption based on the tree connect. */
|
||||||
|
}
|
||||||
|
|
||||||
|
if (state->smb2.should_encrypt) {
|
||||||
|
state->smb2.should_sign = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
state->smb2.recv_iov = talloc_zero_array(state, struct iovec, 3);
|
state->smb2.recv_iov = talloc_zero_array(state, struct iovec, 3);
|
||||||
@ -2795,7 +2800,7 @@ struct tevent_req *smb2cli_req_send(TALLOC_CTX *mem_ctx,
|
|||||||
uint32_t clear_flags,
|
uint32_t clear_flags,
|
||||||
uint32_t timeout_msec,
|
uint32_t timeout_msec,
|
||||||
uint32_t pid,
|
uint32_t pid,
|
||||||
uint32_t tid,
|
struct smbXcli_tcon *tcon,
|
||||||
struct smbXcli_session *session,
|
struct smbXcli_session *session,
|
||||||
const uint8_t *fixed,
|
const uint8_t *fixed,
|
||||||
uint16_t fixed_len,
|
uint16_t fixed_len,
|
||||||
@ -2808,7 +2813,7 @@ struct tevent_req *smb2cli_req_send(TALLOC_CTX *mem_ctx,
|
|||||||
req = smb2cli_req_create(mem_ctx, ev, conn, cmd,
|
req = smb2cli_req_create(mem_ctx, ev, conn, cmd,
|
||||||
additional_flags, clear_flags,
|
additional_flags, clear_flags,
|
||||||
timeout_msec,
|
timeout_msec,
|
||||||
pid, tid, session,
|
pid, tcon, session,
|
||||||
fixed, fixed_len, dyn, dyn_len);
|
fixed, fixed_len, dyn, dyn_len);
|
||||||
if (req == NULL) {
|
if (req == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -3999,7 +4004,7 @@ static struct tevent_req *smbXcli_negprot_smb2_subreq(struct smbXcli_negprot_sta
|
|||||||
state->conn, SMB2_OP_NEGPROT,
|
state->conn, SMB2_OP_NEGPROT,
|
||||||
0, 0, /* flags */
|
0, 0, /* flags */
|
||||||
state->timeout_msec,
|
state->timeout_msec,
|
||||||
0xFEFF, 0, NULL, /* pid, tid, session */
|
0xFEFF, NULL, NULL, /* pid, tcon, session */
|
||||||
state->smb2.fixed, sizeof(state->smb2.fixed),
|
state->smb2.fixed, sizeof(state->smb2.fixed),
|
||||||
state->smb2.dyn, dialect_count*2);
|
state->smb2.dyn, dialect_count*2);
|
||||||
}
|
}
|
||||||
|
@ -201,7 +201,7 @@ struct tevent_req *smb2cli_req_create(TALLOC_CTX *mem_ctx,
|
|||||||
uint32_t clear_flags,
|
uint32_t clear_flags,
|
||||||
uint32_t timeout_msec,
|
uint32_t timeout_msec,
|
||||||
uint32_t pid,
|
uint32_t pid,
|
||||||
uint32_t tid,
|
struct smbXcli_tcon *tcon,
|
||||||
struct smbXcli_session *session,
|
struct smbXcli_session *session,
|
||||||
const uint8_t *fixed,
|
const uint8_t *fixed,
|
||||||
uint16_t fixed_len,
|
uint16_t fixed_len,
|
||||||
@ -225,7 +225,7 @@ struct tevent_req *smb2cli_req_send(TALLOC_CTX *mem_ctx,
|
|||||||
uint32_t clear_flags,
|
uint32_t clear_flags,
|
||||||
uint32_t timeout_msec,
|
uint32_t timeout_msec,
|
||||||
uint32_t pid,
|
uint32_t pid,
|
||||||
uint32_t tid,
|
struct smbXcli_tcon *tcon,
|
||||||
struct smbXcli_session *session,
|
struct smbXcli_session *session,
|
||||||
const uint8_t *fixed,
|
const uint8_t *fixed,
|
||||||
uint16_t fixed_len,
|
uint16_t fixed_len,
|
||||||
|
@ -85,7 +85,7 @@ struct tevent_req *smb2cli_tcon_send(TALLOC_CTX *mem_ctx,
|
|||||||
0, 0, /* flags */
|
0, 0, /* flags */
|
||||||
cli->timeout,
|
cli->timeout,
|
||||||
cli->smb2.pid,
|
cli->smb2.pid,
|
||||||
0, /* tid */
|
NULL, /* tcon */
|
||||||
cli->smb2.session,
|
cli->smb2.session,
|
||||||
state->fixed, sizeof(state->fixed),
|
state->fixed, sizeof(state->fixed),
|
||||||
dyn, dyn_len);
|
dyn, dyn_len);
|
||||||
@ -198,7 +198,6 @@ struct tevent_req *smb2cli_tdis_send(TALLOC_CTX *mem_ctx,
|
|||||||
{
|
{
|
||||||
struct tevent_req *req, *subreq;
|
struct tevent_req *req, *subreq;
|
||||||
struct smb2cli_tdis_state *state;
|
struct smb2cli_tdis_state *state;
|
||||||
uint32_t tcon_id = 0;
|
|
||||||
|
|
||||||
req = tevent_req_create(mem_ctx, &state,
|
req = tevent_req_create(mem_ctx, &state,
|
||||||
struct smb2cli_tdis_state);
|
struct smb2cli_tdis_state);
|
||||||
@ -208,15 +207,11 @@ struct tevent_req *smb2cli_tdis_send(TALLOC_CTX *mem_ctx,
|
|||||||
state->cli = cli;
|
state->cli = cli;
|
||||||
SSVAL(state->fixed, 0, 4);
|
SSVAL(state->fixed, 0, 4);
|
||||||
|
|
||||||
if (cli->smb2.tcon) {
|
|
||||||
tcon_id = smb2cli_tcon_current_id(cli->smb2.tcon);
|
|
||||||
}
|
|
||||||
|
|
||||||
subreq = smb2cli_req_send(state, ev, cli->conn, SMB2_OP_TDIS,
|
subreq = smb2cli_req_send(state, ev, cli->conn, SMB2_OP_TDIS,
|
||||||
0, 0, /* flags */
|
0, 0, /* flags */
|
||||||
cli->timeout,
|
cli->timeout,
|
||||||
cli->smb2.pid,
|
cli->smb2.pid,
|
||||||
tcon_id,
|
cli->smb2.tcon,
|
||||||
cli->smb2.session,
|
cli->smb2.session,
|
||||||
state->fixed, sizeof(state->fixed),
|
state->fixed, sizeof(state->fixed),
|
||||||
NULL, 0);
|
NULL, 0);
|
||||||
|
@ -116,7 +116,7 @@ void smb2_transport_send(struct smb2_request *req)
|
|||||||
uint32_t additional_flags = IVAL(req->out.hdr, SMB2_HDR_FLAGS);
|
uint32_t additional_flags = IVAL(req->out.hdr, SMB2_HDR_FLAGS);
|
||||||
uint32_t clear_flags = 0;
|
uint32_t clear_flags = 0;
|
||||||
uint32_t pid = IVAL(req->out.hdr, SMB2_HDR_PID);
|
uint32_t pid = IVAL(req->out.hdr, SMB2_HDR_PID);
|
||||||
uint32_t tid = IVAL(req->out.hdr, SMB2_HDR_TID);
|
struct smbXcli_tcon *tcon = NULL;
|
||||||
struct smbXcli_session *session = NULL;
|
struct smbXcli_session *session = NULL;
|
||||||
bool need_pending_break = false;
|
bool need_pending_break = false;
|
||||||
size_t hdr_ofs;
|
size_t hdr_ofs;
|
||||||
@ -148,7 +148,7 @@ void smb2_transport_send(struct smb2_request *req)
|
|||||||
0, /*clear_flags */
|
0, /*clear_flags */
|
||||||
0, /* timeout_msec */
|
0, /* timeout_msec */
|
||||||
0, /* pid */
|
0, /* pid */
|
||||||
0, /* tid */
|
NULL, /* tcon */
|
||||||
NULL, /* session */
|
NULL, /* session */
|
||||||
NULL, /* body */
|
NULL, /* body */
|
||||||
0, /* body_fixed */
|
0, /* body_fixed */
|
||||||
@ -167,6 +167,10 @@ void smb2_transport_send(struct smb2_request *req)
|
|||||||
session = req->session->smbXcli;
|
session = req->session->smbXcli;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (req->tree) {
|
||||||
|
tcon = req->tree->smbXcli;
|
||||||
|
}
|
||||||
|
|
||||||
if (transport->compound.related) {
|
if (transport->compound.related) {
|
||||||
additional_flags |= SMB2_HDR_FLAG_CHAINED;
|
additional_flags |= SMB2_HDR_FLAG_CHAINED;
|
||||||
}
|
}
|
||||||
@ -186,7 +190,7 @@ void smb2_transport_send(struct smb2_request *req)
|
|||||||
clear_flags,
|
clear_flags,
|
||||||
timeout_msec,
|
timeout_msec,
|
||||||
pid,
|
pid,
|
||||||
tid,
|
tcon,
|
||||||
session,
|
session,
|
||||||
body.data, body.length,
|
body.data, body.length,
|
||||||
dyn.data, dyn.length);
|
dyn.data, dyn.length);
|
||||||
@ -342,7 +346,7 @@ static void smb2_transport_break_handler(struct tevent_req *subreq)
|
|||||||
0, /*clear_flags */
|
0, /*clear_flags */
|
||||||
0, /* timeout_msec */
|
0, /* timeout_msec */
|
||||||
0, /* pid */
|
0, /* pid */
|
||||||
0, /* tid */
|
NULL, /* tcon */
|
||||||
NULL, /* session */
|
NULL, /* session */
|
||||||
NULL, /* body */
|
NULL, /* body */
|
||||||
0, /* body_fixed */
|
0, /* body_fixed */
|
||||||
|
Loading…
Reference in New Issue
Block a user