[SCM] Samba Shared Repository - branch master updated

Jeremy Allison jra at samba.org
Thu Dec 17 20:05:02 UTC 2020


The branch, master has been updated
       via  a77de71ced0 vfs_acl_tdb: avoid deleting the NT ACL from the tdb
       via  25ec2881727 vfs_acl_xattr: avoid removing the ACL xattr
       via  e6b0797caff vfs_acl_common: add an fsp extension when setting ACL
       via  498831cf66b vfs_acl_common: add and use a function exit label
       via  d860785f68c vfs_acl_xattr: reformatting
       via  92b14995423 vfs: RIP SMB_VFS_SYS_ACL_SET_FILE()
       via  6efe41c49cb posix_acls: use pathref fsp in copy_access_posix_acl()
       via  24a46b9db95 smbd: use pathref fsp in change_dir_owner_to_parent()
       via  74b9080668c smbd: use a real dirfsp/atname in mkdir_internal() with SMB_VFS_MKDIRAT()
       via  43b5e97ad96 smbd: after creating a directory, open the fsp as pathref fsp
       via  83ffeac7163 smbd: pass fsp to mkdir_internal()
       via  405d11642b6 smbd: open a pathref fsp on the parent directory
       via  621793733dc vfs_time_audit: support real dirfsps in smb_time_audit_mkdirat()
       via  cf07a5cd456 vfs_full_audit: support real dirfsps in smb_full_audit_mkdirat()
       via  a6f35e89d00 vfs_shadow_copy2: support real dirfsps in shadow_copy2_mkdirat()
       via  c3fb27d92b8 smbd: check for absolute paths in full_path_from_dirfsp_atname()
       via  71a614861a5 vfs_linux_xfs_sgid: support real dirfsps in linux_xfs_sgid_mkdirat()
       via  640629b21ba vfs_glusterfs: support real dirfsps in vfs_gluster_mkdirat()
       via  cb3d8b20def vfs_audit: support real dirfsps in audit_mkdirat()
       via  6c79c2f2e82 vfs_extd_audit: support real dirfsps in audit_mkdirat()
       via  dc4c952807f vfs_xattr_tdb: support real dirfsps in xattr_tdb_mkdirat()
       via  875fd6eec25 vfs_media_harmony: support real dirfsps in mh_mkdirat()
       via  2d57908f139 vfs_syncops: support real dirfsps in syncops_mkdirat()
       via  9bafb894033 vfs_unityed_media: support real dirfsps in um_mkdirat()
       via  3dee234e25e vfs_default: remove assert from vfswrap_mkdirat()
       via  b54158fb72d smbd: move mode logic out of vfswrap_mkdirat() to the caller mkdir_internal()
       via  1af5892a985 pysmbd: use SMB_VFS_SYS_ACL_SET_FD() in set_sys_acl_conn()
       via  33cbe40c419 posix_acls: use SMB_VFS_SYS_ACL_SET_FD() in set_unix_posix_default_acl()
       via  8d323aebe34 posix_acls: use SMB_VFS_SYS_ACL_SET_FD() in set_canon_ace_list()
       via  1f4426b44e1 vfs_default: add support for SMB_ACL_TYPE_DEFAULT and pathref fsps in vfswrap_sys_acl_set_fd()
       via  ee0a6d228ab vfs_aixacl2: handle pathref fsps in aixjfs2_sys_acl_set_fd()
       via  f4c2f867f03 vfs_aixacl: handle pathref fsps in aixacl_sys_acl_set_fd()
       via  fc6ee68c290 vfs_vxfs: add support for SMB_ACL_TYPE_DEFAULT in vxfs_sys_acl_set_fd()
       via  9303683ee28 vfs_tru64acl: add support for SMB_ACL_TYPE_DEFAULT to tru64acl_sys_acl_set_fd()
       via  7d9a9993cc7 vfs_solarisacl: add support for SMB_ACL_TYPE_DEFAULT in solarisacl_sys_acl_set_fd()
       via  bf369327dbf vfs_posixacl: support SMB_ACL_TYPE_DEFAULT in posixacl_sys_acl_set_fd()
       via  ba07df5e0d9 vfs_gpfs: add support for SMB_ACL_TYPE_DEFAULT in gpfsacl_sys_acl_set_fd()
       via  a866027e41b vfs_fake_acls: add support for SMB_ACL_TYPE_DEFAULT in fake_acls_sys_acl_set_fd()
       via  6c30d49f480 vfs_aixacl2: use ACL type in aixjfs2_sys_acl_set_fd()
       via  3363cddc3a7 vfs_aixacl: use passed in ACL type in aixacl_sys_acl_set_fd()
       via  467dbdbdde3 posixacl_xattr: add support for SMB_ACL_TYPE_DEFAULT in posixacl_xattr_acl_set_fd()
       via  8d0ea8bafa0 vfs: add acl type arg to SMB_VFS_SYS_ACL_SET_FD()
       via  ebf37cfc3cb smbd: remove fd_close() from open_directory()
       via  de806498603 smbd: Ensure close_directory() and close_normal_file() only deal with is_fsa files.
       via  7c5476baadb smbd: mark fsp as valid FSA fsp after Durable Handle reconnect succeeded
       via  59b0fae26e1 smbd: Move closing a print file out of close_normal_file() (it isn't a normal file) and into close_file().
       via  12dd02d884d smbd: On error exit in create_file_unixpath(), we can't call close_file() on uncompleted opens.
       via  e7f1588ee49 smbd: If an smb_filename already has a pathref fsp don't overwrite it.
       via  8559af63169 smbd: dup_file_fsp() for old DOS style opens also needs to copy the new flags.
       via  cbe1485f7b2 smbd: Fix debugs in file_new() and fsp_new().
      from  6c95e467817 smbd/notify: add option "honor change notify privilege"

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit a77de71ced013604382e5c62a904db0fbf1cdd81
Author: Ralph Boehme <slow at samba.org>
Date:   Wed Dec 16 15:41:07 2020 +0100

    vfs_acl_tdb: avoid deleting the NT ACL from the tdb
    
    ...when called as part of setting a new NT ACL. This implements the same logic
    added to vfs_acl_xattr in the previous commit, to make sure both modules behave
    identically.
    
    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 at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Thu Dec 17 20:04:22 UTC 2020 on sn-devel-184

commit 25ec288172738f78a7f97e241de2684fd97ad51e
Author: Ralph Boehme <slow at samba.org>
Date:   Wed Dec 16 15:42:46 2020 +0100

    vfs_acl_xattr: avoid removing the ACL xattr
    
    ...when called as part of setting a new NT ACL.
    
    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 at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit e6b0797caff1e292cec3bee245ee63e58702efb8
Author: Ralph Boehme <slow at samba.org>
Date:   Wed Dec 16 15:37:02 2020 +0100

    vfs_acl_common: add an fsp extension when setting ACL
    
    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 at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 498831cf66b77cad77cceebce0bfd9b00dd5c572
Author: Ralph Boehme <slow at samba.org>
Date:   Wed Dec 16 15:32:52 2020 +0100

    vfs_acl_common: add and use a function exit label
    
    No change in behaviour. A subsequent commit will add more function exit cleanup
    logic after the done label.
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit d860785f68c20e4460d9386c48494ada10bad77e
Author: Ralph Boehme <slow at samba.org>
Date:   Sat Dec 12 14:16:54 2020 +0100

    vfs_acl_xattr: reformatting
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 92b149954237a445594c993b79a860c63113d54b
Author: Ralph Boehme <slow at samba.org>
Date:   Mon Dec 14 16:23:38 2020 +0100

    vfs: RIP SMB_VFS_SYS_ACL_SET_FILE()
    
              .--. .-,       .-..-.__
            .'(`.-` \_.-'-./`  |\_( "\__
         __.>\ ';  _;---,._|   / __/`'--)
        /.--.  : |/' _.--.<|  /  | |
    _..-'    `\     /' /`  /_/ _/_/
     >_.-``-. `Y  /' _;---.`|/))))
    '` .-''. \|:  .'   __, .-'"`
     .'--._ `-:  \/:  /'  '.\             _|_
         /.'`\ :;   /'      `-           `-|-`
        -`    |     |                      |
              :.; : |                  .-'~^~`-.
              |:    |                .' _     _ `.
              |:.   |                | |_) | |_) |
              :. :  |                | | \ | |   |
              : ;   |                |           |
              : ;   |                |  SMB_VFS  |
              : ;   |                |  SYS_ACL  |
              : ;   |                | SET_FILE  |
            .jgs. : ;                |           |
    -."-/\\\/:::.    `\."-._'."-"_\\-|           |///."-
    " -."-.\\"-."//.-".`-."_\\-.".-\\`=.........=`//-".
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 6efe41c49cbcf3d6de95f33983f59aecd6a1ee31
Author: Ralph Boehme <slow at samba.org>
Date:   Mon Dec 14 11:21:05 2020 +0100

    posix_acls: use pathref fsp in copy_access_posix_acl()
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 24a46b9db9561c49996a2e77320228a7d22de08a
Author: Ralph Boehme <slow at samba.org>
Date:   Mon Dec 14 11:20:46 2020 +0100

    smbd: use pathref fsp in change_dir_owner_to_parent()
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 74b9080668cd4307e14049c9d908b5610911507b
Author: Ralph Boehme <slow at samba.org>
Date:   Wed Dec 16 15:27:39 2020 +0100

    smbd: use a real dirfsp/atname in mkdir_internal() with SMB_VFS_MKDIRAT()
    
    Now that all VFS modules support real dirfsps in SMB_VFS_MKDIRAT(), pass the
    pathref fsp from the parent directory and the basename of the new directory.
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 43b5e97ad9620dcb5d79cdcf0fa6d6e61ebc5106
Author: Ralph Boehme <slow at samba.org>
Date:   Wed Dec 16 15:25:47 2020 +0100

    smbd: after creating a directory, open the fsp as pathref fsp
    
    After the directory has been created by SMB_VFS_MKDIRAT(), open the fsp on the
    new directory as pathref fsp so we can use handle based VFS functions.
    
    open_directory() will reopen the fsp as a full fsp, but that doesn't really hurt
    thanks to the reopen_from_procfd() optimisation.
    
    Note that smb_dname == fsp->fsp_name.
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 83ffeac71636fa397c52116cbf8839ec350e2f51
Author: Ralph Boehme <slow at samba.org>
Date:   Thu Dec 17 12:31:13 2020 +0100

    smbd: pass fsp to mkdir_internal()
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 405d11642b6dcfb373827f05cd2eef33c91e00db
Author: Ralph Boehme <slow at samba.org>
Date:   Wed Dec 16 15:20:47 2020 +0100

    smbd: open a pathref fsp on the parent directory
    
    Prepares for calling SMB_VFS_MKDIRAT() below with a real dirfsp/atname. As
    parent_dir_fname now has a pathref fsp in parent_dir_fname->fsp, make sure to
    talloc_free() the parent_dir_fname before leaving the function, so the pathref
    fsp is closed right there and not left around until the talloc tos is
    destroyed (parent_dir_fname is a child of talloc-tos).
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 621793733dc6f22b2c90ca236906c62127e93cb0
Author: Ralph Boehme <slow at samba.org>
Date:   Mon Dec 14 15:56:11 2020 +0100

    vfs_time_audit: support real dirfsps in smb_time_audit_mkdirat()
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit cf07a5cd456c371dd0ff1b893cc6394299bd6920
Author: Ralph Boehme <slow at samba.org>
Date:   Mon Dec 14 15:55:04 2020 +0100

    vfs_full_audit: support real dirfsps in smb_full_audit_mkdirat()
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit a6f35e89d004405f80d0d8d8f7d0e6a67e14cd3d
Author: Ralph Boehme <slow at samba.org>
Date:   Mon Dec 14 15:53:33 2020 +0100

    vfs_shadow_copy2: support real dirfsps in shadow_copy2_mkdirat()
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit c3fb27d92b82241183ae811e5ee7ca90e53b7284
Author: Ralph Boehme <slow at samba.org>
Date:   Mon Dec 14 15:53:11 2020 +0100

    smbd: check for absolute paths in full_path_from_dirfsp_atname()
    
    If the "atname" is an absolute path we can ignore the dirfsp and just return a
    copy of the atname.
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 71a614861a50a7b8cfb568eca092f86b982274f9
Author: Ralph Boehme <slow at samba.org>
Date:   Mon Dec 14 15:49:15 2020 +0100

    vfs_linux_xfs_sgid: support real dirfsps in linux_xfs_sgid_mkdirat()
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 640629b21ba95148e81c5473f0bfb8ab45a27752
Author: Ralph Boehme <slow at samba.org>
Date:   Mon Dec 14 15:43:39 2020 +0100

    vfs_glusterfs: support real dirfsps in vfs_gluster_mkdirat()
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit cb3d8b20def699377e48fb32cfed32bf7c716373
Author: Ralph Boehme <slow at samba.org>
Date:   Mon Dec 14 15:42:23 2020 +0100

    vfs_audit: support real dirfsps in audit_mkdirat()
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 6c79c2f2e829f5a11687785f5761675f25d93f7f
Author: Ralph Boehme <slow at samba.org>
Date:   Mon Dec 14 15:39:37 2020 +0100

    vfs_extd_audit: support real dirfsps in audit_mkdirat()
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit dc4c952807fd80993c6aaa9b1cd5a2918c5b0618
Author: Ralph Boehme <slow at samba.org>
Date:   Mon Dec 14 15:38:07 2020 +0100

    vfs_xattr_tdb: support real dirfsps in xattr_tdb_mkdirat()
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 875fd6eec256c195f7bbb56fc1dd7e22cdfeff04
Author: Ralph Boehme <slow at samba.org>
Date:   Mon Dec 14 15:35:22 2020 +0100

    vfs_media_harmony: support real dirfsps in mh_mkdirat()
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 2d57908f139b0a13a2f70906ab4dcdb220d80284
Author: Ralph Boehme <slow at samba.org>
Date:   Mon Dec 14 15:31:37 2020 +0100

    vfs_syncops: support real dirfsps in syncops_mkdirat()
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 9bafb8940331fed0432f3e93aee346f3ea4c62df
Author: Ralph Boehme <slow at samba.org>
Date:   Mon Dec 14 15:29:10 2020 +0100

    vfs_unityed_media: support real dirfsps in um_mkdirat()
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 3dee234e25eaf04bbf1afff316226da3090f1e82
Author: Ralph Boehme <slow at samba.org>
Date:   Mon Dec 14 11:55:10 2020 +0100

    vfs_default: remove assert from vfswrap_mkdirat()
    
    vfswrap_mkdirat() deals with real dirfsps just fine now.
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit b54158fb72d5008c0cf639c9d24501a010885ef1
Author: Ralph Boehme <slow at samba.org>
Date:   Mon Dec 14 11:51:20 2020 +0100

    smbd: move mode logic out of vfswrap_mkdirat() to the caller mkdir_internal()
    
    This is the correct place where this code should be. It also means opaque VFS
    modules that implement their own mkdirat() like glusterfs now use this logic.
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 1af5892a9851389b9eba978c4c70cc67392dce0e
Author: Ralph Boehme <slow at samba.org>
Date:   Mon Dec 14 11:25:12 2020 +0100

    pysmbd: use SMB_VFS_SYS_ACL_SET_FD() in set_sys_acl_conn()
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 33cbe40c4190f90039bb59a23ea0316b5ed8c507
Author: Ralph Boehme <slow at samba.org>
Date:   Mon Dec 14 11:21:45 2020 +0100

    posix_acls: use SMB_VFS_SYS_ACL_SET_FD() in set_unix_posix_default_acl()
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 8d323aebe34f4d6188e98c7a9551b140d9ee1121
Author: Ralph Boehme <slow at samba.org>
Date:   Mon Dec 14 10:44:47 2020 +0100

    posix_acls: use SMB_VFS_SYS_ACL_SET_FD() in set_canon_ace_list()
    
    SMB_VFS_SYS_ACL_SET_FD() can now safely be used to set default ACLs on
    directories.
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 1f4426b44e178d05337b7804987a74c4628a2530
Author: Ralph Boehme <slow at samba.org>
Date:   Sun Dec 13 09:11:37 2020 +0100

    vfs_default: add support for SMB_ACL_TYPE_DEFAULT and pathref fsps in vfswrap_sys_acl_set_fd()
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit ee0a6d228abf6d3f49c2c0f10de4eb705f914731
Author: Ralph Boehme <slow at samba.org>
Date:   Mon Dec 14 10:07:04 2020 +0100

    vfs_aixacl2: handle pathref fsps in aixjfs2_sys_acl_set_fd()
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit f4c2f867f035fcbe3d547d5635d058b0aec7636a
Author: Ralph Boehme <slow at samba.org>
Date:   Mon Dec 14 10:04:15 2020 +0100

    vfs_aixacl: handle pathref fsps in aixacl_sys_acl_set_fd()
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit fc6ee68c2908c8cae8fe02809028e92d3092791d
Author: Ralph Boehme <slow at samba.org>
Date:   Mon Dec 14 08:10:44 2020 +0100

    vfs_vxfs: add support for SMB_ACL_TYPE_DEFAULT in vxfs_sys_acl_set_fd()
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 9303683ee284feaed846b6e6e9fdc615922b7a74
Author: Ralph Boehme <slow at samba.org>
Date:   Mon Dec 14 08:08:30 2020 +0100

    vfs_tru64acl: add support for SMB_ACL_TYPE_DEFAULT to tru64acl_sys_acl_set_fd()
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 7d9a9993cc70c7130990b3a2b471f081af30528a
Author: Ralph Boehme <slow at samba.org>
Date:   Mon Dec 14 08:05:53 2020 +0100

    vfs_solarisacl: add support for SMB_ACL_TYPE_DEFAULT in solarisacl_sys_acl_set_fd()
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit bf369327dbfd301da6b49d73f25f2ef6e088524a
Author: Ralph Boehme <slow at samba.org>
Date:   Mon Dec 14 07:57:45 2020 +0100

    vfs_posixacl: support SMB_ACL_TYPE_DEFAULT in posixacl_sys_acl_set_fd()
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit ba07df5e0d9d43ba74b93e9b05156b0c1a2f83a9
Author: Ralph Boehme <slow at samba.org>
Date:   Sun Dec 13 09:19:25 2020 +0100

    vfs_gpfs: add support for SMB_ACL_TYPE_DEFAULT in gpfsacl_sys_acl_set_fd()
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit a866027e41bbf8f73868061dc17d88ad8da78a41
Author: Ralph Boehme <slow at samba.org>
Date:   Sun Dec 13 09:18:00 2020 +0100

    vfs_fake_acls: add support for SMB_ACL_TYPE_DEFAULT in fake_acls_sys_acl_set_fd()
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 6c30d49f4800ea67df651190d7458bbb724a5d5e
Author: Ralph Boehme <slow at samba.org>
Date:   Sun Dec 13 09:07:51 2020 +0100

    vfs_aixacl2: use ACL type in aixjfs2_sys_acl_set_fd()
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 3363cddc3a754ff52a8acbdc164bec6bed112583
Author: Ralph Boehme <slow at samba.org>
Date:   Sun Dec 13 09:06:24 2020 +0100

    vfs_aixacl: use passed in ACL type in aixacl_sys_acl_set_fd()
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 467dbdbdde30a8214200bf2be7674bbcb07460f8
Author: Ralph Boehme <slow at samba.org>
Date:   Sun Dec 13 08:55:39 2020 +0100

    posixacl_xattr: add support for SMB_ACL_TYPE_DEFAULT in posixacl_xattr_acl_set_fd()
    
    No need to handle pathref fsps here, as that is taken care of by
    SMB_VFS_FSETXATTR().
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 8d0ea8bafa003984dda4a105e4c8b755644cc7f7
Author: Ralph Boehme <slow at samba.org>
Date:   Mon Dec 14 16:28:26 2020 +0100

    vfs: add acl type arg to SMB_VFS_SYS_ACL_SET_FD()
    
    No change in behaviour, the new arg is not yet used in any module.
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit ebf37cfc3cb025171e0ceca321b343de82975c42
Author: Ralph Boehme <slow at samba.org>
Date:   Thu Dec 17 12:41:29 2020 +0100

    smbd: remove fd_close() from open_directory()
    
    fd_close() was accidentally added twice by
    d00d09fdcf73a5839ae4f82cf8e953bb761bfbfb. If it would have been removed by
    5770cdd7635a018817418f58bd37268aedebd6a9 that adds the reopen_from_procfd()
    optimisation, all would be fine. But fd_close() still being called before
    reopen_from_procfd() means we're closing the pathref fd prevening the
    optimisation.
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit de806498603b47274f1e4647eeb2a84db2b7319a
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Dec 16 16:38:28 2020 -0800

    smbd: Ensure close_directory() and close_normal_file() only deal with is_fsa files.
    
    This must be the case, so assert it.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 7c5476baadb44b34566341ef3cfc9bb32ca81c68
