From 727f3ee6acf8c7d8a4fd2c8a02eadf496e3687af Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sun, 26 Feb 2012 17:35:28 +0100 Subject: 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...). --- source3/libsmb/cliconnect.c | 2 +- source3/libsmb/smb2cli.h | 2 +- source3/libsmb/smb2cli_session.c | 10 ++-------- source3/torture/test_smb2.c | 14 ++++++++------ 4 files changed, 12 insertions(+), 16 deletions(-) (limited to 'source3') 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"); -- cgit