mirror of
https://github.com/samba-team/samba.git
synced 2025-01-12 09:18:10 +03:00
smbd: Invalidate the session correctly.
When a session is invalidated then we must also ensure it isn't used in any pending requests being processed. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
This commit is contained in:
parent
8a50509021
commit
d4a5c832f1
@ -457,6 +457,8 @@ static int pp_self_ref_destructor(struct smbd_smb2_session_setup_state **pp_stat
|
|||||||
|
|
||||||
static int smbd_smb2_session_setup_state_destructor(struct smbd_smb2_session_setup_state *state)
|
static int smbd_smb2_session_setup_state_destructor(struct smbd_smb2_session_setup_state *state)
|
||||||
{
|
{
|
||||||
|
struct smbd_smb2_request *preq;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If state->session is not NULL,
|
* If state->session is not NULL,
|
||||||
* we move the session from the session table to the request on failure
|
* we move the session from the session table to the request on failure
|
||||||
@ -471,6 +473,27 @@ static int smbd_smb2_session_setup_state_destructor(struct smbd_smb2_session_set
|
|||||||
state->session->status = NT_STATUS_USER_SESSION_DELETED;
|
state->session->status = NT_STATUS_USER_SESSION_DELETED;
|
||||||
state->smb2req->session = talloc_move(state->smb2req, &state->session);
|
state->smb2req->session = talloc_move(state->smb2req, &state->session);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* We've made this session owned by the current request.
|
||||||
|
* Ensure that any outstanding requests don't also refer
|
||||||
|
* to it.
|
||||||
|
*/
|
||||||
|
|
||||||
|
for (preq = state->smb2req->sconn->smb2.requests; preq != NULL; preq = preq->next) {
|
||||||
|
if (preq == state->smb2req) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (preq->session == state->smb2req->session) {
|
||||||
|
preq->session = NULL;
|
||||||
|
/*
|
||||||
|
* If we no longer have a session we can't
|
||||||
|
* sign or encrypt replies.
|
||||||
|
*/
|
||||||
|
preq->do_signing = false;
|
||||||
|
preq->do_encryption = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user