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

Jule Anger janger at samba.org
Mon Apr 11 08:51:02 UTC 2022


The branch, v4-16-test has been updated
       via  ef77abc2c49 s3:auth: Fix user_in_list() for UNIX groups
       via  5e59bd41a8c s3:tests Test "username map" for UNIX groups
       via  2b9d29ceb8a selftest: Add to "username.map" mapping for jackthemappergroup
       via  16038d75b2c selftest: Create groups "jackthemappergroup" and "jacknomappergroup"
       via  f09dfc53fd5 selftest: Create users "jackthemapper" and "jacknomapper"
       via  bf221a9b207 vfs_shadow_copy2: implement readdir()
       via  d6b48ec3795 CI: add a test listing a snapshotted directory
       via  829f203c2f3 CI: avoid smb2.twrp being run by plansmbtorture4testsuite() directly
       via  414d890b65e s3: smbd: Preserve the fsp->fsp_name->st buf across a MSG_SMB_FILE_RENAME message.
       via  a68c572869d s3: smbd: Preserve the fsp->fsp_name->st bufs across rename_open_files()
       via  96a8922639d s4: torture: Add test_smb2_close_full_information() test to smb2.rename.
       via  140670f6c05 s4: torture: Add CHECK_CREATED macro to smb2/rename.c. Not yet used.
       via  60386712349 s4: torture: Add CHECK_VAL macro to smb2/rename.c. Not yet used.
       via  552e0867848 s3: tests.py: Only run smb2.rename against fileserver.
       via  0f0c12b64fd s3: smbd: smbd_smb2_setinfo_send(). All calls to SMB_VFS_FSTAT(fsp, &fsp->fsp_name->st) clobber fsp->fsp_name->st.st_ex_iflags.
       via  c8b6ddb08c3 s3: smbd: smbd_smb2_getinfo_send(). All calls to SMB_VFS_FSTAT(fsp, &fsp->fsp_name->st) clobber fsp->fsp_name->st.st_ex_iflags.
       via  c9763e71bc7 s3: cmd_vfs: cmd_set_nt_acl(). All calls to SMB_VFS_FSTAT(fsp, &fsp->fsp_name->st) clobber fsp->fsp_name->st.st_ex_iflags.
       via  b88c1f1bc2f s3: cmd_vfs: cmd_open(). All calls to SMB_VFS_FSTAT(fsp, &fsp->fsp_name->st) clobber fsp->fsp_name->st.st_ex_iflags.
       via  bbf4e324f73 s3: pysmbd.c: init_files_struct(). All calls to SMB_VFS_FSTAT(fsp, &fsp->fsp_name->st) clobber fsp->fsp_name->st.st_ex_iflags.
       via  6d66132ed26 s3: smbd: call_trans2setfilepathinfo(). All calls to SMB_VFS_FSTAT(fsp, &fsp->fsp_name->st) clobber fsp->fsp_name->st.st_ex_iflags.
       via  c48414de71f s3: smbd: call_trans2qfilepathinfo(). All calls to SMB_VFS_FSTAT(fsp, &fsp->fsp_name->st) clobber fsp->fsp_name->st.st_ex_iflags.
       via  386325da318 s3: smbd: rename_internals_fsp(). All calls to SMB_VFS_FSTAT(fsp, &fsp->fsp_name->st) clobber fsp->fsp_name->st.st_ex_iflags.
       via  640b6a01bd8 s3: smbd: mkdir_internal(). 2 of 2. All calls to SMB_VFS_FSTAT(fsp, &fsp->fsp_name->st) clobber fsp->fsp_name->st.st_ex_iflags.
       via  2d7568cd415 s3: smbd: mkdir_internal(). 1 of 2. All calls to SMB_VFS_FSTAT(fsp, &fsp->fsp_name->st) clobber fsp->fsp_name->st.st_ex_iflags.
       via  c2d6b29cf3a s3: smbd: open_file(). All calls to SMB_VFS_FSTAT(fsp, &fsp->fsp_name->st) clobber fsp->fsp_name->st.st_ex_iflags.
       via  09bc8b2bb82 s3: smbd: non_widelink_open(). All calls to SMB_VFS_FSTAT(fsp, &fsp->fsp_name->st) clobber fsp->fsp_name->st.st_ex_iflags.
       via  f46dad0a2b9 s3: smbd: open_internal_dirfsp(). All calls to SMB_VFS_FSTAT(fsp, &fsp->fsp_name->st) clobber fsp->fsp_name->st.st_ex_iflags.
       via  f1030ba8db3 s3: smbd: open_internal_dirfsp() add missing file_free() in error path.
       via  061c2f52f30 s3: smbd: mdssvc: All calls to SMB_VFS_FSTAT(fsp, &fsp->fsp_name->st) clobber fsp->fsp_name->st.st_ex_iflags.
       via  008999b0cab s3: VFS: vxfs: All calls to SMB_VFS_FSTAT(fsp, &fsp->fsp_name->st) clobber fsp->fsp_name->st.st_ex_iflags.
       via  513ca8e0e57 s3: smbd: In set_ea_dos_attribute(), if we've stored btime and set XATTR_DOSINFO_CREATE_TIME successfully, we need to clear ST_EX_IFLAG_CALCULATED_BTIME.
       via  fff4845206e s3: smbd: In set_ea_dos_attribute() cause root fallback code to exit via the same place.
       via  96bf06efad9 s4: torture: Add regression test for re-opening a durable handle after calling SMB2 setinfo (end of file).
      from  19705602653 vfs_gpfs: Initialize litemask to 0

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


- Log -----------------------------------------------------------------
commit ef77abc2c4903b62da501dddc1e9e0c75b979899
Author: Pavel Filipenský <pfilipen at redhat.com>
Date:   Fri Mar 25 11:11:50 2022 +0100

    s3:auth: Fix user_in_list() for UNIX groups
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15041
    
    Signed-off-by: Pavel Filipenský <pfilipen at redhat.com>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Noel Power <npower at samba.org>
    
    Autobuild-User(master): Noel Power <npower at samba.org>
    Autobuild-Date(master): Thu Apr  7 09:49:44 UTC 2022 on sn-devel-184
    
    (cherry picked from commit 6dc463d3e2eb229df1c4f620cfcaf22ac71738d4)
    
    Autobuild-User(v4-16-test): Jule Anger <janger at samba.org>
    Autobuild-Date(v4-16-test): Mon Apr 11 08:51:01 UTC 2022 on sn-devel-184

