summaryrefslogtreecommitdiff
path: root/source4/torture
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-11-18 09:25:25 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:46:25 -0500
commitc8c7fb2492d3f19939df67f98e4ea6ad423274da (patch)
treeb67057f342a564245eddc57270e21780125bbb98 /source4/torture
parent799724aae7f431ef721b15745a89f01b12b10d9c (diff)
downloadsamba-c8c7fb2492d3f19939df67f98e4ea6ad423274da.tar.gz
samba-c8c7fb2492d3f19939df67f98e4ea6ad423274da.tar.bz2
samba-c8c7fb2492d3f19939df67f98e4ea6ad423274da.zip
r11775: added support for creating files on SMB2 with initial EA lists and an ACL
(This used to be commit ff197092988cee64742f83df23c43ae664a196f9)
Diffstat (limited to 'source4/torture')
-rw-r--r--source4/torture/smb2/connect.c14
-rw-r--r--source4/torture/smb2/scan.c44
-rw-r--r--source4/torture/smb2/setinfo.c2
-rw-r--r--source4/torture/smb2/util.c54
-rw-r--r--source4/torture/torture.c1
5 files changed, 75 insertions, 40 deletions
diff --git a/source4/torture/smb2/connect.c b/source4/torture/smb2/connect.c
index 54f2920600..2307d8fffb 100644
--- a/source4/torture/smb2/connect.c
+++ b/source4/torture/smb2/connect.c
@@ -133,19 +133,6 @@ static struct smb2_handle torture_smb2_create(struct smb2_tree *tree,
struct smb2_create io;
NTSTATUS status;
TALLOC_CTX *tmp_ctx = talloc_new(tree);
- DATA_BLOB blob = data_blob(NULL, 0);
-
-#if 0 /* TODO: find out what this blob mean */
- uint8_t buf[0x18];
-
- SIVAL(buf, 0x00, 0x00000000);
- SIVAL(buf, 0x04, 0x00040010);
- SIVAL(buf, 0x08, 0x00180000);
- SIVAL(buf, 0x0C, 0x00000000);
- SBVAL(buf, 0x10, 0x006C00466341784DLLU);
-
- blob = data_blob_const(buf, 0x18)
-#endif
ZERO_STRUCT(io);
io.in.oplock_flags = 0;
@@ -158,7 +145,6 @@ static struct smb2_handle torture_smb2_create(struct smb2_tree *tree,
NTCREATEX_SHARE_ACCESS_WRITE;
io.in.create_options = NTCREATEX_OPTIONS_WRITE_THROUGH;
io.in.fname = fname;
- io.in.blob = blob;
status = smb2_create(tree, tmp_ctx, &io);
if (!NT_STATUS_IS_OK(status)) {
diff --git a/source4/torture/smb2/scan.c b/source4/torture/smb2/scan.c
index f3a7cd4aa9..908dac3e11 100644
--- a/source4/torture/smb2/scan.c
+++ b/source4/torture/smb2/scan.c
@@ -97,6 +97,50 @@ BOOL torture_smb2_getinfo_scan(void)
}
/*
+ scan for valid SMB2 setinfo levels
+*/
+BOOL torture_smb2_setinfo_scan(void)
+{
+ TALLOC_CTX *mem_ctx = talloc_new(NULL);
+ struct smb2_tree *tree;
+ NTSTATUS status;
+ struct smb2_setinfo io;
+ struct smb2_handle handle;
+ int c, i;
+
+ if (!torture_smb2_connection(mem_ctx, &tree)) {
+ return False;
+ }
+
+ if (!torture_setup_complex_file(FNAME)) {
+ printf("Failed to setup complex file '%s'\n", FNAME);
+ }
+ torture_setup_complex_file(FNAME ":2ndstream");
+
+ torture_smb2_testfile(tree, FNAME, &handle);
+
+ ZERO_STRUCT(io);
+ io.in.blob = data_blob_talloc(mem_ctx, NULL, 1024);
+
+ for (c=1;c<5;c++) {
+ for (i=0;i<0x100;i++) {
+ io.in.level = (i<<8) | c;
+ io.in.handle = handle;
+ status = smb2_setinfo(tree, &io);
+ if (!NT_STATUS_EQUAL(status, NT_STATUS_INVALID_INFO_CLASS) &&
+ !NT_STATUS_EQUAL(status, NT_STATUS_NOT_SUPPORTED)) {
+ printf("file level 0x%04x - %s\n",
+ io.in.level, nt_errstr(status));
+ }
+ }
+ }
+
+ talloc_free(mem_ctx);
+
+ return True;
+}
+
+/*
scan for valid SMB2 opcodes
*/
BOOL torture_smb2_scan(void)
diff --git a/source4/torture/smb2/setinfo.c b/source4/torture/smb2/setinfo.c
index a743c2e5d9..5d0055a1bb 100644
--- a/source4/torture/smb2/setinfo.c
+++ b/source4/torture/smb2/setinfo.c
@@ -134,6 +134,8 @@ BOOL torture_smb2_setinfo(void)
goto done; \
}} while (0)
+
+ torture_smb2_all_info(tree, handle);
printf("test basic_information level\n");
basetime += 86400;
diff --git a/source4/torture/smb2/util.c b/source4/torture/smb2/util.c
index bb239bdd1b..56309929ad 100644
--- a/source4/torture/smb2/util.c
+++ b/source4/torture/smb2/util.c
@@ -60,7 +60,6 @@ NTSTATUS smb2_util_unlink(struct smb2_tree *tree, const char *fname)
NTCREATEX_SHARE_ACCESS_WRITE;
io.in.create_options = NTCREATEX_OPTIONS_DELETE_ON_CLOSE;
io.in.fname = fname;
- io.in.blob = data_blob(NULL, 0);
status = smb2_create(tree, tree, &io);
if (NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_NOT_FOUND)) {
@@ -93,6 +92,7 @@ NTSTATUS smb2_util_write(struct smb2_tree *tree,
*/
NTSTATUS smb2_create_complex_file(struct smb2_tree *tree, const char *fname, struct smb2_handle *handle)
{
+ TALLOC_CTX *tmp_ctx = talloc_new(tree);
char buf[7] = "abc";
struct smb2_create io;
union smb_setfileinfo setfile;
@@ -110,9 +110,33 @@ NTSTATUS smb2_create_complex_file(struct smb2_tree *tree, const char *fname, str
NTCREATEX_SHARE_ACCESS_WRITE;
io.in.create_options = 0;
io.in.fname = fname;
- io.in.blob = data_blob(NULL, 0);
- status = smb2_create(tree, tree, &io);
+ io.in.sd = security_descriptor_create(tmp_ctx,
+ NULL, NULL,
+ SID_NT_AUTHENTICATED_USERS,
+ SEC_ACE_TYPE_ACCESS_ALLOWED,
+ SEC_RIGHTS_FILE_ALL | SEC_STD_ALL,
+ 0,
+ SID_WORLD,
+ SEC_ACE_TYPE_ACCESS_ALLOWED,
+ SEC_RIGHTS_FILE_READ | SEC_STD_ALL,
+ 0,
+ NULL);
+
+ if (strchr(fname, ':') == NULL) {
+ /* setup some EAs */
+ io.in.eas.num_eas = 2;
+ io.in.eas.eas = talloc_array(tmp_ctx, struct ea_struct, 2);
+ io.in.eas.eas[0].flags = 0;
+ io.in.eas.eas[0].name.s = "EAONE";
+ io.in.eas.eas[0].value = data_blob_talloc(tmp_ctx, "VALUE1", 6);
+ io.in.eas.eas[1].flags = 0;
+ io.in.eas.eas[1].name.s = "SECONDEA";
+ io.in.eas.eas[1].value = data_blob_talloc(tmp_ctx, "ValueTwo", 8);
+ }
+
+ status = smb2_create(tree, tmp_ctx, &io);
+ talloc_free(tmp_ctx);
NT_STATUS_NOT_OK_RETURN(status);
*handle = io.out.handle;
@@ -120,26 +144,6 @@ NTSTATUS smb2_create_complex_file(struct smb2_tree *tree, const char *fname, str
status = smb2_util_write(tree, *handle, buf, 0, sizeof(buf));
NT_STATUS_NOT_OK_RETURN(status);
-#if 0
- if (strchr(fname, ':') == NULL) {
- /* setup some EAs */
- setfile.generic.level = RAW_SFILEINFO_EA_SET;
- setfile.generic.file.fnum = fnum;
- setfile.ea_set.in.num_eas = 2;
- setfile.ea_set.in.eas = talloc_array(mem_ctx, struct ea_struct, 2);
- setfile.ea_set.in.eas[0].flags = 0;
- setfile.ea_set.in.eas[0].name.s = "EAONE";
- setfile.ea_set.in.eas[0].value = data_blob_talloc(mem_ctx, "VALUE1", 6);
- setfile.ea_set.in.eas[1].flags = 0;
- setfile.ea_set.in.eas[1].name.s = "SECONDEA";
- setfile.ea_set.in.eas[1].value = data_blob_talloc(mem_ctx, "ValueTwo", 8);
- status = smb_raw_setfileinfo(cli->tree, &setfile);
- if (!NT_STATUS_IS_OK(status)) {
- printf("Failed to setup EAs\n");
- }
- }
-#endif
-
/* make sure all the timestamps aren't the same, and are also
in different DST zones*/
setfile.generic.level = RAW_SFILEINFO_BASIC_INFORMATION;
@@ -294,9 +298,8 @@ NTSTATUS torture_smb2_testfile(struct smb2_tree *tree, const char *fname,
NTCREATEX_SHARE_ACCESS_DELETE|
NTCREATEX_SHARE_ACCESS_READ|
NTCREATEX_SHARE_ACCESS_WRITE;
- io.in.create_options = NTCREATEX_OPTIONS_DELETE_ON_CLOSE;
+ io.in.create_options = 0;
io.in.fname = fname;
- io.in.blob = data_blob(NULL, 0);
status = smb2_create(tree, tree, &io);
NT_STATUS_NOT_OK_RETURN(status);
@@ -330,7 +333,6 @@ NTSTATUS torture_smb2_testdir(struct smb2_tree *tree, const char *fname,
io.in.share_access = NTCREATEX_SHARE_ACCESS_READ|NTCREATEX_SHARE_ACCESS_WRITE|NTCREATEX_SHARE_ACCESS_DELETE;
io.in.create_options = NTCREATEX_OPTIONS_DIRECTORY;
io.in.fname = fname;
- io.in.blob = data_blob(NULL, 0);
status = smb2_create(tree, tree, &io);
NT_STATUS_NOT_OK_RETURN(status);
diff --git a/source4/torture/torture.c b/source4/torture/torture.c
index 3a9fba7dff..434bca2500 100644
--- a/source4/torture/torture.c
+++ b/source4/torture/torture.c
@@ -2255,6 +2255,7 @@ static struct {
{"SMB2-CONNECT", torture_smb2_connect, 0},
{"SMB2-SCAN", torture_smb2_scan, 0},
{"SMB2-SCANGETINFO", torture_smb2_getinfo_scan, 0},
+ {"SMB2-SCANSETINFO", torture_smb2_setinfo_scan, 0},
{"SMB2-GETINFO", torture_smb2_getinfo, 0},
{"SMB2-SETINFO", torture_smb2_setinfo, 0},