[SCM] Samba Shared Repository - branch master updated

Jeremy Allison jra at samba.org
Tue Apr 14 17:59:03 UTC 2020


The branch, master has been updated
       via  5e987e2f40e s3: VFS: Add cmocka test for vfs_full_audit to make sure all arrays are correct.
       via  977d3c7bab3 s3: VFS: full_audit. Add missing fcntl entry in vfs_op_names[] array.
      from  eab086c5725 s4/torture: fix timeval wrap in torture_libsmbclient_utimes() test

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


- Log -----------------------------------------------------------------
commit 5e987e2f40e7698de489696d795ebe26b7e75c9b
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Apr 10 14:14:25 2020 -0700

    s3: VFS: Add cmocka test for vfs_full_audit to make sure all arrays are correct.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14343
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Tue Apr 14 17:58:40 UTC 2020 on sn-devel-184

commit 977d3c7bab3319725abc418839d581489fd9bbe9
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Apr 10 13:27:18 2020 -0700

    s3: VFS: full_audit. Add missing fcntl entry in vfs_op_names[] array.
    
    Found by yannick at in2ip.nl.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14343
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>

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

Summary of changes:
 .../test_vfs_full_audit.c}                         | 42 ++++++++++++----------
 source3/modules/vfs_full_audit.c                   |  1 +
 source3/modules/wscript_build                      |  5 +++
 source3/selftest/tests.py                          |  4 +++
 4 files changed, 34 insertions(+), 18 deletions(-)
 copy source3/{rpc_server/rpc_contexts.c => modules/test_vfs_full_audit.c} (52%)


Changeset truncated at 500 lines:

diff --git a/source3/rpc_server/rpc_contexts.c b/source3/modules/test_vfs_full_audit.c
similarity index 52%
copy from source3/rpc_server/rpc_contexts.c
copy to source3/modules/test_vfs_full_audit.c
index 131bea21fd6..4a12e466ff3 100644
--- a/source3/rpc_server/rpc_contexts.c
+++ b/source3/modules/test_vfs_full_audit.c
@@ -1,7 +1,9 @@
 /*
  *  Unix SMB/CIFS implementation.
- *  RPC Pipe client / server routines
- *  Almost completely rewritten by (C) Jeremy Allison 2005 - 2010
+ *
+ *  Unit test for entries in vfs_full_audit arrays.
+ *
+ *  Copyright (C) Jeremy Allison 2020
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -17,27 +19,31 @@
  *  along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
+/* Needed for static build to complete... */
 #include "includes.h"
-#include "ntdomain.h"
+#include "smbd/smbd.h"
+NTSTATUS vfs_full_audit_init(TALLOC_CTX *ctx);
 
-#include "rpc_contexts.h"
+#include "vfs_full_audit.c"
+#include <cmocka.h>
 
-#undef DBGC_CLASS
-#define DBGC_CLASS DBGC_RPC_SRV
-
-struct pipe_rpc_fns *find_pipe_fns_by_context(struct pipe_rpc_fns *list,
-					      uint32_t context_id)
+static void test_full_audit_array(void **state)
 {
-	struct pipe_rpc_fns *fns = NULL;
+	unsigned i;
 
-	if ( !list ) {
-		DEBUG(0,("find_pipe_fns_by_context: ERROR!  No context list for pipe!\n"));
-		return NULL;
+	for (i=0; i<SMB_VFS_OP_LAST; i++) {
+		assert_non_null(vfs_op_names[i].name);
+		assert_int_equal(vfs_op_names[i].type, i);
 	}
+}
 
-	for (fns=list; fns; fns=fns->next ) {
-		if ( fns->context_id == context_id )
-			return fns;
-	}
-	return NULL;
+int main(int argc, char **argv)
+{
+	const struct CMUnitTest tests[] = {
+		cmocka_unit_test(test_full_audit_array),
+	};
+
+	cmocka_set_message_output(CM_OUTPUT_SUBUNIT);
+
+	return cmocka_run_group_tests(tests, NULL, NULL);
 }
diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c
index 1ea58a0ffab..f8eef6eb1df 100644
--- a/source3/modules/vfs_full_audit.c
+++ b/source3/modules/vfs_full_audit.c
@@ -293,6 +293,7 @@ static struct {
 	{ SMB_VFS_OP_FALLOCATE,"fallocate" },
 	{ SMB_VFS_OP_LOCK,	"lock" },
 	{ SMB_VFS_OP_KERNEL_FLOCK,	"kernel_flock" },
+	{ SMB_VFS_OP_FCNTL,	"fcntl" },
 	{ SMB_VFS_OP_LINUX_SETLEASE, "linux_setlease" },
 	{ SMB_VFS_OP_GETLOCK,	"getlock" },
 	{ SMB_VFS_OP_SYMLINKAT,	"symlinkat" },
diff --git a/source3/modules/wscript_build b/source3/modules/wscript_build
index 2d81357c513..1f2d2d3acb6 100644
--- a/source3/modules/wscript_build
+++ b/source3/modules/wscript_build
@@ -91,6 +91,11 @@ bld.SAMBA3_MODULE('vfs_full_audit',
                  internal_module=bld.SAMBA3_IS_STATIC_MODULE('vfs_full_audit'),
                  enabled=bld.SAMBA3_IS_ENABLED_MODULE('vfs_full_audit'))
 
+bld.SAMBA3_BINARY('test_vfs_full_audit',
+                  source='test_vfs_full_audit.c',
+                  deps='smbd_base cmocka',
+                  for_selftest=True)
+
 bld.SAMBA3_MODULE('vfs_fake_perms',
                  subsystem='vfs',
                  source='vfs_fake_perms.c',
diff --git a/source3/selftest/tests.py b/source3/selftest/tests.py
index 1ceb0a5ad5f..568434a208c 100755
--- a/source3/selftest/tests.py
+++ b/source3/selftest/tests.py
@@ -506,6 +506,10 @@ plantestsuite("samba3.test_vfs_widelinks", "none",
               [os.path.join(bindir(), "test_vfs_widelinks"),
                "$SMB_CONF_PATH"])
 
+plantestsuite("samba3.test_vfs_full_audit", "none",
+              [os.path.join(bindir(), "test_vfs_full_audit"),
+               "$SMB_CONF_PATH"])
+
 plantestsuite(
     "samba3.resolvconf", "none",
     [os.path.join(samba3srcdir, "script/tests/test_resolvconf.sh")])


-- 
Samba Shared Repository



More information about the samba-cvs mailing list