summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libcli/smb/smb1cli_trans.c21
-rw-r--r--libcli/smb/smbXcli_base.c18
-rw-r--r--libcli/smb/smbXcli_base.h10
-rw-r--r--source3/libsmb/async_smb.c8
-rw-r--r--source3/libsmb/clitrans.c10
-rw-r--r--source4/libcli/raw/clitransport.c13
-rw-r--r--source4/libcli/raw/rawtrans.c20
7 files changed, 59 insertions, 41 deletions
diff --git a/libcli/smb/smb1cli_trans.c b/libcli/smb/smb1cli_trans.c
index ca0fdc157d..cc4f7d3b91 100644
--- a/libcli/smb/smb1cli_trans.c
+++ b/libcli/smb/smb1cli_trans.c
@@ -39,7 +39,7 @@ struct smb1cli_trans_state {
uint32_t timeout_msec;
uint16_t mid;
uint32_t pid;
- uint16_t tid;
+ struct smbXcli_tcon *tcon;
struct smbXcli_session *session;
const char *pipe_name;
uint8_t *pipe_name_conv;
@@ -415,7 +415,8 @@ struct tevent_req *smb1cli_trans_send(
uint8_t additional_flags, uint8_t clear_flags,
uint16_t additional_flags2, uint16_t clear_flags2,
uint32_t timeout_msec,
- uint32_t pid, uint16_t tid,
+ uint32_t pid,
+ struct smbXcli_tcon *tcon,
struct smbXcli_session *session,
const char *pipe_name, uint16_t fid, uint16_t function, int flags,
uint16_t *setup, uint8_t num_setup, uint8_t max_setup,
@@ -470,7 +471,7 @@ struct tevent_req *smb1cli_trans_send(
state->num_rsetup = 0;
state->rsetup = NULL;
state->pid = pid;
- state->tid = tid;
+ state->tcon = tcon;
state->session = session;
ZERO_STRUCT(state->rparam);
ZERO_STRUCT(state->rdata);
@@ -514,7 +515,8 @@ struct tevent_req *smb1cli_trans_send(
state->additional_flags2,
state->clear_flags2,
state->timeout_msec,
- state->pid, state->tid,
+ state->pid,
+ state->tcon,
state->session,
wct, state->vwv,
iov_count, state->iov);
@@ -646,7 +648,8 @@ static void smb1cli_trans_done(struct tevent_req *subreq)
state->additional_flags2,
state->clear_flags2,
state->timeout_msec,
- state->pid, state->tid,
+ state->pid,
+ state->tcon,
state->session,
wct, state->vwv,
iov_count, state->iov);
@@ -753,7 +756,8 @@ static void smb1cli_trans_done2(struct tevent_req *subreq2)
state->additional_flags2,
state->clear_flags2,
state->timeout_msec,
- state->pid, state->tid,
+ state->pid,
+ state->tcon,
state->session,
wct, state->vwv,
iov_count, state->iov);
@@ -844,7 +848,8 @@ NTSTATUS smb1cli_trans(TALLOC_CTX *mem_ctx, struct smbXcli_conn *conn,
uint8_t additional_flags, uint8_t clear_flags,
uint16_t additional_flags2, uint16_t clear_flags2,
uint32_t timeout_msec,
- uint32_t pid, uint16_t tid,
+ uint32_t pid,
+ struct smbXcli_tcon *tcon,
struct smbXcli_session *session,
const char *pipe_name, uint16_t fid, uint16_t function,
int flags,
@@ -879,7 +884,7 @@ NTSTATUS smb1cli_trans(TALLOC_CTX *mem_ctx, struct smbXcli_conn *conn,
additional_flags, clear_flags,
additional_flags2, clear_flags2,
timeout_msec,
- pid, tid, session,
+ pid, tcon, session,
pipe_name, fid, function, flags,
setup, num_setup, max_setup,
param, num_param, max_param,
diff --git a/libcli/smb/smbXcli_base.c b/libcli/smb/smbXcli_base.c
index e9592e78a2..037c0dd8a3 100644
--- a/libcli/smb/smbXcli_base.c
+++ b/libcli/smb/smbXcli_base.c
@@ -174,6 +174,7 @@ struct smbXcli_req_state {
struct tevent_context *ev;
struct smbXcli_conn *conn;
struct smbXcli_session *session; /* maybe NULL */
+ struct smbXcli_tcon *tcon; /* maybe NULL */
uint8_t length_hdr[4];
@@ -1114,7 +1115,6 @@ static bool smb1cli_req_cancel(struct tevent_req *req)
uint8_t flags;
uint16_t flags2;
uint32_t pid;
- uint16_t tid;
uint16_t mid;
struct tevent_req *subreq;
NTSTATUS status;
@@ -1123,7 +1123,6 @@ static bool smb1cli_req_cancel(struct tevent_req *req)
flags2 = SVAL(state->smb1.hdr, HDR_FLG2);
pid = SVAL(state->smb1.hdr, HDR_PID);
pid |= SVAL(state->smb1.hdr, HDR_PIDHIGH)<<16;
- tid = SVAL(state->smb1.hdr, HDR_TID);
mid = SVAL(state->smb1.hdr, HDR_MID);
subreq = smb1cli_req_create(state, state->ev,
@@ -1132,7 +1131,8 @@ static bool smb1cli_req_cancel(struct tevent_req *req)
flags, 0,
flags2, 0,
0, /* timeout */
- pid, tid,
+ pid,
+ state->tcon,
state->session,
0, NULL, /* vwv */
0, NULL); /* bytes */
@@ -1169,7 +1169,7 @@ struct tevent_req *smb1cli_req_create(TALLOC_CTX *mem_ctx,
uint16_t clear_flags2,
uint32_t timeout_msec,
uint32_t pid,
- uint16_t tid,
+ struct smbXcli_tcon *tcon,
struct smbXcli_session *session,
uint8_t wct, uint16_t *vwv,
int iov_count,
@@ -1180,6 +1180,7 @@ struct tevent_req *smb1cli_req_create(TALLOC_CTX *mem_ctx,
uint8_t flags = 0;
uint16_t flags2 = 0;
uint16_t uid = 0;
+ uint16_t tid = 0;
if (iov_count > MAX_SMB_IOV) {
/*
@@ -1196,11 +1197,16 @@ struct tevent_req *smb1cli_req_create(TALLOC_CTX *mem_ctx,
state->ev = ev;
state->conn = conn;
state->session = session;
+ state->tcon = tcon;
if (session) {
uid = session->smb1.session_id;
}
+ if (tcon) {
+ tid = tcon->smb1.tcon_id;
+ }
+
state->smb1.recv_cmd = 0xFF;
state->smb1.recv_status = NT_STATUS_INTERNAL_ERROR;
state->smb1.recv_iov = talloc_zero_array(state, struct iovec, 3);
@@ -1443,7 +1449,7 @@ struct tevent_req *smb1cli_req_send(TALLOC_CTX *mem_ctx,
uint16_t clear_flags2,
uint32_t timeout_msec,
uint32_t pid,
- uint16_t tid,
+ struct smbXcli_tcon *tcon,
struct smbXcli_session *session,
uint8_t wct, uint16_t *vwv,
uint32_t num_bytes,
@@ -1460,7 +1466,7 @@ struct tevent_req *smb1cli_req_send(TALLOC_CTX *mem_ctx,
additional_flags, clear_flags,
additional_flags2, clear_flags2,
timeout_msec,
- pid, tid, session,
+ pid, tcon, session,
wct, vwv, 1, &iov);
if (req == NULL) {
return NULL;
diff --git a/libcli/smb/smbXcli_base.h b/libcli/smb/smbXcli_base.h
index 9f4c0bc340..a105c8278b 100644
--- a/libcli/smb/smbXcli_base.h
+++ b/libcli/smb/smbXcli_base.h
@@ -110,7 +110,7 @@ struct tevent_req *smb1cli_req_create(TALLOC_CTX *mem_ctx,
uint16_t clear_flags2,
uint32_t timeout_msec,
uint32_t pid,
- uint16_t tid,
+ struct smbXcli_tcon *tcon,
struct smbXcli_session *session,
uint8_t wct, uint16_t *vwv,
int iov_count,
@@ -127,7 +127,7 @@ struct tevent_req *smb1cli_req_send(TALLOC_CTX *mem_ctx,
uint16_t clear_flags2,
uint32_t timeout_msec,
uint32_t pid,
- uint16_t tid,
+ struct smbXcli_tcon *tcon,
struct smbXcli_session *session,
uint8_t wct, uint16_t *vwv,
uint32_t num_bytes,
@@ -152,7 +152,8 @@ struct tevent_req *smb1cli_trans_send(
uint8_t additional_flags, uint8_t clear_flags,
uint16_t additional_flags2, uint16_t clear_flags2,
uint32_t timeout_msec,
- uint32_t pid, uint16_t tid,
+ uint32_t pid,
+ struct smbXcli_tcon *tcon,
struct smbXcli_session *session,
const char *pipe_name, uint16_t fid, uint16_t function, int flags,
uint16_t *setup, uint8_t num_setup, uint8_t max_setup,
@@ -171,7 +172,8 @@ NTSTATUS smb1cli_trans(TALLOC_CTX *mem_ctx, struct smbXcli_conn *conn,
uint8_t additional_flags, uint8_t clear_flags,
uint16_t additional_flags2, uint16_t clear_flags2,
uint32_t timeout_msec,
- uint32_t pid, uint16_t tid,
+ uint32_t pid,
+ struct smbXcli_tcon *tcon,
struct smbXcli_session *session,
const char *pipe_name, uint16_t fid, uint16_t function,
int flags,
diff --git a/source3/libsmb/async_smb.c b/source3/libsmb/async_smb.c
index 9704ea59a9..ed68a5d927 100644
--- a/source3/libsmb/async_smb.c
+++ b/source3/libsmb/async_smb.c
@@ -62,7 +62,6 @@ struct tevent_req *cli_smb_req_create(TALLOC_CTX *mem_ctx,
uint8_t clear_flags = 0;
uint16_t additional_flags2 = 0;
uint16_t clear_flags2 = 0;
- uint16_t tid = 0;
state = talloc_zero(mem_ctx, struct cli_smb_req_state);
if (state == NULL) {
@@ -88,13 +87,12 @@ struct tevent_req *cli_smb_req_create(TALLOC_CTX *mem_ctx,
additional_flags2 |= FLAGS2_DFS_PATHNAMES;
}
- tid = cli_state_get_tid(cli);
state->req = smb1cli_req_create(state, ev, cli->conn, smb_command,
additional_flags, clear_flags,
additional_flags2, clear_flags2,
cli->timeout,
cli->smb1.pid,
- tid,
+ cli->smb1.tcon,
cli->smb1.session,
wct, vwv, iov_count, bytes_iov);
if (state->req == NULL) {
@@ -122,7 +120,6 @@ struct tevent_req *cli_smb_send(TALLOC_CTX *mem_ctx,
uint8_t clear_flags = 0;
uint16_t additional_flags2 = 0;
uint16_t clear_flags2 = 0;
- uint16_t tid = 0;
state = talloc_zero(mem_ctx, struct cli_smb_req_state);
if (state == NULL) {
@@ -148,13 +145,12 @@ struct tevent_req *cli_smb_send(TALLOC_CTX *mem_ctx,
additional_flags2 |= FLAGS2_DFS_PATHNAMES;
}
- tid = cli_state_get_tid(cli);
state->req = smb1cli_req_send(state, ev, cli->conn, smb_command,
additional_flags, clear_flags,
additional_flags2, clear_flags2,
cli->timeout,
cli->smb1.pid,
- tid,
+ cli->smb1.tcon,
cli->smb1.session,
wct, vwv, num_bytes, bytes);
if (state->req == NULL) {
diff --git a/source3/libsmb/clitrans.c b/source3/libsmb/clitrans.c
index 9755d57254..08fda5fdb5 100644
--- a/source3/libsmb/clitrans.c
+++ b/source3/libsmb/clitrans.c
@@ -61,7 +61,6 @@ struct tevent_req *cli_trans_send(
uint8_t clear_flags = 0;
uint16_t additional_flags2 = 0;
uint16_t clear_flags2 = 0;
- uint16_t tid = 0;
state = talloc_zero(mem_ctx, struct cli_trans_state);
if (state == NULL) {
@@ -85,13 +84,13 @@ struct tevent_req *cli_trans_send(
additional_flags2 |= FLAGS2_DFS_PATHNAMES;
}
- tid = cli_state_get_tid(cli);
state->req = smb1cli_trans_send(state, ev,
cli->conn, cmd,
additional_flags, clear_flags,
additional_flags2, clear_flags2,
cli->timeout,
- cli->smb1.pid, tid,
+ cli->smb1.pid,
+ cli->smb1.tcon,
cli->smb1.session,
pipe_name, fid, function, flags,
setup, num_setup, max_setup,
@@ -169,7 +168,6 @@ NTSTATUS cli_trans(TALLOC_CTX *mem_ctx, struct cli_state *cli,
uint8_t clear_flags = 0;
uint16_t additional_flags2 = 0;
uint16_t clear_flags2 = 0;
- uint16_t tid = 0;
if (cli->case_sensitive) {
clear_flags |= FLAG_CASELESS_PATHNAMES;
@@ -182,13 +180,13 @@ NTSTATUS cli_trans(TALLOC_CTX *mem_ctx, struct cli_state *cli,
additional_flags2 |= FLAGS2_DFS_PATHNAMES;
}
- tid = cli_state_get_tid(cli);
status = smb1cli_trans(mem_ctx,
cli->conn, trans_cmd,
additional_flags, clear_flags,
additional_flags2, clear_flags2,
cli->timeout,
- cli->smb1.pid, tid,
+ cli->smb1.pid,
+ cli->smb1.tcon,
cli->smb1.session,
pipe_name, fid, function, flags,
setup, num_setup, max_setup,
diff --git a/source4/libcli/raw/clitransport.c b/source4/libcli/raw/clitransport.c
index 321df768f2..f9d96b58df 100644
--- a/source4/libcli/raw/clitransport.c
+++ b/source4/libcli/raw/clitransport.c
@@ -213,7 +213,7 @@ struct tevent_req *smbcli_transport_setup_subreq(struct smbcli_request *req)
uint16_t additional_flags2;
uint16_t clear_flags2;
uint32_t pid;
- uint16_t tid;
+ struct smbXcli_tcon *tcon = NULL;
struct smbXcli_session *session = NULL;
uint32_t timeout_msec = transport->options.request_timeout * 1000;
struct iovec *bytes_iov = NULL;
@@ -224,7 +224,6 @@ struct tevent_req *smbcli_transport_setup_subreq(struct smbcli_request *req)
additional_flags2 = SVAL(req->out.hdr, HDR_FLG2);
pid = SVAL(req->out.hdr, HDR_PID);
pid |= SVAL(req->out.hdr, HDR_PIDHIGH)<<16;
- tid = SVAL(req->out.hdr, HDR_TID);
clear_flags = ~additional_flags;
clear_flags2 = ~additional_flags2;
@@ -233,6 +232,10 @@ struct tevent_req *smbcli_transport_setup_subreq(struct smbcli_request *req)
session = req->session->smbXcli;
}
+ if (req->tree) {
+ tcon = req->tree->smbXcli;
+ }
+
bytes_iov = talloc(req, struct iovec);
if (bytes_iov == NULL) {
return NULL;
@@ -250,7 +253,7 @@ struct tevent_req *smbcli_transport_setup_subreq(struct smbcli_request *req)
clear_flags2,
timeout_msec,
pid,
- tid,
+ tcon,
session,
req->out.wct,
(uint16_t *)req->out.vwv,
@@ -295,7 +298,7 @@ void smbcli_transport_send(struct smbcli_request *req)
0, /* clear_flags2 */
0, /* timeout_msec */
0, /* pid */
- 0, /* tid */
+ NULL, /* tcon */
NULL, /* session */
0, /* wct */
NULL, /* vwv */
@@ -501,7 +504,7 @@ static void smbcli_transport_break_handler(struct tevent_req *subreq)
0, /* clear_flags2 */
0, /* timeout_msec */
0, /* pid */
- 0, /* tid */
+ NULL, /* tcon */
NULL, /* session */
0, /* wct */
NULL, /* vwv */
diff --git a/source4/libcli/raw/rawtrans.c b/source4/libcli/raw/rawtrans.c
index 1df5209523..3a12fd30d5 100644
--- a/source4/libcli/raw/rawtrans.c
+++ b/source4/libcli/raw/rawtrans.c
@@ -36,7 +36,7 @@ static struct smbcli_request *smb_raw_trans_backend_send(struct smbcli_tree *tre
uint16_t additional_flags2;
uint16_t clear_flags2;
uint32_t pid;
- uint16_t tid;
+ struct smbXcli_tcon *tcon = NULL;
struct smbXcli_session *session = NULL;
const char *pipe_name = NULL;
uint8_t s;
@@ -54,12 +54,15 @@ static struct smbcli_request *smb_raw_trans_backend_send(struct smbcli_tree *tre
additional_flags2 = SVAL(req->out.hdr, HDR_FLG2);
pid = SVAL(req->out.hdr, HDR_PID);
pid |= SVAL(req->out.hdr, HDR_PIDHIGH)<<16;
- tid = SVAL(req->out.hdr, HDR_TID);
if (req->session) {
session = req->session->smbXcli;
}
+ if (req->tree) {
+ tcon = req->tree->smbXcli;
+ }
+
clear_flags = ~additional_flags;
clear_flags2 = ~additional_flags2;
@@ -89,7 +92,8 @@ static struct smbcli_request *smb_raw_trans_backend_send(struct smbcli_tree *tre
additional_flags2,
clear_flags2,
timeout_msec,
- pid, tid,
+ pid,
+ tcon,
session,
pipe_name,
0xFFFF, /* fid */
@@ -262,7 +266,7 @@ struct smbcli_request *smb_raw_nttrans_send(struct smbcli_tree *tree,
uint16_t additional_flags2;
uint16_t clear_flags2;
uint32_t pid;
- uint16_t tid;
+ struct smbXcli_tcon *tcon = NULL;
struct smbXcli_session *session = NULL;
uint32_t timeout_msec;
uint32_t tmp;
@@ -278,12 +282,15 @@ struct smbcli_request *smb_raw_nttrans_send(struct smbcli_tree *tree,
additional_flags2 = SVAL(req->out.hdr, HDR_FLG2);
pid = SVAL(req->out.hdr, HDR_PID);
pid |= SVAL(req->out.hdr, HDR_PIDHIGH)<<16;
- tid = SVAL(req->out.hdr, HDR_TID);
if (req->session) {
session = req->session->smbXcli;
}
+ if (req->tree) {
+ tcon = req->tree->smbXcli;
+ }
+
clear_flags = ~additional_flags;
clear_flags2 = ~additional_flags2;
@@ -309,7 +316,8 @@ struct smbcli_request *smb_raw_nttrans_send(struct smbcli_tree *tree,
additional_flags2,
clear_flags2,
timeout_msec,
- pid, tid,
+ pid,
+ tcon,
session,
NULL, /* pipe_name */
0xFFFF, /* fid */