summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuk Claes <luk@debian.org>2012-06-02 12:45:40 +0200
committerStefan Metzmacher <metze@samba.org>2012-07-23 22:13:29 +0200
commitcdec0c46464c8b524fc64ff46f1af809af026086 (patch)
tree36e8a1f4b3b3166886c192d967972d0176b51299
parent6bff589e33afde6e0f7db9f99f14be5cb171f587 (diff)
downloadsamba-cdec0c46464c8b524fc64ff46f1af809af026086.tar.gz
samba-cdec0c46464c8b524fc64ff46f1af809af026086.tar.bz2
samba-cdec0c46464c8b524fc64ff46f1af809af026086.zip
s3:libsmb: use cli_state_{g,s}et_uid instead of smb1.uid directly
Signed-off-by: Luk Claes <luk@debian.org> Signed-off-by: Stefan Metzmacher <metze@samba.org>
-rw-r--r--source3/include/client.h2
-rw-r--r--source3/libsmb/async_smb.c8
-rw-r--r--source3/libsmb/clientgen.c11
-rw-r--r--source3/libsmb/clitrans.c8
4 files changed, 20 insertions, 9 deletions
diff --git a/source3/include/client.h b/source3/include/client.h
index 5694ed0888..b6e62a3d92 100644
--- a/source3/include/client.h
+++ b/source3/include/client.h
@@ -104,7 +104,7 @@ struct cli_state {
uint16_t pid;
uint16_t vc_num;
uint16_t tid;
- uint16_t uid;
+ struct smbXcli_session *session;
} smb1;
struct {
diff --git a/source3/libsmb/async_smb.c b/source3/libsmb/async_smb.c
index c2986e25e9..4350d8f1bd 100644
--- a/source3/libsmb/async_smb.c
+++ b/source3/libsmb/async_smb.c
@@ -62,6 +62,7 @@ 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) {
@@ -87,13 +88,14 @@ 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,
- cli->smb1.uid,
+ uid,
wct, vwv, iov_count, bytes_iov);
if (state->req == NULL) {
talloc_free(state);
@@ -120,6 +122,7 @@ 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) {
@@ -145,13 +148,14 @@ 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,
- cli->smb1.uid,
+ uid,
wct, vwv, num_bytes, bytes);
if (state->req == NULL) {
talloc_free(state);
diff --git a/source3/libsmb/clientgen.c b/source3/libsmb/clientgen.c
index 4398d80182..dcb8467339 100644
--- a/source3/libsmb/clientgen.c
+++ b/source3/libsmb/clientgen.c
@@ -269,7 +269,10 @@ struct cli_state *cli_state_create(TALLOC_CTX *mem_ctx,
cli->smb1.pid = (uint16_t)getpid();
cli->smb1.vc_num = cli->smb1.pid;
cli->smb1.tid = UINT16_MAX;
- cli->smb1.uid = UID_FIELD_INVALID;
+ cli->smb1.session = smbXcli_session_create(cli, cli->conn);
+ if (cli->smb1.session == NULL) {
+ goto error;
+ }
cli->initialised = 1;
return cli;
@@ -398,13 +401,13 @@ uint16_t cli_state_set_tid(struct cli_state *cli, uint16_t tid)
uint16_t cli_state_get_uid(struct cli_state *cli)
{
- return cli->smb1.uid;
+ return smb1cli_session_current_id(cli->smb1.session);
}
uint16_t cli_state_set_uid(struct cli_state *cli, uint16_t uid)
{
- uint16_t ret = cli->smb1.uid;
- cli->smb1.uid = uid;
+ uint16_t ret = smb1cli_session_current_id(cli->smb1.session);
+ smb1cli_session_set_id(cli->smb1.session, uid);
return ret;
}
diff --git a/source3/libsmb/clitrans.c b/source3/libsmb/clitrans.c
index 5dd7008c59..a3ac816e8a 100644
--- a/source3/libsmb/clitrans.c
+++ b/source3/libsmb/clitrans.c
@@ -61,6 +61,7 @@ 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) {
@@ -84,12 +85,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, cli->smb1.uid,
+ cli->smb1.pid, cli->smb1.tid, uid,
pipe_name, fid, function, flags,
setup, num_setup, max_setup,
param, num_param, max_param,
@@ -166,6 +168,7 @@ 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;
@@ -178,12 +181,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, cli->smb1.uid,
+ cli->smb1.pid, cli->smb1.tid, uid,
pipe_name, fid, function, flags,
setup, num_setup, max_setup,
param, num_param, max_param,