mirror of
https://github.com/samba-team/samba.git
synced 2025-02-28 01:58:17 +03:00
s3:smbd: pass smbXsrv_client to downgrade_lease()
This prepares for multichannel support, where breaks are not bound to a single connection. 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:
parent
54bd3a46c8
commit
42497b8639
@ -335,7 +335,7 @@ static void lease_timeout_handler(struct tevent_context *ctx,
|
||||
|
||||
DEBUG(1, ("lease break timed out for file %s -- replying anyway\n",
|
||||
fsp_str_dbg(fsp)));
|
||||
(void)downgrade_lease(lease->sconn->client->connections,
|
||||
(void)downgrade_lease(lease->sconn->client,
|
||||
1,
|
||||
&fsp->file_id,
|
||||
&lease->lease.lease_key,
|
||||
@ -409,7 +409,7 @@ bool fsp_lease_update(struct files_struct *fsp)
|
||||
|
||||
struct downgrade_lease_additional_state {
|
||||
struct tevent_immediate *im;
|
||||
struct smbXsrv_connection *xconn;
|
||||
struct smbXsrv_client *client;
|
||||
uint32_t break_flags;
|
||||
struct smb2_lease_key lease_key;
|
||||
uint32_t break_from;
|
||||
@ -424,7 +424,7 @@ static void downgrade_lease_additional_trigger(struct tevent_context *ev,
|
||||
struct downgrade_lease_additional_state *state =
|
||||
talloc_get_type_abort(private_data,
|
||||
struct downgrade_lease_additional_state);
|
||||
struct smbXsrv_connection *xconn = state->xconn;
|
||||
struct smbXsrv_connection *xconn = state->client->connections;
|
||||
NTSTATUS status;
|
||||
|
||||
status = smbd_smb2_send_lease_break(xconn,
|
||||
@ -435,8 +435,8 @@ static void downgrade_lease_additional_trigger(struct tevent_context *ev,
|
||||
state->break_to);
|
||||
TALLOC_FREE(state);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
smbd_server_connection_terminate(xconn,
|
||||
nt_errstr(status));
|
||||
smbd_server_disconnect_client(state->client,
|
||||
nt_errstr(status));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -475,12 +475,13 @@ static void fsps_lease_update(struct smbd_server_connection *sconn,
|
||||
files_forall(sconn, fsps_lease_update_fn, &state);
|
||||
}
|
||||
|
||||
NTSTATUS downgrade_lease(struct smbXsrv_connection *xconn,
|
||||
NTSTATUS downgrade_lease(struct smbXsrv_client *client,
|
||||
uint32_t num_file_ids,
|
||||
const struct file_id *ids,
|
||||
const struct smb2_lease_key *key,
|
||||
uint32_t lease_state)
|
||||
{
|
||||
struct smbXsrv_connection *xconn = client->connections;
|
||||
struct smbd_server_connection *sconn = xconn->client->sconn;
|
||||
const struct GUID *client_guid = NULL;
|
||||
struct share_mode_lock *lck;
|
||||
@ -565,7 +566,7 @@ NTSTATUS downgrade_lease(struct smbXsrv_connection *xconn,
|
||||
breaking_to_requested |= SMB2_LEASE_READ;
|
||||
}
|
||||
|
||||
state = talloc_zero(xconn,
|
||||
state = talloc_zero(client,
|
||||
struct downgrade_lease_additional_state);
|
||||
if (state == NULL) {
|
||||
TALLOC_FREE(lck);
|
||||
@ -579,7 +580,7 @@ NTSTATUS downgrade_lease(struct smbXsrv_connection *xconn,
|
||||
return NT_STATUS_NO_MEMORY;
|
||||
}
|
||||
|
||||
state->xconn = xconn;
|
||||
state->client = client;
|
||||
state->lease_key = *key;
|
||||
state->break_from = current_state;
|
||||
state->break_to = breaking_to_requested;
|
||||
|
@ -48,6 +48,7 @@
|
||||
|
||||
/* The following definitions come from smbd/signing.c */
|
||||
|
||||
struct smbXsrv_client;
|
||||
struct smbXsrv_connection;
|
||||
struct dcesrv_context;
|
||||
|
||||
@ -781,7 +782,7 @@ NTSTATUS set_file_oplock(files_struct *fsp);
|
||||
bool remove_oplock(files_struct *fsp);
|
||||
bool downgrade_oplock(files_struct *fsp);
|
||||
bool fsp_lease_update(struct files_struct *fsp);
|
||||
NTSTATUS downgrade_lease(struct smbXsrv_connection *xconn,
|
||||
NTSTATUS downgrade_lease(struct smbXsrv_client *client,
|
||||
uint32_t num_file_ids,
|
||||
const struct file_id *ids,
|
||||
const struct smb2_lease_key *key,
|
||||
|
@ -399,7 +399,7 @@ static struct tevent_req *smbd_smb2_lease_break_send(
|
||||
return tevent_req_post(req, ev);
|
||||
}
|
||||
|
||||
status = downgrade_lease(smb2_req->xconn,
|
||||
status = downgrade_lease(smb2_req->xconn->client,
|
||||
lls.num_file_ids,
|
||||
lls.ids,
|
||||
&in_lease_key,
|
||||
|
Loading…
x
Reference in New Issue
Block a user