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

Jule Anger janger at samba.org
Tue Mar 29 10:22:01 UTC 2022


The branch, v4-16-test has been updated
       via  15035d82a58 vfs_shadow_copy2: remove async getxattrat
       via  e644e783060 CI: add a test for async dosmode on a file in a shadow_copy2 snapshot
       via  d67d5bd74f0 CI: enable "smbd async dosmode" on shadow_write share
       via  de314f93375 smbd: also check for NT_STATUS_NOT_SUPPORTED
       via  310e334a59e CI: add test "smb2.async_dosmode"
       via  16be7d70450 smbd: check "store dos attributes" settings in the async dosmode code
       via  84504306f1d CI: remove shares referencing removed functionality
       via  337301252b6 waf: Document the confusing --nonshared-binary, --builtin-libraries, --private-libraries and --bundled-libraries
      from  7676cb51450 s3: smbd: Don't allow setting the delete on close bit on a directory if it contains non-visible files and "delete veto files = no".

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


- Log -----------------------------------------------------------------
commit 15035d82a58821d1f54291a111e8a43a9ad3b82e
Author: Ralph Boehme <slow at samba.org>
Date:   Wed Feb 23 11:36:29 2022 +0100

    vfs_shadow_copy2: remove async getxattrat
    
    vfswrap_getxattrat_send() is handle based using smb_fname->fsp. As
    the open of smb_fname->fsp was processed by this module, the handle
    is already correctly opened on the file in the snapshot. In the end
    this means we can just call directly call the next function here.
    
    Note that the same reasoning might apply to other modules that use
    vfs_not_implemented_getxattrat_send(), but checking and adjusting those is a job
    for another day. Currently they will continue to go via the sync fallback of the
    caller.
    
    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): Mon Feb 28 20:53:35 UTC 2022 on sn-devel-184
    
    (cherry picked from commit afc2103da0fe947afc027b3e25c5e82aa5d3f1fb)
    
    Autobuild-User(v4-16-test): Jule Anger <janger at samba.org>
    Autobuild-Date(v4-16-test): Tue Mar 29 10:21:03 UTC 2022 on sn-devel-184

commit e644e783060fc44082f683a7d36384173a79e899
Author: Ralph Boehme <slow at samba.org>
Date:   Wed Feb 23 18:10:59 2022 +0100

    CI: add a test for async dosmode on a file in a shadow_copy2 snapshot
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 1097b1d0776661d873861672ca38e5892014725d)

commit d67d5bd74f0715fe8e5684aa655c4863b1558936
Author: Ralph Boehme <slow at samba.org>
Date:   Wed Feb 23 18:14:38 2022 +0100

    CI: enable "smbd async dosmode" on shadow_write share
    
    Existing tests don't care, upcoming new test needs it.
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 48f81b4e7216e4dad0a86aca75890c32117a342e)

commit de314f9337547bf26dbb10268ce455e9a6bcc8da
Author: Ralph Boehme <slow at samba.org>
Date:   Fri Dec 17 15:02:06 2021 +0100

    smbd: also check for NT_STATUS_NOT_SUPPORTED
    
    If a VFS module fails SMB_VFS_GETXATTRAT_SEND/RECV with ENOSYS like currently
    vfs_shadow_copy2 or any other module that uses
    vfs_not_implemented_getxattrat_send() the ENOSYS error that
    vfs_not_implemented_getxattrat_send() sets gets mapped to
    NT_STATUS_NOT_SUPPORTED by map_nt_error_from_unix().
    
    Unfortunately when checking whether the async SMB_VFS_GETXATTRAT_SEND() failed
    and to determine if the sync fallback should be triggered, we currently only
    check for NT_STATUS_NOT_IMPLEMENTED which is the error we get when "store dos
    attributes" is disabled.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14957
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 97caec07ffd18f247134d21c3ba07c31591863bc)

commit 310e334a59e8ddbaa2ad661ea709bdb77db35d2f
Author: Ralph Boehme <slow at samba.org>
Date:   Tue Jan 25 17:59:37 2022 +0100

    CI: add test "smb2.async_dosmode"
    
    Verifies async-dosmode sync fallback works with shadow_copy2 which returns
    ENOSYS for SMB_VFS_GET_DOS_ATTRIBUTES_SEND().
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14957
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit ffdb1c3e00c233efc99e8f1a66a5f83beb4e07f3)

