1
0
mirror of https://github.com/samba-team/samba.git synced 2025-08-03 04:22:09 +03:00

s3:smbd: avoid dereferencing client->connections

There're typically better ways to get the same information.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=11897

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
This commit is contained in:
Stefan Metzmacher
2020-07-08 10:15:56 +02:00
parent c66110cf33
commit 36812aadbd
4 changed files with 7 additions and 9 deletions

View File

@ -90,5 +90,5 @@ bool fsp_lease_type_is_exclusive(struct files_struct *fsp)
const struct GUID *fsp_client_guid(const files_struct *fsp)
{
return &fsp->conn->sconn->client->connections->smb2.client.guid;
return &fsp->conn->sconn->client->global->client_guid;
}

View File

@ -5444,7 +5444,7 @@ static NTSTATUS lease_match(connection_struct *conn,
state.id = vfs_file_id_from_sbuf(conn, &fname->st);
}
status = leases_db_parse(&sconn->client->connections->smb2.client.guid,
status = leases_db_parse(&sconn->client->global->client_guid,
lease_key, lease_match_parser, &state);
if (!NT_STATUS_IS_OK(status)) {
/*

View File

@ -480,8 +480,7 @@ NTSTATUS downgrade_lease(struct smbXsrv_client *client,
const struct smb2_lease_key *key,
uint32_t lease_state)
{
struct smbXsrv_connection *xconn = client->connections;
struct smbd_server_connection *sconn = xconn->client->sconn;
struct smbd_server_connection *sconn = client->sconn;
const struct GUID *client_guid = NULL;
struct share_mode_lock *lck;
const struct file_id id = ids[0];
@ -501,7 +500,7 @@ NTSTATUS downgrade_lease(struct smbXsrv_client *client,
return NT_STATUS_OBJECT_NAME_NOT_FOUND;
}
client_guid = &sconn->client->connections->smb2.client.guid;
client_guid = &sconn->client->global->client_guid;
status = leases_db_get(client_guid,
key,
@ -607,8 +606,7 @@ NTSTATUS downgrade_lease(struct smbXsrv_client *client,
NTSTATUS set_status;
set_status = leases_db_set(
&sconn->client->connections->
smb2.client.guid,
&sconn->client->global->client_guid,
key,
current_state,
breaking,
@ -626,7 +624,7 @@ NTSTATUS downgrade_lease(struct smbXsrv_client *client,
}
tevent_schedule_immediate(state->im,
xconn->client->raw_ev_ctx,
client->raw_ev_ctx,
downgrade_lease_additional_trigger,
state);

View File

@ -1436,7 +1436,7 @@ static void smbd_smb2_logoff_shutdown_done(struct tevent_req *subreq)
NTSTATUS status;
bool ok;
const struct GUID *client_guid =
&state->smb2req->session->client->connections->smb2.client.guid;
&state->smb2req->session->client->global->client_guid;
status = smb2srv_session_shutdown_recv(subreq);
if (tevent_req_nterror(req, status)) {