diff options
Diffstat (limited to 'source4/torture')
-rw-r--r-- | source4/torture/gentest.c | 2 | ||||
-rw-r--r-- | source4/torture/scanner.c | 49 | ||||
-rw-r--r-- | source4/torture/torture.c | 1 | ||||
-rw-r--r-- | source4/torture/torture_util.c | 35 |
4 files changed, 86 insertions, 1 deletions
diff --git a/source4/torture/gentest.c b/source4/torture/gentest.c index 72b8e8d404..111d00b1a9 100644 --- a/source4/torture/gentest.c +++ b/source4/torture/gentest.c @@ -1256,7 +1256,7 @@ static BOOL handler_ntrename(int instance) parm[0].ntrename.in.old_name = gen_fname(); parm[0].ntrename.in.new_name = gen_fname(); parm[0].ntrename.in.attrib = gen_attrib(); - parm[0].ntrename.in.root_fid = gen_root_fid(instance); + parm[0].ntrename.in.unknown = gen_bits_mask2(0, 0xFFFFFFF); parm[0].ntrename.in.flags = gen_rename_flags(); GEN_COPY_PARM; diff --git a/source4/torture/scanner.c b/source4/torture/scanner.c index 0a92db9a4b..955ae7a274 100644 --- a/source4/torture/scanner.c +++ b/source4/torture/scanner.c @@ -512,3 +512,52 @@ BOOL torture_nttrans_scan(int dummy) printf("nttrans scan finished\n"); return True; } + + +/* scan for valid base SMB requests */ +BOOL torture_smb_scan(int dummy) +{ + static struct cli_state *cli; + int op; + struct cli_request *req; + NTSTATUS status; + + for (op=0x0;op<=0xFF;op++) { + if (op == SMBreadbraw) continue; + + if (!torture_open_connection(&cli)) { + return False; + } + + req = cli_request_setup(cli->tree, op, 0, 0); + + if (!cli_request_send(req)) { + cli_request_destroy(req); + break; + } + + usleep(10000); + if (cli_transport_pending(cli->transport)) { + status = cli_request_simple_recv(req); + printf("op=0x%x status=%s\n", op, nt_errstr(status)); + torture_close_connection(cli); + continue; + } + + sleep(1); + if (cli_transport_pending(cli->transport)) { + status = cli_request_simple_recv(req); + printf("op=0x%x status=%s\n", op, nt_errstr(status)); + } else { + printf("op=0x%x no reply\n", op); + cli_request_destroy(req); + continue; /* don't attempt close! */ + } + + torture_close_connection(cli); + } + + + printf("smb scan finished\n"); + return True; +} diff --git a/source4/torture/torture.c b/source4/torture/torture.c index a43db896e0..bf46c888b2 100644 --- a/source4/torture/torture.c +++ b/source4/torture/torture.c @@ -3929,6 +3929,7 @@ static struct { {"SCAN-TRANS2", torture_trans2_scan, 0}, {"SCAN-NTTRANS", torture_nttrans_scan, 0}, {"SCAN-ALIASES", torture_trans2_aliases, 0}, + {"SCAN-SMB", torture_smb_scan, 0}, {NULL, NULL, 0}}; diff --git a/source4/torture/torture_util.c b/source4/torture/torture_util.c index c8fb8a84b2..7fa8e1133b 100644 --- a/source4/torture/torture_util.c +++ b/source4/torture/torture_util.c @@ -35,6 +35,41 @@ double end_timer(void) (tp2.tv_usec - tp1.tv_usec)*1.0e-6); } + +/* + create a directory, returning a handle to it +*/ +int create_directory_handle(struct cli_state *cli, const char *dname) +{ + NTSTATUS status; + union smb_open io; + TALLOC_CTX *mem_ctx; + + mem_ctx = talloc_init("create_directory_handle"); + + io.generic.level = RAW_OPEN_NTCREATEX; + io.ntcreatex.in.root_fid = 0; + io.ntcreatex.in.flags = 0; + io.ntcreatex.in.access_mask = SA_RIGHT_FILE_ALL_ACCESS; + io.ntcreatex.in.create_options = NTCREATEX_OPTIONS_DIRECTORY; + io.ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL; + io.ntcreatex.in.share_access = NTCREATEX_SHARE_ACCESS_READ | NTCREATEX_SHARE_ACCESS_WRITE; + io.ntcreatex.in.alloc_size = 0; + io.ntcreatex.in.open_disposition = NTCREATEX_DISP_CREATE; + io.ntcreatex.in.impersonation = NTCREATEX_IMPERSONATION_ANONYMOUS; + io.ntcreatex.in.security_flags = 0; + io.ntcreatex.in.fname = dname; + + status = smb_raw_open(cli->tree, mem_ctx, &io); + if (!NT_STATUS_IS_OK(status)) { + talloc_destroy(mem_ctx); + return -1; + } + + talloc_destroy(mem_ctx); + return io.ntcreatex.out.fnum; +} + /* sometimes we need a fairly complex file to work with, so we can test all possible attributes. |