[SCM] Samba Shared Repository - branch master updated

Jeremy Allison jra at samba.org
Mon Nov 7 22:59:01 UTC 2022


The branch, master has been updated
       via  be1431a8930 smbd: Don't hide directories with "hide new files timeout"
       via  e8848a3eab8 torture: Show that "hide new files timeout" also hides directories
       via  8b4a3c12a0d torture3: Run the "hidenewfiles" test against SMB2
       via  721cfe94247 torture3: Fix a copy&paste error and a typo
      from  635b1adfc5c gpo: GPME doesn't permit nesting of admx categories in builtin

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


- Log -----------------------------------------------------------------
commit be1431a8930a9386bb5dbf15604fc6b8330c42f4
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Nov 7 15:08:51 2022 +0100

    smbd: Don't hide directories with "hide new files timeout"
    
    The intention of this option was to hide *files*. Before this patch we
    also hide directories where new files are dropped.
    
    This is a change in behaviour, but I think this option is niche enough
    to justify not adding another parameter that we then need to test. If
    workflows break with this change and people depend on directories also
    to be hidden, we can still add the additional option value required.
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Mon Nov  7 22:58:33 UTC 2022 on sn-devel-184

commit e8848a3eab8fc43132640f67b858780f43f2b07c
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Nov 7 14:57:04 2022 +0100

    torture: Show that "hide new files timeout" also hides directories
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 8b4a3c12a0d6f08827237aba5af3c1e3eb1c43e8
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Nov 7 14:56:28 2022 +0100

    torture3: Run the "hidenewfiles" test against SMB2
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 721cfe94247da7c0150b1d78f95592f7bf3a2356
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Nov 7 12:11:52 2022 +0100

    torture3: Fix a copy&paste error and a typo
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

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

Summary of changes:
 source3/selftest/tests.py           | 15 ++++++--
 source3/smbd/dir.c                  |  6 ++--
 source3/torture/proto.h             |  1 +
 source3/torture/test_hidenewfiles.c | 70 ++++++++++++++++++++++++++++++++++---
 source3/torture/torture.c           |  4 +++
 5 files changed, 88 insertions(+), 8 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/selftest/tests.py b/source3/selftest/tests.py
index 04e47fa962f..2155866923f 100755
--- a/source3/selftest/tests.py
+++ b/source3/selftest/tests.py
@@ -191,8 +191,8 @@ for t in tests:
     plantestsuite("samba3.smbtorture_s3.vfs_aio_pthread(%s).%s" % (env, t), env, [os.path.join(samba3srcdir, "script/tests/test_smbtorture_s3.sh"), t, '//$SERVER_IP/vfs_aio_pthread', '$USERNAME', '$PASSWORD', smbtorture3, "", "-l $LOCAL_PATH"])
     plantestsuite("samba3.smbtorture_s3.vfs_aio_fork(%s).%s" % (env, t), env, [os.path.join(samba3srcdir, "script/tests/test_smbtorture_s3.sh"), t, '//$SERVER_IP/vfs_aio_fork', '$USERNAME', '$PASSWORD', smbtorture3, "", "-l $LOCAL_PATH"])
 
