diff options
author | Stefan Metzmacher <metze@samba.org> | 2012-07-23 20:15:21 +0200 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2012-07-24 00:08:58 +0200 |
commit | 43b070d8dd20d7a2a1a0ec1eb5ebc679cd699bf3 (patch) | |
tree | 6097b25d13e25556a5d89430d7b31abc902399df | |
parent | af90c71ed8e66586aa23f7d0e18efc557c9a0c08 (diff) | |
download | samba-43b070d8dd20d7a2a1a0ec1eb5ebc679cd699bf3.tar.gz samba-43b070d8dd20d7a2a1a0ec1eb5ebc679cd699bf3.tar.xz samba-43b070d8dd20d7a2a1a0ec1eb5ebc679cd699bf3.zip |
libcli/smb: pass down smbXcli_session to smb1cli_req_create/send() and smb1cli_trans*
metze
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Tue Jul 24 00:08:58 CEST 2012 on sn-devel-104
-rw-r--r-- | libcli/smb/smb1cli_trans.c | 21 | ||||
-rw-r--r-- | libcli/smb/smbXcli_base.c | 19 | ||||
-rw-r--r-- | libcli/smb/smbXcli_base.h | 10 | ||||
-rw-r--r-- | source3/libsmb/async_smb.c | 8 | ||||
-rw-r--r-- | source3/libsmb/clitrans.c | 10 | ||||
-rw-r--r-- | source4/libcli/raw/clitransport.c | 13 | ||||
-rw-r--r-- | source4/libcli/raw/rawtrans.c | 20 |
7 files changed, 59 insertions, 42 deletions
diff --git a/libcli/smb/smb1cli_trans.c b/libcli/smb/smb1cli_trans.c index fadac8e7b4a..ca0fdc157dd 100644 --- a/libcli/smb/smb1cli_trans.c +++ b/libcli/smb/smb1cli_trans.c @@ -40,7 +40,7 @@ struct smb1cli_trans_state { uint16_t mid; uint32_t pid; uint16_t tid; - uint16_t uid; + struct smbXcli_session *session; const char *pipe_name; uint8_t *pipe_name_conv; size_t pipe_name_conv_len; @@ -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, uint16_t uid, + uint32_t pid, uint16_t tid, + 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, uint8_t *param, uint32_t num_param, uint32_t max_param, @@ -470,7 +471,7 @@ struct tevent_req *smb1cli_trans_send( state->rsetup = NULL; state->pid = pid; state->tid = tid; - state->uid = uid; + state->session = session; ZERO_STRUCT(state->rparam); ZERO_STRUCT(state->rdata); @@ -513,7 +514,8 @@ struct tevent_req *smb1cli_trans_send( state->additional_flags2, state->clear_flags2, state->timeout_msec, - state->pid, state->tid, state->uid, + state->pid, state->tid, + state->session, wct, state->vwv, iov_count, state->iov); if (tevent_req_nomem(subreq, req)) { @@ -644,7 +646,8 @@ static void smb1cli_trans_done(struct tevent_req *subreq) state->additional_flags2, state->clear_flags2, state->timeout_msec, - state->pid, state->tid, state->uid, + state->pid, state->tid, + state->session, wct, state->vwv, iov_count, state->iov); if (tevent_req_nomem(subreq2, req)) { @@ -750,7 +753,8 @@ static void smb1cli_trans_done2(struct tevent_req *subreq2) state->additional_flags2, state->clear_flags2, state->timeout_msec, - state->pid, state->tid, state->uid, + state->pid, state->tid, + state->session, wct, state->vwv, iov_count, state->iov); if (tevent_req_nomem(subreq2, req)) { @@ -840,7 +844,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, uint16_t uid, + uint32_t pid, uint16_t tid, + 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, @@ -874,7 +879,7 @@ NTSTATUS smb1cli_trans(TALLOC_CTX *mem_ctx, struct smbXcli_conn *conn, additional_flags, clear_flags, additional_flags2, clear_flags2, timeout_msec, - pid, tid, uid, + pid, tid, 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 1d473690c30..c41890d6df8 100644 --- a/libcli/smb/smbXcli_base.c +++ b/libcli/smb/smbXcli_base.c @@ -1095,7 +1095,6 @@ static bool smb1cli_req_cancel(struct tevent_req *req) uint16_t flags2; uint32_t pid; uint16_t tid; - uint16_t uid; uint16_t mid; struct tevent_req *subreq; NTSTATUS status; @@ -1105,7 +1104,6 @@ static bool smb1cli_req_cancel(struct tevent_req *req) pid = SVAL(state->smb1.hdr, HDR_PID); pid |= SVAL(state->smb1.hdr, HDR_PIDHIGH)<<16; tid = SVAL(state->smb1.hdr, HDR_TID); - uid = SVAL(state->smb1.hdr, HDR_UID); mid = SVAL(state->smb1.hdr, HDR_MID); subreq = smb1cli_req_create(state, state->ev, @@ -1114,7 +1112,8 @@ static bool smb1cli_req_cancel(struct tevent_req *req) flags, 0, flags2, 0, 0, /* timeout */ - pid, tid, uid, + pid, tid, + state->session, 0, NULL, /* vwv */ 0, NULL); /* bytes */ if (subreq == NULL) { @@ -1151,7 +1150,7 @@ struct tevent_req *smb1cli_req_create(TALLOC_CTX *mem_ctx, uint32_t timeout_msec, uint32_t pid, uint16_t tid, - uint16_t uid, + struct smbXcli_session *session, uint8_t wct, uint16_t *vwv, int iov_count, struct iovec *bytes_iov) @@ -1160,6 +1159,7 @@ struct tevent_req *smb1cli_req_create(TALLOC_CTX *mem_ctx, struct smbXcli_req_state *state; uint8_t flags = 0; uint16_t flags2 = 0; + uint16_t uid = 0; if (iov_count > MAX_SMB_IOV) { /* @@ -1175,6 +1175,11 @@ struct tevent_req *smb1cli_req_create(TALLOC_CTX *mem_ctx, } state->ev = ev; state->conn = conn; + state->session = session; + + if (session) { + uid = session->smb1.session_id; + } state->smb1.recv_cmd = 0xFF; state->smb1.recv_status = NT_STATUS_INTERNAL_ERROR; @@ -1419,7 +1424,7 @@ struct tevent_req *smb1cli_req_send(TALLOC_CTX *mem_ctx, uint32_t timeout_msec, uint32_t pid, uint16_t tid, - uint16_t uid, + struct smbXcli_session *session, uint8_t wct, uint16_t *vwv, uint32_t num_bytes, const uint8_t *bytes) @@ -1435,7 +1440,7 @@ struct tevent_req *smb1cli_req_send(TALLOC_CTX *mem_ctx, additional_flags, clear_flags, additional_flags2, clear_flags2, timeout_msec, - pid, tid, uid, + pid, tid, session, wct, vwv, 1, &iov); if (req == NULL) { return NULL; @@ -3532,7 +3537,7 @@ static struct tevent_req *smbXcli_negprot_smb1_subreq(struct smbXcli_negprot_sta flags, ~flags, flags2, ~flags2, state->timeout_msec, - 0xFFFE, 0, 0, /* pid, tid, uid */ + 0xFFFE, 0, NULL, /* pid, tid, session */ 0, NULL, /* wct, vwv */ bytes.length, bytes.data); } diff --git a/libcli/smb/smbXcli_base.h b/libcli/smb/smbXcli_base.h index 5f02fb4a607..9d4847c7d6e 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, uint32_t timeout_msec, uint32_t pid, uint16_t tid, - uint16_t uid, + struct smbXcli_session *session, uint8_t wct, uint16_t *vwv, int iov_count, struct iovec *bytes_iov); @@ -127,7 +127,7 @@ struct tevent_req *smb1cli_req_send(TALLOC_CTX *mem_ctx, uint32_t timeout_msec, uint32_t pid, uint16_t tid, - uint16_t uid, + struct smbXcli_session *session, uint8_t wct, uint16_t *vwv, uint32_t num_bytes, const uint8_t *bytes); @@ -151,7 +151,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, uint16_t uid, + uint32_t pid, uint16_t tid, + 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, uint8_t *param, uint32_t num_param, uint32_t max_param, @@ -169,7 +170,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, uint16_t uid, + uint32_t pid, uint16_t tid, + 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, diff --git a/source3/libsmb/async_smb.c b/source3/libsmb/async_smb.c index 4350d8f1bd1..a82b0ced72a 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 uid = 0; state = talloc_zero(mem_ctx, struct cli_smb_req_state); if (state == NULL) { @@ -88,14 +87,13 @@ struct tevent_req *cli_smb_req_create(TALLOC_CTX *mem_ctx, additional_flags2 |= FLAGS2_DFS_PATHNAMES; } - uid = cli_state_get_uid(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, cli->smb1.tid, - uid, + cli->smb1.session, wct, vwv, iov_count, bytes_iov); if (state->req == NULL) { talloc_free(state); @@ -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 uid = 0; state = talloc_zero(mem_ctx, struct cli_smb_req_state); if (state == NULL) { @@ -148,14 +145,13 @@ struct tevent_req *cli_smb_send(TALLOC_CTX *mem_ctx, additional_flags2 |= FLAGS2_DFS_PATHNAMES; } - uid = cli_state_get_uid(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, cli->smb1.tid, - uid, + cli->smb1.session, wct, vwv, num_bytes, bytes); if (state->req == NULL) { talloc_free(state); diff --git a/source3/libsmb/clitrans.c b/source3/libsmb/clitrans.c index a3ac816e8a7..5a27678310d 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 uid = 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; } - uid = cli_state_get_uid(cli); state->req = smb1cli_trans_send(state, ev, cli->conn, cmd, additional_flags, clear_flags, additional_flags2, clear_flags2, cli->timeout, - cli->smb1.pid, cli->smb1.tid, uid, + cli->smb1.pid, cli->smb1.tid, + cli->smb1.session, pipe_name, fid, function, flags, setup, num_setup, max_setup, param, num_param, max_param, @@ -168,7 +167,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 uid = 0; if (cli->case_sensitive) { clear_flags |= FLAG_CASELESS_PATHNAMES; @@ -181,13 +179,13 @@ NTSTATUS cli_trans(TALLOC_CTX *mem_ctx, struct cli_state *cli, additional_flags2 |= FLAGS2_DFS_PATHNAMES; } - uid = cli_state_get_uid(cli); status = smb1cli_trans(mem_ctx, cli->conn, trans_cmd, additional_flags, clear_flags, additional_flags2, clear_flags2, cli->timeout, - cli->smb1.pid, cli->smb1.tid, uid, + cli->smb1.pid, cli->smb1.tid, + cli->smb1.session, pipe_name, fid, function, flags, setup, num_setup, max_setup, param, num_param, max_param, diff --git a/source4/libcli/raw/clitransport.c b/source4/libcli/raw/clitransport.c index f9759b1b7f5..321df768f2f 100644 --- a/source4/libcli/raw/clitransport.c +++ b/source4/libcli/raw/clitransport.c @@ -214,7 +214,7 @@ struct tevent_req *smbcli_transport_setup_subreq(struct smbcli_request *req) uint16_t clear_flags2; uint32_t pid; uint16_t tid; - uint16_t uid; + struct smbXcli_session *session = NULL; uint32_t timeout_msec = transport->options.request_timeout * 1000; struct iovec *bytes_iov = NULL; struct tevent_req *subreq = NULL; @@ -225,11 +225,14 @@ struct tevent_req *smbcli_transport_setup_subreq(struct smbcli_request *req) pid = SVAL(req->out.hdr, HDR_PID); pid |= SVAL(req->out.hdr, HDR_PIDHIGH)<<16; tid = SVAL(req->out.hdr, HDR_TID); - uid = SVAL(req->out.hdr, HDR_UID); clear_flags = ~additional_flags; clear_flags2 = ~additional_flags2; + if (req->session) { + session = req->session->smbXcli; + } + bytes_iov = talloc(req, struct iovec); if (bytes_iov == NULL) { return NULL; @@ -248,7 +251,7 @@ struct tevent_req *smbcli_transport_setup_subreq(struct smbcli_request *req) timeout_msec, pid, tid, - uid, + session, req->out.wct, (uint16_t *)req->out.vwv, 1, bytes_iov); @@ -293,7 +296,7 @@ void smbcli_transport_send(struct smbcli_request *req) 0, /* timeout_msec */ 0, /* pid */ 0, /* tid */ - 0, /* uid */ + NULL, /* session */ 0, /* wct */ NULL, /* vwv */ 0, /* iov_count */ @@ -499,7 +502,7 @@ static void smbcli_transport_break_handler(struct tevent_req *subreq) 0, /* timeout_msec */ 0, /* pid */ 0, /* tid */ - 0, /* uid */ + NULL, /* session */ 0, /* wct */ NULL, /* vwv */ 0, /* iov_count */ diff --git a/source4/libcli/raw/rawtrans.c b/source4/libcli/raw/rawtrans.c index 8e16e5b9113..1df52095239 100644 --- a/source4/libcli/raw/rawtrans.c +++ b/source4/libcli/raw/rawtrans.c @@ -37,7 +37,7 @@ static struct smbcli_request *smb_raw_trans_backend_send(struct smbcli_tree *tre uint16_t clear_flags2; uint32_t pid; uint16_t tid; - uint16_t uid; + struct smbXcli_session *session = NULL; const char *pipe_name = NULL; uint8_t s; uint32_t timeout_msec; @@ -55,7 +55,10 @@ static struct smbcli_request *smb_raw_trans_backend_send(struct smbcli_tree *tre pid = SVAL(req->out.hdr, HDR_PID); pid |= SVAL(req->out.hdr, HDR_PIDHIGH)<<16; tid = SVAL(req->out.hdr, HDR_TID); - uid = SVAL(req->out.hdr, HDR_UID); + + if (req->session) { + session = req->session->smbXcli; + } clear_flags = ~additional_flags; clear_flags2 = ~additional_flags2; @@ -86,7 +89,8 @@ static struct smbcli_request *smb_raw_trans_backend_send(struct smbcli_tree *tre additional_flags2, clear_flags2, timeout_msec, - pid, tid, uid, + pid, tid, + session, pipe_name, 0xFFFF, /* fid */ 0, /* function */ @@ -259,7 +263,7 @@ struct smbcli_request *smb_raw_nttrans_send(struct smbcli_tree *tree, uint16_t clear_flags2; uint32_t pid; uint16_t tid; - uint16_t uid; + struct smbXcli_session *session = NULL; uint32_t timeout_msec; uint32_t tmp; @@ -275,7 +279,10 @@ struct smbcli_request *smb_raw_nttrans_send(struct smbcli_tree *tree, pid = SVAL(req->out.hdr, HDR_PID); pid |= SVAL(req->out.hdr, HDR_PIDHIGH)<<16; tid = SVAL(req->out.hdr, HDR_TID); - uid = SVAL(req->out.hdr, HDR_UID); + + if (req->session) { + session = req->session->smbXcli; + } clear_flags = ~additional_flags; clear_flags2 = ~additional_flags2; @@ -302,7 +309,8 @@ struct smbcli_request *smb_raw_nttrans_send(struct smbcli_tree *tree, additional_flags2, clear_flags2, timeout_msec, - pid, tid, uid, + pid, tid, + session, NULL, /* pipe_name */ 0xFFFF, /* fid */ parms->in.function, |