summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2019-04-10 16:38:28 +0200
committerChristof Schmitt <cs@samba.org>2019-04-14 04:01:31 +0000
commit1269bfe47bb0f5a19e8e54f01de375cc0a43191e (patch)
treeb8a25648832ef4713067173046b959c4d1707988 /source3
parentb4b941f2af601482725ae826b77b863200fee604 (diff)
downloadsamba-1269bfe47bb0f5a19e8e54f01de375cc0a43191e.tar.gz
smbd: Use leases_db in fsp_lease_update()
Remove a reference to "struct share_mode_lease" Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Christof Schmitt <cs@samba.org>
Diffstat (limited to 'source3')
-rw-r--r--source3/smbd/oplock.c32
1 files changed, 20 insertions, 12 deletions
diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c
index 95983c66b45..5c094e1a84e 100644
--- a/source3/smbd/oplock.c
+++ b/source3/smbd/oplock.c
@@ -430,13 +430,23 @@ bool fsp_lease_update(struct share_mode_lock *lck,
const struct GUID *client_guid,
struct fsp_lease *lease)
{
- struct share_mode_data *d = lck->data;
- int idx;
- struct share_mode_lease *l = NULL;
+ uint32_t current_state;
+ bool breaking;
+ uint16_t lease_version, epoch;
+ NTSTATUS status;
- idx = find_share_mode_lease(d, client_guid, &lease->lease.lease_key);
- if (idx == -1) {
- DEBUG(1, ("%s: Could not find lease entry\n", __func__));
+ status = leases_db_get(client_guid,
+ &lease->lease.lease_key,
+ &lck->data->id,
+ &current_state,
+ &breaking,
+ NULL, /* breaking_to_requested */
+ NULL, /* breaking_to_required */
+ &lease_version,
+ &epoch);
+ if (!NT_STATUS_IS_OK(status)) {
+ DBG_WARNING("Could not find lease entry: %s\n",
+ nt_errstr(status));
TALLOC_FREE(lease->timeout);
lease->lease.lease_state = SMB2_LEASE_NONE;
lease->lease.lease_epoch += 1;
@@ -444,19 +454,17 @@ bool fsp_lease_update(struct share_mode_lock *lck,
return false;
}
- l = &d->leases[idx];
-
DEBUG(10,("%s: refresh lease state\n", __func__));
/* Ensure we're in sync with current lease state. */
- if (lease->lease.lease_epoch != l->epoch) {
+ if (lease->lease.lease_epoch != epoch) {
DEBUG(10,("%s: cancel outdated timeout\n", __func__));
TALLOC_FREE(lease->timeout);
}
- lease->lease.lease_epoch = l->epoch;
- lease->lease.lease_state = l->current_state;
+ lease->lease.lease_epoch = epoch;
+ lease->lease.lease_state = current_state;
- if (l->breaking) {
+ if (breaking) {
lease->lease.lease_flags |= SMB2_LEASE_FLAG_BREAK_IN_PROGRESS;
if (lease->timeout == NULL) {