struct tevent_req *req, *subreq;
struct smb2cli_close_state *state;
uint8_t *fixed;
- uint32_t tcon_id = 0;
req = tevent_req_create(mem_ctx, &state,
struct smb2cli_close_state);
SBVAL(fixed, 8, fid_persistent);
SBVAL(fixed, 16, fid_volatile);
- if (tcon) {
- tcon_id = smb2cli_tcon_current_id(tcon);
- }
-
subreq = smb2cli_req_send(state, ev, conn, SMB2_OP_CLOSE,
0, 0, /* flags */
timeout_msec,
0xFEFF, /* pid */
- tcon_id,
+ tcon,
session,
state->fixed, sizeof(state->fixed),
NULL, 0);
size_t blobs_offset;
uint8_t *dyn;
size_t dyn_len;
- uint32_t tcon_id = 0;
req = tevent_req_create(mem_ctx, &state,
struct smb2cli_create_state);
data_blob_free(&blob);
}
- if (tcon) {
- tcon_id = smb2cli_tcon_current_id(tcon);
- }
-
subreq = smb2cli_req_send(state, ev, conn, SMB2_OP_CREATE,
0, 0, /* flags */
timeout_msec,
0xFEFF, /* pid */
- tcon_id,
+ tcon,
session,
state->fixed, sizeof(state->fixed),
dyn, dyn_len);
struct tevent_req *req, *subreq;
struct smb2cli_flush_state *state;
uint8_t *fixed;
- uint32_t tcon_id = 0;
req = tevent_req_create(mem_ctx, &state,
struct smb2cli_flush_state);
SBVAL(fixed, 8, fid_persistent);
SBVAL(fixed, 16, fid_volatile);
- if (tcon) {
- tcon_id = smb2cli_tcon_current_id(tcon);
- }
-
subreq = smb2cli_req_send(state, ev, conn, SMB2_OP_FLUSH,
0, 0, /* flags */
timeout_msec,
0xFEFF, /* pid */
- tcon_id,
+ tcon,
session,
state->fixed, sizeof(state->fixed),
NULL, 0);
uint32_t output_buffer_offset = 0;
uint32_t output_buffer_length = 0;
uint32_t pad_length = 0;
- uint32_t tcon_id = 0;
req = tevent_req_create(mem_ctx, &state,
struct smb2cli_ioctl_state);
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,
0, 0, /* flags */
timeout_msec,
0xFEFF, /* pid */
- tcon_id,
+ tcon,
session,
state->fixed, sizeof(state->fixed),
dyn, dyn_len);
uint8_t *fixed;
uint8_t *dyn;
size_t dyn_len;
- uint32_t tcon_id = 0;
req = tevent_req_create(mem_ctx, &state,
struct smb2cli_query_directory_state);
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,
0, 0, /* flags */
timeout_msec,
0xFEFF, /* pid */
- tcon_id,
+ tcon,
session,
state->fixed, sizeof(state->fixed),
dyn, dyn_len);
size_t dyn_len;
uint16_t input_buffer_offset = 0;
uint32_t input_buffer_length = 0;
- uint32_t tcon_id = 0;
req = tevent_req_create(mem_ctx, &state,
struct smb2cli_query_info_state);
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,
0, 0, /* flags */
timeout_msec,
0xFEFF, /* pid */
- tcon_id,
+ tcon,
session,
state->fixed, sizeof(state->fixed),
dyn, dyn_len);
struct tevent_req *req, *subreq;
struct smb2cli_read_state *state;
uint8_t *fixed;
- uint32_t tcon_id = 0;
req = tevent_req_create(mem_ctx, &state,
struct smb2cli_read_state);
SBVAL(fixed, 32, minimum_count);
SBVAL(fixed, 40, remaining_bytes);
- if (tcon) {
- tcon_id = smb2cli_tcon_current_id(tcon);
- }
-
subreq = smb2cli_req_send(state, ev, conn, SMB2_OP_READ,
0, 0, /* flags */
timeout_msec,
0xFEFF, /* pid */
- tcon_id,
+ tcon,
session,
state->fixed, sizeof(state->fixed),
state->dyn_pad, sizeof(state->dyn_pad));
0, 0, /* flags */
timeout_msec,
0xFEFF,
- 0, /* tid */
+ NULL, /* tcon */
session,
state->fixed, sizeof(state->fixed),
dyn, dyn_len);
0, 0, /* flags */
timeout_msec,
0xFEFF, /* pid */
- 0, /* tid */
+ NULL, /* tcon */
session,
state->fixed, sizeof(state->fixed),
NULL, 0);
size_t dyn_len;
uint16_t input_buffer_offset = 0;
uint32_t input_buffer_length = 0;
- uint32_t tcon_id = 0;
req = tevent_req_create(mem_ctx, &state,
struct smb2cli_set_info_state);
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,
0, 0, /* flags */
timeout_msec,
0xFEFF, /* pid */
- tcon_id,
+ tcon,
session,
state->fixed, sizeof(state->fixed),
dyn, dyn_len);
uint8_t *fixed;
const uint8_t *dyn;
size_t dyn_len;
- uint32_t tcon_id = 0;
req = tevent_req_create(mem_ctx, &state,
struct smb2cli_write_state);
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,
0, 0, /* flags */
timeout_msec,
0xFEFF, /* pid */
- tcon_id,
+ tcon,
session,
state->fixed, sizeof(state->fixed),
dyn, dyn_len);
struct smbXcli_req_state);
uint32_t flags = IVAL(state->smb2.hdr, SMB2_HDR_FLAGS);
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 aid = BVAL(state->smb2.hdr, SMB2_HDR_ASYNC_ID);
+ struct smbXcli_tcon *tcon = state->tcon;
struct smbXcli_session *session = state->session;
uint8_t *fixed = state->smb2.pad;
uint16_t fixed_len = 4;
SMB2_OP_CANCEL,
flags, 0,
0, /* timeout */
- pid, tid, session,
+ pid, tcon, session,
fixed, fixed_len,
NULL, 0);
if (subreq == NULL) {
SIVAL(substate->smb2.hdr, SMB2_HDR_FLAGS, flags);
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_ASYNC_ID, aid);
uint32_t clear_flags,
uint32_t timeout_msec,
uint32_t pid,
- uint32_t tid,
+ struct smbXcli_tcon *tcon,
struct smbXcli_session *session,
const uint8_t *fixed,
uint16_t fixed_len,
struct tevent_req *req;
struct smbXcli_req_state *state;
uint32_t flags = 0;
+ uint32_t tid = 0;
uint64_t uid = 0;
req = tevent_req_create(mem_ctx, &state,
state->ev = ev;
state->conn = conn;
state->session = session;
+ state->tcon = tcon;
if (session) {
uid = session->smb2.session_id;
state->smb2.should_sign = session->smb2.should_sign;
state->smb2.should_encrypt = session->smb2.should_encrypt;
- /* TODO: turn on encryption based on the tree connect. */
-
if (cmd == SMB2_OP_SESSSETUP &&
session->smb2.signing_key.length != 0) {
state->smb2.should_sign = true;
session->smb2.channel_signing_key.length == 0) {
state->smb2.should_encrypt = false;
}
+ }
- if (state->smb2.should_encrypt) {
- state->smb2.should_sign = false;
- }
+ if (tcon) {
+ 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);
uint32_t clear_flags,
uint32_t timeout_msec,
uint32_t pid,
- uint32_t tid,
+ struct smbXcli_tcon *tcon,
struct smbXcli_session *session,
const uint8_t *fixed,
uint16_t fixed_len,
req = smb2cli_req_create(mem_ctx, ev, conn, cmd,
additional_flags, clear_flags,
timeout_msec,
- pid, tid, session,
+ pid, tcon, session,
fixed, fixed_len, dyn, dyn_len);
if (req == NULL) {
return NULL;
state->conn, SMB2_OP_NEGPROT,
0, 0, /* flags */
state->timeout_msec,
- 0xFEFF, 0, NULL, /* pid, tid, session */
+ 0xFEFF, NULL, NULL, /* pid, tcon, session */
state->smb2.fixed, sizeof(state->smb2.fixed),
state->smb2.dyn, dialect_count*2);
}
uint32_t clear_flags,
uint32_t timeout_msec,
uint32_t pid,
- uint32_t tid,
+ struct smbXcli_tcon *tcon,
struct smbXcli_session *session,
const uint8_t *fixed,
uint16_t fixed_len,
uint32_t clear_flags,
uint32_t timeout_msec,
uint32_t pid,
- uint32_t tid,
+ struct smbXcli_tcon *tcon,
struct smbXcli_session *session,
const uint8_t *fixed,
uint16_t fixed_len,
0, 0, /* flags */
cli->timeout,
cli->smb2.pid,
- 0, /* tid */
+ NULL, /* tcon */
cli->smb2.session,
state->fixed, sizeof(state->fixed),
dyn, dyn_len);
{
struct tevent_req *req, *subreq;
struct smb2cli_tdis_state *state;
- uint32_t tcon_id = 0;
req = tevent_req_create(mem_ctx, &state,
struct smb2cli_tdis_state);
state->cli = cli;
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,
0, 0, /* flags */
cli->timeout,
cli->smb2.pid,
- tcon_id,
+ cli->smb2.tcon,
cli->smb2.session,
state->fixed, sizeof(state->fixed),
NULL, 0);
uint32_t additional_flags = IVAL(req->out.hdr, SMB2_HDR_FLAGS);
uint32_t clear_flags = 0;
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;
bool need_pending_break = false;
size_t hdr_ofs;
0, /*clear_flags */
0, /* timeout_msec */
0, /* pid */
- 0, /* tid */
+ NULL, /* tcon */
NULL, /* session */
NULL, /* body */
0, /* body_fixed */
session = req->session->smbXcli;
}
+ if (req->tree) {
+ tcon = req->tree->smbXcli;
+ }
+
if (transport->compound.related) {
additional_flags |= SMB2_HDR_FLAG_CHAINED;
}
clear_flags,
timeout_msec,
pid,
- tid,
+ tcon,
session,
body.data, body.length,
dyn.data, dyn.length);
0, /*clear_flags */
0, /* timeout_msec */
0, /* pid */
- 0, /* tid */
+ NULL, /* tcon */
NULL, /* session */
NULL, /* body */
0, /* body_fixed */