From: Volker Lendecke Date: Wed, 7 Aug 2019 19:37:31 +0000 (+0200) Subject: smbd: Make "lease" const in create_file_unixpath() X-Git-Tag: tdb-1.4.2~184 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=665e3f022f215ea7dcaabedee950be134039cd7a;p=thirdparty%2Fsamba.git smbd: Make "lease" const in create_file_unixpath() This is the one place where *lease actually got modified. We can easily make a copy, "struct smb2_lease" is not too large, and this case is pretty rare anyway. Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison --- diff --git a/source3/smbd/open.c b/source3/smbd/open.c index 1bb82d933d9..a2336d7819b 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -4961,7 +4961,7 @@ static NTSTATUS create_file_unixpath(connection_struct *conn, uint32_t create_options, uint32_t file_attributes, uint32_t oplock_request, - struct smb2_lease *lease, + const struct smb2_lease *lease, uint64_t allocation_size, uint32_t private_flags, struct security_descriptor *sd, @@ -4970,6 +4970,7 @@ static NTSTATUS create_file_unixpath(connection_struct *conn, files_struct **result, int *pinfo) { + struct smb2_lease none_lease; int info = FILE_WAS_OPENED; files_struct *base_fsp = NULL; files_struct *fsp = NULL; @@ -5023,9 +5024,11 @@ static NTSTATUS create_file_unixpath(connection_struct *conn, &epoch); if (NT_STATUS_EQUAL(status, NT_STATUS_OPLOCK_NOT_GRANTED)) { /* Dynamic share file. No leases and update epoch... */ - lease->lease_state = SMB2_LEASE_NONE; - lease->lease_epoch = epoch; - lease->lease_version = version; + none_lease = *lease; + none_lease.lease_state = SMB2_LEASE_NONE; + none_lease.lease_epoch = epoch; + none_lease.lease_version = version; + lease = &none_lease; } else if (!NT_STATUS_IS_OK(status)) { goto fail; }