-plantestsuite("samba3.smbtorture_s3.hidenewfiles(fileserver_smb1)",
-              "fileserver_smb1",
+plantestsuite("samba3.smbtorture_s3.hidenewfiles",
+              "simpleserver",
               [os.path.join(samba3srcdir,
                             "script/tests/test_smbtorture_s3.sh"),
                'hide-new-files-timeout',
@@ -202,6 +202,17 @@ plantestsuite("samba3.smbtorture_s3.hidenewfiles(fileserver_smb1)",
                smbtorture3,
                "",
                "-l $LOCAL_PATH"])
+plantestsuite("samba3.smbtorture_s3.hidenewfiles_showdirs",
+              "simpleserver",
+              [os.path.join(samba3srcdir,
+                            "script/tests/test_smbtorture_s3.sh"),
+               'hide-new-files-timeout-showdirs',
+               '//$SERVER_IP/hidenewfiles',
+               '$USERNAME',
+               '$PASSWORD',
+               smbtorture3,
+               "",
+               "-l $LOCAL_PATH"])
 
 #
 # MSDFS attribute tests.
diff --git a/source3/smbd/dir.c b/source3/smbd/dir.c
index 64c7d5ca962..a18d70c870a 100644
--- a/source3/smbd/dir.c
+++ b/source3/smbd/dir.c
@@ -1404,7 +1404,8 @@ bool is_visible_fsp(struct files_struct *fsp)
 		 * only thing we can check is the
 		 * hide_new_files_timeout.
 		 */
-		if (hide_new_files_timeout != 0) {
+		if ((hide_new_files_timeout != 0) &&
+		    !S_ISDIR(fsp->fsp_name->st.st_ex_mode)) {
 			double age = timespec_elapsed(
 				&fsp->fsp_name->st.st_ex_mtime);
 
@@ -1443,7 +1444,8 @@ bool is_visible_fsp(struct files_struct *fsp)
 			return false;
 		}
 
-		if (hide_new_files_timeout != 0) {
+		if ((hide_new_files_timeout != 0) &&
+		    !S_ISDIR(fsp->fsp_name->st.st_ex_mode)) {
 			double age = timespec_elapsed(
 				&fsp->fsp_name->st.st_ex_mtime);
 
diff --git a/source3/torture/proto.h b/source3/torture/proto.h
index 7b00da26181..92b7dd4216c 100644
--- a/source3/torture/proto.h
+++ b/source3/torture/proto.h
@@ -171,6 +171,7 @@ bool run_g_lock_ping_pong(int dummy);
 bool run_local_namemap_cache1(int dummy);
 bool run_local_idmap_cache1(int dummy);
 bool run_hidenewfiles(int dummy);
+bool run_hidenewfiles_showdirs(int dummy);
 bool run_readdir_timestamp(int dummy);
 bool run_ctdbd_conn1(int dummy);
 
diff --git a/source3/torture/test_hidenewfiles.c b/source3/torture/test_hidenewfiles.c
index 05e6d7ef2b1..6d6811c7684 100644
--- a/source3/torture/test_hidenewfiles.c
+++ b/source3/torture/test_hidenewfiles.c
@@ -1,6 +1,6 @@
 /*
  * Unix SMB/CIFS implementation.
- * Test pthreadpool_tevent
+ * Test "hide new files timeout"
  * Copyright (C) Volker Lendecke 2018
  *
  * This program is free software; you can redistribute it and/or modify
@@ -78,7 +78,7 @@ static bool have_file(struct cli_state *cli, const char *fname)
 
 	status = cli_list(
 		cli,
-		"*.*",
+		"*",
 		FILE_ATTRIBUTE_DIRECTORY|
 		FILE_ATTRIBUTE_SYSTEM|
 		FILE_ATTRIBUTE_HIDDEN,
@@ -105,10 +105,10 @@ bool run_hidenewfiles(int dummy)
 	bool gotit = false;
 	bool ok;
 
-	/* what is configure in smb.conf */
+	/* what is configured in smb.conf */
 	unsigned hideunreadable_seconds = 5;
 
-	ok = torture_open_connection(&cli, 0);
+	ok = torture_open_connection_flags(&cli, 0, 0);
 	if (!ok) {
 		return false;
 	}
@@ -170,3 +170,65 @@ fail:
 
 	return ret;
 }
+
+bool run_hidenewfiles_showdirs(int dummy)
+{
+	const char *dname = "dir";
+	const char *fname = "dir/x.txt";
+	struct cli_state *cli;
+	struct smb_create_returns cr;
+	struct timeval create_time;
+	uint16_t fnum = UINT16_MAX;
+	NTSTATUS status;
+	bool ret = false;
+	bool gotit = false;
+	bool ok;
+
+	ok = torture_open_connection_flags(&cli, 0, 0);
+	if (!ok) {
+		return false;
+	}
+
+	cli_unlink(cli, fname, FILE_ATTRIBUTE_SYSTEM|FILE_ATTRIBUTE_HIDDEN);
+	cli_rmdir(cli, dname);
+
+	status = cli_mkdir(cli, dname);
+	if (!NT_STATUS_IS_OK(status)) {
+		d_printf("mkdir(%s) failed: %s\n", dname, nt_errstr(status));
+		goto fail;
+	}
+
+	status = cli_ntcreate(
+		cli,
+		fname,
+		0,
+		FILE_GENERIC_WRITE|DELETE_ACCESS,
+		FILE_ATTRIBUTE_NORMAL,
+		0,
+		FILE_CREATE,
+		0,
+		0,
+		&fnum,
+		&cr);
+	if (!NT_STATUS_IS_OK(status)) {
+		d_printf("cli_ntcreate failed: %s\n", nt_errstr(status));
+		goto fail;
+	}
+	nttime_to_timeval(&create_time, cr.last_write_time);
+
+	gotit = have_file(cli, dname);
+	if (!gotit) {
+		d_printf("%s was hidden\n", dname);
+		goto fail;
+	}
+
+	ret = true;
+fail:
+	if (fnum != UINT16_MAX) {
+		cli_nt_delete_on_close(cli, fnum, true);
+		cli_close(cli, fnum);
+	}
+	cli_rmdir(cli, dname);
+
+	return ret;
+}
diff --git a/source3/torture/torture.c b/source3/torture/torture.c
index 65fbd4b5aa0..925a9d424ad 100644
--- a/source3/torture/torture.c
+++ b/source3/torture/torture.c
@@ -15613,6 +15613,10 @@ static struct {
 		.name  = "hide-new-files-timeout",
 		.fn    = run_hidenewfiles,
 	},
+	{
+		.name  = "hide-new-files-timeout-showdirs",
+		.fn    = run_hidenewfiles_showdirs,
+	},
 #ifdef CLUSTER_SUPPORT
 	{
 		.name  = "ctdbd-conn1",


-- 
Samba Shared Repository



More information about the samba-cvs mailing list