summaryrefslogtreecommitdiff
path: root/source4/torture
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2012-08-19 21:01:33 +1000
committerAndrew Bartlett <abartlet@samba.org>2012-08-20 21:58:07 +1000
commitbf1e27bd8fa509d4039ec617a486589607d0d204 (patch)
tree5b14f06e37e15b7df77723f20993f843f8c59efb /source4/torture
parent3787dcf42c9ab9ec5a3648b14f86e8bb2032958e (diff)
downloadsamba-bf1e27bd8fa509d4039ec617a486589607d0d204.tar.gz
samba-bf1e27bd8fa509d4039ec617a486589607d0d204.tar.bz2
samba-bf1e27bd8fa509d4039ec617a486589607d0d204.zip
s4-torture: Improve raw.streams test to cover EAs and to use torture_assert()
The extension of this test is to create an extended attribute, so we can confirm that the easize field on a stream actually refers to the parent file. This has been run against Windows 7. Andrew Bartlett
Diffstat (limited to 'source4/torture')
-rw-r--r--source4/torture/raw/streams.c59
1 files changed, 25 insertions, 34 deletions
diff --git a/source4/torture/raw/streams.c b/source4/torture/raw/streams.c
index d48c555d22..a9097119f3 100644
--- a/source4/torture/raw/streams.c
+++ b/source4/torture/raw/streams.c
@@ -695,10 +695,12 @@ static bool test_stream_names(struct torture_context *tctx,
io.generic.level = RAW_OPEN_NTCREATEX;
io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.flags = 0;
- io.ntcreatex.in.access_mask = SEC_FILE_WRITE_DATA;
+ io.ntcreatex.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
io.ntcreatex.in.create_options = 0;
io.ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL;
- io.ntcreatex.in.share_access = 0;
+ 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;
@@ -709,6 +711,22 @@ static bool test_stream_names(struct torture_context *tctx,
CHECK_STATUS(status, NT_STATUS_OK);
fnum1 = io.ntcreatex.out.file.fnum;
+ torture_comment(tctx, "Adding two EAs to base file\n");
+ ZERO_STRUCT(sinfo);
+ sinfo.generic.level = RAW_SFILEINFO_EA_SET;
+ sinfo.generic.in.file.fnum = fnum1;
+ sinfo.ea_set.in.num_eas = 2;
+ sinfo.ea_set.in.eas = talloc_array(tctx, struct ea_struct, 2);
+ sinfo.ea_set.in.eas[0].flags = 0;
+ sinfo.ea_set.in.eas[0].name.s = "EAONE";
+ sinfo.ea_set.in.eas[0].value = data_blob_string_const("VALUE1");
+ sinfo.ea_set.in.eas[1].flags = 0;
+ sinfo.ea_set.in.eas[1].name.s = "SECONDEA";
+ sinfo.ea_set.in.eas[1].value = data_blob_string_const("ValueTwo");
+
+ status = smb_raw_setfileinfo(cli->tree, &sinfo);
+ CHECK_STATUS(status, NT_STATUS_OK);
+
/*
* Make sure the create time of the streams are different from the
* base file.
@@ -1688,13 +1706,7 @@ static bool test_stream_attributes(struct torture_context *tctx,
status = smb_raw_pathinfo(cli->tree, tctx, &finfo);
CHECK_STATUS(status, NT_STATUS_OK);
- if (finfo.basic_info.out.attrib != FILE_ATTRIBUTE_ARCHIVE) {
- printf("(%s) Incorrect attrib %x - should be %x\n", \
- __location__, (unsigned int)finfo.basic_info.out.attrib,
- (unsigned int)FILE_ATTRIBUTE_ARCHIVE);
- ret = false;
- goto done;
- }
+ torture_assert_int_equal_goto(tctx, finfo.all_info.out.attrib & ~FILE_ATTRIBUTE_NONINDEXED, FILE_ATTRIBUTE_ARCHIVE, ret, done, "attrib incorrect");
/* Now open the stream name. */
@@ -1725,12 +1737,7 @@ static bool test_stream_attributes(struct torture_context *tctx,
sfinfo.generic.level = RAW_SFILEINFO_BASIC_INFORMATION;
sfinfo.generic.in.file.fnum = fnum;
status = smb_raw_setfileinfo(cli->tree, &sfinfo);
- if (!NT_STATUS_EQUAL(status, NT_STATUS_OK)) {
- printf("(%s) %s - %s (should be %s)\n", __location__, "SETATTR",
- nt_errstr(status), nt_errstr(NT_STATUS_OK));
- ret = false;
- goto done;
- }
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK, ret, done, "smb_raw_setfileinfo failed");
smbcli_close(cli->tree, fnum);
fnum = -1;
@@ -1739,27 +1746,11 @@ static bool test_stream_attributes(struct torture_context *tctx,
finfo.generic.level = RAW_FILEINFO_ALL_INFO;
finfo.generic.in.file.path = fname;
status = smb_raw_pathinfo(cli->tree, tctx, &finfo);
- if (!NT_STATUS_IS_OK(status)) {
- printf("(%s) %s pathinfo - %s\n", __location__, "SETATTRE", nt_errstr(status));
- ret = false;
- goto done;
- }
+ torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_OK, ret, done, "smb_raw_pathinfo failed");
- if (finfo.all_info.out.attrib != FILE_ATTRIBUTE_READONLY) {
- printf("(%s) attrib incorrect. Was 0x%x, should be 0x%x\n",
- __location__,
- (unsigned int)finfo.all_info.out.attrib,
- (unsigned int)FILE_ATTRIBUTE_READONLY);
- ret = false;
- goto done;
- }
+ torture_assert_int_equal_goto(tctx, finfo.all_info.out.attrib & ~FILE_ATTRIBUTE_NONINDEXED, FILE_ATTRIBUTE_READONLY, ret, done, "attrib incorrect");
- if (nt_time_to_unix(finfo.all_info.out.write_time) != basetime) {
- printf("(%s) time incorrect.\n",
- __location__);
- ret = false;
- goto done;
- }
+ torture_assert_int_equal_goto(tctx, nt_time_to_unix(finfo.all_info.out.write_time), basetime, ret, done, "time incorrect");
done: