From fc04e3e795cebca5723c24e097f5374a23b2247b Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 19 Nov 2005 06:39:12 +0000 Subject: r11801: - added basic SMB2 find support - added SMB2-SCANFIND test - cleaned up continue flags in EAs and find requests (This used to be commit 8792bc07d927e6470874230153177748afae3ee8) --- source4/torture/smb2/scan.c | 48 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) (limited to 'source4/torture/smb2/scan.c') diff --git a/source4/torture/smb2/scan.c b/source4/torture/smb2/scan.c index 81e0bea69a..b0c4ba4c8d 100644 --- a/source4/torture/smb2/scan.c +++ b/source4/torture/smb2/scan.c @@ -146,6 +146,54 @@ BOOL torture_smb2_setinfo_scan(void) return True; } + +/* + scan for valid SMB2 scan levels +*/ +BOOL torture_smb2_find_scan(void) +{ + TALLOC_CTX *mem_ctx = talloc_new(NULL); + struct smb2_tree *tree; + NTSTATUS status; + struct smb2_find io; + struct smb2_handle handle; + int i; + + if (!torture_smb2_connection(mem_ctx, &tree)) { + return False; + } + + status = smb2_util_roothandle(tree, &handle); + if (!NT_STATUS_IS_OK(status)) { + printf("Failed to open roothandle - %s\n", nt_errstr(status)); + return False; + } + + ZERO_STRUCT(io); + io.in.pattern = "*"; + io.in.continue_flags = SMB2_CONTINUE_FLAG_RESTART; + io.in.max_response_size = 0x10000; + io.in.handle = handle; + + for (i=1;i<0x100;i++) { + io.in.level = i; + + io.in.handle = handle; + status = smb2_find(tree, mem_ctx, &io); + if (!NT_STATUS_EQUAL(status, NT_STATUS_INVALID_INFO_CLASS) && + !NT_STATUS_EQUAL(status, NT_STATUS_INVALID_PARAMETER) && + !NT_STATUS_EQUAL(status, NT_STATUS_NOT_SUPPORTED)) { + printf("find level 0x%04x is %d bytes - %s\n", + io.in.level, io.out.blob.length, nt_errstr(status)); + dump_data(1, io.out.blob.data, io.out.blob.length); + } + } + + talloc_free(mem_ctx); + + return True; +} + /* scan for valid SMB2 opcodes */ -- cgit