summaryrefslogtreecommitdiff
path: root/source4/torture
diff options
context:
space:
mode:
Diffstat (limited to 'source4/torture')
-rw-r--r--source4/torture/gentest.c6
-rw-r--r--source4/torture/raw/eas.c97
-rw-r--r--source4/torture/raw/open.c89
-rw-r--r--source4/torture/raw/search.c2
-rw-r--r--source4/torture/torture_util.c56
5 files changed, 143 insertions, 107 deletions
diff --git a/source4/torture/gentest.c b/source4/torture/gentest.c
index e49267e162..6c2f9d37fa 100644
--- a/source4/torture/gentest.c
+++ b/source4/torture/gentest.c
@@ -1089,14 +1089,14 @@ static BOOL handler_open(int instance)
NTSTATUS status[NSERVERS];
parm[0].openold.level = RAW_OPEN_OPEN;
- parm[0].openold.in.flags = gen_bits_mask2(0xF, 0xFFFF);
+ parm[0].openold.in.open_mode = gen_bits_mask2(0xF, 0xFFFF);
parm[0].openold.in.search_attrs = gen_attrib();
parm[0].openold.in.fname = gen_fname_open(instance);
if (!options.use_oplocks) {
/* mask out oplocks */
- parm[0].openold.in.flags &= ~(OPENX_FLAGS_REQUEST_OPLOCK|
- OPENX_FLAGS_REQUEST_BATCH_OPLOCK);
+ parm[0].openold.in.open_mode &= ~(OPENX_FLAGS_REQUEST_OPLOCK|
+ OPENX_FLAGS_REQUEST_BATCH_OPLOCK);
}
GEN_COPY_PARM;
diff --git a/source4/torture/raw/eas.c b/source4/torture/raw/eas.c
index 044fe9ebb4..00c2fac74a 100644
--- a/source4/torture/raw/eas.c
+++ b/source4/torture/raw/eas.c
@@ -34,55 +34,6 @@
goto done; \
}} while (0)
-/*
- check that an EA has the right value
-*/
-static BOOL check_ea(struct smbcli_state *cli, TALLOC_CTX *mem_ctx,
- const char *fname, const char *eaname, const char *value)
-{
- union smb_fileinfo info;
- NTSTATUS status;
- BOOL ret = True;
- int i;
-
- info.all_eas.level = RAW_FILEINFO_ALL_EAS;
- info.all_eas.in.fname = fname;
-
- status = smb_raw_pathinfo(cli->tree, mem_ctx, &info);
- CHECK_STATUS(status, NT_STATUS_OK);
-
- for (i=0;i<info.all_eas.out.num_eas;i++) {
- if (StrCaseCmp(eaname, info.all_eas.out.eas[i].name.s) == 0) {
- if (value == NULL) {
- printf("attr '%s' should not be present\n", eaname);
- return False;
- }
- if (strlen(value) == info.all_eas.out.eas[i].value.length &&
- memcmp(value,
- info.all_eas.out.eas[i].value.data,
- info.all_eas.out.eas[i].value.length) == 0) {
- return True;
- } else {
- printf("attr '%s' has wrong value '%*.*s'\n",
- eaname,
- info.all_eas.out.eas[i].value.length,
- info.all_eas.out.eas[i].value.length,
- info.all_eas.out.eas[i].value.data);
- ret = False;
- goto done;
- }
- }
- }
-
- if (value != NULL) {
- printf("attr '%s' not found\n", eaname);
- ret = False;
- }
-
-done:
- return ret;
-}
-
static DATA_BLOB data_blob_string_const(const char *str)
{
DATA_BLOB blob;
@@ -91,6 +42,12 @@ static DATA_BLOB data_blob_string_const(const char *str)
return blob;
}
+static BOOL check_ea(struct smbcli_state *cli,
+ const char *fname, const char *eaname, const char *value)
+{
+ NTSTATUS status = torture_check_ea(cli, fname, eaname, value);
+ return NT_STATUS_IS_OK(status);
+}
static BOOL test_eas(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
{
@@ -121,7 +78,7 @@ static BOOL test_eas(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_STATUS(status, NT_STATUS_OK);
fnum = io.ntcreatex.out.fnum;
- ret &= check_ea(cli, mem_ctx, fname, "EAONE", NULL);
+ ret &= check_ea(cli, fname, "EAONE", NULL);
printf("Adding first EA\n");
setfile.generic.level = RAW_SFILEINFO_EA_SET;
@@ -133,7 +90,7 @@ static BOOL test_eas(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
status = smb_raw_setfileinfo(cli->tree, &setfile);
CHECK_STATUS(status, NT_STATUS_OK);
- ret &= check_ea(cli, mem_ctx, fname, "EAONE", "VALUE1");
+ ret &= check_ea(cli, fname, "EAONE", "VALUE1");
setfile.ea_set.in.ea.name.s = "SECONDEA";
setfile.ea_set.in.ea.value = data_blob_string_const("ValueTwo");
@@ -142,16 +99,16 @@ static BOOL test_eas(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
status = smb_raw_setfileinfo(cli->tree, &setfile);
CHECK_STATUS(status, NT_STATUS_OK);
- ret &= check_ea(cli, mem_ctx, fname, "EAONE", "VALUE1");
- ret &= check_ea(cli, mem_ctx, fname, "SECONDEA", "ValueTwo");
+ ret &= check_ea(cli, fname, "EAONE", "VALUE1");
+ ret &= check_ea(cli, fname, "SECONDEA", "ValueTwo");
printf("Modifying 2nd EA\n");
setfile.ea_set.in.ea.value = data_blob_string_const(" Changed Value");
status = smb_raw_setfileinfo(cli->tree, &setfile);
CHECK_STATUS(status, NT_STATUS_OK);
- ret &= check_ea(cli, mem_ctx, fname, "EAONE", "VALUE1");
- ret &= check_ea(cli, mem_ctx, fname, "SECONDEA", " Changed Value");
+ ret &= check_ea(cli, fname, "EAONE", "VALUE1");
+ ret &= check_ea(cli, fname, "SECONDEA", " Changed Value");
printf("Setting a NULL EA\n");
setfile.ea_set.in.ea.value = data_blob(NULL, 0);
@@ -159,9 +116,9 @@ static BOOL test_eas(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
status = smb_raw_setfileinfo(cli->tree, &setfile);
CHECK_STATUS(status, NT_STATUS_OK);
- ret &= check_ea(cli, mem_ctx, fname, "EAONE", "VALUE1");
- ret &= check_ea(cli, mem_ctx, fname, "SECONDEA", " Changed Value");
- ret &= check_ea(cli, mem_ctx, fname, "NULLEA", NULL);
+ ret &= check_ea(cli, fname, "EAONE", "VALUE1");
+ ret &= check_ea(cli, fname, "SECONDEA", " Changed Value");
+ ret &= check_ea(cli, fname, "NULLEA", NULL);
printf("Deleting first EA\n");
setfile.ea_set.in.ea.flags = 0;
@@ -170,8 +127,8 @@ static BOOL test_eas(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
status = smb_raw_setfileinfo(cli->tree, &setfile);
CHECK_STATUS(status, NT_STATUS_OK);
- ret &= check_ea(cli, mem_ctx, fname, "EAONE", NULL);
- ret &= check_ea(cli, mem_ctx, fname, "SECONDEA", " Changed Value");
+ ret &= check_ea(cli, fname, "EAONE", NULL);
+ ret &= check_ea(cli, fname, "SECONDEA", " Changed Value");
printf("Deleting second EA\n");
setfile.ea_set.in.ea.flags = 0;
@@ -180,8 +137,8 @@ static BOOL test_eas(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
status = smb_raw_setfileinfo(cli->tree, &setfile);
CHECK_STATUS(status, NT_STATUS_OK);
- ret &= check_ea(cli, mem_ctx, fname, "EAONE", NULL);
- ret &= check_ea(cli, mem_ctx, fname, "SECONDEA", NULL);
+ ret &= check_ea(cli, fname, "EAONE", NULL);
+ ret &= check_ea(cli, fname, "SECONDEA", NULL);
done:
smbcli_close(cli->tree, fnum);
@@ -241,10 +198,10 @@ static BOOL test_nttrans_create(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_STATUS(status, NT_STATUS_OK);
fnum = io.ntcreatex.out.fnum;
- ret &= check_ea(cli, mem_ctx, fname, "EAONE", NULL);
- ret &= check_ea(cli, mem_ctx, fname, "1st EA", "Value One");
- ret &= check_ea(cli, mem_ctx, fname, "2nd EA", "Second Value");
- ret &= check_ea(cli, mem_ctx, fname, "and 3rd", "final value");
+ ret &= check_ea(cli, fname, "EAONE", NULL);
+ ret &= check_ea(cli, fname, "1st EA", "Value One");
+ ret &= check_ea(cli, fname, "2nd EA", "Second Value");
+ ret &= check_ea(cli, fname, "and 3rd", "final value");
smbcli_close(cli->tree, fnum);
@@ -261,10 +218,10 @@ static BOOL test_nttrans_create(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_STATUS(status, NT_STATUS_OK);
fnum = io.ntcreatex.out.fnum;
- ret &= check_ea(cli, mem_ctx, fname, "1st EA", "Value One");
- ret &= check_ea(cli, mem_ctx, fname, "2nd EA", "Second Value");
- ret &= check_ea(cli, mem_ctx, fname, "and 3rd", "final value");
- ret &= check_ea(cli, mem_ctx, fname, "Fourth EA", NULL);
+ ret &= check_ea(cli, fname, "1st EA", "Value One");
+ ret &= check_ea(cli, fname, "2nd EA", "Second Value");
+ ret &= check_ea(cli, fname, "and 3rd", "final value");
+ ret &= check_ea(cli, fname, "Fourth EA", NULL);
done:
smbcli_close(cli->tree, fnum);
diff --git a/source4/torture/raw/open.c b/source4/torture/raw/open.c
index a1cc76ebd8..f3d5daeade 100644
--- a/source4/torture/raw/open.c
+++ b/source4/torture/raw/open.c
@@ -160,7 +160,7 @@ static BOOL test_open(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
io.openold.level = RAW_OPEN_OPEN;
io.openold.in.fname = fname;
- io.openold.in.flags = OPEN_FLAGS_FCB;
+ io.openold.in.open_mode = OPEN_FLAGS_FCB;
io.openold.in.search_attrs = 0;
status = smb_raw_open(cli->tree, mem_ctx, &io);
CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_NOT_FOUND);
@@ -187,21 +187,21 @@ static BOOL test_open(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
io.openold.in.fname = fname;
io.openold.in.search_attrs = 0;
- io.openold.in.flags = OPEN_FLAGS_OPEN_READ;
+ io.openold.in.open_mode = OPEN_FLAGS_OPEN_READ;
status = smb_raw_open(cli->tree, mem_ctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
fnum = io.openold.out.fnum;
CHECK_RDWR(fnum, RDWR_RDONLY);
smbcli_close(cli->tree, fnum);
- io.openold.in.flags = OPEN_FLAGS_OPEN_WRITE;
+ io.openold.in.open_mode = OPEN_FLAGS_OPEN_WRITE;
status = smb_raw_open(cli->tree, mem_ctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
fnum = io.openold.out.fnum;
CHECK_RDWR(fnum, RDWR_WRONLY);
smbcli_close(cli->tree, fnum);
- io.openold.in.flags = OPEN_FLAGS_OPEN_RDWR;
+ io.openold.in.open_mode = OPEN_FLAGS_OPEN_RDWR;
status = smb_raw_open(cli->tree, mem_ctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
fnum = io.openold.out.fnum;
@@ -209,22 +209,22 @@ static BOOL test_open(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
smbcli_close(cli->tree, fnum);
/* check the share modes roughly - not a complete matrix */
- io.openold.in.flags = OPEN_FLAGS_OPEN_RDWR | OPEN_FLAGS_DENY_WRITE;
+ io.openold.in.open_mode = OPEN_FLAGS_OPEN_RDWR | OPEN_FLAGS_DENY_WRITE;
status = smb_raw_open(cli->tree, mem_ctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
fnum = io.openold.out.fnum;
CHECK_RDWR(fnum, RDWR_RDWR);
- if (io.openold.in.flags != io.openold.out.rmode) {
- printf("(%s) rmode should equal flags - 0x%x 0x%x\n",
- __location__, io.openold.out.rmode, io.openold.in.flags);
+ if (io.openold.in.open_mode != io.openold.out.rmode) {
+ printf("(%s) rmode should equal open_mode - 0x%x 0x%x\n",
+ __location__, io.openold.out.rmode, io.openold.in.open_mode);
}
- io.openold.in.flags = OPEN_FLAGS_OPEN_RDWR | OPEN_FLAGS_DENY_NONE;
+ io.openold.in.open_mode = OPEN_FLAGS_OPEN_RDWR | OPEN_FLAGS_DENY_NONE;
status = smb_raw_open(cli->tree, mem_ctx, &io);
CHECK_STATUS(status, NT_STATUS_SHARING_VIOLATION);
- io.openold.in.flags = OPEN_FLAGS_OPEN_READ | OPEN_FLAGS_DENY_NONE;
+ io.openold.in.open_mode = OPEN_FLAGS_OPEN_READ | OPEN_FLAGS_DENY_NONE;
status = smb_raw_open(cli->tree, mem_ctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
fnum2 = io.openold.out.fnum;
@@ -237,7 +237,7 @@ static BOOL test_open(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
io.openold.level = RAW_OPEN_OPEN;
io.openold.in.fname = fname;
io.openold.in.search_attrs = 0;
- io.openold.in.flags = OPEN_FLAGS_OPEN_READ;
+ io.openold.in.open_mode = OPEN_FLAGS_OPEN_READ;
status = smb_raw_open(cli->tree, mem_ctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
fnum = io.openold.out.fnum;
@@ -319,12 +319,16 @@ static BOOL test_openx(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
i, (int)open_funcs[i].with_file, (int)open_funcs[i].open_func);
ret = False;
}
- if (NT_STATUS_IS_OK(status) || open_funcs[i].with_file) {
+ if (NT_STATUS_IS_OK(status)) {
smbcli_close(cli->tree, io.openx.out.fnum);
+ }
+ if (open_funcs[i].with_file) {
smbcli_unlink(cli->tree, fname);
}
}
+ smbcli_unlink(cli->tree, fname);
+
/* check the basic return fields */
io.openx.in.open_func = OPENX_OPEN_FUNC_OPEN | OPENX_OPEN_FUNC_CREATE;
status = smb_raw_open(cli->tree, mem_ctx, &io);
@@ -434,6 +438,10 @@ static BOOL test_openx(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_VAL(io.openx.out.access_mask, SEC_STD_ALL);
smbcli_close(cli->tree, io.openx.out.fnum);
+ io.openx.in.fname = "\\A.+,;=[].B";
+ status = smb_raw_open(cli->tree, mem_ctx, &io);
+ CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_NOT_FOUND);
+
done:
smbcli_close(cli->tree, fnum);
smbcli_unlink(cli->tree, fname);
@@ -445,9 +453,7 @@ done:
/*
test RAW_OPEN_T2OPEN
- I can't work out how to get win2003 to accept a create file via TRANS2_OPEN, which
- is why you see all the ACCESS_DENIED results below. When we finally work this out then this
- test will make more sense
+ many thanks to kukks for a sniff showing how this works with os2->w2k
*/
static BOOL test_t2open(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
{
@@ -468,15 +474,15 @@ static BOOL test_t2open(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
{ OPENX_OPEN_FUNC_OPEN, True, NT_STATUS_OK },
{ OPENX_OPEN_FUNC_OPEN, False, NT_STATUS_OBJECT_NAME_NOT_FOUND },
{ OPENX_OPEN_FUNC_OPEN | OPENX_OPEN_FUNC_CREATE, True, NT_STATUS_OK },
- { OPENX_OPEN_FUNC_OPEN | OPENX_OPEN_FUNC_CREATE, False, NT_STATUS_ACCESS_DENIED },
+ { OPENX_OPEN_FUNC_OPEN | OPENX_OPEN_FUNC_CREATE, False, NT_STATUS_OK },
{ OPENX_OPEN_FUNC_FAIL, True, NT_STATUS_OBJECT_NAME_COLLISION },
- { OPENX_OPEN_FUNC_FAIL, False, NT_STATUS_ACCESS_DENIED },
+ { OPENX_OPEN_FUNC_FAIL, False, NT_STATUS_OBJECT_NAME_COLLISION },
{ OPENX_OPEN_FUNC_FAIL | OPENX_OPEN_FUNC_CREATE, True, NT_STATUS_OBJECT_NAME_COLLISION },
- { OPENX_OPEN_FUNC_FAIL | OPENX_OPEN_FUNC_CREATE, False, NT_STATUS_ACCESS_DENIED },
- { OPENX_OPEN_FUNC_TRUNC, True, NT_STATUS_ACCESS_DENIED },
- { OPENX_OPEN_FUNC_TRUNC, False, NT_STATUS_OBJECT_NAME_NOT_FOUND },
- { OPENX_OPEN_FUNC_TRUNC | OPENX_OPEN_FUNC_CREATE, True, NT_STATUS_ACCESS_DENIED },
- { OPENX_OPEN_FUNC_TRUNC | OPENX_OPEN_FUNC_CREATE, False, NT_STATUS_ACCESS_DENIED },
+ { OPENX_OPEN_FUNC_FAIL | OPENX_OPEN_FUNC_CREATE, False, NT_STATUS_OBJECT_NAME_COLLISION },
+ { OPENX_OPEN_FUNC_TRUNC, True, NT_STATUS_OK },
+ { OPENX_OPEN_FUNC_TRUNC, False, NT_STATUS_OK },
+ { OPENX_OPEN_FUNC_TRUNC | OPENX_OPEN_FUNC_CREATE, True, NT_STATUS_OK },
+ { OPENX_OPEN_FUNC_TRUNC | OPENX_OPEN_FUNC_CREATE, False, NT_STATUS_OK },
};
fnum = create_complex_file(cli, mem_ctx, fname1);
@@ -490,20 +496,26 @@ static BOOL test_t2open(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
printf("Checking RAW_OPEN_T2OPEN\n");
io.t2open.level = RAW_OPEN_T2OPEN;
- io.t2open.in.flags = OPENX_FLAGS_ADDITIONAL_INFO |
- OPENX_FLAGS_EA_LEN | OPENX_FLAGS_EXTENDED_RETURN;
+ io.t2open.in.flags = OPENX_FLAGS_ADDITIONAL_INFO;
io.t2open.in.open_mode = OPENX_MODE_DENY_NONE | OPENX_MODE_ACCESS_RDWR;
io.t2open.in.open_func = OPENX_OPEN_FUNC_OPEN | OPENX_OPEN_FUNC_CREATE;
+ io.t2open.in.search_attrs = 0;
io.t2open.in.file_attrs = 0;
io.t2open.in.write_time = 0;
io.t2open.in.size = 0;
io.t2open.in.timeout = 0;
- io.t2open.in.eas = talloc_p(mem_ctx, struct ea_struct);
- io.t2open.in.num_eas = 1;
+ io.t2open.in.num_eas = 3;
+ io.t2open.in.eas = talloc_array_p(mem_ctx, struct ea_struct, io.t2open.in.num_eas);
io.t2open.in.eas[0].flags = 0;
- io.t2open.in.eas[0].name.s = "EAONE";
- io.t2open.in.eas[0].value = data_blob_talloc(mem_ctx, "1", 1);
+ io.t2open.in.eas[0].name.s = ".CLASSINFO";
+ io.t2open.in.eas[0].value = data_blob_talloc(mem_ctx, "first value", 11);
+ io.t2open.in.eas[1].flags = 0;
+ io.t2open.in.eas[1].name.s = "EA TWO";
+ io.t2open.in.eas[1].value = data_blob_talloc(mem_ctx, "foo", 3);
+ io.t2open.in.eas[2].flags = 0;
+ io.t2open.in.eas[2].name.s = "X THIRD";
+ io.t2open.in.eas[2].value = data_blob_talloc(mem_ctx, "xy", 2);
/* check all combinations of open_func */
for (i=0; i<ARRAY_SIZE(open_funcs); i++) {
@@ -526,25 +538,35 @@ static BOOL test_t2open(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
}
smbcli_unlink(cli->tree, fname1);
+ smbcli_unlink(cli->tree, fname2);
/* check the basic return fields */
- fnum = create_complex_file(cli, mem_ctx, fname);
- smbcli_close(cli->tree, fnum);
io.t2open.in.open_func = OPENX_OPEN_FUNC_OPEN | OPENX_OPEN_FUNC_CREATE;
+ io.t2open.in.write_time = 0;
io.t2open.in.fname = fname;
status = smb_raw_open(cli->tree, mem_ctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
fnum = io.t2open.out.fnum;
CHECK_ALL_INFO(io.t2open.out.size, size);
+#if 0
+ /* windows appears to leak uninitialised memory here */
CHECK_VAL(io.t2open.out.write_time, 0);
+#endif
CHECK_ALL_INFO(io.t2open.out.attrib, attrib & ~FILE_ATTRIBUTE_NONINDEXED);
CHECK_VAL(io.t2open.out.access, OPENX_MODE_DENY_NONE | OPENX_MODE_ACCESS_RDWR);
CHECK_VAL(io.t2open.out.ftype, 0);
CHECK_VAL(io.t2open.out.devstate, 0);
- CHECK_VAL(io.t2open.out.action, OPENX_ACTION_EXISTED);
+ CHECK_VAL(io.t2open.out.action, OPENX_ACTION_CREATED);
smbcli_close(cli->tree, fnum);
+ status = torture_check_ea(cli, fname, ".CLASSINFO", "first value");
+ CHECK_STATUS(status, NT_STATUS_OK);
+ status = torture_check_ea(cli, fname, "EA TWO", "foo");
+ CHECK_STATUS(status, NT_STATUS_OK);
+ status = torture_check_ea(cli, fname, "X THIRD", "xy");
+ CHECK_STATUS(status, NT_STATUS_OK);
+
/* now check the search attrib for hidden files - win2003 ignores this? */
SET_ATTRIB(FILE_ATTRIBUTE_HIDDEN);
CHECK_ALL_INFO(FILE_ATTRIBUTE_HIDDEN, attrib);
@@ -564,14 +586,15 @@ static BOOL test_t2open(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
io.t2open.in.open_func = OPENX_OPEN_FUNC_FAIL | OPENX_OPEN_FUNC_CREATE;
io.t2open.in.file_attrs = FILE_ATTRIBUTE_SYSTEM;
status = smb_raw_open(cli->tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_ACCESS_DENIED);
+ CHECK_STATUS(status, NT_STATUS_OK);
/* check timeout on create - win2003 ignores the timeout! */
io.t2open.in.open_func = OPENX_OPEN_FUNC_OPEN | OPENX_OPEN_FUNC_CREATE;
io.t2open.in.file_attrs = 0;
+ io.t2open.in.timeout = 20000;
io.t2open.in.open_mode = OPENX_MODE_ACCESS_RDWR | OPENX_MODE_DENY_ALL;
status = smb_raw_open(cli->tree, mem_ctx, &io);
- CHECK_STATUS(status, NT_STATUS_ACCESS_DENIED);
+ CHECK_STATUS(status, NT_STATUS_SHARING_VIOLATION);
done:
smbcli_close(cli->tree, fnum);
diff --git a/source4/torture/raw/search.c b/source4/torture/raw/search.c
index f159c4e154..395b9ff559 100644
--- a/source4/torture/raw/search.c
+++ b/source4/torture/raw/search.c
@@ -1150,7 +1150,7 @@ static BOOL test_os2_delete(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
}
if (i>0) {
- io2.t2fnext.in.resume_key = 0;
+ io2.t2fnext.in.resume_key = result.list[i-1].ea_size.resume_key;
io2.t2fnext.in.last_name = result.list[i-1].ea_size.name.s;
}
} while (NT_STATUS_IS_OK(status) && result.count != 0);
diff --git a/source4/torture/torture_util.c b/source4/torture/torture_util.c
index 6370086838..05b06c6d0e 100644
--- a/source4/torture/torture_util.c
+++ b/source4/torture/torture_util.c
@@ -356,3 +356,59 @@ NTSTATUS torture_set_sparse(struct smbcli_tree *tree, int fnum)
return status;
}
+
+/*
+ check that an EA has the right value
+*/
+NTSTATUS torture_check_ea(struct smbcli_state *cli,
+ const char *fname, const char *eaname, const char *value)
+{
+ union smb_fileinfo info;
+ NTSTATUS status;
+ int i;
+ TALLOC_CTX *mem_ctx = talloc(cli, 0);
+
+ info.all_eas.level = RAW_FILEINFO_ALL_EAS;
+ info.all_eas.in.fname = fname;
+
+ status = smb_raw_pathinfo(cli->tree, mem_ctx, &info);
+ if (!NT_STATUS_IS_OK(status)) {
+ talloc_free(mem_ctx);
+ return status;
+ }
+
+ for (i=0;i<info.all_eas.out.num_eas;i++) {
+ if (StrCaseCmp(eaname, info.all_eas.out.eas[i].name.s) == 0) {
+ if (value == NULL) {
+ printf("attr '%s' should not be present\n", eaname);
+ talloc_free(mem_ctx);
+ return NT_STATUS_EA_CORRUPT_ERROR;
+ }
+ if (strlen(value) == info.all_eas.out.eas[i].value.length &&
+ memcmp(value,
+ info.all_eas.out.eas[i].value.data,
+ info.all_eas.out.eas[i].value.length) == 0) {
+ talloc_free(mem_ctx);
+ return NT_STATUS_OK;
+ } else {
+ printf("attr '%s' has wrong value '%*.*s'\n",
+ eaname,
+ info.all_eas.out.eas[i].value.length,
+ info.all_eas.out.eas[i].value.length,
+ info.all_eas.out.eas[i].value.data);
+ talloc_free(mem_ctx);
+ return NT_STATUS_EA_CORRUPT_ERROR;
+ }
+ }
+ }
+
+ talloc_free(mem_ctx);
+
+ if (value != NULL) {
+ printf("attr '%s' not found\n", eaname);
+ return NT_STATUS_NONEXISTENT_EA_ENTRY;
+ }
+
+ return NT_STATUS_OK;
+}
+