Bug 14737 - Samba does not response STATUS_INVALID_PARAMETER when opening 2 objects with same lease key
Summary: Samba does not response STATUS_INVALID_PARAMETER when opening 2 objects with ...
Status: ASSIGNED
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: File services (show other bugs)
Version: 4.14.5
Hardware: All All
: P5 normal (vote)
Target Milestone: ---
Assignee: Jeremy Allison
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-06-11 18:39 UTC by Jeremy Allison
Modified: 2021-06-11 18:40 UTC (History)
0 users

See Also:


Attachments
wireshark pcap (4.15 KB, application/vnd.tcpdump.pcap)
2021-06-11 18:40 UTC, Jeremy Allison
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jeremy Allison 2021-06-11 18:39:46 UTC
From: haihua yang via samba <samba@lists.samba.org>
To: samba@lists.samba.org
Subject: [Samba] Samba does not response STATUS_INVALID_PARAMETER when opening 2 objects with same lease key

Hi,
According to MS-SMB2 3.3.5.9.8
<https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-smb2/24cfce29-5d80-4651-ba5f-a2661c666b41>,
it should respond STATUS_INVALID_PARAMETER when a client opens 2 different
objects with the same lease key, but samba successfully opens both files
and sends a lease break to the client. And since there are 2 fsp with
different file_id sharing the same lease, the lease_timeout_handler does
not find the right fsp to downgrade the lease, hence it keeps the lease in
the breaking state if the client does not close the opens..
Looks like the cause is in function lease_match_parser, it first compares
the file id and NOT_GRANTED if it mismatches,
5361         for (i = 0; i < num_files; i++) {
5362                 const struct leases_db_file *f = &files[i];
5363
5364                 /* Everything should be the same. */
5365                 if (!file_id_equal(&state->id, &f->id)) {
5366                         /* This should catch all dynamic share cases.
*/
5367                         state->match_status =
NT_STATUS_OPLOCK_NOT_GRANTED;
5368                         break;
5369                 }
Comment 1 Jeremy Allison 2021-06-11 18:40:21 UTC
Created attachment 16653 [details]
wireshark pcap