Bug 14879 - A directory containing dangling symlinks cannot be deleted by SMB2 alone when they are the only entry in the directory
Summary: A directory containing dangling symlinks cannot be deleted by SMB2 alone when...
Status: RESOLVED FIXED
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: File services (show other bugs)
Version: 4.15.0
Hardware: All All
: P5 normal (vote)
Target Milestone: ---
Assignee: Jule Anger
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on: 14878
Blocks: 14892
  Show dependency treegraph
 
Reported: 2021-10-21 18:55 UTC by Jeremy Allison
Modified: 2021-11-24 11:56 UTC (History)
4 users (show)

See Also:


Attachments
Raw patch that fixes this bug and also 4878 (4.34 KB, patch)
2021-10-21 18:58 UTC, Jeremy Allison
no flags Details
git-am fix for 4.15.next. (20.45 KB, patch)
2021-10-29 18:16 UTC, Jeremy Allison
slow: review+
Details
patch for v4-14 (28.95 KB, patch)
2021-11-24 11:56 UTC, Pavel Fiipenský
pfilipen: review? (jra)
pfilipen: review? (slow)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jeremy Allison 2021-10-21 18:55:51 UTC
Dangling symlinks are implicitly vetoed files in SMB2, they are not shown to the client. A directory containing a dangling symlink cannot be deleted by SMB2 even though the client cannot see the dangling symlink entry.

We need to allow directories containing only dangling symlinks to be deleted by a Windows client when "delete veto files = yes" is set.

Called out by Pavel Filipensky <pfilipen@redhat.com> on the samba-technical list.

Have a patch, need bugid and regression test.
Comment 1 Jeremy Allison 2021-10-21 18:58:04 UTC
Created attachment 16863 [details]
Raw patch that fixes this bug and also 4878

Storing it here so I don't lose it. This needs to be paired with regression tests.
Comment 2 Samba QA Contact 2021-10-29 15:31:36 UTC
This bug was referenced in samba master:

942123b95923f35a32df4196a072a3ed3468396a
295d7d026babe3cd5123d0f53adcb16868907f05
f254be19d6501a4f573843af97963e350a9ee2ed
a37d16e7c55f85e3f2c9c8614755ea6307092d5f
26fecad2e66e91a3913d88ee2e0889f266e91d89
e9ef970eee5eca8ab3720279c54098e91d2dfda9
0b818c6b77e972626d0b071bebcf4ce55619fb84
Comment 3 Jeremy Allison 2021-10-29 18:16:54 UTC
Created attachment 16900 [details]
git-am fix for 4.15.next.

Cherry-picked from master. Note this must be applied *after* the fix in:
https://bugzilla.samba.org/show_bug.cgi?id=14878
Comment 4 Ralph Böhme 2021-11-04 07:54:29 UTC
Reassigning to Jule for inclusion in 4.15.
Comment 5 Jeremy Allison 2021-11-04 21:18:07 UTC
Note to Jule:

Please note the patches for these bugs *MUST* be applied in the following
order:

https://bugzilla.samba.org/show_bug.cgi?id=14878
https://bugzilla.samba.org/show_bug.cgi?id=14879
https://bugzilla.samba.org/show_bug.cgi?id=14892

in order to apply correctly. Thanks !
Comment 6 Jule Anger 2021-11-10 14:26:55 UTC
Pushed to autobuild-v4-15-test.
Comment 7 Samba QA Contact 2021-11-10 17:08:24 UTC
This bug was referenced in samba v4-15-test:

359517877d6462ff4398401748f921c8b79357a6
7a4173809a87350bc3580240232978042ec2ceca
0dba0917fd97e975d1daab5b0828644d026c2bc5
e00fe095e8cf7ab54bc82870b913762d2fdddbad
4793c4d5307472f0eb72f70f7dbf7324744e3f91
5023dbc04bfad7cc39e8c4de96f40c82e7a0288e
a549dc219cba5bd61969e4919ae4142f52c133ea
Comment 8 Jule Anger 2021-11-10 18:03:46 UTC
Closing out bug report.

Thanks!
Comment 9 Pavel Fiipenský 2021-11-24 11:56:12 UTC
Created attachment 17024 [details]
patch for v4-14

a549dc2 s3: docs-xml: Clarify the "delete veto files" paramter.
- as original

5023dbc s3: smbd: Fix logic in can_delete_directory_fsp() to cope with dangling symlinks.
- modified to match 4.14

4793c4d s3: smbd: Fix logic in rmdir_internals() to cope with dangling symlinks.
- modified to match 4.14

e00fe09 s3: smbd: Fix rmdir_internals() to do an early return if lp_delete_veto_files() is not set.
- modified to match 4.14

0dba091 s3: VFS: xattr_tdb. Allow unlinkat to cope with dangling symlinks.
- modified to match 4.14

7a41738 s3: VFS: streams_depot. Allow unlinkat to cope with dangling symlinks.
- modified to match 4.14

3595178 s3: smbd: Add two tests showing the ability to delete a directory containing a dangling symlink over SMB2 depends on "delete veto files" setting.
- as original