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

Jule Anger janger at samba.org
Mon Apr 11 09:22:02 UTC 2022


The branch, v4-15-test has been updated
       via  799aa4e8892 s3:auth: Fix user_in_list() for UNIX groups
       via  26a7e8fa7a3 s3:tests Test "username map" for UNIX groups
       via  fc3c13d67f4 selftest: Add to "username.map" mapping for jackthemappergroup
       via  77370c99542 selftest: Create groups "jackthemappergroup" and "jacknomappergroup"
       via  94bed5330df selftest: Create users "jackthemapper" and "jacknomapper"
       via  a275f517628 vfs_shadow_copy2: implement readdir()
       via  fbcbe7b96c5 CI: add a test listing a snapshotted directory
       via  4d4848e4fae CI: avoid smb2.twrp being run by plansmbtorture4testsuite() directly
       via  cc08531b0e5 s3: smbd: Preserve the fsp->fsp_name->st buf across a MSG_SMB_FILE_RENAME message.
       via  60802b1df92 s3: smbd: Preserve the fsp->fsp_name->st bufs across rename_open_files()
       via  057babba5c2 s4: torture: Add test_smb2_close_full_information() test to smb2.rename.
       via  1b90b7b1aa3 s4: torture: Add CHECK_CREATED macro to smb2/rename.c. Not yet used.
       via  5e42298e69a s4: torture: Add CHECK_VAL macro to smb2/rename.c. Not yet used.
       via  23e3863b070 s3: tests.py: Only run smb2.rename against fileserver.
       via  f475832bd2e 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  b93079ca2a7 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  0671b340fbb 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  687e9cc8458 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  8880efcc4a1 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  df48c005013 s3: smbd: call_trans2setfilepathinfo(). All calls to SMB_VFS_FSTAT(fsp, &fsp->fsp_name->st) clobber fsp->fsp_name->st.st_ex_iflags.
       via  3905cfe754c s3: smbd: call_trans2qfilepathinfo(). All calls to SMB_VFS_FSTAT(fsp, &fsp->fsp_name->st) clobber fsp->fsp_name->st.st_ex_iflags.
       via  462ccb63241 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  e51a120f620 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  e191e40de48 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  ae9e3609129 s3: smbd: open_file(). All calls to SMB_VFS_FSTAT(fsp, &fsp->fsp_name->st) clobber fsp->fsp_name->st.st_ex_iflags.
       via  7600f2f0da4 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  1e32786854d 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  59ef773603a s3: smbd: open_internal_dirfsp() add missing file_free() in error path.
       via  b3eb7cfdce1 s3: smbd: mdssvc: All calls to SMB_VFS_FSTAT(fsp, &fsp->fsp_name->st) clobber fsp->fsp_name->st.st_ex_iflags.
       via  0b3fdccf2c6 s3: VFS: vxfs: All calls to SMB_VFS_FSTAT(fsp, &fsp->fsp_name->st) clobber fsp->fsp_name->st.st_ex_iflags.
       via  f39b359ac1e 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  b47077ee770 s3: smbd: In set_ea_dos_attribute() cause root fallback code to exit via the same place.
       via  8b8c80d1507 s4: torture: Add regression test for re-opening a durable handle after calling SMB2 setinfo (end of file).
      from  c1b4844f988 vfs_gpfs: Initialize litemask to 0

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


- Log -----------------------------------------------------------------
commit 799aa4e8892dacf1f760cc5f8f911a742f2d8034
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-15-test): Jule Anger <janger at samba.org>
    Autobuild-Date(v4-15-test): Mon Apr 11 09:22:01 UTC 2022 on sn-devel-184

commit 26a7e8fa7a36820ce8cda66998f0a4b6aadd2296
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 fc3c13d67f4cab1b32aa764ee5735fba2378b4cb
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 77370c9954251c77336328e4bbf1da28639c4afd
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 94bed5330dfc89debdcb84082fa70d87c3a5a484
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 a275f517628e86c4a9a1bcb1bb86921592f91b17
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 fbcbe7b96c52e1d6e6c030d7fc311d03b22ec3e9
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 4d4848e4faec551677fa0bb24c6ba1cbe4196c70
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 cc08531b0e524630eae6225cf1070e6ab6c66bad
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 60802b1df92c1825460e04441ddd671516042e99
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 057babba5c2797e0e526b28b88f2f8b9fa5fb779
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 1b90b7b1aa3ceab546201868aed0ae7c419b2047
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 5e42298e69ac37172bd9d42c0d8943d0491ebd66
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 23e3863b0705ca2bd277410e657b751c58fefca1
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 f475832bd2e491dad11d1a7cbd6bc669c12ef7df
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 b93079ca2a7a13345f9d9f89ba94df4dddf0aa47
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 0671b340fbbc00e07412b5f8f8d3bed4f9c53cfb
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>
    (back-ported picked from commit 23d5c909286d438534f1a7defb2faacd1877fea1)

commit 687e9cc84581e930060ecd79236e4801eed476f4
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 8880efcc4a152b53b630d093332444f37d8113bd
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 df48c0050136e58eb8badd9ca9cdc7f09202fb92
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 3905cfe754c9a73fc40644e305732b53b13f0694
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 462ccb63241a8043e8e2b128b63acb1f8d3960ad
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 e51a120f620bb9f7d6c0f372312f1a3deacc529e
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 e191e40de485915afee71040f51a002b90216e2f
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 ae9e3609129e0854c0a4ec744e67d56904dd4969
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 7600f2f0da41fc74805587426c078f17b04cd6b0
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 1e32786854d4bc6f06f67fb1d27ebf46a19163bd
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 59ef773603a6e25ca441d3a4a19f9f05ea44ee07
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 b3eb7cfdce1bdbb1265c310a207c3bc55608a897
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 0b3fdccf2c603225ac3f272c74ee677b105d3edc
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 f39b359ac1e148f5689183a3a27be044d598afa6
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 b47077ee7702104514ebc032fefc8b7839b59218
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 8b8c80d15079b0ccda70bc42c9c5e464663f6167
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                        |  20 +--
 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(+), 62 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 62fb3d1e39e..8d309f9c99a 100755
--- a/selftest/target/Samba3.pm
+++ b/selftest/target/Samba3.pm
@@ -1466,8 +1466,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
@@ -1488,6 +1490,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
 ";
@@ -2525,6 +2529,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);
@@ -2532,6 +2538,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;
@@ -2554,6 +2562,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;
@@ -2569,6 +2579,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
@@ -3298,6 +3310,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
@@ -3317,6 +3331,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:
@@ -3362,6 +3378,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 06c71363d5b..d7ee1ab6200 100755
--- a/source3/selftest/tests.py
+++ b/source3/selftest/tests.py
@@ -393,6 +393,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:
@@ -1007,6 +1009,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 078ce6df07c..c62b0368757 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 a2269d8da65..196c0008e31 100644
--- a/source3/smbd/files.c
+++ b/source3/smbd/files.c
@@ -244,7 +244,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)) {
@@ -263,9 +262,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 ad0fcb8ac6f..c4e575afb7f 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;
@@ -1503,12 +1502,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),
@@ -4307,10 +4305,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)) {
@@ -4367,10 +4366,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;
 		}
 	}
 
@@ -4834,16 +4834,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