summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2012-02-26 17:35:28 +0100
committerMichael Adam <obnox@samba.org>2012-02-28 00:08:52 +0100
commit727f3ee6acf8c7d8a4fd2c8a02eadf496e3687af (patch)
tree1b101d9d1de8ffaddfda0a7ed19450000aa363f1
parent5ebbd46b4a8714e98bb14862f9c3dc31301d8404 (diff)
downloadsamba-727f3ee6acf8c7d8a4fd2c8a02eadf496e3687af.tar.gz
samba-727f3ee6acf8c7d8a4fd2c8a02eadf496e3687af.tar.bz2
samba-727f3ee6acf8c7d8a4fd2c8a02eadf496e3687af.zip
s3:libsmb:smb2: pass previous session ID to session setup, not previous session
We only need the session, and under some circumstances, it might complicate things for the caller to have to cope with the whole structure (talloc...).
-rw-r--r--source3/libsmb/cliconnect.c2
-rw-r--r--source3/libsmb/smb2cli.h2
-rw-r--r--source3/libsmb/smb2cli_session.c10
-rw-r--r--source3/torture/test_smb2.c14
-rw-r--r--source4/libcli/smb2/session.c4
5 files changed, 14 insertions, 18 deletions
diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c
index 79b9496f8b..9d4e4e1f99 100644
--- a/source3/libsmb/cliconnect.c
+++ b/source3/libsmb/cliconnect.c
@@ -1232,7 +1232,7 @@ static bool cli_sesssetup_blob_next(struct cli_sesssetup_blob_state *state,
0, /* in_flags */
SMB2_CAP_DFS, /* in_capabilities */
0, /* in_channel */
- NULL, /* in_previous_session */
+ 0, /* in_previous_session_id */
&state->smb2_blob);
if (subreq == NULL) {
return false;
diff --git a/source3/libsmb/smb2cli.h b/source3/libsmb/smb2cli.h
index 65e2f71aa7..184bd10fa0 100644
--- a/source3/libsmb/smb2cli.h
+++ b/source3/libsmb/smb2cli.h
@@ -32,7 +32,7 @@ struct tevent_req *smb2cli_session_setup_send(TALLOC_CTX *mem_ctx,
uint8_t in_flags,
uint32_t in_capabilities,
uint32_t in_channel,
- struct smbXcli_session *in_previous_session,
+ uint64_t in_previous_session_id,
const DATA_BLOB *in_security_buffer);
NTSTATUS smb2cli_session_setup_recv(struct tevent_req *req,
TALLOC_CTX *mem_ctx,
diff --git a/source3/libsmb/smb2cli_session.c b/source3/libsmb/smb2cli_session.c
index d1d65f3f43..13412d1606 100644
--- a/source3/libsmb/smb2cli_session.c
+++ b/source3/libsmb/smb2cli_session.c
@@ -46,7 +46,7 @@ struct tevent_req *smb2cli_session_setup_send(TALLOC_CTX *mem_ctx,
uint8_t in_flags,
uint32_t in_capabilities,
uint32_t in_channel,
- struct smbXcli_session *in_previous_session,
+ uint64_t in_previous_session_id,
const DATA_BLOB *in_security_buffer)
{
struct tevent_req *req, *subreq;
@@ -57,7 +57,6 @@ struct tevent_req *smb2cli_session_setup_send(TALLOC_CTX *mem_ctx,
uint8_t security_mode;
uint16_t security_buffer_offset = 0;
uint16_t security_buffer_length = 0;
- uint64_t previous_session_id = 0;
req = tevent_req_create(mem_ctx, &state,
struct smb2cli_session_setup_state);
@@ -81,11 +80,6 @@ struct tevent_req *smb2cli_session_setup_send(TALLOC_CTX *mem_ctx,
security_buffer_length = in_security_buffer->length;
}
- if (in_previous_session) {
- previous_session_id =
- smb2cli_session_current_id(in_previous_session);
- }
-
buf = state->fixed;
SSVAL(buf, 0, 25);
@@ -95,7 +89,7 @@ struct tevent_req *smb2cli_session_setup_send(TALLOC_CTX *mem_ctx,
SIVAL(buf, 8, in_channel);
SSVAL(buf, 12, security_buffer_offset);
SSVAL(buf, 14, security_buffer_length);
- SBVAL(buf, 16, previous_session_id);
+ SBVAL(buf, 16, in_previous_session_id);
if (security_buffer_length > 0) {
dyn = in_security_buffer->data;
diff --git a/source3/torture/test_smb2.c b/source3/torture/test_smb2.c
index 5b37213f12..9334ab73bc 100644
--- a/source3/torture/test_smb2.c
+++ b/source3/torture/test_smb2.c
@@ -426,7 +426,8 @@ bool run_smb2_session_reconnect(int dummy)
0x0, /* in_flags */
SMB2_CAP_DFS, /* in_capabilities */
0, /* in_channel */
- cli1->smb2.session, /* in_previous_session */
+ /* in_previous_session_id: */
+ smb2cli_session_current_id(cli1->smb2.session),
&in_blob); /* in_security_buffer */
if (subreq == NULL) {
printf("smb2cli_session_setup_send() returned NULL\n");
@@ -460,7 +461,8 @@ bool run_smb2_session_reconnect(int dummy)
0x0, /* in_flags */
SMB2_CAP_DFS, /* in_capabilities */
0, /* in_channel */
- cli1->smb2.session, /* in_previous_session */
+ /* in_previous_session_id: */
+ smb2cli_session_current_id(cli1->smb2.session),
&in_blob); /* in_security_buffer */
if (subreq == NULL) {
printf("smb2cli_session_setup_send() returned NULL\n");
@@ -881,7 +883,7 @@ bool run_smb2_multi_channel(int dummy)
0x01, /* in_flags */
SMB2_CAP_DFS, /* in_capabilities */
0, /* in_channel */
- NULL, /* in_previous_session */
+ 0, /* in_previous_session_id */
&in_blob); /* in_security_buffer */
if (subreq == NULL) {
printf("smb2cli_session_setup_send() returned NULL\n");
@@ -915,7 +917,7 @@ bool run_smb2_multi_channel(int dummy)
0x01, /* in_flags */
SMB2_CAP_DFS, /* in_capabilities */
0, /* in_channel */
- NULL, /* in_previous_session */
+ 0, /* in_previous_session_id */
&in_blob); /* in_security_buffer */
if (subreq == NULL) {
printf("smb2cli_session_setup_send() returned NULL\n");
@@ -1143,7 +1145,7 @@ bool run_smb2_session_reauth(int dummy)
0x0, /* in_flags */
SMB2_CAP_DFS, /* in_capabilities */
0, /* in_channel */
- NULL, /* in_previous_session */
+ 0, /* in_previous_session_id */
&in_blob); /* in_security_buffer */
if (subreq == NULL) {
printf("smb2cli_session_setup_send() returned NULL\n");
@@ -1199,7 +1201,7 @@ bool run_smb2_session_reauth(int dummy)
0x0, /* in_flags */
SMB2_CAP_DFS, /* in_capabilities */
0, /* in_channel */
- NULL, /* in_previous_session */
+ 0, /* in_previous_session_id */
&in_blob); /* in_security_buffer */
if (subreq == NULL) {
printf("smb2cli_session_setup_send() returned NULL\n");
diff --git a/source4/libcli/smb2/session.c b/source4/libcli/smb2/session.c
index 097411813a..e26a65be33 100644
--- a/source4/libcli/smb2/session.c
+++ b/source4/libcli/smb2/session.c
@@ -159,7 +159,7 @@ struct tevent_req *smb2_session_setup_spnego_send(TALLOC_CTX *mem_ctx,
0, /* in_flags */
0, /* in_capabilities */
0, /* in_channel */
- NULL, /* in_previous_session */
+ 0, /* in_previous_session_id */
&state->in_secblob);
if (tevent_req_nomem(subreq, req)) {
return tevent_req_post(req, ev);
@@ -239,7 +239,7 @@ static void smb2_session_setup_spnego_done(struct tevent_req *subreq)
0, /* in_flags */
0, /* in_capabilities */
0, /* in_channel */
- NULL, /* in_previous_session */
+ 0, /* in_previous_session_id */
&state->in_secblob);
if (tevent_req_nomem(subreq, req)) {
return;