diff options
Diffstat (limited to 'source4/torture/smb2/util.c')
-rw-r--r-- | source4/torture/smb2/util.c | 77 |
1 files changed, 37 insertions, 40 deletions
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: |