summaryrefslogtreecommitdiff
path: root/source4/libcli/smb2
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2012-02-25 22:32:03 +0100
committerMichael Adam <obnox@samba.org>2012-02-28 00:08:53 +0100
commit69a64e6695779437b13b621ea6fb778bf1501cc8 (patch)
tree0b6820c22b861e3d38875bb2d7bfc77a8fea8eec /source4/libcli/smb2
parent727f3ee6acf8c7d8a4fd2c8a02eadf496e3687af (diff)
downloadsamba-69a64e6695779437b13b621ea6fb778bf1501cc8.tar.gz
samba-69a64e6695779437b13b621ea6fb778bf1501cc8.tar.bz2
samba-69a64e6695779437b13b621ea6fb778bf1501cc8.zip
s4:libcli:smb2: add a previous session argument to smb2_session_setup_spnego()
So that we can do a session reconnect.
Diffstat (limited to 'source4/libcli/smb2')
-rw-r--r--source4/libcli/smb2/connect.c3
-rw-r--r--source4/libcli/smb2/session.c22
2 files changed, 16 insertions, 9 deletions
diff --git a/source4/libcli/smb2/connect.c b/source4/libcli/smb2/connect.c
index a6a5690bf1..f1cf108723 100644
--- a/source4/libcli/smb2/connect.c
+++ b/source4/libcli/smb2/connect.c
@@ -176,7 +176,8 @@ static void smb2_connect_negprot_done(struct tevent_req *subreq)
subreq = smb2_session_setup_spnego_send(state, state->ev,
state->session,
- state->credentials);
+ state->credentials,
+ 0 /* previous_session_id */);
if (tevent_req_nomem(subreq, req)) {
return;
}
diff --git a/source4/libcli/smb2/session.c b/source4/libcli/smb2/session.c
index e26a65be33..d727d552b1 100644
--- a/source4/libcli/smb2/session.c
+++ b/source4/libcli/smb2/session.c
@@ -75,6 +75,7 @@ struct smb2_session_setup_spnego_state {
struct tevent_context *ev;
struct smb2_session *session;
struct cli_credentials *credentials;
+ uint64_t previous_session_id;
NTSTATUS gensec_status;
DATA_BLOB in_secblob;
DATA_BLOB out_secblob;
@@ -85,10 +86,12 @@ static void smb2_session_setup_spnego_done(struct tevent_req *subreq);
/*
a composite function that does a full SPNEGO session setup
*/
-struct tevent_req *smb2_session_setup_spnego_send(TALLOC_CTX *mem_ctx,
- struct tevent_context *ev,
- struct smb2_session *session,
- struct cli_credentials *credentials)
+struct tevent_req *smb2_session_setup_spnego_send(
+ TALLOC_CTX *mem_ctx,
+ struct tevent_context *ev,
+ struct smb2_session *session,
+ struct cli_credentials *credentials,
+ uint64_t previous_session_id)
{
struct tevent_req *req;
struct smb2_session_setup_spnego_state *state;
@@ -109,6 +112,7 @@ struct tevent_req *smb2_session_setup_spnego_send(TALLOC_CTX *mem_ctx,
state->ev = ev;
state->session = session;
state->credentials = credentials;
+ state->previous_session_id = previous_session_id;
server_gss_blob = smbXcli_conn_server_gss_blob(session->transport->conn);
if (server_gss_blob) {
@@ -159,7 +163,7 @@ struct tevent_req *smb2_session_setup_spnego_send(TALLOC_CTX *mem_ctx,
0, /* in_flags */
0, /* in_capabilities */
0, /* in_channel */
- 0, /* in_previous_session_id */
+ state->previous_session_id,
&state->in_secblob);
if (tevent_req_nomem(subreq, req)) {
return tevent_req_post(req, ev);
@@ -239,7 +243,7 @@ static void smb2_session_setup_spnego_done(struct tevent_req *subreq)
0, /* in_flags */
0, /* in_capabilities */
0, /* in_channel */
- 0, /* in_previous_session_id */
+ state->previous_session_id,
&state->in_secblob);
if (tevent_req_nomem(subreq, req)) {
return;
@@ -259,7 +263,8 @@ NTSTATUS smb2_session_setup_spnego_recv(struct tevent_req *req)
sync version of smb2_session_setup_spnego
*/
NTSTATUS smb2_session_setup_spnego(struct smb2_session *session,
- struct cli_credentials *credentials)
+ struct cli_credentials *credentials,
+ uint64_t previous_session_id)
{
struct tevent_req *subreq;
NTSTATUS status;
@@ -272,7 +277,8 @@ NTSTATUS smb2_session_setup_spnego(struct smb2_session *session,
}
subreq = smb2_session_setup_spnego_send(frame, ev,
- session, credentials);
+ session, credentials,
+ previous_session_id);
if (subreq == NULL) {
TALLOC_FREE(frame);
return NT_STATUS_NO_MEMORY;