>From 24fa5a4db23ad943990b628dd11220ce31cce7e6 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Thu, 17 Feb 2011 14:13:24 +0100 Subject: [PATCH] s3: Redirect chmod in vfs_acl_[xattr|tdb] This should fix a lost secdesc upon rename --- source3/modules/vfs_acl_common.c | 19 +++++++++++++++++++ source3/modules/vfs_acl_tdb.c | 1 + source3/modules/vfs_acl_xattr.c | 1 + 3 files changed, 21 insertions(+), 0 deletions(-) diff --git a/source3/modules/vfs_acl_common.c b/source3/modules/vfs_acl_common.c index f1884f5..1ca7866 100644 --- a/source3/modules/vfs_acl_common.c +++ b/source3/modules/vfs_acl_common.c @@ -1012,3 +1012,22 @@ static int unlink_acl_common(struct vfs_handle_struct *handle, smb_fname->base_name, false); } + +static int chmod_acl_common(vfs_handle_struct *handle, const char *path, + mode_t mode) +{ + int result; + + /* + * We can't use vfswrap_chmod here, because that can delete + * the secdesc via + * vfswrap_chmod->vfswrap_chmod_acl->chmod_acl->copy_access_posix_acl-> + * SMB_VFS_SYS_ACL_SET_FILE. + */ + + START_PROFILE(syscall_chmod); + result = chmod(path, mode); + END_PROFILE(syscall_chmod); + + return result; +} diff --git a/source3/modules/vfs_acl_tdb.c b/source3/modules/vfs_acl_tdb.c index b26208c..22911ac 100644 --- a/source3/modules/vfs_acl_tdb.c +++ b/source3/modules/vfs_acl_tdb.c @@ -400,6 +400,7 @@ static struct vfs_fn_pointers vfs_acl_tdb_fns = { .open = open_acl_common, .create_file = create_file_acl_common, .unlink = unlink_acl_tdb, + .chmod = chmod_acl_common, .rmdir = rmdir_acl_tdb, .fget_nt_acl = fget_nt_acl_common, .get_nt_acl = get_nt_acl_common, diff --git a/source3/modules/vfs_acl_xattr.c b/source3/modules/vfs_acl_xattr.c index 46e282d..6f225ac 100644 --- a/source3/modules/vfs_acl_xattr.c +++ b/source3/modules/vfs_acl_xattr.c @@ -207,6 +207,7 @@ static struct vfs_fn_pointers vfs_acl_xattr_fns = { .open = open_acl_common, .create_file = create_file_acl_common, .unlink = unlink_acl_common, + .chmod = chmod_acl_common, .fget_nt_acl = fget_nt_acl_common, .get_nt_acl = get_nt_acl_common, .fset_nt_acl = fset_nt_acl_common, -- 1.7.0.4