diff options
author | Michael Adam <obnox@samba.org> | 2012-02-25 22:32:03 +0100 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2012-02-28 00:08:53 +0100 |
commit | 69a64e6695779437b13b621ea6fb778bf1501cc8 (patch) | |
tree | 0b6820c22b861e3d38875bb2d7bfc77a8fea8eec /source4 | |
parent | 727f3ee6acf8c7d8a4fd2c8a02eadf496e3687af (diff) | |
download | samba-69a64e6695779437b13b621ea6fb778bf1501cc8.tar.gz samba-69a64e6695779437b13b621ea6fb778bf1501cc8.tar.xz 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')
-rw-r--r-- | source4/libcli/smb2/connect.c | 3 | ||||
-rw-r--r-- | source4/libcli/smb2/session.c | 22 | ||||
-rw-r--r-- | source4/torture/smb2/util.c | 3 |
3 files changed, 18 insertions, 10 deletions
diff --git a/source4/libcli/smb2/connect.c b/source4/libcli/smb2/connect.c index a6a5690bf14..f1cf1087237 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 e26a65be339..d727d552b1f 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; diff --git a/source4/torture/smb2/util.c b/source4/torture/smb2/util.c index 5da4c198dc2..97a66783fc0 100644 --- a/source4/torture/smb2/util.c +++ b/source4/torture/smb2/util.c @@ -321,7 +321,8 @@ bool torture_smb2_session_setup(struct torture_context *tctx, return false; } - status = smb2_session_setup_spnego(session, credentials); + status = smb2_session_setup_spnego(session, credentials, + 0 /* previous_session_id */); if (!NT_STATUS_IS_OK(status)) { printf("session setup failed: %s\n", nt_errstr(status)); talloc_free(session); |