commit 5e59bd41a8cce710bee8199951dd30b1792ec7b7
Author: Pavel Filipenský <pfilipen at redhat.com>
Date:   Tue Apr 5 14:04:52 2022 +0200

    s3:tests Test "username map" for UNIX groups
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15041
    
    Signed-off-by: Pavel Filipenský <pfilipen at redhat.com>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Noel Power <npower at samba.org>
    (cherry picked from commit af8747a28bd62937a01fa4648f404bd0b09a44c0)

commit 2b9d29ceb8a9c7da0d25f8a470fff574aa66e609
Author: Pavel Filipenský <pfilipen at redhat.com>
Date:   Tue Apr 5 08:31:41 2022 +0200

    selftest: Add to "username.map" mapping for jackthemappergroup
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15041
    
    Only for environment ad_member_idmap_nss.
    
    * !jacknompapper = \@jackthemappergroup
      jackthemaper from group jackthemappergroup is mapped to jacknompapper
    
    * !root = jacknomappergroup
      since there is no '@' or '+' prefix, it is not an UNIX group mapping
    
    Signed-off-by: Pavel Filipenský <pfilipen at redhat.com>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Noel Power <npower at samba.org>
    (cherry picked from commit 0feeb6d58a6d6b1949faa842473053af4562c979)

commit 16038d75b2c554f2a63e06cabd9276c771783bbd
Author: Pavel Filipenský <pfilipen at redhat.com>
Date:   Tue Apr 5 08:30:23 2022 +0200

    selftest: Create groups "jackthemappergroup" and "jacknomappergroup"
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15041
    
    Signed-off-by: Pavel Filipenský <pfilipen at redhat.com>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Noel Power <npower at samba.org>
    (cherry picked from commit 26e4268d6e3bde74520e36f3ca3cc9d979292d1d)

commit f09dfc53fd5eb4550ae1d0c574423e94e3f1f9bd
Author: Pavel Filipenský <pfilipen at redhat.com>
Date:   Fri Apr 1 15:56:30 2022 +0200

    selftest: Create users "jackthemapper" and "jacknomapper"
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15041
    
    Signed-off-by: Pavel Filipenský <pfilipen at redhat.com>
    Reviewed-by: Noel Power <npower at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 1b0146182224fe01ed70815364656a626038685a)

commit bf221a9b207dcd085171fbe8458e33a96a1d0869
Author: Ralph Boehme <slow at samba.org>
Date:   Thu Mar 24 16:25:22 2022 +0100

    vfs_shadow_copy2: implement readdir()
    
    RN: shadow_copy2 fails listing snapshotted dirs with shadow:fixinodes
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15035
    
    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 Mar 31 18:47:42 UTC 2022 on sn-devel-184
    
    (cherry picked from commit 9fa67ba8eeb6249d4b91b894e80eb1985c845314)

commit d6b48ec3795bf4bb6b7665be6ce9009932f59db6
Author: Ralph Boehme <slow at samba.org>
Date:   Thu Mar 24 17:31:00 2022 +0100

    CI: add a test listing a snapshotted directory
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15035
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit ba9c5ba8ec54e72d68e3f753a5350afe0fb50a7c)

commit 829f203c2f3838d619e845d02d25c9443703ec4a
Author: Ralph Boehme <slow at samba.org>
Date:   Mon Mar 28 20:05:26 2022 +0200

    CI: avoid smb2.twrp being run by plansmbtorture4testsuite() directly
    
    This should only be run by a blackbox test.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15035
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (backported from commit f734e960eb7ad98808ad8757de51c51d3db86a2b)
    [slow at samba.org: conflict in source3/selftest/tests.py caused by new test in master not present in 4.16]

commit 414d890b65ef742acb736484525dd54039e09c18
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Mar 28 18:39:55 2022 -0700

    s3: smbd: Preserve the fsp->fsp_name->st buf across a MSG_SMB_FILE_RENAME message.
    
    Remove knownfail.d/rename-full-info
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15038
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    
    (Back-ported from commit 06bfac2125da5e4d37a596d1213912f0c698e69e)

commit a68c572869dbf31104404dfef0949dabea77c4d3
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Mar 28 18:42:18 2022 -0700

    s3: smbd: Preserve the fsp->fsp_name->st bufs across rename_open_files()
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15038
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    
    (cherry picked from commit 5e1aa469ae61af0442f432e0a2e3bf8c8709616a)

commit 96a8922639d5ad9dc5005c5a1b1d747686a0d44f
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Mar 28 18:25:54 2022 -0700

    s4: torture: Add test_smb2_close_full_information() test to smb2.rename.
    
    Creates a file, opens it again on two different connections
    and then renames it. When we close and ask for SMB2_CLOSE_FLAGS_FULL_INFORMATION
    we expect this to succeed and return valid data on the handles that did not do
    the rename request.
    
    This currently succeeds by accident on master, so we are not
    adding a knownfail.d/ file here. When we back-port this test
    to 4.16.next, 4.15.next we will add a knownfail.d file.
    
    The rename request zeros out the fsp->fsp_name->st field on the handles
    that are open but are not being renamed, marking them as INVALID_STAT.
    
    This should not happen on any open handle. Fix to follow will
    preserve the field on rename in both the local connection and
    different connection case.
    
    Master gets away with this as in this branch, openat_pathref_fsp(),
    which we use in the setup_close_full_information() call to fetch
    the SMB2_CLOSE_FLAGS_FULL_INFORMATION data doesn't require an
    existing VALID_STAT struct in order to open the file. This
    hides the fact the rename zeroed out fsp->fsp_name->st.
    
    4.16.x and 4.15.x don't have this fix, so expose the bug.
    Regardless, even in master we should not zero out any
    fsp->fsp_name->st values on rename.
    
    Add knownfail.d/rename-full-info for 4.16.x, 4.15.x.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15038
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    
    (Back-ported from commit 1301e6461393601a4d43cfc465a05114e6ae4662)

