summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2020-06-02 16:33:23 +0200
committerStefan Metzmacher <metze@samba.org>2020-07-08 15:54:40 +0000
commit42497b8639965de7b800b25ce20052ef7b44fb05 (patch)
tree6ed48e79301978e91efc96e7b9db3748140cd42a
parent54bd3a46c84b87aa4d391c797c363df954b9b686 (diff)
downloadsamba-42497b8639965de7b800b25ce20052ef7b44fb05.tar.gz
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>
-rw-r--r--source3/smbd/oplock.c17
-rw-r--r--source3/smbd/proto.h3
-rw-r--r--source3/smbd/smb2_break.c2
3 files changed, 12 insertions, 10 deletions
diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c
index 1c1510f3aab..fce604ded06 100644
--- a/source3/smbd/oplock.c
+++ b/source3/smbd/oplock.c
@@ -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;
diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h
index 118e926b55f..7d59ca5242f 100644
--- a/source3/smbd/proto.h
+++ b/source3/smbd/proto.h
@@ -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,
diff --git a/source3/smbd/smb2_break.c b/source3/smbd/smb2_break.c
index 2ab55aa8720..02ccac972e2 100644
--- a/source3/smbd/smb2_break.c
+++ b/source3/smbd/smb2_break.c
@@ -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,