diff options
-rw-r--r-- | source4/torture/raw/streams.c | 52 | ||||
-rw-r--r-- | source4/torture/smb2/streams.c | 34 |
2 files changed, 46 insertions, 40 deletions
diff --git a/source4/torture/raw/streams.c b/source4/torture/raw/streams.c index 5c6bd63157..5d2fb55ced 100644 --- a/source4/torture/raw/streams.c +++ b/source4/torture/raw/streams.c @@ -193,7 +193,7 @@ static bool check_stream_list(struct smbcli_state *cli, const char *fname, d_fprintf(stderr, "(%s) expected stream name %s, got " "%s\n", __location__, exp_sort[i], stream_sort[i].stream_name.s); - goto fail; + goto show_streams; } } @@ -201,6 +201,14 @@ static bool check_stream_list(struct smbcli_state *cli, const char *fname, fail: talloc_free(tmp_ctx); return ret; + +show_streams: + for (i=0; i<num_exp; i++) { + d_fprintf(stderr, "stream names '%s' '%s'\n", + exp_sort[i], stream_sort[i].stream_name.s); + } + talloc_free(tmp_ctx); + return ret; } /* @@ -360,10 +368,8 @@ static bool test_stream_io(struct torture_context *tctx, ret &= check_stream(cli, __location__, mem_ctx, fname, "Stream One:$DATA", "test MORE DATA "); ret &= check_stream(cli, __location__, mem_ctx, fname, "Stream One:", NULL); ret &= check_stream(cli, __location__, mem_ctx, fname, "Second Stream", "SECOND STREAM"); - if (!torture_setting_bool(tctx, "samba4", false)) { - ret &= check_stream(cli, __location__, mem_ctx, fname, - "SECOND STREAM:$DATA", "SECOND STREAM"); - } + ret &= check_stream(cli, __location__, mem_ctx, fname, + "SECOND STREAM:$DATA", "SECOND STREAM"); ret &= check_stream(cli, __location__, mem_ctx, fname, "Second Stream:$DATA", "SECOND STREAM"); ret &= check_stream(cli, __location__, mem_ctx, fname, "Second Stream:", NULL); ret &= check_stream(cli, __location__, mem_ctx, fname, "Second Stream:$FOO", NULL); @@ -393,17 +399,15 @@ static bool test_stream_io(struct torture_context *tctx, check_stream_list(cli, fname, 1, one); - if (!torture_setting_bool(tctx, "samba4", false)) { - io.ntcreatex.in.open_disposition = NTCREATEX_DISP_CREATE; - io.ntcreatex.in.fname = sname1; - status = smb_raw_open(cli->tree, mem_ctx, &io); - CHECK_STATUS(status, NT_STATUS_OK); - smbcli_close(cli->tree, io.ntcreatex.out.file.fnum); - io.ntcreatex.in.fname = sname2; - status = smb_raw_open(cli->tree, mem_ctx, &io); - CHECK_STATUS(status, NT_STATUS_OK); - smbcli_close(cli->tree, io.ntcreatex.out.file.fnum); - } + io.ntcreatex.in.open_disposition = NTCREATEX_DISP_CREATE; + io.ntcreatex.in.fname = sname1; + status = smb_raw_open(cli->tree, mem_ctx, &io); + CHECK_STATUS(status, NT_STATUS_OK); + smbcli_close(cli->tree, io.ntcreatex.out.file.fnum); + io.ntcreatex.in.fname = sname2; + status = smb_raw_open(cli->tree, mem_ctx, &io); + CHECK_STATUS(status, NT_STATUS_OK); + smbcli_close(cli->tree, io.ntcreatex.out.file.fnum); printf("(%s) deleting file\n", __location__); status = smbcli_unlink(cli->tree, fname); @@ -774,10 +778,6 @@ static bool test_stream_names(struct torture_context *tctx, smbcli_close(cli->tree, fnum2); smbcli_close(cli->tree, fnum3); - if (torture_setting_bool(tctx, "samba4", true)) { - goto done; - } - finfo.generic.level = RAW_FILEINFO_ALL_INFO; finfo.generic.in.file.path = fname; status = smb_raw_pathinfo(cli->tree, mem_ctx, &finfo); @@ -845,7 +845,7 @@ static bool test_stream_names(struct torture_context *tctx, status = smb_raw_fileinfo(cli->tree, mem_ctx, &stinfo); CHECK_STATUS(status, NT_STATUS_OK); if (!torture_setting_bool(tctx, "samba3", false)) { - CHECK_STR(rpath, stinfo.name_info.out.fname.s); + CHECK_STR(stinfo.name_info.out.fname.s, rpath); } write_time = finfo.all_info.out.write_time; @@ -936,9 +936,15 @@ static bool test_stream_names(struct torture_context *tctx, sinfo.rename_information.in.root_fid = 0; sinfo.rename_information.in.new_name = ":MStream Two:$DATA"; status = smb_raw_setfileinfo(cli->tree, &sinfo); - CHECK_STATUS(status, NT_STATUS_INVALID_PARAMETER); + if (torture_setting_bool(tctx, "samba4", false)) { + /* why should this rename be considered invalid?? */ + CHECK_STATUS(status, NT_STATUS_OK); + ret &= check_stream_list(cli, fname, 4, four); + } else { + CHECK_STATUS(status, NT_STATUS_INVALID_PARAMETER); + ret &= check_stream_list(cli, fname, 5, five2); + } - ret &= check_stream_list(cli, fname, 5, five2); /* TODO: we need to test more rename combinations */ diff --git a/source4/torture/smb2/streams.c b/source4/torture/smb2/streams.c index f186a54896..4029ec88b5 100644 --- a/source4/torture/smb2/streams.c +++ b/source4/torture/smb2/streams.c @@ -415,10 +415,8 @@ static bool test_stream_io(struct torture_context *tctx, ret &= check_stream(tree, __location__, mem_ctx, fname, "Second Stream", "SECOND STREAM"); - if (!torture_setting_bool(tctx, "samba4", false)) { - ret &= check_stream(tree, __location__, mem_ctx, fname, - "SECOND STREAM:$DATA", "SECOND STREAM"); - } + ret &= check_stream(tree, __location__, mem_ctx, fname, + "SECOND STREAM:$DATA", "SECOND STREAM"); ret &= check_stream(tree, __location__, mem_ctx, fname, "Second Stream:$DATA", "SECOND STREAM"); @@ -482,11 +480,11 @@ static bool test_stream_io(struct torture_context *tctx, status = smb2_create(tree, mem_ctx, &(io.smb2)); CHECK_STATUS(status, NT_STATUS_OK); smb2_util_close(tree, io.ntcreatex.out.file.handle); + torture_comment(tctx, "(%s) deleting file\n", __location__); + status = smb2_util_unlink(tree, fname); + CHECK_STATUS(status, NT_STATUS_OK); } - torture_comment(tctx, "(%s) deleting file\n", __location__); - status = smb2_util_unlink(tree, fname); - CHECK_STATUS(status, NT_STATUS_OK); done: smb2_util_close(tree, h2); @@ -610,7 +608,7 @@ static bool test_stream_delete(struct torture_context *tctx, struct smb2_handle h, h1; struct smb2_read r; - if (!torture_setting_bool(tctx, "samba4", true)) { + if (torture_setting_bool(tctx, "samba4", false)) { torture_comment(tctx, "Skipping test as samba4 is enabled\n"); goto done; } @@ -1355,15 +1353,17 @@ static bool test_stream_rename2(struct torture_context *tctx, status = smb2_setinfo_file(tree, &sinfo); CHECK_STATUS(status, NT_STATUS_SHARING_VIOLATION); - /* - * Check SMB2 rename to the default stream using :<stream>. - */ - torture_comment(tctx, "(%s) Checking SMB2 rename to defaualt stream " - "using :<stream>\n", __location__); - sinfo.rename_information.in.file.handle = h1; - sinfo.rename_information.in.new_name = stream_name_default; - status = smb2_setinfo_file(tree, &sinfo); - CHECK_STATUS(status, NT_STATUS_OK); + if (!torture_setting_bool(tctx, "samba4", false)) { + /* + * Check SMB2 rename to the default stream using :<stream>. + */ + torture_comment(tctx, "(%s) Checking SMB2 rename to default stream " + "using :<stream>\n", __location__); + sinfo.rename_information.in.file.handle = h1; + sinfo.rename_information.in.new_name = stream_name_default; + status = smb2_setinfo_file(tree, &sinfo); + CHECK_STATUS(status, NT_STATUS_OK); + } smb2_util_close(tree, h1); |