commit 16be7d70450b234daebdfd2dc4813655d73e547c
Author: Ralph Boehme <slow at samba.org>
Date:   Mon Jan 24 16:45:11 2022 +0100

    smbd: check "store dos attributes" settings in the async dosmode code
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14957
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit ecf56c1d9b6b898ed4060e3bba341392ddcc9b5a)

commit 84504306f1df79a08e5e4444fe0839800a121988
Author: Ralph Boehme <slow at samba.org>
Date:   Mon Jan 24 16:54:29 2022 +0100

    CI: remove shares referencing removed functionality
    
    The whole "smbd:force sync [user|root] [path|chdir] safe threadpool" stuff was
    removed long ago by 29dd6f3e59055a17fa3d6a63619773f940e63374.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14957
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    (cherry picked from commit 1e3e22cc45583cb11ef5dbc3c044bf6189fe6036)

commit 337301252b6c01e7cac10ca40164700514687645
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Mon Mar 28 11:16:51 2022 +1300

    waf: Document the confusing --nonshared-binary, --builtin-libraries, --private-libraries and --bundled-libraries
    
    These options are confusing to all who encounter them.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=8731
    
    Signed-off-by: Andrew Bartlett <abartlet at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>
    
    Autobuild-User(master): Stefan Metzmacher <metze at samba.org>
    Autobuild-Date(master): Mon Mar 28 10:06:01 UTC 2022 on sn-devel-184
    
    (cherry picked from commit 14e7112734bbb31db99e394323ef2cb31385ebf7)

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

Summary of changes:
 buildtools/wafsamba/wscript                      | 67 +++++++++++++++++++---
 selftest/target/Samba3.pm                        | 51 +----------------
 source3/modules/vfs_default.c                    |  8 +++
 source3/modules/vfs_shadow_copy2.c               |  2 -
 source3/script/tests/test_shadow_copy_torture.sh | 43 ++++++++++++++
 source3/selftest/tests.py                        |  8 ++-
 source3/smbd/dosmode.c                           |  9 ++-
 source4/selftest/tests.py                        |  1 +
 source4/torture/smb2/dosmode.c                   | 71 ++++++++++++++++++++++++
 source4/torture/smb2/smb2.c                      |  1 +
 10 files changed, 198 insertions(+), 63 deletions(-)


Changeset truncated at 500 lines:

diff --git a/buildtools/wafsamba/wscript b/buildtools/wafsamba/wscript
index 62b63fef145..a4d6f3e5c49 100644
--- a/buildtools/wafsamba/wscript
+++ b/buildtools/wafsamba/wscript
@@ -30,11 +30,37 @@ def options(opt):
     gr = opt.option_group('library handling options')
 
     gr.add_option('--bundled-libraries',
-                   help=("comma separated list of bundled libraries. May include !LIBNAME to disable bundling a library. Can be 'NONE' or 'ALL' [auto]"),
+                   help=(f'''comma separated list of bundled libraries.
+
+{Context.g_module.APPNAME} includes copies of externally maintained
+system libraries (such as popt, cmokca) as well as Samba-maintained
+libraries that can be found on the system already (such as talloc,
+tdb).
+
+This option, most useful for packagers, controls if each library
+should be forced to be obtained from inside Samba (bundled), forced to
+be obtained from the system (bundling disabled, ensuing that
+dependency errors are not silently missed) or if that choice should be
+automatic (best for end users).
+
+May include !LIBNAME to disable bundling a library.
+
+Can be 'NONE' or 'ALL' [auto]'''),
                    action="store", dest='BUNDLED_LIBS', default='')
 
     gr.add_option('--private-libraries',
-                   help=("comma separated list of normally public libraries to build instead as private libraries. May include !LIBNAME to disable making a library private in order to limit the effect of 'ALL'"),
+                   help=(f'''comma separated list of normally public libraries to build instead as private libraries.
+
+By default {Context.g_module.APPNAME} will publish a number of public
+libraries for use by other software.  For Samba this would include
+libwbclient, libsmbclient and others.
+
+This allows that to be disabled, to ensure that other software does
+not use these libraries and they are placed in a private filesystem
+prefix.
+
+May include !LIBNAME to disable making a library private in order to
+limit the effect of 'ALL' '''),
                    action="store", dest='PRIVATE_LIBS', default='')
 
     extension_default = default_value('PRIVATE_EXTENSION_DEFAULT')
