[SCM] Samba Shared Repository - branch v4-21-test updated

Jule Anger janger at samba.org
Mon Mar 31 11:15:02 UTC 2025


The branch, v4-21-test has been updated
       via  1f9c1dad691 vfs: Fix Bug 15791, vfs_acl_tdb unlinkat()
       via  fbd038e3db9 vfs: Fix a lock order violation in unlinkat_acl_tdb()
      from  cd0b2f6df72 vfs_ceph_new: Add path based fallback for SMB_VFS_FNTIMES

https://git.samba.org/?p=samba.git;a=shortlog;h=v4-21-test


- Log -----------------------------------------------------------------
commit 1f9c1dad691db9279c3e450a50952bb8fc0e4590
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Jan 28 14:03:49 2025 +0100

    vfs: Fix Bug 15791, vfs_acl_tdb unlinkat()
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=15791
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    (cherry picked from commit 93a6d36239dd2ce2b3863945f8b9b59cb6aa911a)
    
    Autobuild-User(v4-21-test): Jule Anger <janger at samba.org>
    Autobuild-Date(v4-21-test): Mon Mar 31 11:14:47 UTC 2025 on atb-devel-224

commit fbd038e3db901b1fcffd9947afb4a0313696354e
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Feb 26 16:04:01 2025 +0100

    vfs: Fix a lock order violation in unlinkat_acl_tdb()
    
    unlinkat is called when the share mode record is locked.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=15791
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    (cherry picked from commit 93bc238aa91ec8041648d17e11bf235132974eda)

-----------------------------------------------------------------------

Summary of changes:
 source3/modules/vfs_acl_tdb.c | 51 ++++++++++++++++++++++++-------------------
 1 file changed, 28 insertions(+), 23 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/modules/vfs_acl_tdb.c b/source3/modules/vfs_acl_tdb.c
index 5ecba7ba757..fb99c58b2f7 100644
--- a/source3/modules/vfs_acl_tdb.c
+++ b/source3/modules/vfs_acl_tdb.c
@@ -58,7 +58,7 @@ static bool acl_tdb_init(void)
 
 	become_root();
 	acl_db = db_open(NULL, dbname, 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600,
-			 DBWRAP_LOCK_ORDER_1, DBWRAP_FLAG_NONE);
+			 DBWRAP_LOCK_ORDER_2, DBWRAP_FLAG_NONE);
 	unbecome_root();
 
 	if (acl_db == NULL) {
@@ -195,38 +195,43 @@ static int unlinkat_acl_tdb(vfs_handle_struct *handle,
 			const struct smb_filename *smb_fname,
 			int flags)
 {
-	struct smb_filename *smb_fname_tmp = NULL;
-	struct db_context *db = acl_db;
-	int ret = -1;
-
-	smb_fname_tmp = cp_smb_filename_nostream(talloc_tos(), smb_fname);
-	if (smb_fname_tmp == NULL) {
-		errno = ENOMEM;
-		goto out;
-	}
+	struct stat_ex st = {};
+	int ret;
 
-	ret = vfs_stat(handle->conn, smb_fname_tmp);
-	if (ret == -1) {
-		goto out;
+	if (!is_named_stream(smb_fname)) {
+		if (VALID_STAT(smb_fname->st)) {
+			st = smb_fname->st;
+		} else {
+			ret = SMB_VFS_NEXT_FSTATAT(handle,
+						   dirfsp,
+						   smb_fname,
+						   &st,
+						   AT_SYMLINK_NOFOLLOW);
+			if (ret == -1) {
+				return ret;
+			}
+		}
 	}
 
 	if (flags & AT_REMOVEDIR) {
-		ret = rmdir_acl_common(handle,
-				dirfsp,
-				smb_fname_tmp);
+		ret = rmdir_acl_common(handle, dirfsp, smb_fname);
 	} else {
-		ret = unlink_acl_common(handle,
-				dirfsp,
-				smb_fname_tmp,
-				flags);
+		ret = unlink_acl_common(handle, dirfsp, smb_fname, flags);
 	}
 
 	if (ret == -1) {
-		goto out;
+		return -1;
+	}
+
+	if (is_named_stream(smb_fname)) {
+		/*
+		 * ACLs only stored for basenames
+		 */
+		return ret;
 	}
 
-	acl_tdb_delete(handle, db, &smb_fname_tmp->st);
- out:
+	acl_tdb_delete(handle, acl_db, &st);
+
 	return ret;
 }
 


-- 
Samba Shared Repository



More information about the samba-cvs mailing list