summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source4/include/smb_interfaces.h2
-rw-r--r--source4/libcli/raw/rawfile.c2
-rw-r--r--source4/torture/gentest.c2
-rw-r--r--source4/torture/scanner.c49
-rw-r--r--source4/torture/torture.c1
-rw-r--r--source4/torture/torture_util.c35
6 files changed, 88 insertions, 3 deletions
diff --git a/source4/include/smb_interfaces.h b/source4/include/smb_interfaces.h
index f010883f18..2f5373702c 100644
--- a/source4/include/smb_interfaces.h
+++ b/source4/include/smb_interfaces.h
@@ -151,7 +151,7 @@ union smb_rename {
struct {
uint16 attrib;
uint16 flags; /* see RENAME_FLAG_* */
- uint32 root_fid; /* is it? */
+ uint32 unknown;
const char *old_name;
const char *new_name;
} in;
diff --git a/source4/libcli/raw/rawfile.c b/source4/libcli/raw/rawfile.c
index 57b6ded66f..97ec7c1f00 100644
--- a/source4/libcli/raw/rawfile.c
+++ b/source4/libcli/raw/rawfile.c
@@ -48,7 +48,7 @@ struct cli_request *smb_raw_rename_send(struct cli_tree *tree,
SETUP_REQUEST(SMBntrename, 4, 0);
SSVAL(req->out.vwv, VWV(0), parms->ntrename.in.attrib);
SSVAL(req->out.vwv, VWV(1), parms->ntrename.in.flags);
- SIVAL(req->out.vwv, VWV(2), parms->ntrename.in.root_fid);
+ SIVAL(req->out.vwv, VWV(2), parms->ntrename.in.unknown);
cli_req_append_ascii4(req, parms->ntrename.in.old_name, STR_TERMINATE);
cli_req_append_ascii4(req, parms->ntrename.in.new_name, STR_TERMINATE);
break;
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.