mirror of
https://github.com/samba-team/samba.git
synced 2024-12-22 13:34:15 +03:00
s3: smbd: Fix our leases code to return the correct error in the non-dynamic share case.
We now return INVALID_PARAMETER when trying to open a different file with a duplicate lease key on the same (non-dynamic) share. This will enable us to pass another Windows test suite leases test. We now behave the same as Windows10. Remove knownfail.d/smb2-lease-duplicateopen BUG: https://bugzilla.samba.org/show_bug.cgi?id=14737 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: David Mulder <dmulder@suse.com> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Fri Feb 18 20:12:12 UTC 2022 on sn-devel-184
This commit is contained in:
parent
ca3896b6f8
commit
408be54323
@ -1 +0,0 @@
|
||||
^samba3.smb2.lease.duplicate_open\(nt4_dc\)
|
@ -5308,8 +5308,42 @@ static void lease_match_parser(
|
||||
|
||||
/* Everything should be the same. */
|
||||
if (!file_id_equal(&state->id, &f->id)) {
|
||||
/* This should catch all dynamic share cases. */
|
||||
state->match_status = NT_STATUS_OPLOCK_NOT_GRANTED;
|
||||
/*
|
||||
* The client asked for a lease on a
|
||||
* file that doesn't match the file_id
|
||||
* in the database.
|
||||
*
|
||||
* Maybe this is a dynamic share, i.e.
|
||||
* a share where the servicepath is
|
||||
* different for different users (e.g.
|
||||
* the [HOMES] share.
|
||||
*
|
||||
* If the servicepath is different, but the requested
|
||||
* file name + stream name is the same then this is
|
||||
* a dynamic share, the client is using the same share
|
||||
* name and doesn't know that the underlying servicepath
|
||||
* is different. It was expecting a lease on the
|
||||
* same file. Return NT_STATUS_OPLOCK_NOT_GRANTED
|
||||
* to break leases
|
||||
*
|
||||
* Otherwise the client has messed up, or is
|
||||
* testing our error codes, so return
|
||||
* NT_STATUS_INVALID_PARAMETER.
|
||||
*/
|
||||
if (!strequal(f->servicepath, state->servicepath) &&
|
||||
strequal(f->base_name, state->fname->base_name) &&
|
||||
strequal(f->stream_name, state->fname->stream_name))
|
||||
{
|
||||
/*
|
||||
* Name is the same but servicepath is
|
||||
* different, dynamic share. Break leases.
|
||||
*/
|
||||
state->match_status =
|
||||
NT_STATUS_OPLOCK_NOT_GRANTED;
|
||||
} else {
|
||||
state->match_status =
|
||||
NT_STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (!strequal(f->servicepath, state->servicepath)) {
|
||||
|
Loading…
Reference in New Issue
Block a user