summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2012-05-17 00:32:40 +0200
committerStefan Metzmacher <metze@samba.org>2012-06-25 20:55:07 +0200
commit45cd2bc2b33230b69eeaa6f82be6f7af36770f0a (patch)
tree1deca06e0ab33d1bf7348c447f980f1305bf33d8 /source3/smbd
parent299b63f8759c39cfda1d936dea154d085ca3264e (diff)
downloadsamba-45cd2bc2b33230b69eeaa6f82be6f7af36770f0a.tar.gz
samba-45cd2bc2b33230b69eeaa6f82be6f7af36770f0a.tar.bz2
samba-45cd2bc2b33230b69eeaa6f82be6f7af36770f0a.zip
s3:smb2_sesssetup: make use of smb2srv_session_close_previous_send/recv
metze
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/smb2_sesssetup.c66
1 files changed, 66 insertions, 0 deletions
diff --git a/source3/smbd/smb2_sesssetup.c b/source3/smbd/smb2_sesssetup.c
index ee588b06fe..85bcc05c4a 100644
--- a/source3/smbd/smb2_sesssetup.c
+++ b/source3/smbd/smb2_sesssetup.c
@@ -411,6 +411,7 @@ static int smbd_smb2_session_setup_state_destructor(struct smbd_smb2_session_set
}
static void smbd_smb2_session_setup_gensec_done(struct tevent_req *subreq);
+static void smbd_smb2_session_setup_previous_done(struct tevent_req *subreq);
static struct tevent_req *smbd_smb2_session_setup_send(TALLOC_CTX *mem_ctx,
struct tevent_context *ev,
@@ -534,6 +535,71 @@ static void smbd_smb2_session_setup_gensec_done(struct tevent_req *subreq)
return;
}
+ if ((state->in_previous_session_id != 0) &&
+ (state->session->global->session_wire_id !=
+ state->in_previous_session_id))
+ {
+ subreq = smb2srv_session_close_previous_send(state, state->ev,
+ state->session->connection,
+ state->session_info,
+ state->in_previous_session_id,
+ state->session->global->session_wire_id);
+ if (tevent_req_nomem(subreq, req)) {
+ return;
+ }
+ tevent_req_set_callback(subreq,
+ smbd_smb2_session_setup_previous_done,
+ req);
+ return;
+ }
+
+ if (state->session->global->auth_session_info != NULL) {
+ status = smbd_smb2_reauth_generic_return(state->session,
+ state->smb2req,
+ state->session_info,
+ &state->out_session_flags,
+ &state->out_session_id);
+ if (tevent_req_nterror(req, status)) {
+ return;
+ }
+ /* we want to keep the session */
+ state->session = NULL;
+ tevent_req_done(req);
+ return;
+ }
+
+ status = smbd_smb2_auth_generic_return(state->session,
+ state->smb2req,
+ state->in_security_mode,
+ state->session_info,
+ &state->out_session_flags,
+ &state->out_session_id);
+ if (tevent_req_nterror(req, status)) {
+ return;
+ }
+
+ /* we want to keep the session */
+ state->session = NULL;
+ tevent_req_done(req);
+ return;
+}
+
+static void smbd_smb2_session_setup_previous_done(struct tevent_req *subreq)
+{
+ struct tevent_req *req =
+ tevent_req_callback_data(subreq,
+ struct tevent_req);
+ struct smbd_smb2_session_setup_state *state =
+ tevent_req_data(req,
+ struct smbd_smb2_session_setup_state);
+ NTSTATUS status;
+
+ status = smb2srv_session_close_previous_recv(subreq);
+ TALLOC_FREE(subreq);
+ if (tevent_req_nterror(req, status)) {
+ return;
+ }
+
if (state->session->global->auth_session_info != NULL) {
status = smbd_smb2_reauth_generic_return(state->session,
state->smb2req,