From 43b070d8dd20d7a2a1a0ec1eb5ebc679cd699bf3 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Mon, 23 Jul 2012 20:15:21 +0200 Subject: libcli/smb: pass down smbXcli_session to smb1cli_req_create/send() and smb1cli_trans* metze Autobuild-User(master): Stefan Metzmacher Autobuild-Date(master): Tue Jul 24 00:08:58 CEST 2012 on sn-devel-104 --- libcli/smb/smb1cli_trans.c | 21 +++++++++++++-------- libcli/smb/smbXcli_base.c | 19 ++++++++++++------- libcli/smb/smbXcli_base.h | 10 ++++++---- 3 files changed, 31 insertions(+), 19 deletions(-) (limited to 'libcli/smb') diff --git a/libcli/smb/smb1cli_trans.c b/libcli/smb/smb1cli_trans.c index fadac8e7b4..ca0fdc157d 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 1d473690c3..c41890d6df 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 5f02fb4a60..9d4847c7d6 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, -- cgit