commit 140670f6c05846f004ed70a3642780b3fa199bac
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Mar 28 18:24:27 2022 -0700

    s4: torture: Add CHECK_CREATED macro to smb2/rename.c. Not yet used.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15038
    Reviewed-by: Ralph Boehme <slow at samba.org>
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 4725ef5c96395dc2f48fab1160a3312d95e21416)

commit 60386712349f2a9f48f38fdc7c8dca8d4f635640
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Mar 28 18:23:05 2022 -0700

    s4: torture: Add CHECK_VAL macro to smb2/rename.c. Not yet used.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15038
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    (cherry picked from commit e862a2d9ec4e7bec1dd58490e9dee47d543b9154)

commit 552e0867848486629cc18bf52f7922768f41e1d5
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Mar 28 18:09:20 2022 -0700

    s3: tests.py: Only run smb2.rename against fileserver.
    
    No need to run this against nt4_dc or ad_dc.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15038
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    
    (Back-ported from commit e01c5992b061d8ed54645fff52a73418013340ab)

commit 0f0c12b64fd56f32d19aaa54e20e5b0307e0a30d
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Mar 18 12:30:27 2022 -0700

    s3: smbd: smbd_smb2_setinfo_send(). All calls to SMB_VFS_FSTAT(fsp, &fsp->fsp_name->st) clobber fsp->fsp_name->st.st_ex_iflags.
    
    If doing an SMB_VFS_FSTAT() returning onto the stat struct stored in the fsp,
    we must call vfs_stat_fsp() as this preserves the iflags.
    
    This is the last SMB_VFS_FSTAT that uses fsp->fsp_name->st, so
    remove knownfail.d/durable-v2-setinfo
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15022
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Thu Mar 24 17:21:29 UTC 2022 on sn-devel-184
    
    (cherry picked from commit c4f9c372405bea8a7d9c6b39e04cebefa3322a19)

commit c8b6ddb08c389567c7afa8de1aeeea314084668a
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Mar 18 11:45:50 2022 -0700

    s3: smbd: smbd_smb2_getinfo_send(). All calls to SMB_VFS_FSTAT(fsp, &fsp->fsp_name->st) clobber fsp->fsp_name->st.st_ex_iflags.
    
    If doing an SMB_VFS_FSTAT() returning onto the stat struct stored in the fsp,
    we must call vfs_stat_fsp() as this preserves the iflags.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15022
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    (cherry picked from commit 7fb2038faca256c03c2bd7d982f39f5b1a57f784)

commit c9763e71bc70f2d75aa45c86b8b196c4ceabee88
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Mar 18 15:04:34 2022 -0700

    s3: cmd_vfs: cmd_set_nt_acl(). All calls to SMB_VFS_FSTAT(fsp, &fsp->fsp_name->st) clobber fsp->fsp_name->st.st_ex_iflags.
    
    If doing an SMB_VFS_FSTAT() returning onto the stat struct stored in the fsp,
    we must call vfs_stat_fsp() as this preserves the iflags.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15022
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    (cherry picked from commit 23d5c909286d438534f1a7defb2faacd1877fea1)

commit b88c1f1bc2f8687b0c200afb5d943ba60f1e17e0
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Mar 18 15:01:52 2022 -0700

    s3: cmd_vfs: cmd_open(). All calls to SMB_VFS_FSTAT(fsp, &fsp->fsp_name->st) clobber fsp->fsp_name->st.st_ex_iflags.
    
    If doing an SMB_VFS_FSTAT() returning onto the stat struct stored in the fsp,
    we must call vfs_stat_fsp() as this preserves the iflags.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15022
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    (cherry picked from commit fbc6cdfbeda4086851dfb0f91fd23b4fd541e174)

commit bbf4e324f73f1a197eedc69fd584c8ca6b77c980
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Mar 18 14:57:13 2022 -0700

    s3: pysmbd.c: init_files_struct(). All calls to SMB_VFS_FSTAT(fsp, &fsp->fsp_name->st) clobber fsp->fsp_name->st.st_ex_iflags.
    
    If doing an SMB_VFS_FSTAT() returning onto the stat struct stored in the fsp,
    we must call vfs_stat_fsp() as this preserves the iflags.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15022
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    (cherry picked from commit c4193f11d1871051d4cce4521b1f444a083c9189)

commit 6d66132ed267b0b4eb92369d8ec2883f734946c6
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Mar 18 12:27:53 2022 -0700

    s3: smbd: call_trans2setfilepathinfo(). All calls to SMB_VFS_FSTAT(fsp, &fsp->fsp_name->st) clobber fsp->fsp_name->st.st_ex_iflags.
    
    If doing an SMB_VFS_FSTAT() returning onto the stat struct stored in the fsp,
    we must call vfs_stat_fsp() as this preserves the iflags.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15022
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    (cherry picked from commit 6a25b6997ff9f99fde309db1e163d16cd70ca5f5)

commit c48414de71f5bae3bf05324a8ac134b763446b89
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Mar 18 12:26:27 2022 -0700

    s3: smbd: call_trans2qfilepathinfo(). All calls to SMB_VFS_FSTAT(fsp, &fsp->fsp_name->st) clobber fsp->fsp_name->st.st_ex_iflags.
    
    If doing an SMB_VFS_FSTAT() returning onto the stat struct stored in the fsp,
    we must call vfs_stat_fsp() as this preserves the iflags.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15022
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    (cherry picked from commit 8d3812daa5b0c9eb534515d37498d0d6e1a40ec8)

commit 386325da318f642dd54f1b41a69e61630ea1a4e1
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Mar 18 12:24:27 2022 -0700

    s3: smbd: rename_internals_fsp(). All calls to SMB_VFS_FSTAT(fsp, &fsp->fsp_name->st) clobber fsp->fsp_name->st.st_ex_iflags.
    
    If doing an SMB_VFS_FSTAT() returning onto the stat struct stored in the fsp,
    we must call vfs_stat_fsp() as this preserves the iflags.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15022
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    (cherry picked from commit b53a69f4ffcaa5ec9b8660152802f5a7b2effc1f)

