Bug 15791 - Remove of file or directory not possible with vfs_acl_tdb
Summary: Remove of file or directory not possible with vfs_acl_tdb
Status: RESOLVED FIXED
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: File services (show other bugs)
Version: 4.17.12
Hardware: All All
: P5 critical (vote)
Target Milestone: ---
Assignee: Jule Anger
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-01-28 12:33 UTC by armin
Modified: 2025-04-17 17:15 UTC (History)
1 user (show)

See Also:


Attachments
patch (1.05 KB, patch)
2025-01-28 13:56 UTC, Volker Lendecke
no flags Details
Patch (2.87 KB, patch)
2025-02-26 16:08 UTC, Volker Lendecke
no flags Details
Patch cherry-picked from master (3.09 KB, patch)
2025-03-29 09:42 UTC, Volker Lendecke
slow: review+
Details

Note You need to log in before you can comment on or make changes to this bug.
Description armin 2025-01-28 12:33:58 UTC
Tested with Samba 4.17.12 (but same code in 4.21).

When using "vfs objects = acl_tdb" it is not possible to remove files or 
 irectories in share.
The log always shows "rmdir_internals: couldn't remove .... : No such file or directory"
 
The cause is in file
  source3/modules/vfs_acl_tdb.c
in function
  unlinkat_acl_tdb()
 
The call "vfs_stat(handle->conn, smb_fname_tmp);" does a stat with the filename only, without the full path.
It always fails!
Removing this stat call and let the rest of the code do its job, all works.
Comment 1 Volker Lendecke 2025-01-28 13:56:32 UTC
Created attachment 18540 [details]
patch

Do you have the chance to test the attached patch?
Comment 2 armin 2025-01-29 10:33:02 UTC
The patch does not work.

The call to full_path_from_dirfsp_atname() creates just the relative path for the share. But vfs_stat() obviously needs the full path.

I just removed the call to vfs_stat() and removal is possible then.

But I found another problem.
Removing a directory works fine then, but removing a file causes an error.
The file is removed, but a "no such file or directory" is returned anyway.
And samba crashes with panic.
In the log it shows:
dbwrap_lock_order_lock: Lock order violation: Trying /var/lib/samba/file_ntacls.tdb at 1 while /run/samba/locking.tdb at 1 is locked
Comment 3 armin 2025-02-26 13:57:08 UTC
I just changed the Importance to "Critical", because in this status the vfs_acl_tdb is not usable.
Comment 4 Volker Lendecke 2025-02-26 16:08:49 UTC
Created attachment 18586 [details]
Patch

Next try. The stat call is required to remove the right acl from the tdb.
Comment 5 armin 2025-02-27 11:39:41 UTC
(In reply to Volker Lendecke from comment #4)

This looks really promising.

All errors are gone on the first check. But I will do more tests.

Thank you!
Comment 6 armin 2025-03-10 12:18:58 UTC
(In reply to armin from comment #5)

No more errors found. Patch works here.
Thank you!
Comment 8 Samba QA Contact 2025-03-29 08:26:14 UTC
This bug was referenced in samba master:

93bc238aa91ec8041648d17e11bf235132974eda
93a6d36239dd2ce2b3863945f8b9b59cb6aa911a
Comment 9 Volker Lendecke 2025-03-29 09:42:51 UTC
Created attachment 18622 [details]
Patch cherry-picked from master

builds in both 4.21 and 4.22
Comment 10 Ralph Böhme 2025-03-29 11:00:29 UTC
Reassigning to Jule for inclusion in 4.21 and 4.22.
Comment 11 Jule Anger 2025-03-31 10:01:52 UTC
Pushed to autobuild-v4-{22,21}-test.
Comment 12 Samba QA Contact 2025-03-31 11:15:14 UTC
This bug was referenced in samba v4-21-test:

fbd038e3db901b1fcffd9947afb4a0313696354e
1f9c1dad691db9279c3e450a50952bb8fc0e4590
Comment 13 Samba QA Contact 2025-03-31 12:14:13 UTC
This bug was referenced in samba v4-22-test:

34a2e467259cad93b12caaf2b7a4dbfa68f68929
d731cc875f2f14b9410141f983d993069bcd8f18
Comment 14 Samba QA Contact 2025-03-31 14:50:01 UTC
This bug was referenced in samba v4-21-stable (Release samba-4.21.5):

fbd038e3db901b1fcffd9947afb4a0313696354e
1f9c1dad691db9279c3e450a50952bb8fc0e4590
Comment 15 Jule Anger 2025-04-03 12:55:22 UTC
Closing out bug report.

Thanks!
Comment 16 Samba QA Contact 2025-04-17 17:15:34 UTC
This bug was referenced in samba v4-22-stable (Release samba-4.22.1):

34a2e467259cad93b12caaf2b7a4dbfa68f68929
d731cc875f2f14b9410141f983d993069bcd8f18