@@ -48,12 +74,33 @@ def options(opt):
                    action="store", dest='PRIVATE_EXTENSION_EXCEPTION', default=extension_exception)
 
     builtin_default = default_value('BUILTIN_LIBRARIES_DEFAULT')
-    gr.add_option('--builtin-libraries',
-                   help=("command separated list of libraries to build directly into binaries [%s]" % builtin_default),
-                   action="store", dest='BUILTIN_LIBRARIES', default=builtin_default)
+    gr.add_option('--builtin-libraries', help=(
+f'''comma separated list of libraries to build directly into binaries.
+
+By default {Context.g_module.APPNAME} will build a large number of
+shared libraries, to reduce binary size.  This overrides this
+behaviour and essentially statically links the specified libraries into
+each binary [{builtin_default}]'''),
+                  action="store",
+                  dest='BUILTIN_LIBRARIES', default=builtin_default)
 
     gr.add_option('--minimum-library-version',
-                   help=("list of minimum system library versions (LIBNAME1:version,LIBNAME2:version)"),
+                   help=(
+f'''list of minimum system library versions for otherwise bundled
+libraries.
+
+{Context.g_module.APPNAME} by default requires that, in order to match
+what is tested in our continuous integration (CI) test-suite, that the
+versions of libraries that we include match that found on the system,
+before we will select not to 'bundle'.
+
+This option, possibly useful for packagers, allows that specified
+version to be overridden (say, if it is absolutely known that a the
+newer version included in this tarball has no relevant changes).
+
+Use this with extreme care
+
+(LIBNAME1:version,LIBNAME2:version)'''),
                    action="store", dest='MINIMUM_LIBRARY_VERSION', default='')
 
     gr.add_option('--disable-rpath',
@@ -66,7 +113,13 @@ def options(opt):
                    help=("Disable use of rpath for private library path in installed files"),
                    action="store_true", dest='disable_rpath_private_install', default=False)
     gr.add_option('--nonshared-binary',
-                   help=("Disable use of shared libs for the listed binaries"),
+                   help=(
+f'''Disable use of shared libaries internal to {Context.g_module.APPNAME} for the listed binaries.
+
+The resulting binaries are 'statically linked' with regard to components provided by
+{Context.g_module.APPNAME}, but remain dynamically linked to (eg) libc.so and libgnutls.so
+
+Currently the only tested value is 'smbtorture,smbd/smbd' for Samba'''),
                    action="store", dest='NONSHARED_BINARIES', default='')
     gr.add_option('--disable-symbol-versions',
                    help=("Disable use of the --version-script linker option"),
diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm
index 2c2eed09441..a51e04ecf83 100755
--- a/selftest/target/Samba3.pm
+++ b/selftest/target/Samba3.pm
@@ -1545,31 +1545,11 @@ sub setup_simpleserver
 	aio_pthread:aio open = yes
 	smbd async dosmode = yes
 
-[vfs_aio_pthread_async_dosmode_force_sync1]
+[async_dosmode_shadow_copy2]
 	path = $prefix_abs/share
 	read only = no
-	vfs objects = aio_pthread
-	store dos attributes = yes
-	aio_pthread:aio open = yes
+	vfs objects = shadow_copy2 xattr_tdb
 	smbd async dosmode = yes
-	# This simulates non linux systems
-	smbd:force sync user path safe threadpool = yes
-	smbd:force sync user chdir safe threadpool = yes
-	smbd:force sync root path safe threadpool = yes
-	smbd:force sync root chdir safe threadpool = yes
-
-[vfs_aio_pthread_async_dosmode_force_sync2]
-	path = $prefix_abs/share
-	read only = no
-	vfs objects = aio_pthread xattr_tdb
-	store dos attributes = yes
-	aio_pthread:aio open = yes
-	smbd async dosmode = yes
-	# This simulates non linux systems
-	smbd:force sync user path safe threadpool = yes
-	smbd:force sync user chdir safe threadpool = yes
-	smbd:force sync root path safe threadpool = yes
-	smbd:force sync root chdir safe threadpool = yes
 
 [vfs_aio_fork]
 	path = $prefix_abs/share
@@ -1970,32 +1950,6 @@ sub setup_fileserver_smb1
 	aio_pthread:aio open = yes
 	smbd async dosmode = yes
 
-[vfs_aio_pthread_async_dosmode_force_sync1]
-	path = $prefix_abs/share
-	read only = no
-	vfs objects = aio_pthread
-	store dos attributes = yes
-	aio_pthread:aio open = yes
-	smbd async dosmode = yes
-	# This simulates non linux systems
-	smbd:force sync user path safe threadpool = yes
-	smbd:force sync user chdir safe threadpool = yes
-	smbd:force sync root path safe threadpool = yes
-	smbd:force sync root chdir safe threadpool = yes
-
-[vfs_aio_pthread_async_dosmode_force_sync2]
-	path = $prefix_abs/share
-	read only = no
-	vfs objects = aio_pthread xattr_tdb
-	store dos attributes = yes
-	aio_pthread:aio open = yes
-	smbd async dosmode = yes
-	# This simulates non linux systems
-	smbd:force sync user path safe threadpool = yes
-	smbd:force sync user chdir safe threadpool = yes
-	smbd:force sync root path safe threadpool = yes
-	smbd:force sync root chdir safe threadpool = yes
-
 [vfs_aio_fork]
 	path = $prefix_abs/share
         vfs objects = aio_fork
@@ -3213,6 +3167,7 @@ sub provision($$)
 	error_inject:pwrite = EBADF
 	shadow:mountpoint = $shadow_tstdir
 	shadow:fixinodes = yes
+	smbd async dosmode = yes
 
 [dfq]
 	path = $shrdir/dfree
diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c
index c52d29dc2fe..5977122a512 100644
--- a/source3/modules/vfs_default.c
+++ b/source3/modules/vfs_default.c
@@ -1784,6 +1784,14 @@ static struct tevent_req *vfswrap_get_dos_attributes_send(
 		.smb_fname = smb_fname,
 	};
 
+	if (!lp_store_dos_attributes(SNUM(dir_fsp->conn))) {
+		DBG_ERR("%s: \"smbd async dosmode\" enabled, but "
+			"\"store dos attributes\" is disabled\n",
+			dir_fsp->conn->connectpath);
+		tevent_req_nterror(req, NT_STATUS_NOT_IMPLEMENTED);
+		return tevent_req_post(req, ev);
+	}
+
 	subreq = SMB_VFS_GETXATTRAT_SEND(state,
 					 ev,
 					 dir_fsp,
diff --git a/source3/modules/vfs_shadow_copy2.c b/source3/modules/vfs_shadow_copy2.c
index d61b3eac4b9..769f8c7da87 100644
--- a/source3/modules/vfs_shadow_copy2.c
+++ b/source3/modules/vfs_shadow_copy2.c
@@ -3256,8 +3256,6 @@ static struct vfs_fn_pointers vfs_shadow_copy2_fns = {
 	.realpath_fn = shadow_copy2_realpath,
 	.get_shadow_copy_data_fn = shadow_copy2_get_shadow_copy_data,
 	.mkdirat_fn = shadow_copy2_mkdirat,
-	.getxattrat_send_fn = vfs_not_implemented_getxattrat_send,
-	.getxattrat_recv_fn = vfs_not_implemented_getxattrat_recv,
 	.fsetxattr_fn = shadow_copy2_fsetxattr,
 	.fchflags_fn = shadow_copy2_fchflags,
 	.get_real_filename_fn = shadow_copy2_get_real_filename,
diff --git a/source3/script/tests/test_shadow_copy_torture.sh b/source3/script/tests/test_shadow_copy_torture.sh
index e5dc0192e95..4ae2f9f707f 100755
--- a/source3/script/tests/test_shadow_copy_torture.sh
+++ b/source3/script/tests/test_shadow_copy_torture.sh
@@ -150,6 +150,47 @@ test_shadow_copy_fix_inodes()
     echo $out | grep "hardlink: for read/write fnum 1" || return 1
 }
 
+build_hiddenfile()
+{
+    local snapdir
+
+    snapdir=$WORKDIR/.snapshots
+
+    #delete snapshots from previous tests
+    find $WORKDIR -name ".snapshots" -exec rm -rf {} \; 1>/dev/null 2>&1
+    build_snapshots
+
+    touch $WORKDIR/hiddenfile
+
+    # Create a file with hidden attribute
+    $SMBCLIENT -U $USERNAME%$PASSWORD \
+	       "//$SERVER/shadow_write" \
+	       -c "put $WORKDIR/hiddenfile hiddenfile; setmode hiddenfile +h"
+    # ...and move it to the snapshot directory
+    mv $WORKDIR/hiddenfile $snapdir/$SNAPSHOT/
+}
+
+test_hiddenfile()
+{
+    build_hiddenfile
+
+    out=$($SMBCLIENT \
+	   -U $USERNAME%$PASSWORD \
+	   "//$SERVER/shadow_write" \
+	   -c "allinfo $SNAPSHOT/hiddenfile") || return 1
+    echo $out
+    echo $out | grep "attributes: HA (22)" || return 1
+
+    out=$($SMBCLIENT \
+	   -U $USERNAME%$PASSWORD \
+	   "//$SERVER/shadow_write" \
+	   -c "ls $SNAPSHOT/hiddenfile") || return 1
+    echo $out
+    echo $out | grep "hiddenfile[[:blank:]]*AH" || return 1
+
+    return 0
+}
+
 build_files $WORKDIR
 
 # test open for writing and write behaviour of snapshoted files
@@ -161,4 +202,6 @@ test_shadow_copy_openroot "opening root of shadow copy share"
 
 testit "fix inodes with hardlink" test_shadow_copy_fix_inodes || failed=`expr $failed + 1`
 
+testit "Test reading DOS attribute" test_hiddenfile || failed=`expr $failed + 1`
+
 exit $failed
diff --git a/source3/selftest/tests.py b/source3/selftest/tests.py
index 03f144489b0..7fbc5e385fc 100755
--- a/source3/selftest/tests.py
+++ b/source3/selftest/tests.py
@@ -303,9 +303,7 @@ plantestsuite("samba3.smbtorture_s3.plain.%s" % "SMB2-DEL-ON-CLOSE-NONWRITE-DELE
 
 shares = [
     "vfs_aio_pthread_async_dosmode_default1",
-    "vfs_aio_pthread_async_dosmode_default2",
-    "vfs_aio_pthread_async_dosmode_force_sync1",
-    "vfs_aio_pthread_async_dosmode_force_sync2"
+    "vfs_aio_pthread_async_dosmode_default2"
 ]
 for s in shares:
     plantestsuite("samba3.smbtorture_s3.%s(simpleserver).SMB2-BASIC" % s, "simpleserver", [os.path.join(samba3srcdir, "script/tests/test_smbtorture_s3.sh"), 'SMB2-BASIC', '//$SERVER_IP/' + s, '$USERNAME', '$PASSWORD', smbtorture3, "", "-l $LOCAL_PATH"])
@@ -1013,6 +1011,10 @@ for t in tests:
         plansmbtorture4testsuite(t, "fileserver", '//$SERVER_IP/tmp -U$USERNAME%$PASSWORD')
     elif t == "smb2.acls_non_canonical":
         plansmbtorture4testsuite(t, "nt4_dc", '//$SERVER_IP/acls_non_canonical -U$USERNAME%$PASSWORD')
+    elif t == "smb2.async_dosmode":
+        plansmbtorture4testsuite("smb2.async_dosmode",
+                                 "simpleserver",
+                                 "//$SERVER_IP/async_dosmode_shadow_copy2 -U$USERNAME%$PASSWORD")
     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 5b252d2bf64..c0208ffa0a5 100644
--- a/source3/smbd/dosmode.c
+++ b/source3/smbd/dosmode.c
@@ -854,10 +854,13 @@ static void dos_mode_at_vfs_get_dosmode_done(struct tevent_req *subreq)
 		 * dos_mode_post() which also does the mapping of a last resort
 		 * from S_IFMT(st_mode).
 		 *
-		 * Only if we get NT_STATUS_NOT_IMPLEMENTED from a stacked VFS
-		 * module we must fallback to sync processing.
+		 * Only if we get NT_STATUS_NOT_IMPLEMENTED or
+		 * NT_STATUS_NOT_SUPPORTED from a stacked VFS module we must
+		 * fallback to sync processing.
 		 */
-		if (!NT_STATUS_EQUAL(status, NT_STATUS_NOT_IMPLEMENTED)) {
+		if (!NT_STATUS_EQUAL(status, NT_STATUS_NOT_IMPLEMENTED) &&
+		    !NT_STATUS_EQUAL(status, NT_STATUS_NOT_SUPPORTED))
+		{
 			/*
 			 * state->dosmode should still be 0, but reset
 			 * it to be sure.
diff --git a/source4/selftest/tests.py b/source4/selftest/tests.py
index a7572b53cad..a2df97f9059 100755
--- a/source4/selftest/tests.py
+++ b/source4/selftest/tests.py
@@ -379,6 +379,7 @@ smb2_s3only = [
     "smb2.fileid",
     "smb2.fileid_unique",
     "smb2.timestamps",
+    "smb2.async_dosmode",
 ]
 smb2 = [x for x in smbtorture4_testsuites("smb2.") if x not in smb2_s3only]
 
diff --git a/source4/torture/smb2/dosmode.c b/source4/torture/smb2/dosmode.c
index 7808ca67dba..7610a20329f 100644
--- a/source4/torture/smb2/dosmode.c
+++ b/source4/torture/smb2/dosmode.c
@@ -181,3 +181,74 @@ done:
 	smb2_deltree(tree, dname);
 	return ret;
 }
+
+bool torture_smb2_async_dosmode(struct torture_context *tctx)
+{
+	bool ret = true;
+	NTSTATUS status;
+	struct smb2_tree *tree = NULL;
+	const char *dname = "torture_dosmode";
+	const char *fname = "torture_dosmode\\file";
+	struct smb2_handle h = {{0}};
+	struct smb2_create io;
+	union smb_setfileinfo sfinfo;
+	struct smb2_find f;
+	union smb_search_data *d;
+	unsigned int count;
+
+	if (!torture_smb2_connection(tctx, &tree)) {
+		return false;
+	}
+
+	smb2_deltree(tree, dname);
+
+	status = torture_smb2_testdir(tree, dname, &h);
+	torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
+					"torture_smb2_testdir failed");
+
+	ZERO_STRUCT(io);
+	io.in.desired_access = SEC_FLAG_MAXIMUM_ALLOWED;
+	io.in.file_attributes   = FILE_ATTRIBUTE_NORMAL;
+	io.in.create_disposition = NTCREATEX_DISP_CREATE;
+	io.in.create_options = 0;
+	io.in.fname = fname;
+
+	status = smb2_create(tree, tctx, &io);
+	torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
+					"smb2_create failed");
+
+	ZERO_STRUCT(sfinfo);
+	sfinfo.basic_info.in.attrib = FILE_ATTRIBUTE_HIDDEN;
+	sfinfo.generic.level = RAW_SFILEINFO_BASIC_INFORMATION;
+	sfinfo.generic.in.file.handle = io.out.file.handle;
+	status = smb2_setinfo_file(tree, &sfinfo);
+	torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
+					"smb2_setinfo_filefailed");
+
+	smb2_util_close(tree, io.out.file.handle);
+
+	ZERO_STRUCT(f);
+	f.in.file.handle	= h;
+	f.in.pattern		= "file";
+	f.in.continue_flags	= SMB2_CONTINUE_FLAG_RESTART;
+	f.in.max_response_size	= 0x1000;
+	f.in.level              = SMB2_FIND_BOTH_DIRECTORY_INFO;
+
+	status = smb2_find_level(tree, tree, &f, &count, &d);
+	torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "");
+
+	smb2_util_close(tree, h);
+	ZERO_STRUCT(h);
+
+	torture_assert_goto(tctx,
+			    d->both_directory_info.attrib & FILE_ATTRIBUTE_HIDDEN,
+			    ret, done,
+			    "FILE_ATTRIBUTE_HIDDEN is not set\n");
+
+done:
+	if (!smb2_util_handle_empty(h)) {
+		smb2_util_close(tree, h);
+	}
+	smb2_deltree(tree, dname);
+	return ret;
+}
diff --git a/source4/torture/smb2/smb2.c b/source4/torture/smb2/smb2.c
index 95a7b49952f..3c69d8c7fa0 100644
--- a/source4/torture/smb2/smb2.c
+++ b/source4/torture/smb2/smb2.c
@@ -188,6 +188,7 @@ NTSTATUS torture_smb2_init(TALLOC_CTX *ctx)
 	torture_suite_add_suite(suite, torture_smb2_session_init(suite));
 	torture_suite_add_suite(suite, torture_smb2_replay_init(suite));
 	torture_suite_add_simple_test(suite, "dosmode", torture_smb2_dosmode);
+	torture_suite_add_simple_test(suite, "async_dosmode", torture_smb2_async_dosmode);
 	torture_suite_add_simple_test(suite, "maxfid", torture_smb2_maxfid);
 	torture_suite_add_simple_test(suite, "hold-sharemode",
 				      torture_smb2_hold_sharemode);


-- 
Samba Shared Repository



More information about the samba-cvs mailing list