commit 640b6a01bd8f6467ae134b59c9188344548e5354
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Mar 18 12:22:26 2022 -0700

    s3: smbd: mkdir_internal(). 2 of 2. All calls to SMB_VFS_FSTAT(fsp, &fsp->fsp_name->st) clobber fsp->fsp_name->st.st_ex_iflags.
    
    If doing an SMB_VFS_FSTAT() returning onto the stat struct stored in the fsp,
    we must call vfs_stat_fsp() as this preserves the iflags.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15022
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    (cherry picked from commit 7f5c484804c87f37493e1f79d5c7e1738a4e0113)

commit 2d7568cd4151232fed9e5932b339d3a31fd16dba
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Mar 18 12:19:44 2022 -0700

    s3: smbd: mkdir_internal(). 1 of 2. All calls to SMB_VFS_FSTAT(fsp, &fsp->fsp_name->st) clobber fsp->fsp_name->st.st_ex_iflags.
    
    If doing an SMB_VFS_FSTAT() returning onto the stat struct stored in the fsp,
    we must call vfs_stat_fsp() as this preserves the iflags.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15022
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    (cherry picked from commit 064c5770deb4307272c60f0b08f6bc137df4b227)

commit c2d6b29cf3aac177bcb4d82cfbbd9b60efbc6220
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Mar 18 12:11:23 2022 -0700

    s3: smbd: open_file(). All calls to SMB_VFS_FSTAT(fsp, &fsp->fsp_name->st) clobber fsp->fsp_name->st.st_ex_iflags.
    
    If doing an SMB_VFS_FSTAT() returning onto the stat struct stored in the fsp,
    we must call vfs_stat_fsp() as this preserves the iflags.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15022
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    (cherry picked from commit cfadecca802600fa9a01fa9781e4df9a0b71fa3c)

commit 09bc8b2bb8209c63550aa04ee8cf49b46631b68e
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Mar 18 12:09:43 2022 -0700

    s3: smbd: non_widelink_open(). All calls to SMB_VFS_FSTAT(fsp, &fsp->fsp_name->st) clobber fsp->fsp_name->st.st_ex_iflags.
    
    If doing an SMB_VFS_FSTAT() returning onto the stat struct stored in the fsp,
    we must call vfs_stat_fsp() as this preserves the iflags.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15022
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    (cherry picked from commit 18694c81cc3c3d94dc99e3b11878021052279eb6)

commit f46dad0a2b9c11315c587bbf07b749f41631603e
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Mar 18 12:02:35 2022 -0700

    s3: smbd: open_internal_dirfsp(). All calls to SMB_VFS_FSTAT(fsp, &fsp->fsp_name->st) clobber fsp->fsp_name->st.st_ex_iflags.
    
    If doing an SMB_VFS_FSTAT() returning onto the stat struct stored in the fsp,
    we must call vfs_stat_fsp() as this preserves the iflags.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15022
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    (cherry picked from commit a604dd02ffb468ba472ac4dd64f06d30ecdcc810)

commit f1030ba8db34b6e5026d5e78bb99a5cddf26220b
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Mar 18 12:00:15 2022 -0700

    s3: smbd: open_internal_dirfsp() add missing file_free() in error path.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15022
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    (cherry picked from commit ec2fb9d22842332992b8f667a8218f7aaa1be7c4)

commit 061c2f52f3027646b36fe82b2ab91288951d536e
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Mar 18 11:56:53 2022 -0700

    s3: smbd: mdssvc: All calls to SMB_VFS_FSTAT(fsp, &fsp->fsp_name->st) clobber fsp->fsp_name->st.st_ex_iflags.
    
    If doing an SMB_VFS_FSTAT() returning onto the stat struct stored in the fsp,
    we must call vfs_stat_fsp() as this preserves the iflags.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15022
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    (cherry picked from commit 2b246dbf687cbb6ef1e31e22fd64a95bdca8f4e9)

commit 008999b0cab8098119393486f9774406ad70214e
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Mar 18 11:51:00 2022 -0700

    s3: VFS: vxfs: All calls to SMB_VFS_FSTAT(fsp, &fsp->fsp_name->st) clobber fsp->fsp_name->st.st_ex_iflags.
    
    If doing an SMB_VFS_FSTAT() returning onto the stat struct stored in the fsp,
    we must call vfs_stat_fsp() as this preserves the iflags.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15022
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    (cherry picked from commit d460118be3ad2a3100bb3458f6f0223df12f7c3f)

commit 513ca8e0e57eb482362aeb76a453882e527e2e90
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Mar 18 11:41:48 2022 -0700

    s3: smbd: In set_ea_dos_attribute(), if we've stored btime and set XATTR_DOSINFO_CREATE_TIME successfully, we need to clear ST_EX_IFLAG_CALCULATED_BTIME.
    
    This is no longer a calculated field, every call to fdos_mode() will
    set it as non-calculated.
    
    https://bugzilla.samba.org/show_bug.cgi?id=15022
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    (cherry picked from commit 2fc0820afcd375594b1d99edcd651420bea6ac91)

commit fff4845206ec7157e2fc81f3afa9fcb2305c0790
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Mar 18 11:40:04 2022 -0700

    s3: smbd: In set_ea_dos_attribute() cause root fallback code to exit via the same place.
    
    We're going to add another action on success next.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15022
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    (cherry picked from commit 9f62a149f12e899dbc2a7bac9458e7a375bf6608)

commit 96bf06efad9412fd81d39d5fb320c3e0d03d8011
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Mar 18 14:52:02 2022 -0700

    s4: torture: Add regression test for re-opening a durable handle after calling SMB2 setinfo (end of file).
    
    This is an implementation of a test written by Apple for their
    client. Currently fails to reconnect due to btime being overwritten
    incorrectly in the SMB2 setinfo path.
    
    Add knownfail.d/durable-v2-setinfo
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=15022
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    (cherry picked from commit 0036617a5c76e6003e3c9a5039c325d77d897709)

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

