summaryrefslogtreecommitdiff
path: root/source4/torture/smb2/util.c
diff options
context:
space:
mode:
authorZack Kirsch <zack.kirsch@isilon.com>2009-07-04 16:16:23 -0700
committerTim Prouty <tprouty@samba.org>2009-12-07 16:54:16 -0800
commitd252d23ff15577e2c7049181b5b30692c4bcd6bc (patch)
tree0fa17dedd67aa45046abc8639958537d27b6bdb3 /source4/torture/smb2/util.c
parent8ceb428c5568bd690cb6811a0618f7866633705b (diff)
downloadsamba-d252d23ff15577e2c7049181b5b30692c4bcd6bc.tar.gz
samba-d252d23ff15577e2c7049181b5b30692c4bcd6bc.tar.bz2
samba-d252d23ff15577e2c7049181b5b30692c4bcd6bc.zip
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
Diffstat (limited to 'source4/torture/smb2/util.c')
-rw-r--r--source4/torture/smb2/util.c77
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: