summaryrefslogtreecommitdiff
path: root/source4/torture/raw/open.c
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2007-01-03 06:29:22 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:36:01 -0500
commitd1e3dccab64712cc219bb5c6892cb0d243d109fc (patch)
tree9f514aa59a27901fd644dc215b375600bca053ec /source4/torture/raw/open.c
parente8dfa06d45b4aaa784b9f8795f4197451aed4188 (diff)
downloadsamba-d1e3dccab64712cc219bb5c6892cb0d243d109fc.tar.gz
samba-d1e3dccab64712cc219bb5c6892cb0d243d109fc.tar.bz2
samba-d1e3dccab64712cc219bb5c6892cb0d243d109fc.zip
r20497: Two changes to RAW-OPEN that Samba does not fulfil:
Samba3 returns the SPARSE flag for files with size > allocation, and on many configs Samba3 does not support EAs. Cope with both. Tridge, please check this is acceptable for this test. Volker (This used to be commit 4df4d37c3d4d9e6c430afd36e88684f02c73700e)
Diffstat (limited to 'source4/torture/raw/open.c')
-rw-r--r--source4/torture/raw/open.c30
1 files changed, 25 insertions, 5 deletions
diff --git a/source4/torture/raw/open.c b/source4/torture/raw/open.c
index e288a8d5fe..3c6b1e2fa5 100644
--- a/source4/torture/raw/open.c
+++ b/source4/torture/raw/open.c
@@ -396,8 +396,15 @@ static BOOL test_openx(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
io.openx.in.file_attrs = FILE_ATTRIBUTE_SYSTEM;
status = smb_raw_open(cli->tree, mem_ctx, &io);
CHECK_STATUS(status, NT_STATUS_OK);
- CHECK_ALL_INFO(FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_ARCHIVE,
- attrib & ~FILE_ATTRIBUTE_NONINDEXED);
+ if (lp_parm_bool(-1, "torture", "samba3", False)) {
+ CHECK_ALL_INFO(FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_ARCHIVE,
+ attrib & ~(FILE_ATTRIBUTE_NONINDEXED|
+ FILE_ATTRIBUTE_SPARSE));
+ }
+ else {
+ CHECK_ALL_INFO(FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_ARCHIVE,
+ attrib & ~(FILE_ATTRIBUTE_NONINDEXED));
+ }
smbcli_close(cli->tree, io.openx.out.file.fnum);
smbcli_unlink(cli->tree, fname);
@@ -550,6 +557,7 @@ static BOOL test_t2open(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
/* check all combinations of open_func */
for (i=0; i<ARRAY_SIZE(open_funcs); i++) {
+ again:
if (open_funcs[i].with_file) {
io.t2open.in.fname = fname1;
} else {
@@ -557,6 +565,15 @@ static BOOL test_t2open(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
}
io.t2open.in.open_func = open_funcs[i].open_func;
status = smb_raw_open(cli->tree, mem_ctx, &io);
+ if ((io.t2open.in.num_eas != 0)
+ && NT_STATUS_EQUAL(status, NT_STATUS_EAS_NOT_SUPPORTED)
+ && lp_parm_bool(-1, "torture", "samba3", False)) {
+ printf("(%s) EAs not supported, not treating as fatal "
+ "in Samba3 test\n", __location__);
+ io.t2open.in.num_eas = 0;
+ goto again;
+ }
+
if (!NT_STATUS_EQUAL(status, open_funcs[i].correct_status)) {
printf("(%s) incorrect status %s should be %s (i=%d with_file=%d open_func=0x%x)\n",
__location__, nt_errstr(status), nt_errstr(open_funcs[i].correct_status),
@@ -592,11 +609,14 @@ static BOOL test_t2open(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
smbcli_close(cli->tree, fnum);
status = torture_check_ea(cli, fname, ".CLASSINFO", "first value");
- CHECK_STATUS(status, NT_STATUS_OK);
+ CHECK_STATUS(status, io.t2open.in.num_eas
+ ? NT_STATUS_OK : NT_STATUS_EAS_NOT_SUPPORTED);
status = torture_check_ea(cli, fname, "EA TWO", "foo");
- CHECK_STATUS(status, NT_STATUS_OK);
+ CHECK_STATUS(status, io.t2open.in.num_eas
+ ? NT_STATUS_OK : NT_STATUS_EAS_NOT_SUPPORTED);
status = torture_check_ea(cli, fname, "X THIRD", "xy");
- CHECK_STATUS(status, NT_STATUS_OK);
+ CHECK_STATUS(status, io.t2open.in.num_eas
+ ? NT_STATUS_OK : NT_STATUS_EAS_NOT_SUPPORTED);
/* now check the search attrib for hidden files - win2003 ignores this? */
SET_ATTRIB(FILE_ATTRIBUTE_HIDDEN);