Author: Ralph Boehme <slow at samba.org>
Date:   Thu Dec 17 13:41:20 2020 +0100

    smbd: mark fsp as valid FSA fsp after Durable Handle reconnect succeeded
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 59b0fae26e1f7c1d340be4b67bbca13ff8bba43f
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Dec 16 19:49:56 2020 -0800

    smbd: Move closing a print file out of close_normal_file() (it isn't a normal file) and into close_file().
    
    Streamlines closing print files and allows close_normal_file()
    to restrict itself to is_fsa fsps.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 12dd02d884df84b9e6ea14e67c13a86482cf9cc5
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Dec 16 15:44:41 2020 -0800

    smbd: On error exit in create_file_unixpath(), we can't call close_file() on uncompleted opens.
    
    We can't call directly into close_file(), as that cannot deal
    with regular file and directory opens where fsp->fsp_flags.is_fsa
    hasn't been set to true (uncompleted opens).
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit e7f1588ee490249204fd730663d2161d6a5fa6e0
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Dec 16 23:59:50 2020 -0800

    smbd: If an smb_filename already has a pathref fsp don't overwrite it.
    
    That leaks fsps.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 8559af63169730e008e838aebfdd63b135a9caf7
Author: Jeremy Allison <jra at samba.org>
Date:   Thu Dec 17 01:10:12 2020 -0800

    smbd: dup_file_fsp() for old DOS style opens also needs to copy the new flags.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit cbe1485f7b27a598588d42cf1430e74a90ef3e69
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Dec 16 23:55:31 2020 -0800

    smbd: Fix debugs in file_new() and fsp_new().
    
    Allows grep ' files structure ' in the log
    to count up and down the number of files allocated.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

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

Summary of changes:
 docs-xml/manpages/vfs_full_audit.8.xml |   1 -
 examples/VFS/skel_opaque.c             |  14 +--
 examples/VFS/skel_transparent.c        |  16 +---
 source3/include/vfs.h                  |  27 +++---
 source3/include/vfs_macros.h           |  13 +--
 source3/lib/sysacls.c                  |   2 +-
 source3/modules/posixacl_xattr.c       |  16 +++-
 source3/modules/posixacl_xattr.h       |   1 +
 source3/modules/vfs_acl_common.c       |  34 +++----
 source3/modules/vfs_acl_common.h       |   4 +
 source3/modules/vfs_acl_tdb.c          |  58 ++----------
 source3/modules/vfs_acl_xattr.c        |  42 +++------
 source3/modules/vfs_aixacl.c           |  34 +++----
 source3/modules/vfs_aixacl2.c          |  56 +++--------
 source3/modules/vfs_audit.c            |  12 ++-
 source3/modules/vfs_cap.c              |  39 --------
 source3/modules/vfs_catia.c            |  50 +---------
 source3/modules/vfs_ceph.c             |  15 ---
 source3/modules/vfs_default.c          |  63 ++++++++-----
 source3/modules/vfs_extd_audit.c       |  14 ++-
 source3/modules/vfs_fake_acls.c        |  22 ++++-
 source3/modules/vfs_full_audit.c       |  43 ++++-----
 source3/modules/vfs_glusterfs.c        |  16 +++-
 source3/modules/vfs_gpfs.c             |  40 +++-----
 source3/modules/vfs_hpuxacl.c          |   1 -
 source3/modules/vfs_linux_xfs_sgid.c   |  16 ++--
 source3/modules/vfs_media_harmony.c    |  50 +++-------
 source3/modules/vfs_nfs4acl_xattr.c    |  10 +-
 source3/modules/vfs_not_implemented.c  |  14 +--
 source3/modules/vfs_posixacl.c         |   8 +-
 source3/modules/vfs_posixacl.h         |   1 +
 source3/modules/vfs_shadow_copy2.c     |  12 ++-
 source3/modules/vfs_solarisacl.c       | 118 +++--------------------
 source3/modules/vfs_streams_xattr.c    |   3 +-
 source3/modules/vfs_syncops.c          |  14 ++-
 source3/modules/vfs_time_audit.c       |  40 +++-----
 source3/modules/vfs_tru64acl.c         |  46 ++-------
 source3/modules/vfs_unityed_media.c    |  52 +++-------
 source3/modules/vfs_vxfs.c             |  23 +----
 source3/modules/vfs_xattr_tdb.c        |  16 ++--
 source3/modules/vfs_zfsacl.c           |  10 +-
 source3/smbd/close.c                   |  16 ++--
 source3/smbd/durable.c                 |   2 +
 source3/smbd/filename.c                |   3 +-
 source3/smbd/files.c                   |  17 +++-
 source3/smbd/open.c                    | 167 ++++++++++++++-------------------
 source3/smbd/posix_acls.c              | 106 ++++++---------------
 source3/smbd/pysmbd.c                  |  11 ++-
 source3/smbd/vfs.c                     |  16 +---
 49 files changed, 485 insertions(+), 919 deletions(-)


Changeset truncated at 500 lines:

diff --git a/docs-xml/manpages/vfs_full_audit.8.xml b/docs-xml/manpages/vfs_full_audit.8.xml
index d4fbdb4f02e..1b768917d21 100644
--- a/docs-xml/manpages/vfs_full_audit.8.xml
+++ b/docs-xml/manpages/vfs_full_audit.8.xml
@@ -145,7 +145,6 @@
         <member>sys_acl_get_fd</member>
         <member>sys_acl_get_file</member>
         <member>sys_acl_set_fd</member>
-        <member>sys_acl_set_file</member>
         <member>telldir</member>
         <member>translate_name</member>
         <member>unlinkat</member>
diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c
index 881a7fdaf1c..1f20753fc76 100644
--- a/examples/VFS/skel_opaque.c
+++ b/examples/VFS/skel_opaque.c
@@ -839,16 +839,9 @@ static int skel_sys_acl_blob_get_fd(vfs_handle_struct *handle,
 	return -1;
 }
 
-static int skel_sys_acl_set_file(vfs_handle_struct *handle,
-				const struct smb_filename *smb_fname,
-				SMB_ACL_TYPE_T acltype,
-				SMB_ACL_T theacl)
-{
-	errno = ENOSYS;
-	return -1;
-}
-
-static int skel_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
+static int skel_sys_acl_set_fd(vfs_handle_struct *handle,
+			       struct files_struct *fsp,
+			       SMB_ACL_TYPE_T type,
 			       SMB_ACL_T theacl)
 {
 	errno = ENOSYS;
@@ -1138,7 +1131,6 @@ static struct vfs_fn_pointers skel_opaque_fns = {
 	.sys_acl_get_fd_fn = skel_sys_acl_get_fd,
 	.sys_acl_blob_get_file_fn = skel_sys_acl_blob_get_file,
 	.sys_acl_blob_get_fd_fn = skel_sys_acl_blob_get_fd,
-	.sys_acl_set_file_fn = skel_sys_acl_set_file,
 	.sys_acl_set_fd_fn = skel_sys_acl_set_fd,
 	.sys_acl_delete_def_file_fn = skel_sys_acl_delete_def_file,
 
diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c
index 2680b4f3285..f7d99e6101b 100644
--- a/examples/VFS/skel_transparent.c
+++ b/examples/VFS/skel_transparent.c
@@ -1103,19 +1103,12 @@ static int skel_sys_acl_blob_get_fd(vfs_handle_struct *handle,
 						blob_description, blob);
 }
 
-static int skel_sys_acl_set_file(vfs_handle_struct *handle,
-				const struct smb_filename *smb_fname,
-				SMB_ACL_TYPE_T acltype,
-				SMB_ACL_T theacl)
-{
-	return SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, smb_fname,
-			acltype, theacl);
-}
-
-static int skel_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
+static int skel_sys_acl_set_fd(vfs_handle_struct *handle,
+			       struct files_struct *fsp,
+			       SMB_ACL_TYPE_T type,
 			       SMB_ACL_T theacl)
 {
-	return SMB_VFS_NEXT_SYS_ACL_SET_FD(handle, fsp, theacl);
+	return SMB_VFS_NEXT_SYS_ACL_SET_FD(handle, fsp, type, theacl);
 }
 
 static int skel_sys_acl_delete_def_file(vfs_handle_struct *handle,
@@ -1443,7 +1436,6 @@ static struct vfs_fn_pointers skel_transparent_fns = {
 	.sys_acl_get_fd_fn = skel_sys_acl_get_fd,
 	.sys_acl_blob_get_file_fn = skel_sys_acl_blob_get_file,
 	.sys_acl_blob_get_fd_fn = skel_sys_acl_blob_get_fd,
-	.sys_acl_set_file_fn = skel_sys_acl_set_file,
 	.sys_acl_set_fd_fn = skel_sys_acl_set_fd,
 	.sys_acl_delete_def_file_fn = skel_sys_acl_delete_def_file,
 
diff --git a/source3/include/vfs.h b/source3/include/vfs.h
index 1a5d71e8401..04c8c3e4c76 100644
--- a/source3/include/vfs.h
+++ b/source3/include/vfs.h
@@ -340,6 +340,8 @@
  * Version 44 - Add dirfsp arg to SMB_VFS_READDIR()
  * Version 44 - Remove SMB_VFS_GET_DOS_ATTRIBUTES()
  * Version 44 - Replace SMB_VFS_GET_COMPRESSION() with SMB_VFS_FGET_COMPRESSION()
+ * Version 44 - Add type argument to SMB_VFS_SYS_ACL_SET_FD()
+ * Version 44 - Remove SMB_VFS_SYS_ACL_SET_FILE()
  */
 
 #define SMB_VFS_INTERFACE_VERSION 44
@@ -1215,11 +1217,10 @@ struct vfs_fn_pointers {
 	int (*sys_acl_blob_get_fd_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp,
 				      TALLOC_CTX *mem_ctx, char **blob_description,
 				      DATA_BLOB *blob);
-	int (*sys_acl_set_file_fn)(struct vfs_handle_struct *handle,
-					const struct smb_filename *smb_fname,
-					SMB_ACL_TYPE_T acltype,
-					SMB_ACL_T theacl);
-	int (*sys_acl_set_fd_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, SMB_ACL_T theacl);
+	int (*sys_acl_set_fd_fn)(struct vfs_handle_struct *handle,
+				 struct files_struct *fsp,
+				 SMB_ACL_TYPE_T type,
+				 SMB_ACL_T theacl);
 	int (*sys_acl_delete_def_file_fn)(struct vfs_handle_struct *handle,
 					const struct smb_filename *smb_fname);
 
@@ -1741,12 +1742,10 @@ int smb_vfs_call_sys_acl_blob_get_fd(struct vfs_handle_struct *handle,
 				     TALLOC_CTX *mem_ctx,
 				     char **blob_description,
 				     DATA_BLOB *blob);
-int smb_vfs_call_sys_acl_set_file(struct vfs_handle_struct *handle,
-				const struct smb_filename *smb_fname,
-				SMB_ACL_TYPE_T acltype,
-				SMB_ACL_T theacl);
 int smb_vfs_call_sys_acl_set_fd(struct vfs_handle_struct *handle,
-				struct files_struct *fsp, SMB_ACL_T theacl);
+				struct files_struct *fsp,
+				SMB_ACL_TYPE_T type,
+				SMB_ACL_T theacl);
 int smb_vfs_call_sys_acl_delete_def_file(struct vfs_handle_struct *handle,
 				const struct smb_filename *smb_fname);
 ssize_t smb_vfs_call_getxattr(struct vfs_handle_struct *handle,
@@ -2160,11 +2159,9 @@ int vfs_not_implemented_sys_acl_blob_get_file(vfs_handle_struct *handle,
 int vfs_not_implemented_sys_acl_blob_get_fd(vfs_handle_struct *handle,
 				files_struct *fsp, TALLOC_CTX *mem_ctx,
 				char **blob_description, DATA_BLOB *blob);
-int vfs_not_implemented_sys_acl_set_file(vfs_handle_struct *handle,
-				const struct smb_filename *smb_fname,
-				SMB_ACL_TYPE_T acltype,
-				SMB_ACL_T theacl);
-int vfs_not_implemented_sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
+int vfs_not_implemented_sys_acl_set_fd(vfs_handle_struct *handle,
+				       struct files_struct *fsp,
+				       SMB_ACL_TYPE_T type,
 				       SMB_ACL_T theacl);
 int vfs_not_implemented_sys_acl_delete_def_file(vfs_handle_struct *handle,
 					const struct smb_filename *smb_fname);
diff --git a/source3/include/vfs_macros.h b/source3/include/vfs_macros.h
index 80720ad16cd..9a6dd67288c 100644
--- a/source3/include/vfs_macros.h
+++ b/source3/include/vfs_macros.h
@@ -508,15 +508,10 @@
 #define SMB_VFS_NEXT_SYS_ACL_BLOB_GET_FD(handle, fsp, mem_ctx, blob_description, blob)	\
 	smb_vfs_call_sys_acl_blob_get_fd((handle)->next, (fsp), mem_ctx, (blob_description), (blob))
 
-#define SMB_VFS_SYS_ACL_SET_FILE(conn, smb_fname, acltype, theacl) \
-	smb_vfs_call_sys_acl_set_file((conn)->vfs_handles, (smb_fname), (acltype), (theacl))
-#define SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, smb_fname, acltype, theacl) \
-	smb_vfs_call_sys_acl_set_file((handle)->next, (smb_fname), (acltype), (theacl))
-
-#define SMB_VFS_SYS_ACL_SET_FD(fsp, theacl) \
-	smb_vfs_call_sys_acl_set_fd((fsp)->conn->vfs_handles, (fsp), (theacl))
-#define SMB_VFS_NEXT_SYS_ACL_SET_FD(handle, fsp, theacl) \
-	smb_vfs_call_sys_acl_set_fd((handle)->next, (fsp), (theacl))
+#define SMB_VFS_SYS_ACL_SET_FD(fsp, type, theacl) \
+	smb_vfs_call_sys_acl_set_fd((fsp)->conn->vfs_handles, (fsp), (type), (theacl))
+#define SMB_VFS_NEXT_SYS_ACL_SET_FD(handle, fsp, type, theacl) \
+	smb_vfs_call_sys_acl_set_fd((handle)->next, (fsp), (type), (theacl))
 
 #define SMB_VFS_SYS_ACL_DELETE_DEF_FILE(conn, smb_fname) \
 	smb_vfs_call_sys_acl_delete_def_file((conn)->vfs_handles, (smb_fname))
diff --git a/source3/lib/sysacls.c b/source3/lib/sysacls.c
index c80f8f30c90..ad970b6299b 100644
--- a/source3/lib/sysacls.c
+++ b/source3/lib/sysacls.c
@@ -387,7 +387,7 @@ int sys_acl_set_file(vfs_handle_struct *handle,
 int sys_acl_set_fd(vfs_handle_struct *handle, files_struct *fsp,
 		   SMB_ACL_T acl_d)
 {
-	return posixacl_sys_acl_set_fd(handle, fsp, acl_d);
+	return posixacl_sys_acl_set_fd(handle, fsp, SMB_ACL_TYPE_ACCESS, acl_d);
 }
 
 int sys_acl_delete_def_file(vfs_handle_struct *handle,
diff --git a/source3/modules/posixacl_xattr.c b/source3/modules/posixacl_xattr.c
index 6f016e17e0b..7582ceb121e 100644
--- a/source3/modules/posixacl_xattr.c
+++ b/source3/modules/posixacl_xattr.c
@@ -479,12 +479,24 @@ int posixacl_xattr_acl_set_file(vfs_handle_struct *handle,
 }
 
 int posixacl_xattr_acl_set_fd(vfs_handle_struct *handle,
-			      files_struct *fsp, SMB_ACL_T theacl)
+			      files_struct *fsp,
+			      SMB_ACL_TYPE_T type,
+			      SMB_ACL_T theacl)
 {
+	const char *name = NULL;
 	char *buf;
 	ssize_t size;
 	int ret;
 
+	if (type == SMB_ACL_TYPE_ACCESS) {
+		name = ACL_EA_ACCESS;
+	} else if (type == SMB_ACL_TYPE_DEFAULT) {
+		name = ACL_EA_DEFAULT;
+	} else {
+		errno = EINVAL;
+		return -1;
+	}
+
 	size = smb_acl_to_posixacl_xattr(theacl, NULL, 0);
 	buf = alloca(size);
 	if (!buf) {
@@ -497,7 +509,7 @@ int posixacl_xattr_acl_set_fd(vfs_handle_struct *handle,
 		return -1;
 	}
 
-	return SMB_VFS_FSETXATTR(fsp, ACL_EA_ACCESS, buf, size, 0);
+	return SMB_VFS_FSETXATTR(fsp, name, buf, size, 0);
 }
 
 int posixacl_xattr_acl_delete_def_file(vfs_handle_struct *handle,
diff --git a/source3/modules/posixacl_xattr.h b/source3/modules/posixacl_xattr.h
index 70962dd3115..7d0fb2bb8bf 100644
--- a/source3/modules/posixacl_xattr.h
+++ b/source3/modules/posixacl_xattr.h
@@ -37,6 +37,7 @@ int posixacl_xattr_acl_set_file(vfs_handle_struct *handle,
 
 int posixacl_xattr_acl_set_fd(vfs_handle_struct *handle,
 			      files_struct *fsp,
+			      SMB_ACL_TYPE_T type,
 			      SMB_ACL_T theacl);
 
 int posixacl_xattr_acl_delete_def_file(vfs_handle_struct *handle,
diff --git a/source3/modules/vfs_acl_common.c b/source3/modules/vfs_acl_common.c
index 14ea915d828..5aeb159b686 100644
--- a/source3/modules/vfs_acl_common.c
+++ b/source3/modules/vfs_acl_common.c
@@ -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 */
@@ -1097,23 +1104,19 @@ NTSTATUS fset_nt_acl_common(
 			status = set_underlying_acl(handle, fsp, psd,
 						    security_info_sent, true);
 			if (!NT_STATUS_IS_OK(status)) {
-				TALLOC_FREE(frame);
-				return status;
+				goto done;
 			}
 		}
 		ZERO_ARRAY(hash);
 		status = store_v3_blob(store_acl_blob_fsp_fn, handle, fsp, psd,
 				       NULL, hash);
-
-		TALLOC_FREE(frame);
-		return status;
+		goto done;
 	}
 
 	status = set_underlying_acl(handle, fsp, psd, security_info_sent,
 				    chown_needed);
 	if (!NT_STATUS_IS_OK(status)) {
-		TALLOC_FREE(frame);
-		return status;
+		goto done;
 	}
 
 	/* Get the full underlying sd, then hash. */
@@ -1124,14 +1127,12 @@ NTSTATUS fset_nt_acl_common(
 					  &pdesc_next);
 
 	if (!NT_STATUS_IS_OK(status)) {
-		TALLOC_FREE(frame);
-		return status;
+		goto done;
 	}
 
 	status = hash_sd_sha256(pdesc_next, hash);
 	if (!NT_STATUS_IS_OK(status)) {
-		TALLOC_FREE(frame);
-		return status;
+		goto done;
 	}
 
 	/* Get the full underlying sd, then hash. */
@@ -1147,14 +1148,12 @@ NTSTATUS fset_nt_acl_common(
 		status = store_v3_blob(store_acl_blob_fsp_fn, handle, fsp, psd,
 				       pdesc_next, hash);
 
-		TALLOC_FREE(frame);
-		return status;
+		goto done;
 	}
 
 	status = hash_blob_sha256(sys_acl_blob, sys_acl_hash);
 	if (!NT_STATUS_IS_OK(status)) {
-		TALLOC_FREE(frame);
-		return status;
+		goto done;
 	}
 
 	if (DEBUGLEVEL >= 10) {
@@ -1176,12 +1175,13 @@ NTSTATUS fset_nt_acl_common(
 				     sys_acl_description, sys_acl_hash);
 	if (!NT_STATUS_IS_OK(status)) {
 		DBG_DEBUG("create_sys_acl_blob failed\n");
-		TALLOC_FREE(frame);
-		return status;
+		goto done;
 	}
 
 	status = store_acl_blob_fsp_fn(handle, fsp, &blob);
 
+done:
+	VFS_REMOVE_FSP_EXTENSION(handle, fsp);
 	TALLOC_FREE(frame);
 	return status;
 }
diff --git a/source3/modules/vfs_acl_common.h b/source3/modules/vfs_acl_common.h
index c84448b9f15..c686395bdfa 100644
--- a/source3/modules/vfs_acl_common.h
+++ b/source3/modules/vfs_acl_common.h
@@ -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);
 
diff --git a/source3/modules/vfs_acl_tdb.c b/source3/modules/vfs_acl_tdb.c
index 2fb03c03efc..4439a92557e 100644
--- a/source3/modules/vfs_acl_tdb.c
+++ b/source3/modules/vfs_acl_tdb.c
@@ -369,55 +369,13 @@ static int connect_acl_tdb(struct vfs_handle_struct *handle,
  Remove a Windows ACL - we're setting the underlying POSIX ACL.
 *********************************************************************/
 
-static int sys_acl_set_file_tdb(vfs_handle_struct *handle,
-			const struct smb_filename *smb_fname_in,
-			SMB_ACL_TYPE_T type,
-			SMB_ACL_T theacl)
-{
-	struct db_context *db = acl_db;
-	int ret = -1;
-	int saved_errno = 0;
-	struct smb_filename *smb_fname = NULL;
-
-	smb_fname = cp_smb_filename_nostream(talloc_tos(), smb_fname_in);
-	if (smb_fname == NULL) {
-		return -1;
-	};
-
-	ret = SMB_VFS_STAT(handle->conn, smb_fname);
-	if (ret == -1) {
-		saved_errno = errno;
-		goto fail;
-	}
-
-	ret = SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle,
-						smb_fname,
-						type,
-						theacl);
-	if (ret == -1) {
-		saved_errno = errno;
-		goto fail;
-	}
-
-	acl_tdb_delete(handle, db, &smb_fname->st);
-
-fail:
-	TALLOC_FREE(smb_fname);
-
-	if (saved_errno != 0) {
-		errno = saved_errno;
-	}
-	return ret;
-}
-
-/*********************************************************************
- Remove a Windows ACL - we're setting the underlying POSIX ACL.
-*********************************************************************/
-
 static int sys_acl_set_fd_tdb(vfs_handle_struct *handle,
                             files_struct *fsp,
+			    SMB_ACL_TYPE_T type,
                             SMB_ACL_T theacl)
 {
+	struct acl_common_fsp_ext *ext = (struct acl_common_fsp_ext *)
+		VFS_FETCH_FSP_EXTENSION(handle, fsp);
 	struct db_context *db = acl_db;
 	NTSTATUS status;
 	int ret;
@@ -428,12 +386,17 @@ static int sys_acl_set_fd_tdb(vfs_handle_struct *handle,
 	}
 
 	ret = SMB_VFS_NEXT_SYS_ACL_SET_FD(handle,
-						fsp,
-						theacl);
+					  fsp,
+					  type,
+					  theacl);
 	if (ret == -1) {
 		return -1;
 	}
 
+	if (ext != NULL && ext->setting_nt_acl) {
+		return 0;
+	}
+
 	acl_tdb_delete(handle, db, &fsp->fsp_name->st);
 	return 0;
 }
@@ -490,7 +453,6 @@ static struct vfs_fn_pointers vfs_acl_tdb_fns = {
 	.fget_nt_acl_fn = acl_tdb_fget_nt_acl,
 	.get_nt_acl_at_fn = acl_tdb_get_nt_acl_at,
 	.fset_nt_acl_fn = acl_tdb_fset_nt_acl,
-	.sys_acl_set_file_fn = sys_acl_set_file_tdb,
 	.sys_acl_set_fd_fn = sys_acl_set_fd_tdb
 };
 
diff --git a/source3/modules/vfs_acl_xattr.c b/source3/modules/vfs_acl_xattr.c
index 2f286ed97f7..f5a26ec5592 100644
--- a/source3/modules/vfs_acl_xattr.c
+++ b/source3/modules/vfs_acl_xattr.c
@@ -223,47 +223,32 @@ static NTSTATUS store_acl_blob_fsp(vfs_handle_struct *handle,
  Remove a Windows ACL - we're setting the underlying POSIX ACL.
 *********************************************************************/
 
-static int sys_acl_set_file_xattr(vfs_handle_struct *handle,
-				const struct smb_filename *smb_fname,
+static int sys_acl_set_fd_xattr(vfs_handle_struct *handle,
+				files_struct *fsp,
 				SMB_ACL_TYPE_T type,
 				SMB_ACL_T theacl)
 {
-	int ret = SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle,
-						smb_fname,
-						type,
-						theacl);
+	struct acl_common_fsp_ext *ext = (struct acl_common_fsp_ext *)
+		VFS_FETCH_FSP_EXTENSION(handle, fsp);
+	int ret;
+
+	ret = SMB_VFS_NEXT_SYS_ACL_SET_FD(handle,
+					  fsp,
+					  type,
+					  theacl);
 	if (ret == -1) {
 		return -1;
 	}
 
-	become_root();
-	SMB_VFS_REMOVEXATTR(handle->conn, smb_fname,
-			XATTR_NTACL_NAME);
-	unbecome_root();
-
-	return ret;
-}
-
-/*********************************************************************
- Remove a Windows ACL - we're setting the underlying POSIX ACL.
-*********************************************************************/
-
-static int sys_acl_set_fd_xattr(vfs_handle_struct *handle,
-                            files_struct *fsp,
-                            SMB_ACL_T theacl)
-{
-	int ret = SMB_VFS_NEXT_SYS_ACL_SET_FD(handle,
-						fsp,
-						theacl);
-	if (ret == -1) {
-		return -1;
+	if (ext != NULL && ext->setting_nt_acl) {
+		return 0;
 	}
 
 	become_root();
 	SMB_VFS_FREMOVEXATTR(fsp, XATTR_NTACL_NAME);
 	unbecome_root();
 
-	return ret;
+	return 0;
 }
 


-- 
Samba Shared Repository



More information about the samba-cvs mailing list