]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
vfs_acl_common: add an fsp extension when setting ACL
authorRalph Boehme <slow@samba.org>
Wed, 16 Dec 2020 14:37:02 +0000 (15:37 +0100)
committerJeremy Allison <jra@samba.org>
Thu, 17 Dec 2020 18:56:29 +0000 (18:56 +0000)
This allows the module checking for the fsp extension variable setting_nt_acl
and will be used in the module functions for .sys_acl_set_fd_fn (so
sys_acl_set_fd_xattr() and sys_acl_set_fd_tdb()).

This depends on the previous code changes, so
won't be back ported. But for reference the
bug id is below.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14592

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/modules/vfs_acl_common.c
source3/modules/vfs_acl_common.h

index 06f751e43870cb150e8c8bfe92bee43c43117339..5aeb159b6863b40c4234a53ccd8ef0cd9ac2999d 100644 (file)
@@ -1034,6 +1034,7 @@ NTSTATUS fset_nt_acl_common(
        TALLOC_CTX *frame = talloc_stackframe();
        bool ignore_file_system_acl = lp_parm_bool(
            SNUM(handle->conn), module_name, "ignore system acls", false);
+       struct acl_common_fsp_ext *ext = NULL;
 
        if (DEBUGLEVEL >= 10) {
                DBG_DEBUG("incoming sd for file %s\n", fsp_str_dbg(fsp));
@@ -1090,6 +1091,12 @@ NTSTATUS fset_nt_acl_common(
                psd->type |= SEC_DESC_SACL_PRESENT;
        }
 
+       ext = VFS_ADD_FSP_EXTENSION(handle,
+                                   fsp,
+                                   struct acl_common_fsp_ext,
+                                   NULL);
+       ext->setting_nt_acl = true;
+
        if (ignore_file_system_acl) {
                if (chown_needed) {
                        /* send only ownership stuff to lower layer */
@@ -1174,6 +1181,7 @@ NTSTATUS fset_nt_acl_common(
        status = store_acl_blob_fsp_fn(handle, fsp, &blob);
 
 done:
+       VFS_REMOVE_FSP_EXTENSION(handle, fsp);
        TALLOC_FREE(frame);
        return status;
 }
index c84448b9f15613ae2d6e30e235f3687053764f5d..c686395bdfa43a13640afa2944d1bfd6a85555d0 100644 (file)
@@ -29,6 +29,10 @@ struct acl_common_config {
        enum default_acl_style default_acl_style;
 };
 
+struct acl_common_fsp_ext {
+       bool setting_nt_acl;
+};
+
 bool init_acl_common_config(vfs_handle_struct *handle,
                            const char *module_name);