Summary of changes:
 selftest/target/Samba3.pm                        |  20 ++-
 source3/auth/user_util.c                         |  12 +-
 source3/modules/vfs_shadow_copy2.c               |  91 ++++++++++++
 source3/modules/vfs_vxfs.c                       |   6 +-
 source3/rpc_server/mdssvc/mdssvc.c               |   6 +-
 source3/script/tests/test_shadow_copy_torture.sh |  21 +++
 source3/script/tests/test_usernamemap.sh         |  28 ++++
 source3/selftest/tests.py                        |   7 +
 source3/smbd/dosmode.c                           |  15 +-
 source3/smbd/files.c                             |   8 +-
 source3/smbd/open.c                              |  44 ++++--
 source3/smbd/pysmbd.c                            |   9 +-
 source3/smbd/reply.c                             |  19 ++-
 source3/smbd/smb2_getinfo.c                      |   6 +-
 source3/smbd/smb2_setinfo.c                      |   6 +-
 source3/smbd/trans2.c                            |  15 +-
 source3/torture/cmd_vfs.c                        |  21 +--
 source4/selftest/tests.py                        |   1 +
 source4/torture/smb2/create.c                    | 168 +++++++++++++++++++++++
 source4/torture/smb2/durable_v2_open.c           | 140 +++++++++++++++++++
 source4/torture/smb2/rename.c                    | 147 ++++++++++++++++++++
 21 files changed, 727 insertions(+), 63 deletions(-)
 create mode 100755 source3/script/tests/test_usernamemap.sh


Changeset truncated at 500 lines:

diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm
index a51e04ecf83..e1d301898d3 100755
--- a/selftest/target/Samba3.pm
+++ b/selftest/target/Samba3.pm
@@ -1472,8 +1472,10 @@ sub setup_ad_member_idmap_nss
 	my $extra_member_options = "
 	# bob:x:65521:65531:localbob gecos:/:/bin/false
 	# jane:x:65520:65531:localjane gecos:/:/bin/false
+	# jackthemapper:x:65519:65531:localjackthemaper gecos:/:/bin/false
+	# jacknomapper:x:65518:65531:localjacknomaper gecos:/:/bin/false
 	idmap config $dcvars->{DOMAIN} : backend = nss
-	idmap config $dcvars->{DOMAIN} : range = 65520-65521
+	idmap config $dcvars->{DOMAIN} : range = 65518-65521
 
 	# Support SMB1 so that we can use posix_whoami().
 	client min protocol = CORE
@@ -1494,6 +1496,8 @@ sub setup_ad_member_idmap_nss
 
 	open(USERMAP, ">$prefix/lib/username.map") or die("Unable to open $prefix/lib/username.map");
 	print USERMAP "
+!jacknomapper = \@jackthemappergroup
+!root = jacknomappergroup
 root = $dcvars->{DOMAIN}/root
 bob = $dcvars->{DOMAIN}/bob
 ";
@@ -2566,6 +2570,8 @@ sub provision($$)
 	my ($gid_nobody, $gid_nogroup, $gid_root, $gid_domusers, $gid_domadmins);
 	my ($gid_userdup, $gid_everyone);
 	my ($gid_force_user);
+	my ($gid_jackthemapper);
+	my ($gid_jacknomapper);
 	my ($uid_user1);
 	my ($uid_user2);
 	my ($uid_gooduser);
@@ -2573,6 +2579,8 @@ sub provision($$)
 	my ($uid_slashuser);
 	my ($uid_localbob);
 	my ($uid_localjane);
