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

Karolin Seeger kseeger at samba.org
Fri Apr 17 10:20:02 UTC 2020


The branch, v4-12-test has been updated
       via  790bf2ab198 s3: VFS: Add cmocka test for vfs_full_audit to make sure all arrays are correct.
       via  5ecac7b6dd5 s3: VFS: full_audit. Add missing fcntl entry in vfs_op_names[] array.
      from  8c537c8a402 s3/librpc/crypto: Fix double free with unresolved credential cache

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


- Log -----------------------------------------------------------------
commit 790bf2ab1988dad118c845c5f477d1f3701d0c7a
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>
    
    (Back-ported from commit 5e987e2f40e7698de489696d795ebe26b7e75c9b)
    
    Autobuild-User(v4-12-test): Karolin Seeger <kseeger at samba.org>
    Autobuild-Date(v4-12-test): Fri Apr 17 10:19:13 UTC 2020 on sn-devel-184

commit 5ecac7b6dd54a4ad89b147bce816f024221d4635
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>
    (cherry picked from commit 977d3c7bab3319725abc418839d581489fd9bbe9)

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

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 5c8267dea9f..b0237cdacba 100644
--- a/source3/modules/vfs_full_audit.c
+++ b/source3/modules/vfs_full_audit.c
@@ -295,6 +295,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 41d8568e43a..d4c87209106 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 6bdbb6f97a4..68ca1eac6e8 100755
--- a/source3/selftest/tests.py
+++ b/source3/selftest/tests.py
@@ -466,6 +466,10 @@ plantestsuite("samba3.test_nfs4_acl", "none",
               [os.path.join(bindir(), "test_nfs4_acls"),
                "$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