From d252d23ff15577e2c7049181b5b30692c4bcd6bc Mon Sep 17 00:00:00 2001 From: Zack Kirsch Date: Sat, 4 Jul 2009 16:16:23 -0700 Subject: s4 torture: Port RAW-ACLS tests to SMB2 - The smblsa calls had to be commented out for now and should be fixed later, but they aren't crucial to the test. - The first two tests from RAW-ACLS were already ported to torture_smb2_setinfo() and test_create_acl(). Modifications were made similar to the RAW-ACLS changes. - test_sd_get_set() was ported, but does not pass against XP or Vista; it is not added to the SMB2-ACLS test suite. - printf -> torture_comment / torture_warning / torture_result --- source4/torture/smb2/util.c | 77 ++++++++++++++++++++++----------------------- 1 file changed, 37 insertions(+), 40 deletions(-) (limited to 'source4/torture/smb2/util.c') diff --git a/source4/torture/smb2/util.c b/source4/torture/smb2/util.c index 4fb7cfbef2..1dc8fca2b0 100644 --- a/source4/torture/smb2/util.c +++ b/source4/torture/smb2/util.c @@ -20,6 +20,7 @@ */ #include "includes.h" +#include "libcli/security/security_descriptor.h" #include "libcli/smb2/smb2.h" #include "libcli/smb2/smb2_calls.h" #include "lib/cmdline/popt_common.h" @@ -444,29 +445,27 @@ bool smb2_util_verify_sd(TALLOC_CTX *tctx, struct smb2_tree *tree, { NTSTATUS status; bool ret = true; - union smb_fileinfo q = {}, q2 = {}; - - if (sd) { - q.query_secdesc.level = RAW_FILEINFO_SEC_DESC; - q.query_secdesc.in.file.handle = handle; - q.query_secdesc.in.secinfo_flags = - SECINFO_OWNER | - SECINFO_GROUP | - SECINFO_DACL; - status = smb2_getinfo_file(tree, tctx, &q); - CHECK_STATUS(status, NT_STATUS_OK); - - if (!security_acl_equal( - q.query_secdesc.out.sd->dacl, sd->dacl)) { - torture_warning(tctx, "%s: security descriptors don't match!\n", - __location__); - torture_warning(tctx, "got:\n"); - NDR_PRINT_DEBUG(security_descriptor, - q.query_secdesc.out.sd); - torture_warning(tctx, "expected:\n"); - NDR_PRINT_DEBUG(security_descriptor, sd); - ret = false; - } + union smb_fileinfo q = {}; + + q.query_secdesc.level = RAW_FILEINFO_SEC_DESC; + q.query_secdesc.in.file.handle = handle; + q.query_secdesc.in.secinfo_flags = + SECINFO_OWNER | + SECINFO_GROUP | + SECINFO_DACL; + status = smb2_getinfo_file(tree, tctx, &q); + CHECK_STATUS(status, NT_STATUS_OK); + + if (!security_acl_equal( + q.query_secdesc.out.sd->dacl, sd->dacl)) { + torture_warning(tctx, "%s: security descriptors don't match!\n", + __location__); + torture_warning(tctx, "got:\n"); + NDR_PRINT_DEBUG(security_descriptor, + q.query_secdesc.out.sd); + torture_warning(tctx, "expected:\n"); + NDR_PRINT_DEBUG(security_descriptor, sd); + ret = false; } done: @@ -482,23 +481,21 @@ bool smb2_util_verify_attrib(TALLOC_CTX *tctx, struct smb2_tree *tree, { NTSTATUS status; bool ret = true; - union smb_fileinfo q = {}, q2 = {}; - - if (attrib) { - q2.standard.level = RAW_FILEINFO_STANDARD; - q2.standard.in.file.handle = handle; - status = smb2_getinfo_file(tree, tctx, &q2); - CHECK_STATUS(status, NT_STATUS_OK); - - q2.standard.out.attrib &= ~FILE_ATTRIBUTE_ARCHIVE; - - if (q2.standard.out.attrib != attrib) { - torture_warning(tctx, "%s: attributes don't match! " - "got %x, expected %x\n", __location__, - (uint32_t)q2.standard.out.attrib, - (uint32_t)attrib); - ret = false; - } + union smb_fileinfo q = {}; + + q.standard.level = RAW_FILEINFO_SMB2_ALL_INFORMATION; + q.standard.in.file.handle = handle; + status = smb2_getinfo_file(tree, tctx, &q); + CHECK_STATUS(status, NT_STATUS_OK); + + q.all_info2.out.attrib &= ~FILE_ATTRIBUTE_ARCHIVE; + + if (q.all_info2.out.attrib != attrib) { + torture_warning(tctx, "%s: attributes don't match! " + "got %x, expected %x\n", __location__, + (uint32_t)q.standard.out.attrib, + (uint32_t)attrib); + ret = false; } done: -- cgit