+	my ($uid_localjackthemapper);
+	my ($uid_localjacknomapper);
 
 	if ($unix_uid < 0xffff - 13) {
 		$max_uid = 0xffff;
@@ -2595,6 +2603,8 @@ sub provision($$)
 	$uid_slashuser = $max_uid - 13;
 	$uid_localbob = $max_uid - 14;
 	$uid_localjane = $max_uid - 15;
+	$uid_localjackthemapper = $max_uid - 16;
+	$uid_localjacknomapper = $max_uid - 17;
 
 	if ($unix_gids[0] < 0xffff - 8) {
 		$max_gid = 0xffff;
@@ -2610,6 +2620,8 @@ sub provision($$)
 	$gid_userdup = $max_gid - 6;
 	$gid_everyone = $max_gid - 7;
 	$gid_force_user = $max_gid - 8;
+	$gid_jackthemapper = $max_gid - 9;
+	$gid_jacknomapper = $max_gid - 10;
 
 	##
 	## create conffile
@@ -3339,6 +3351,8 @@ eviluser:x:$uid_eviluser:$gid_domusers:eviluser gecos::/bin/false
 slashuser:x:$uid_slashuser:$gid_domusers:slashuser gecos:/:/bin/false
 bob:x:$uid_localbob:$gid_domusers:localbob gecos:/:/bin/false
 jane:x:$uid_localjane:$gid_domusers:localjane gecos:/:/bin/false
+jackthemapper:x:$uid_localjackthemapper:$gid_domusers:localjackthemaper gecos:/:/bin/false
+jacknomapper:x:$uid_localjacknomapper:$gid_domusers:localjacknomaper gecos:/:/bin/false
 ";
 	if ($unix_uid != 0) {
 		print PASSWD "root:x:$uid_root:$gid_root:root gecos:$prefix_abs:/bin/false
@@ -3358,6 +3372,8 @@ domadmins:X:$gid_domadmins:
 userdup:x:$gid_userdup:$unix_name
 everyone:x:$gid_everyone:
 force_user:x:$gid_force_user:
+jackthemappergroup:x:$gid_jackthemapper:jackthemapper
+jacknomappergroup:x:$gid_jacknomapper:jacknomapper
 ";
 	if ($unix_gids[0] != 0) {
 		print GROUP "root:x:$gid_root:
@@ -3403,6 +3419,8 @@ force_user:x:$gid_force_user:
 	createuser($self, "gooduser", $password, $conffile, \%createuser_env) || die("Unable to create gooduser");
 	createuser($self, "eviluser", $password, $conffile, \%createuser_env) || die("Unable to create eviluser");
 	createuser($self, "slashuser", $password, $conffile, \%createuser_env) || die("Unable to create slashuser");
+	createuser($self, "jackthemapper", "mApsEcrEt", $conffile, \%createuser_env) || die("Unable to create jackthemapper");
+	createuser($self, "jacknomapper", "nOmApsEcrEt", $conffile, \%createuser_env) || die("Unable to create jacknomapper");
 
 	open(DNS_UPDATE_LIST, ">$prefix/dns_update_list") or die("Unable to open $$prefix/dns_update_list");
 	print DNS_UPDATE_LIST "A $server. $server_ip\n";
diff --git a/source3/auth/user_util.c b/source3/auth/user_util.c
index 70b4f320c5e..aa765c2a692 100644
--- a/source3/auth/user_util.c
+++ b/source3/auth/user_util.c
@@ -143,11 +143,11 @@ bool user_in_list(TALLOC_CTX *ctx, const char *user, const char * const *list)
 		return false;
 	}
 
-	DBG_DEBUG("Checking user %s in list\n", user);
-
 	while (*list) {
 		const char *p = *list;
-		bool ok;
+		bool check_unix_group = false;
+
+		DBG_DEBUG("Checking user '%s' in list '%s'.\n", user, *list);
 
 		/* Check raw username */
 		if (strequal(user, p)) {
@@ -155,11 +155,13 @@ bool user_in_list(TALLOC_CTX *ctx, const char *user, const char * const *list)
 		}
 
 		while (*p == '@' || *p == '&' || *p == '+') {
+			if (*p == '@' || *p == '+') {
+				check_unix_group = true;
+			}
 			p++;
 		}
 
-		ok = user_in_group(user, p);
-		if (ok) {
+		if (check_unix_group && user_in_group(user, p)) {
 			return true;
 		}
 
diff --git a/source3/modules/vfs_shadow_copy2.c b/source3/modules/vfs_shadow_copy2.c
index 769f8c7da87..05b12d4924c 100644
--- a/source3/modules/vfs_shadow_copy2.c
+++ b/source3/modules/vfs_shadow_copy2.c
@@ -3234,6 +3234,96 @@ static int shadow_copy2_connect(struct vfs_handle_struct *handle,
 	return 0;
 }
 
+static struct dirent *shadow_copy2_readdir(vfs_handle_struct *handle,
+					   struct files_struct *dirfsp,
+					   DIR *dirp,
+					   SMB_STRUCT_STAT *sbuf)
+{
+	struct shadow_copy2_private *priv = NULL;
+	struct dirent *ent = NULL;
+	struct smb_filename atname;
+	struct smb_filename *full_fname = NULL;
+	time_t timestamp = 0;
+	char *stripped = NULL;
+	char *conv = NULL;
+	char *abspath = NULL;
+	bool converted = false;
+
+	SMB_VFS_HANDLE_GET_DATA(handle, priv, struct shadow_copy2_private,
+				return NULL);
+
+	ent = SMB_VFS_NEXT_READDIR(handle, dirfsp, dirp, sbuf);
+	if (ent == NULL) {
+		return NULL;
+	}
+	if (sbuf == NULL) {
+		return ent;
+	}
+	if (ISDOT(dirfsp->fsp_name->base_name) && ISDOTDOT(ent->d_name)) {
+		return ent;
+	}
+
+	atname = (struct smb_filename) {
+		.base_name = ent->d_name,
+		.twrp = dirfsp->fsp_name->twrp,
+		.flags = dirfsp->fsp_name->flags,
+	};
+
+	full_fname = full_path_from_dirfsp_atname(talloc_tos(),
+						  dirfsp,
+						  &atname);
+	if (full_fname == NULL) {
+		return NULL;
+	}
+
+	if (!shadow_copy2_strip_snapshot_converted(talloc_tos(),
+						   handle,
+						   full_fname,
+						   &timestamp,
+						   &stripped,
+						   &converted)) {
+		TALLOC_FREE(full_fname);
+		return NULL;
+	}
+
+	if (timestamp == 0 && !converted) {
+		/* Not a snapshot path, no need for convert_sbuf() */
+		TALLOC_FREE(stripped);
+		TALLOC_FREE(full_fname);
+		return ent;
+	}
+
+	if (timestamp == 0) {
+		abspath = make_path_absolute(talloc_tos(),
+					     priv,
+					     full_fname->base_name);
+		TALLOC_FREE(full_fname);
+		if (abspath == NULL) {
+			return NULL;
+		}
+	} else {
+		conv = shadow_copy2_convert(talloc_tos(),
+					    handle,
+					    stripped,
+					    timestamp);
+		TALLOC_FREE(stripped);
+		if (conv == NULL) {
+			return NULL;
+		}
+
+		abspath = make_path_absolute(talloc_tos(), priv, conv);
+		TALLOC_FREE(conv);
+		if (abspath == NULL) {
+			return NULL;
+		}
+	}
+
+	convert_sbuf(handle, abspath, sbuf);
+
+	TALLOC_FREE(abspath);
+	return ent;
+}
+
 static struct vfs_fn_pointers vfs_shadow_copy2_fns = {
 	.connect_fn = shadow_copy2_connect,
 	.disk_free_fn = shadow_copy2_disk_free,
@@ -3264,6 +3354,7 @@ static struct vfs_fn_pointers vfs_shadow_copy2_fns = {
 	.pwrite_recv_fn = shadow_copy2_pwrite_recv,
 	.connectpath_fn = shadow_copy2_connectpath,
 	.parent_pathname_fn = shadow_copy2_parent_pathname,
+	.readdir_fn = shadow_copy2_readdir,
 };
 
 static_decl_vfs;
diff --git a/source3/modules/vfs_vxfs.c b/source3/modules/vfs_vxfs.c
index 75945cc476c..ddd34ba812a 100644
--- a/source3/modules/vfs_vxfs.c
+++ b/source3/modules/vfs_vxfs.c
@@ -407,6 +407,7 @@ static bool vxfs_compare(struct files_struct *fsp,
 	TALLOC_CTX *mem_ctx = talloc_tos();
 	char *existing_buf = NULL, *new_buf = NULL, *compact_buf = NULL;
 	int status;
+	NTSTATUS ntstatus;
 
 	DEBUG(10, ("vfs_vxfs: Getting existing ACL for %s\n", fsp_str_dbg(fsp)));
 
@@ -424,9 +425,10 @@ static bool vxfs_compare(struct files_struct *fsp,
 		goto out;
 	}
 
-	status = SMB_VFS_FSTAT(fsp, &fsp->fsp_name->st);
-	if (status == -1) {
+	ntstatus = vfs_stat_fsp(fsp);
+	if (!NT_STATUS_IS_OK(ntstatus)) {
 		DEBUG(10, ("vfs_vxfs: stat failed!\n"));
+		errno = map_errno_from_nt_status(ntstatus);
 		goto out;
 	}
 
diff --git a/source3/rpc_server/mdssvc/mdssvc.c b/source3/rpc_server/mdssvc/mdssvc.c
index fa31b55a183..956e097eaf4 100644
--- a/source3/rpc_server/mdssvc/mdssvc.c
+++ b/source3/rpc_server/mdssvc/mdssvc.c
@@ -1354,13 +1354,13 @@ static bool slrpc_fetch_attributes(struct mds_ctx *mds_ctx,
 			return true;
 		}
 
-		result = SMB_VFS_FSTAT(smb_fname->fsp, &smb_fname->st);
-		if (result != 0) {
+		status = vfs_stat_fsp(smb_fname->fsp);
+		if (!NT_STATUS_IS_OK(status)) {
 			TALLOC_FREE(smb_fname);
 			return true;
 		}
 
-		sp = &smb_fname->st;
+		sp = &smb_fname->fsp->fsp_name->st;
 	}
 
 	ok = add_filemeta(mds_ctx, reqinfo, fm_array, path, sp);
diff --git a/source3/script/tests/test_shadow_copy_torture.sh b/source3/script/tests/test_shadow_copy_torture.sh
index 4ae2f9f707f..8f9d1be6927 100755
--- a/source3/script/tests/test_shadow_copy_torture.sh
+++ b/source3/script/tests/test_shadow_copy_torture.sh
@@ -191,6 +191,25 @@ test_hiddenfile()
     return 0
 }
 
+test_shadow_copy_listdir_fix_inodes()
+{
+    local msg
+
+    msg=$1
+
+    #delete snapshots from previous tests
+    find $WORKDIR -name ".snapshots" -exec rm -rf {} \; 1>/dev/null 2>&1
+    build_snapshots
+
+    testit "$msg" \
+	   $SMBTORTURE \
+	   -U$USERNAME%$PASSWORD \
+	   "//$SERVER/shadow_write" \
+	   --option="torture:twrp_snapshot=$SNAPSHOT" \
+	   smb2.twrp.listdir || \
+        failed=`expr $failed + 1`
+}
+
 build_files $WORKDIR
 
 # test open for writing and write behaviour of snapshoted files
@@ -204,4 +223,6 @@ testit "fix inodes with hardlink" test_shadow_copy_fix_inodes || failed=`expr $f
 
 testit "Test reading DOS attribute" test_hiddenfile || failed=`expr $failed + 1`
 
+test_shadow_copy_listdir_fix_inodes "fix inodes when listing directory"
+
 exit $failed
diff --git a/source3/script/tests/test_usernamemap.sh b/source3/script/tests/test_usernamemap.sh
new file mode 100755
index 00000000000..3a3344a8781
--- /dev/null
+++ b/source3/script/tests/test_usernamemap.sh
@@ -0,0 +1,28 @@
+#!/bin/sh
+#
+# Copyright (c) 2022 Pavel Filipenský <pfilipen at redhat.com>
+#
+# Tests for "username map" smb.conf parameter for UNIX groups
+
+if [ $# -lt 2 ]; then
+cat <<EOF
+Usage: test_usernamemap.sh SERVER SMBCLIENT
+EOF
+exit 1;
+fi
+
+SERVER="$1"
+SMBCLIENT="$2"
+SMBCLIENT="${VALGRIND} ${SMBCLIENT}"
+
+incdir=$(dirname "$0")/../../../testprogs/blackbox
+. "${incdir}"/subunit.sh
+
+failed=0
+
+# jackthemapper is mapped to jacknomapper, so we need jacknomapper password
+testit "jackthemapper" "${SMBCLIENT}" //"${SERVER}"/tmp -U"${SERVER}/jackthemapper%nOmApsEcrEt" -c ls || failed=$((failed + 1))
+# jacknomapper is not mapped, so we need jacknomapper password
+testit "jacknomapper"  "${SMBCLIENT}" //"${SERVER}"/tmp -U"${SERVER}/jacknomapper%nOmApsEcrEt"  -c ls || failed=$((failed + 1))
+
+testok "$0" "${failed}"
diff --git a/source3/selftest/tests.py b/source3/selftest/tests.py
index 7fbc5e385fc..61f56666fa8 100755
--- a/source3/selftest/tests.py
+++ b/source3/selftest/tests.py
@@ -401,6 +401,8 @@ plantestsuite("samba3.blackbox.smbclient_basic.SMB2_10", "nt4_dc_schannel", [os.
 plantestsuite("samba3.blackbox.smbclient_basic.SMB3_02", "nt4_dc_schannel", [os.path.join(samba3srcdir, "script/tests/test_smbclient_basic.sh"), '$SERVER', '$SERVER_IP', '$DC_USERNAME', '$DC_PASSWORD', smbclient3, configuration, "-mSMB3_02"])
 plantestsuite("samba3.blackbox.smbclient_basic.SMB3_11", "nt4_dc_schannel", [os.path.join(samba3srcdir, "script/tests/test_smbclient_basic.sh"), '$SERVER', '$SERVER_IP', '$DC_USERNAME', '$DC_PASSWORD', smbclient3, configuration, "-mSMB3_11"])
 
+plantestsuite("samba3.blackbox.smbclient_usernamemap", "ad_member_idmap_nss:local", [os.path.join(samba3srcdir, "script/tests/test_usernamemap.sh"), '$SERVER', smbclient3])
+
 plantestsuite("samba3.blackbox.smbclient_basic", "ad_member", [os.path.join(samba3srcdir, "script/tests/test_smbclient_basic.sh"), '$SERVER', '$SERVER_IP', '$DC_USERNAME', '$DC_PASSWORD', smbclient3, configuration])
 for options in ["", "--option=clientntlmv2auth=no", "--option=clientusespnego=no", "--option=clientusespnego=no --option=clientntlmv2auth=no", "--option=clientntlmv2auth=no --option=clientlanmanauth=yes --max-protocol=LANMAN2", "--option=clientntlmv2auth=no --option=clientlanmanauth=yes --option=clientmaxprotocol=NT1"]:
     if "NT1" in options or "LANMAN2" in options:
@@ -1015,6 +1017,11 @@ for t in tests:
         plansmbtorture4testsuite("smb2.async_dosmode",
                                  "simpleserver",
                                  "//$SERVER_IP/async_dosmode_shadow_copy2 -U$USERNAME%$PASSWORD")
+    elif t == "smb2.rename":
+        plansmbtorture4testsuite(t, "fileserver", '//$SERVER_IP/tmp -U$USERNAME%$PASSWORD')
+    elif t == "smb2.twrp":
+        # This is being driven by samba3.blackbox.shadow_copy_torture
+        pass
     elif t == "rpc.wkssvc":
         plansmbtorture4testsuite(t, "ad_member", '//$SERVER/tmp -U$DC_USERNAME%$DC_PASSWORD')
     elif t == "rpc.srvsvc":
diff --git a/source3/smbd/dosmode.c b/source3/smbd/dosmode.c
index c0208ffa0a5..31e3da32edc 100644
--- a/source3/smbd/dosmode.c
+++ b/source3/smbd/dosmode.c
@@ -521,8 +521,21 @@ NTSTATUS set_ea_dos_attribute(connection_struct *conn,
 			status = NT_STATUS_OK;
 		}
 		unbecome_root();
-		return status;
+		if (!NT_STATUS_IS_OK(status)) {
+			return status;
+		}
 	}
+
+	/*
+	 * We correctly stored the create time.
+	 * We *always* set XATTR_DOSINFO_CREATE_TIME,
+	 * so now it can no longer be considered
+	 * calculated.
+	 */
+	update_stat_ex_create_time(
+		&smb_fname->fsp->fsp_name->st,
+		smb_fname->st.st_ex_btime);
+
 	DEBUG(10,("set_ea_dos_attribute: set EA 0x%x on file %s\n",
 		(unsigned int)dosmode,
 		smb_fname_str_dbg(smb_fname)));
diff --git a/source3/smbd/files.c b/source3/smbd/files.c
index 677b600d0a6..704d3d84316 100644
--- a/source3/smbd/files.c
+++ b/source3/smbd/files.c
@@ -245,7 +245,6 @@ NTSTATUS open_internal_dirfsp(connection_struct *conn,
 {
 	struct files_struct *fsp = NULL;
 	NTSTATUS status;
-	int ret;
 
 	status = create_internal_dirfsp(conn, smb_dname, &fsp);
 	if (!NT_STATUS_IS_OK(status)) {
@@ -264,9 +263,10 @@ NTSTATUS open_internal_dirfsp(connection_struct *conn,
 		return status;
 	}
 
-	ret = SMB_VFS_FSTAT(fsp, &fsp->fsp_name->st);
-	if (ret != 0) {
-		return map_nt_error_from_unix(errno);
+	status = vfs_stat_fsp(fsp);
+	if (!NT_STATUS_IS_OK(status)) {
+		file_free(NULL, fsp);
+		return status;
 	}
 
 	if (!S_ISDIR(fsp->fsp_name->st.st_ex_mode)) {
diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index 5a3ac2c064a..a94b85f8f20 100644
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -779,9 +779,8 @@ static NTSTATUS non_widelink_open(const struct files_struct *dirfsp,
 	fsp_set_fd(fsp, fd);
 
 	if (fd != -1) {
-		ret = SMB_VFS_FSTAT(fsp, &fsp->fsp_name->st);
-		if (ret != 0) {
-			status = map_nt_error_from_unix(errno);
+		status = vfs_stat_fsp(fsp);
+		if (!NT_STATUS_IS_OK(status)) {
 			goto out;
 		}
 		orig_fsp_name->st = fsp->fsp_name->st;
@@ -1499,12 +1498,11 @@ static NTSTATUS open_file(files_struct *fsp,
 			}
 
 			if (need_re_stat) {
-				ret = SMB_VFS_FSTAT(fsp, &smb_fname->st);
+				status = vfs_stat_fsp(fsp);
 				/*
 				 * If we have an fd, this stat should succeed.
 				 */
-				if (ret == -1) {
-					status = map_nt_error_from_unix(errno);
+				if (!NT_STATUS_IS_OK(status)) {
 					DBG_ERR("Error doing fstat on open "
 						"file %s (%s)\n",
 						 smb_fname_str_dbg(smb_fname),
@@ -4304,10 +4302,11 @@ static NTSTATUS mkdir_internal(connection_struct *conn,
 	/* Ensure we're checking for a symlink here.... */
 	/* We don't want to get caught by a symlink racer. */
 
-	if (SMB_VFS_FSTAT(fsp, &smb_dname->st) == -1) {
+	status = vfs_stat_fsp(fsp);
+	if (!NT_STATUS_IS_OK(status)) {
 		DEBUG(2, ("Could not stat directory '%s' just created: %s\n",
-			  smb_fname_str_dbg(smb_dname), strerror(errno)));
-		return map_nt_error_from_unix(errno);
+			  smb_fname_str_dbg(smb_dname), nt_errstr(status)));
+		return status;
 	}
 
 	if (!S_ISDIR(smb_dname->st.st_ex_mode)) {
@@ -4364,10 +4363,11 @@ static NTSTATUS mkdir_internal(connection_struct *conn,
 	}
 
 	if (need_re_stat) {
-		if (SMB_VFS_FSTAT(fsp, &smb_dname->st) == -1) {
+		status = vfs_stat_fsp(fsp);
+		if (!NT_STATUS_IS_OK(status)) {
 			DEBUG(2, ("Could not stat directory '%s' just created: %s\n",
-			  smb_fname_str_dbg(smb_dname), strerror(errno)));
-			return map_nt_error_from_unix(errno);
+			  smb_fname_str_dbg(smb_dname), nt_errstr(status)));
+			return status;
 		}
 	}
 
@@ -4831,16 +4831,36 @@ void msg_file_was_renamed(struct messaging_context *msg_ctx,
 	}
 
 	if (strcmp(fsp->conn->connectpath, msg->servicepath) == 0) {
+		SMB_STRUCT_STAT fsp_orig_sbuf;
 		NTSTATUS status;
 		DBG_DEBUG("renaming file %s from %s -> %s\n",
 			  fsp_fnum_dbg(fsp),
 			  fsp_str_dbg(fsp),
 			  smb_fname_str_dbg(smb_fname));
+
+		/*


-- 
Samba Shared Repository



More information about the samba-cvs mailing list