mirror of
https://github.com/samba-team/samba.git
synced 2025-08-08 13:49:29 +03:00
s3:smbXsrv: refactor duplicate code into smbXsrv_session_clear_and_logoff()
This replaces code in smbXsrv_session_logoff_all_callback() and smbXsrv_session_clear_and_logoff(). Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> Autobuild-User(master): Michael Adam <obnox@samba.org> Autobuild-Date(master): Thu May 7 10:43:29 CEST 2015 on sn-devel-104
This commit is contained in:
@ -1094,7 +1094,7 @@ NTSTATUS smb2srv_session_close_previous_recv(struct tevent_req *req)
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
|
||||
static int smbXsrv_session_destructor(struct smbXsrv_session *session)
|
||||
static NTSTATUS smbXsrv_session_clear_and_logoff(struct smbXsrv_session *session)
|
||||
{
|
||||
NTSTATUS status;
|
||||
struct smbXsrv_connection *xconn = NULL;
|
||||
@ -1122,6 +1122,14 @@ static int smbXsrv_session_destructor(struct smbXsrv_session *session)
|
||||
}
|
||||
|
||||
status = smbXsrv_session_logoff(session);
|
||||
return status;
|
||||
}
|
||||
|
||||
static int smbXsrv_session_destructor(struct smbXsrv_session *session)
|
||||
{
|
||||
NTSTATUS status;
|
||||
|
||||
status = smbXsrv_session_clear_and_logoff(session);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
DEBUG(0, ("smbXsrv_session_destructor: "
|
||||
"smbXsrv_session_logoff() failed: %s\n",
|
||||
@ -1655,7 +1663,6 @@ static int smbXsrv_session_logoff_all_callback(struct db_record *local_rec,
|
||||
TDB_DATA val;
|
||||
void *ptr = NULL;
|
||||
struct smbXsrv_session *session = NULL;
|
||||
struct smbXsrv_connection *xconn = NULL;
|
||||
NTSTATUS status;
|
||||
|
||||
val = dbwrap_record_get_value(local_rec);
|
||||
@ -1673,28 +1680,7 @@ static int smbXsrv_session_logoff_all_callback(struct db_record *local_rec,
|
||||
|
||||
session->db_rec = local_rec;
|
||||
|
||||
if (session->client != NULL) {
|
||||
xconn = session->client->connections;
|
||||
}
|
||||
for (; xconn != NULL; xconn = xconn->next) {
|
||||
struct smbd_smb2_request *preq;
|
||||
|
||||
for (preq = xconn->smb2.requests; preq != NULL; preq = preq->next) {
|
||||
if (preq->session != session) {
|
||||
continue;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
status = smbXsrv_session_logoff(session);
|
||||
status = smbXsrv_session_clear_and_logoff(session);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
if (NT_STATUS_IS_OK(state->first_status)) {
|
||||
state->first_status = status;
|
||||
|
Reference in New Issue
Block a user