summaryrefslogtreecommitdiff
path: root/source4/torture/raw
diff options
context:
space:
mode:
Diffstat (limited to 'source4/torture/raw')
-rw-r--r--source4/torture/raw/acls.c104
-rw-r--r--source4/torture/raw/context.c16
-rw-r--r--source4/torture/raw/eas.c6
-rw-r--r--source4/torture/raw/mux.c2
-rw-r--r--source4/torture/raw/notify.c34
-rw-r--r--source4/torture/raw/open.c344
-rw-r--r--source4/torture/raw/openbench.c2
-rw-r--r--source4/torture/raw/oplock.c358
-rw-r--r--source4/torture/raw/read.c6
-rw-r--r--source4/torture/raw/rename.c50
-rw-r--r--source4/torture/raw/samba3misc.c10
-rw-r--r--source4/torture/raw/streams.c26
-rw-r--r--source4/torture/raw/tconrate.c1
-rw-r--r--source4/torture/raw/unlink.c6
14 files changed, 658 insertions, 307 deletions
diff --git a/source4/torture/raw/acls.c b/source4/torture/raw/acls.c
index 48dec6e561..8fde373dce 100644
--- a/source4/torture/raw/acls.c
+++ b/source4/torture/raw/acls.c
@@ -57,7 +57,7 @@ static bool test_sd(struct torture_context *tctx,
printf("TESTING SETFILEINFO EA_SET\n");
io.generic.level = RAW_OPEN_NTCREATEX;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.flags = 0;
io.ntcreatex.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
io.ntcreatex.in.create_options = 0;
@@ -161,7 +161,7 @@ static bool test_nttrans_create(struct torture_context *tctx,
printf("testing nttrans create with sec_desc\n");
io.generic.level = RAW_OPEN_NTTRANS_CREATE;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.flags = 0;
io.ntcreatex.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
io.ntcreatex.in.create_options = 0;
@@ -267,7 +267,7 @@ static bool test_nttrans_create_null_dacl(struct torture_context *tctx,
printf("TESTING SEC_DESC WITH A NULL DACL\n");
io.generic.level = RAW_OPEN_NTTRANS_CREATE;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.flags = 0;
io.ntcreatex.in.access_mask = SEC_STD_READ_CONTROL | SEC_STD_WRITE_DAC
| SEC_STD_WRITE_OWNER;
@@ -512,7 +512,7 @@ static bool test_creator_sid(struct torture_context *tctx,
printf("TESTING SID_CREATOR_OWNER\n");
io.generic.level = RAW_OPEN_NTCREATEX;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.flags = 0;
io.ntcreatex.in.access_mask = SEC_STD_READ_CONTROL | SEC_STD_WRITE_DAC | SEC_STD_WRITE_OWNER;
io.ntcreatex.in.create_options = 0;
@@ -748,7 +748,7 @@ static bool test_generic_bits(struct torture_context *tctx,
printf("TESTING FILE GENERIC BITS\n");
io.generic.level = RAW_OPEN_NTCREATEX;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.flags = 0;
io.ntcreatex.in.access_mask =
SEC_STD_READ_CONTROL |
@@ -778,21 +778,21 @@ static bool test_generic_bits(struct torture_context *tctx,
owner_sid = dom_sid_string(tctx, sd_orig->owner_sid);
- status = smblsa_sid_check_privilege(cli,
+ status = torture_check_privilege(cli,
owner_sid,
sec_privilege_name(SEC_PRIV_RESTORE));
has_restore_privilege = NT_STATUS_IS_OK(status);
if (!NT_STATUS_IS_OK(status)) {
- printf("smblsa_sid_check_privilege - %s\n", nt_errstr(status));
+ printf("torture_check_privilege - %s\n", nt_errstr(status));
}
printf("SEC_PRIV_RESTORE - %s\n", has_restore_privilege?"Yes":"No");
- status = smblsa_sid_check_privilege(cli,
+ status = torture_check_privilege(cli,
owner_sid,
sec_privilege_name(SEC_PRIV_TAKE_OWNERSHIP));
has_take_ownership_privilege = NT_STATUS_IS_OK(status);
if (!NT_STATUS_IS_OK(status)) {
- printf("smblsa_sid_check_privilege - %s\n", nt_errstr(status));
+ printf("torture_check_privilege - %s\n", nt_errstr(status));
}
printf("SEC_PRIV_TAKE_OWNERSHIP - %s\n", has_take_ownership_privilege?"Yes":"No");
@@ -913,7 +913,7 @@ static bool test_generic_bits(struct torture_context *tctx,
printf("TESTING DIR GENERIC BITS\n");
io.generic.level = RAW_OPEN_NTCREATEX;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.flags = 0;
io.ntcreatex.in.access_mask =
SEC_STD_READ_CONTROL |
@@ -943,21 +943,21 @@ static bool test_generic_bits(struct torture_context *tctx,
owner_sid = dom_sid_string(tctx, sd_orig->owner_sid);
- status = smblsa_sid_check_privilege(cli,
+ status = torture_check_privilege(cli,
owner_sid,
sec_privilege_name(SEC_PRIV_RESTORE));
has_restore_privilege = NT_STATUS_IS_OK(status);
if (!NT_STATUS_IS_OK(status)) {
- printf("smblsa_sid_check_privilege - %s\n", nt_errstr(status));
+ printf("torture_check_privilege - %s\n", nt_errstr(status));
}
printf("SEC_PRIV_RESTORE - %s\n", has_restore_privilege?"Yes":"No");
- status = smblsa_sid_check_privilege(cli,
+ status = torture_check_privilege(cli,
owner_sid,
sec_privilege_name(SEC_PRIV_TAKE_OWNERSHIP));
has_take_ownership_privilege = NT_STATUS_IS_OK(status);
if (!NT_STATUS_IS_OK(status)) {
- printf("smblsa_sid_check_privilege - %s\n", nt_errstr(status));
+ printf("torture_check_privilege - %s\n", nt_errstr(status));
}
printf("SEC_PRIV_TAKE_OWNERSHIP - %s\n", has_take_ownership_privilege?"Yes":"No");
@@ -1102,7 +1102,7 @@ static bool test_owner_bits(struct torture_context *tctx,
printf("TESTING FILE OWNER BITS\n");
io.generic.level = RAW_OPEN_NTCREATEX;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.flags = 0;
io.ntcreatex.in.access_mask =
SEC_STD_READ_CONTROL |
@@ -1132,21 +1132,21 @@ static bool test_owner_bits(struct torture_context *tctx,
owner_sid = dom_sid_string(tctx, sd_orig->owner_sid);
- status = smblsa_sid_check_privilege(cli,
+ status = torture_check_privilege(cli,
owner_sid,
sec_privilege_name(SEC_PRIV_RESTORE));
has_restore_privilege = NT_STATUS_IS_OK(status);
if (!NT_STATUS_IS_OK(status)) {
- printf("smblsa_sid_check_privilege - %s\n", nt_errstr(status));
+ printf("torture_check_privilege - %s\n", nt_errstr(status));
}
printf("SEC_PRIV_RESTORE - %s\n", has_restore_privilege?"Yes":"No");
- status = smblsa_sid_check_privilege(cli,
+ status = torture_check_privilege(cli,
owner_sid,
sec_privilege_name(SEC_PRIV_TAKE_OWNERSHIP));
has_take_ownership_privilege = NT_STATUS_IS_OK(status);
if (!NT_STATUS_IS_OK(status)) {
- printf("smblsa_sid_check_privilege - %s\n", nt_errstr(status));
+ printf("torture_check_privilege - %s\n", nt_errstr(status));
}
printf("SEC_PRIV_TAKE_OWNERSHIP - %s\n", has_take_ownership_privilege?"Yes":"No");
@@ -1219,7 +1219,7 @@ static bool test_inheritance(struct torture_context *tctx,
union smb_fileinfo q;
union smb_setfileinfo set;
struct security_descriptor *sd, *sd2, *sd_orig=NULL, *sd_def;
- const char *owner_sid;
+ const char *owner_sid, *group_sid;
const struct dom_sid *creator_owner;
const struct {
uint32_t parent_flags;
@@ -1334,7 +1334,7 @@ static bool test_inheritance(struct torture_context *tctx,
printf("TESTING ACL INHERITANCE\n");
io.generic.level = RAW_OPEN_NTCREATEX;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.flags = 0;
io.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL;
io.ntcreatex.in.create_options = NTCREATEX_OPTIONS_DIRECTORY;
@@ -1353,26 +1353,54 @@ static bool test_inheritance(struct torture_context *tctx,
printf("get the original sd\n");
q.query_secdesc.level = RAW_FILEINFO_SEC_DESC;
q.query_secdesc.in.file.fnum = fnum;
- q.query_secdesc.in.secinfo_flags = SECINFO_DACL | SECINFO_OWNER;
+ q.query_secdesc.in.secinfo_flags = SECINFO_DACL | SECINFO_OWNER | SECINFO_GROUP;
status = smb_raw_fileinfo(cli->tree, tctx, &q);
CHECK_STATUS(status, NT_STATUS_OK);
sd_orig = q.query_secdesc.out.sd;
owner_sid = dom_sid_string(tctx, sd_orig->owner_sid);
+ group_sid = dom_sid_string(tctx, sd_orig->group_sid);
printf("owner_sid is %s\n", owner_sid);
+ printf("group_sid is %s\n", group_sid);
+
+ q.query_secdesc.in.secinfo_flags = SECINFO_DACL | SECINFO_OWNER;
- sd_def = security_descriptor_dacl_create(tctx,
- 0, owner_sid, NULL,
- owner_sid,
- SEC_ACE_TYPE_ACCESS_ALLOWED,
- SEC_RIGHTS_FILE_ALL,
- 0,
- SID_NT_SYSTEM,
- SEC_ACE_TYPE_ACCESS_ALLOWED,
- SEC_RIGHTS_FILE_ALL,
- 0,
- NULL);
+ if (torture_setting_bool(tctx, "samba4", false)) {
+ /* the default ACL in Samba4 includes the group and
+ other permissions */
+ sd_def = security_descriptor_dacl_create(tctx,
+ 0, owner_sid, NULL,
+ owner_sid,
+ SEC_ACE_TYPE_ACCESS_ALLOWED,
+ SEC_RIGHTS_FILE_ALL,
+ 0,
+ group_sid,
+ SEC_ACE_TYPE_ACCESS_ALLOWED,
+ SEC_RIGHTS_FILE_READ | SEC_FILE_EXECUTE,
+ 0,
+ SID_WORLD,
+ SEC_ACE_TYPE_ACCESS_ALLOWED,
+ SEC_RIGHTS_FILE_READ | SEC_FILE_EXECUTE,
+ 0,
+ SID_NT_SYSTEM,
+ SEC_ACE_TYPE_ACCESS_ALLOWED,
+ SEC_RIGHTS_FILE_ALL,
+ 0,
+ NULL);
+ } else {
+ sd_def = security_descriptor_dacl_create(tctx,
+ 0, owner_sid, NULL,
+ owner_sid,
+ SEC_ACE_TYPE_ACCESS_ALLOWED,
+ SEC_RIGHTS_FILE_ALL,
+ 0,
+ SID_NT_SYSTEM,
+ SEC_ACE_TYPE_ACCESS_ALLOWED,
+ SEC_RIGHTS_FILE_ALL,
+ 0,
+ NULL);
+ }
creator_owner = dom_sid_parse_talloc(tctx, SID_CREATOR_OWNER);
@@ -1410,7 +1438,7 @@ static bool test_inheritance(struct torture_context *tctx,
if (!(test_flags[i].parent_flags & SEC_ACE_FLAG_OBJECT_INHERIT)) {
if (!security_descriptor_equal(q.query_secdesc.out.sd, sd_def)) {
- printf("Expected default sd:\n");
+ printf(__location__ ": Expected default sd for i=%d:\n", i);
NDR_PRINT_DEBUG(security_descriptor, sd_def);
printf("at %d - got:\n", i);
NDR_PRINT_DEBUG(security_descriptor, q.query_secdesc.out.sd);
@@ -1639,8 +1667,8 @@ static bool test_inheritance_dynamic(struct torture_context *tctx,
{
NTSTATUS status;
union smb_open io;
- const char *dname = BASEDIR "\\inheritance";
- const char *fname1 = BASEDIR "\\inheritance\\testfile";
+ const char *dname = BASEDIR "\\inheritance2";
+ const char *fname1 = BASEDIR "\\inheritance2\\testfile";
bool ret = true;
int fnum=0, fnum2;
union smb_fileinfo q;
@@ -1655,7 +1683,7 @@ static bool test_inheritance_dynamic(struct torture_context *tctx,
}
io.generic.level = RAW_OPEN_NTCREATEX;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.flags = 0;
io.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL;
io.ntcreatex.in.create_options = NTCREATEX_OPTIONS_DIRECTORY;
@@ -1848,7 +1876,7 @@ static bool test_sd_get_set(struct torture_context *tctx,
sd->type |= SEC_DESC_SACL_PRESENT;
sd->sacl = NULL;
io.ntcreatex.level = RAW_OPEN_NTTRANS_CREATE;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.flags = 0;
io.ntcreatex.in.access_mask = SEC_GENERIC_ALL;
io.ntcreatex.in.create_options = 0;
diff --git a/source4/torture/raw/context.c b/source4/torture/raw/context.c
index a9d36b7788..0e0851e741 100644
--- a/source4/torture/raw/context.c
+++ b/source4/torture/raw/context.c
@@ -175,7 +175,7 @@ static bool test_session(struct smbcli_state *cli, struct torture_context *tctx)
printf("create a file using the new vuid\n");
io.generic.level = RAW_OPEN_NTCREATEX;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.flags = 0;
io.ntcreatex.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
io.ntcreatex.in.create_options = 0;
@@ -311,7 +311,7 @@ static bool test_tree(struct smbcli_state *cli, struct torture_context *tctx)
printf("create a file using the new tid\n");
io.generic.level = RAW_OPEN_NTCREATEX;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.flags = 0;
io.ntcreatex.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
io.ntcreatex.in.create_options = 0;
@@ -425,7 +425,7 @@ static bool test_tree_ulogoff(struct smbcli_state *cli, struct torture_context *
printf("create a file using vuid1\n");
io.generic.level = RAW_OPEN_NTCREATEX;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.flags = 0;
io.ntcreatex.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
io.ntcreatex.in.create_options = 0;
@@ -473,7 +473,7 @@ static bool test_tree_ulogoff(struct smbcli_state *cli, struct torture_context *
printf("create a file using vuid2\n");
io.generic.level = RAW_OPEN_NTCREATEX;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.flags = 0;
io.ntcreatex.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
io.ntcreatex.in.create_options = 0;
@@ -551,7 +551,7 @@ static bool test_pid_exit_only_sees_open(struct smbcli_state *cli, TALLOC_CTX *m
printf("create a file using pid1\n");
cli->session->pid = pid1;
io.generic.level = RAW_OPEN_NTCREATEX;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.flags = 0;
io.ntcreatex.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
io.ntcreatex.in.create_options = 0;
@@ -677,7 +677,7 @@ static bool test_pid_2sess(struct smbcli_state *cli, struct torture_context *tct
printf("create a file using the vuid1\n");
cli->session->vuid = vuid1;
io.generic.level = RAW_OPEN_NTCREATEX;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.flags = 0;
io.ntcreatex.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
io.ntcreatex.in.create_options = 0;
@@ -785,7 +785,7 @@ static bool test_pid_2tcon(struct smbcli_state *cli, struct torture_context *tct
printf("create a file using the tid1\n");
cli->tree->tid = tid1;
io.generic.level = RAW_OPEN_NTCREATEX;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.flags = 0;
io.ntcreatex.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
io.ntcreatex.in.create_options = 0;
@@ -816,7 +816,7 @@ static bool test_pid_2tcon(struct smbcli_state *cli, struct torture_context *tct
printf("create a file using the tid2\n");
cli->tree->tid = tid2;
io.generic.level = RAW_OPEN_NTCREATEX;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.flags = 0;
io.ntcreatex.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
io.ntcreatex.in.create_options = 0;
diff --git a/source4/torture/raw/eas.c b/source4/torture/raw/eas.c
index 49a81dd534..32ceba119a 100644
--- a/source4/torture/raw/eas.c
+++ b/source4/torture/raw/eas.c
@@ -57,7 +57,7 @@ static bool test_eas(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
printf("TESTING SETFILEINFO EA_SET\n");
io.generic.level = RAW_OPEN_NTCREATEX;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.flags = 0;
io.ntcreatex.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
io.ntcreatex.in.create_options = 0;
@@ -282,7 +282,7 @@ static bool test_max_eas(struct smbcli_state *cli, struct torture_context *tctx)
maxeadebug);
io.generic.level = RAW_OPEN_NTCREATEX;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.flags = 0;
io.ntcreatex.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
io.ntcreatex.in.create_options = 0;
@@ -375,7 +375,7 @@ static bool test_nttrans_create(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
printf("TESTING NTTRANS CREATE WITH EAS\n");
io.generic.level = RAW_OPEN_NTTRANS_CREATE;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.flags = 0;
io.ntcreatex.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
io.ntcreatex.in.create_options = 0;
diff --git a/source4/torture/raw/mux.c b/source4/torture/raw/mux.c
index 5b5db3a557..19cb4ce422 100644
--- a/source4/torture/raw/mux.c
+++ b/source4/torture/raw/mux.c
@@ -53,7 +53,7 @@ static bool test_mux_open(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
printf("send first open\n");
io.generic.level = RAW_OPEN_NTCREATEX;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.flags = 0;
io.ntcreatex.in.access_mask = SEC_FILE_READ_DATA;
io.ntcreatex.in.create_options = 0;
diff --git a/source4/torture/raw/notify.c b/source4/torture/raw/notify.c
index c92170cf61..8be7e06dff 100644
--- a/source4/torture/raw/notify.c
+++ b/source4/torture/raw/notify.c
@@ -73,7 +73,7 @@ static bool test_notify_dir(struct smbcli_state *cli, struct smbcli_state *cli2,
get a handle on the directory
*/
io.generic.level = RAW_OPEN_NTCREATEX;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.flags = 0;
io.ntcreatex.in.access_mask = SEC_FILE_ALL;
io.ntcreatex.in.create_options = NTCREATEX_OPTIONS_DIRECTORY;
@@ -310,7 +310,7 @@ static bool test_notify_recursive(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
get a handle on the directory
*/
io.generic.level = RAW_OPEN_NTCREATEX;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.flags = 0;
io.ntcreatex.in.access_mask = SEC_FILE_ALL;
io.ntcreatex.in.create_options = NTCREATEX_OPTIONS_DIRECTORY;
@@ -441,7 +441,7 @@ static bool test_notify_mask_change(struct smbcli_state *cli, TALLOC_CTX *mem_ct
get a handle on the directory
*/
io.generic.level = RAW_OPEN_NTCREATEX;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.flags = 0;
io.ntcreatex.in.access_mask = SEC_FILE_ALL;
io.ntcreatex.in.create_options = NTCREATEX_OPTIONS_DIRECTORY;
@@ -566,7 +566,7 @@ static bool test_notify_mask(struct smbcli_state *cli, struct torture_context *t
get a handle on the directory
*/
io.generic.level = RAW_OPEN_NTCREATEX;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.flags = 0;
io.ntcreatex.in.access_mask = SEC_FILE_ALL;
io.ntcreatex.in.create_options = NTCREATEX_OPTIONS_DIRECTORY;
@@ -793,7 +793,7 @@ static bool test_notify_file(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
printf("TESTING CHANGE NOTIFY ON FILES\n");
io.generic.level = RAW_OPEN_NTCREATEX;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.flags = 0;
io.ntcreatex.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
io.ntcreatex.in.create_options = 0;
@@ -859,7 +859,7 @@ static bool test_notify_tdis(struct torture_context *tctx)
get a handle on the directory
*/
io.generic.level = RAW_OPEN_NTCREATEX;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.flags = 0;
io.ntcreatex.in.access_mask = SEC_FILE_ALL;
io.ntcreatex.in.create_options = NTCREATEX_OPTIONS_DIRECTORY;
@@ -921,7 +921,7 @@ static bool test_notify_exit(struct torture_context *tctx)
get a handle on the directory
*/
io.generic.level = RAW_OPEN_NTCREATEX;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.flags = 0;
io.ntcreatex.in.access_mask = SEC_FILE_ALL;
io.ntcreatex.in.create_options = NTCREATEX_OPTIONS_DIRECTORY;
@@ -982,7 +982,7 @@ static bool test_notify_ulogoff(struct torture_context *tctx)
get a handle on the directory
*/
io.generic.level = RAW_OPEN_NTCREATEX;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.flags = 0;
io.ntcreatex.in.access_mask = SEC_FILE_ALL;
io.ntcreatex.in.create_options = NTCREATEX_OPTIONS_DIRECTORY;
@@ -1050,7 +1050,7 @@ static bool test_notify_tcp_dis(struct torture_context *tctx)
get a handle on the directory
*/
io.generic.level = RAW_OPEN_NTCREATEX;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.flags = 0;
io.ntcreatex.in.access_mask = SEC_FILE_ALL;
io.ntcreatex.in.create_options = NTCREATEX_OPTIONS_DIRECTORY;
@@ -1104,7 +1104,7 @@ static bool test_notify_double(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
get a handle on the directory
*/
io.generic.level = RAW_OPEN_NTCREATEX;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.flags = 0;
io.ntcreatex.in.access_mask = SEC_FILE_ALL;
io.ntcreatex.in.create_options = NTCREATEX_OPTIONS_DIRECTORY;
@@ -1197,7 +1197,7 @@ static bool test_notify_tree(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
printf("TESTING CHANGE NOTIFY FOR DIFFERENT DEPTHS\n");
io.generic.level = RAW_OPEN_NTCREATEX;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.flags = 0;
io.ntcreatex.in.access_mask = SEC_FILE_ALL;
io.ntcreatex.in.create_options = NTCREATEX_OPTIONS_DIRECTORY;
@@ -1293,7 +1293,7 @@ static bool test_notify_overflow(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
NTSTATUS status;
union smb_notify notify;
union smb_open io;
- int fnum, fnum2;
+ int fnum;
int count = 100;
struct smbcli_request *req1;
int i;
@@ -1302,7 +1302,7 @@ static bool test_notify_overflow(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
/* get a handle on the directory */
io.generic.level = RAW_OPEN_NTCREATEX;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.flags = 0;
io.ntcreatex.in.access_mask = SEC_FILE_ALL;
io.ntcreatex.in.create_options = NTCREATEX_OPTIONS_DIRECTORY;
@@ -1371,16 +1371,14 @@ static bool test_notify_basedir(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
NTSTATUS status;
union smb_notify notify;
union smb_open io;
- int fnum, fnum2;
- int count = 100;
+ int fnum;
struct smbcli_request *req1;
- int i;
printf("TESTING CHANGE NOTIFY BASEDIR EVENTS\n");
/* get a handle on the directory */
io.generic.level = RAW_OPEN_NTCREATEX;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.flags = 0;
io.ntcreatex.in.access_mask = SEC_FILE_ALL;
io.ntcreatex.in.create_options = NTCREATEX_OPTIONS_DIRECTORY;
@@ -1487,7 +1485,7 @@ static bool test_notify_tcon(struct smbcli_state *cli, struct torture_context *t
get a handle on the directory
*/
io.generic.level = RAW_OPEN_NTCREATEX;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.flags = 0;
io.ntcreatex.in.access_mask = SEC_FILE_ALL;
io.ntcreatex.in.create_options = NTCREATEX_OPTIONS_DIRECTORY;
diff --git a/source4/torture/raw/open.c b/source4/torture/raw/open.c
index 9f35aae4d0..73f9c3f839 100644
--- a/source4/torture/raw/open.c
+++ b/source4/torture/raw/open.c
@@ -65,7 +65,8 @@ static const char *rdwr_string(enum rdwr_mode m)
#define CHECK_STATUS(status, correct) do { \
if (!NT_STATUS_EQUAL(status, correct)) { \
- printf("(%s) Incorrect status %s - should be %s\n", \
+ torture_result(tctx, TORTURE_FAIL, \
+ "(%s) Incorrect status %s - should be %s\n", \
__location__, nt_errstr(status), nt_errstr(correct)); \
ret = false; \
goto done; \
@@ -74,7 +75,9 @@ static const char *rdwr_string(enum rdwr_mode m)
#define CREATE_FILE do { \
fnum = create_complex_file(cli, tctx, fname); \
if (fnum == -1) { \
- printf("(%s) Failed to create %s - %s\n", __location__, fname, smbcli_errstr(cli->tree)); \
+ torture_result(tctx, TORTURE_FAIL, \
+ "(%s) Failed to create %s - %s\n", \
+ __location__, fname, smbcli_errstr(cli->tree)); \
ret = false; \
goto done; \
}} while (0)
@@ -82,7 +85,8 @@ static const char *rdwr_string(enum rdwr_mode m)
#define CHECK_RDWR(fnum, correct) do { \
enum rdwr_mode m = check_rdwr(cli->tree, fnum); \
if (m != correct) { \
- printf("(%s) Incorrect readwrite mode %s - expected %s\n", \
+ torture_result(tctx, TORTURE_FAIL, \
+ "(%s) Incorrect readwrite mode %s - expected %s\n", \
__location__, rdwr_string(m), rdwr_string(correct)); \
ret = false; \
}} while (0)
@@ -96,7 +100,8 @@ static const char *rdwr_string(enum rdwr_mode m)
t1 = t & ~1; \
t2 = nt_time_to_unix(finfo.all_info.out.field) & ~1; \
if (abs(t1-t2) > 2) { \
- printf("(%s) wrong time for field %s %s - %s\n", \
+ torture_result(tctx, TORTURE_FAIL, \
+ "(%s) wrong time for field %s %s - %s\n", \
__location__, #field, \
timestring(tctx, t1), \
timestring(tctx, t2)); \
@@ -112,7 +117,8 @@ static const char *rdwr_string(enum rdwr_mode m)
CHECK_STATUS(status, NT_STATUS_OK); \
t2 = finfo.all_info.out.field; \
if (t != t2) { \
- printf("(%s) wrong time for field %s %s - %s\n", \
+ torture_result(tctx, TORTURE_FAIL, \
+ "(%s) wrong time for field %s %s - %s\n", \
__location__, #field, \
nt_time_string(tctx, t), \
nt_time_string(tctx, t2)); \
@@ -126,7 +132,8 @@ static const char *rdwr_string(enum rdwr_mode m)
status = smb_raw_pathinfo(cli->tree, tctx, &finfo); \
CHECK_STATUS(status, NT_STATUS_OK); \
if ((v) != (finfo.all_info.out.field)) { \
- printf("(%s) wrong value for field %s 0x%x - 0x%x\n", \
+ torture_result(tctx, TORTURE_FAIL, \
+ "(%s) wrong value for field %s 0x%x - 0x%x\n", \
__location__, #field, (int)v, (int)(finfo.all_info.out.field)); \
dump_all_info(tctx, &finfo); \
ret = false; \
@@ -134,7 +141,8 @@ static const char *rdwr_string(enum rdwr_mode m)
#define CHECK_VAL(v, correct) do { \
if ((v) != (correct)) { \
- printf("(%s) wrong value for %s 0x%x - should be 0x%x\n", \
+ torture_result(tctx, TORTURE_FAIL, \
+ "(%s) wrong value for %s 0x%x - should be 0x%x\n", \
__location__, #v, (int)(v), (int)correct); \
ret = false; \
}} while (0)
@@ -147,7 +155,7 @@ static const char *rdwr_string(enum rdwr_mode m)
sfinfo.basic_info.in.attrib = sattrib; \
status = smb_raw_setpathinfo(cli->tree, &sfinfo); \
if (!NT_STATUS_IS_OK(status)) { \
- printf("(%s) Failed to set attrib 0x%x on %s\n", \
+ torture_warning(tctx, "(%s) Failed to set attrib 0x%x on %s\n", \
__location__, sattrib, fname); \
}} while (0)
@@ -163,7 +171,7 @@ static bool test_open(struct smbcli_state *cli, struct torture_context *tctx)
int fnum = -1, fnum2;
bool ret = true;
- printf("Checking RAW_OPEN_OPEN\n");
+ torture_comment(tctx, "Checking RAW_OPEN_OPEN\n");
io.openold.level = RAW_OPEN_OPEN;
io.openold.in.fname = fname;
@@ -223,7 +231,7 @@ static bool test_open(struct smbcli_state *cli, struct torture_context *tctx)
CHECK_RDWR(fnum, RDWR_RDWR);
if (io.openold.in.open_mode != io.openold.out.rmode) {
- printf("(%s) rmode should equal open_mode - 0x%x 0x%x\n",
+ torture_warning(tctx, "(%s) rmode should equal open_mode - 0x%x 0x%x\n",
__location__, io.openold.out.rmode, io.openold.in.open_mode);
}
@@ -295,7 +303,7 @@ static bool test_openx(struct smbcli_state *cli, struct torture_context *tctx)
{ OPENX_OPEN_FUNC_TRUNC | OPENX_OPEN_FUNC_CREATE, false, NT_STATUS_OK },
};
- printf("Checking RAW_OPEN_OPENX\n");
+ torture_comment(tctx, "Checking RAW_OPEN_OPENX\n");
smbcli_unlink(cli->tree, fname);
io.openx.level = RAW_OPEN_OPENX;
@@ -313,7 +321,9 @@ static bool test_openx(struct smbcli_state *cli, struct torture_context *tctx)
if (open_funcs[i].with_file) {
fnum = create_complex_file(cli, tctx, fname);
if (fnum == -1) {
- d_printf("Failed to create file %s - %s\n", fname, smbcli_errstr(cli->tree));
+ torture_result(tctx, TORTURE_FAIL,
+ "Failed to create file %s - %s\n",
+ fname, smbcli_errstr(cli->tree));
ret = false;
goto done;
}
@@ -322,9 +332,13 @@ static bool test_openx(struct smbcli_state *cli, struct torture_context *tctx)
io.openx.in.open_func = open_funcs[i].open_func;
status = smb_raw_open(cli->tree, tctx, &io);
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),
- i, (int)open_funcs[i].with_file, (int)open_funcs[i].open_func);
+ torture_result(tctx, TORTURE_FAIL,
+ "(%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),
+ i, (int)open_funcs[i].with_file,
+ (int)open_funcs[i].open_func);
ret = false;
}
if (NT_STATUS_IS_OK(status)) {
@@ -424,8 +438,10 @@ static bool test_openx(struct smbcli_state *cli, struct torture_context *tctx)
status = smb_raw_open(cli->tree, tctx, &io);
CHECK_STATUS(status, NT_STATUS_SHARING_VIOLATION);
if (timeval_elapsed(&tv) > 3.0) {
- printf("(%s) Incorrect timing in openx with timeout - waited %.2f seconds\n",
- __location__, timeval_elapsed(&tv));
+ torture_result(tctx, TORTURE_FAIL,
+ "(%s) Incorrect timing in openx with timeout "
+ "- waited %.2f seconds\n",
+ __location__, timeval_elapsed(&tv));
ret = false;
}
smbcli_close(cli->tree, fnum);
@@ -527,13 +543,15 @@ static bool test_t2open(struct smbcli_state *cli, struct torture_context *tctx)
fnum = create_complex_file(cli, tctx, fname1);
if (fnum == -1) {
- d_printf("Failed to create file %s - %s\n", fname1, smbcli_errstr(cli->tree));
+ torture_result(tctx, TORTURE_FAIL,
+ "(%s): Failed to create file %s - %s\n",
+ __location__, fname1, smbcli_errstr(cli->tree));
ret = false;
goto done;
}
smbcli_close(cli->tree, fnum);
- printf("Checking RAW_OPEN_T2OPEN\n");
+ torture_comment(tctx, "Checking RAW_OPEN_T2OPEN\n");
io.t2open.level = RAW_OPEN_T2OPEN;
io.t2open.in.flags = OPENX_FLAGS_ADDITIONAL_INFO;
@@ -570,16 +588,21 @@ static bool test_t2open(struct smbcli_state *cli, struct torture_context *tctx)
if ((io.t2open.in.num_eas != 0)
&& NT_STATUS_EQUAL(status, NT_STATUS_EAS_NOT_SUPPORTED)
&& torture_setting_bool(tctx, "samba3", false)) {
- printf("(%s) EAs not supported, not treating as fatal "
- "in Samba3 test\n", __location__);
+ torture_warning(tctx, "(%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),
- i, (int)open_funcs[i].with_file, (int)open_funcs[i].open_func);
+ torture_result(tctx, TORTURE_FAIL,
+ "(%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),
+ i, (int)open_funcs[i].with_file,
+ (int)open_funcs[i].open_func);
ret = false;
}
if (NT_STATUS_IS_OK(status)) {
@@ -691,12 +714,12 @@ static bool test_ntcreatex(struct smbcli_state *cli, struct torture_context *tct
{ 6, false, NT_STATUS_INVALID_PARAMETER },
};
- printf("Checking RAW_OPEN_NTCREATEX\n");
+ torture_comment(tctx, "Checking RAW_OPEN_NTCREATEX\n");
/* reasonable default parameters */
io.generic.level = RAW_OPEN_NTCREATEX;
io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL;
io.ntcreatex.in.alloc_size = 1024*1024;
io.ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL;
@@ -712,7 +735,9 @@ static bool test_ntcreatex(struct smbcli_state *cli, struct torture_context *tct
if (open_funcs[i].with_file) {
fnum = smbcli_open(cli->tree, fname, O_CREAT|O_RDWR|O_TRUNC, DENY_NONE);
if (fnum == -1) {
- d_printf("Failed to create file %s - %s\n", fname, smbcli_errstr(cli->tree));
+ torture_result(tctx, TORTURE_FAIL,
+ "Failed to create file %s - %s\n",
+ fname, smbcli_errstr(cli->tree));
ret = false;
goto done;
}
@@ -721,9 +746,13 @@ static bool test_ntcreatex(struct smbcli_state *cli, struct torture_context *tct
io.ntcreatex.in.open_disposition = open_funcs[i].open_disp;
status = smb_raw_open(cli->tree, tctx, &io);
if (!NT_STATUS_EQUAL(status, open_funcs[i].correct_status)) {
- printf("(%s) incorrect status %s should be %s (i=%d with_file=%d open_disp=%d)\n",
- __location__, nt_errstr(status), nt_errstr(open_funcs[i].correct_status),
- i, (int)open_funcs[i].with_file, (int)open_funcs[i].open_disp);
+ torture_result(tctx, TORTURE_FAIL,
+ "(%s) incorrect status %s should be %s "
+ "(i=%d with_file=%d open_disp=%d)\n",
+ __location__, nt_errstr(status),
+ nt_errstr(open_funcs[i].correct_status),
+ i, (int)open_funcs[i].with_file,
+ (int)open_funcs[i].open_disp);
ret = false;
}
if (NT_STATUS_IS_OK(status) || open_funcs[i].with_file) {
@@ -866,12 +895,12 @@ static bool test_nttrans_create(struct smbcli_state *cli, struct torture_context
{ 6, false, NT_STATUS_INVALID_PARAMETER },
};
- printf("Checking RAW_OPEN_NTTRANS_CREATE\n");
+ torture_comment(tctx, "Checking RAW_OPEN_NTTRANS_CREATE\n");
/* reasonable default parameters */
io.generic.level = RAW_OPEN_NTTRANS_CREATE;
io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL;
io.ntcreatex.in.alloc_size = 1024*1024;
io.ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL;
@@ -889,7 +918,9 @@ static bool test_nttrans_create(struct smbcli_state *cli, struct torture_context
if (open_funcs[i].with_file) {
fnum = smbcli_open(cli->tree, fname, O_CREAT|O_RDWR|O_TRUNC, DENY_NONE);
if (fnum == -1) {
- d_printf("Failed to create file %s - %s\n", fname, smbcli_errstr(cli->tree));
+ torture_result(tctx, TORTURE_FAIL,
+ "Failed to create file %s - %s\n",
+ fname, smbcli_errstr(cli->tree));
ret = false;
goto done;
}
@@ -898,9 +929,13 @@ static bool test_nttrans_create(struct smbcli_state *cli, struct torture_context
io.ntcreatex.in.open_disposition = open_funcs[i].open_disp;
status = smb_raw_open(cli->tree, tctx, &io);
if (!NT_STATUS_EQUAL(status, open_funcs[i].correct_status)) {
- printf("(%s) incorrect status %s should be %s (i=%d with_file=%d open_disp=%d)\n",
- __location__, nt_errstr(status), nt_errstr(open_funcs[i].correct_status),
- i, (int)open_funcs[i].with_file, (int)open_funcs[i].open_disp);
+ torture_result(tctx, TORTURE_FAIL,
+ "(%s) incorrect status %s should be %s "
+ "(i=%d with_file=%d open_disp=%d)\n",
+ __location__, nt_errstr(status),
+ nt_errstr(open_funcs[i].correct_status),
+ i, (int)open_funcs[i].with_file,
+ (int)open_funcs[i].open_disp);
ret = false;
}
if (NT_STATUS_IS_OK(status) || open_funcs[i].with_file) {
@@ -984,8 +1019,9 @@ static bool test_nttrans_create(struct smbcli_state *cli, struct torture_context
io.ntcreatex.in.create_options = create_option;
status = smb_raw_open(cli->tree, tctx, &io);
if (!NT_STATUS_IS_OK(status)) {
- printf("ntcreatex create option 0x%08x gave %s - should give NT_STATUS_OK\n",
- create_option, nt_errstr(status));
+ torture_warning(tctx, "ntcreatex create option 0x%08x "
+ "gave %s - should give NT_STATUS_OK\n",
+ create_option, nt_errstr(status));
}
CHECK_STATUS(status, NT_STATUS_OK);
fnum = io.ntcreatex.out.file.fnum;
@@ -1032,7 +1068,8 @@ static bool test_nttrans_create(struct smbcli_state *cli, struct torture_context
not_a_directory_mask |= 1<<i;
} else {
unexpected_mask |= 1<<i;
- printf("create option 0x%08x returned %s\n", create_option, nt_errstr(status));
+ torture_comment(tctx, "create option 0x%08x returned %s\n",
+ create_option, nt_errstr(status));
}
}
@@ -1110,11 +1147,11 @@ static bool test_ntcreatex_brlocked(struct smbcli_state *cli, struct torture_con
NTSTATUS status;
bool ret = true;
- printf("Testing ntcreatex with a byte range locked file\n");
+ torture_comment(tctx, "Testing ntcreatex with a byte range locked file\n");
io.generic.level = RAW_OPEN_NTCREATEX;
io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.access_mask = 0x2019f;
io.ntcreatex.in.alloc_size = 0;
io.ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL;
@@ -1145,7 +1182,7 @@ static bool test_ntcreatex_brlocked(struct smbcli_state *cli, struct torture_con
io1.generic.level = RAW_OPEN_NTCREATEX;
io1.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED;
- io1.ntcreatex.in.root_fid = 0;
+ io1.ntcreatex.in.root_fid.fnum = 0;
io1.ntcreatex.in.access_mask = 0x20196;
io1.ntcreatex.in.alloc_size = 0;
io1.ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL;
@@ -1181,7 +1218,7 @@ static bool test_mknew(struct smbcli_state *cli, struct torture_context *tctx)
time_t basetime = (time(NULL) + 3600*24*3) & ~1;
union smb_fileinfo finfo;
- printf("Checking RAW_OPEN_MKNEW\n");
+ torture_comment(tctx, "Checking RAW_OPEN_MKNEW\n");
io.mknew.level = RAW_OPEN_MKNEW;
io.mknew.in.attrib = 0;
@@ -1236,7 +1273,7 @@ static bool test_create(struct smbcli_state *cli, struct torture_context *tctx)
time_t basetime = (time(NULL) + 3600*24*3) & ~1;
union smb_fileinfo finfo;
- printf("Checking RAW_OPEN_CREATE\n");
+ torture_comment(tctx, "Checking RAW_OPEN_CREATE\n");
io.create.level = RAW_OPEN_CREATE;
io.create.in.attrib = 0;
@@ -1292,7 +1329,7 @@ static bool test_ctemp(struct smbcli_state *cli, TALLOC_CTX *tctx)
union smb_fileinfo finfo;
const char *name, *fname = NULL;
- printf("Checking RAW_OPEN_CTEMP\n");
+ torture_comment(tctx, "Checking RAW_OPEN_CTEMP\n");
io.ctemp.level = RAW_OPEN_CTEMP;
io.ctemp.in.attrib = FILE_ATTRIBUTE_HIDDEN;
@@ -1310,7 +1347,7 @@ static bool test_ctemp(struct smbcli_state *cli, TALLOC_CTX *tctx)
CHECK_STATUS(status, NT_STATUS_OK);
fname = finfo.name_info.out.fname.s;
- d_printf("ctemp name=%s real name=%s\n", name, fname);
+ torture_comment(tctx, "ctemp name=%s real name=%s\n", name, fname);
done:
smbcli_close(cli->tree, fnum);
@@ -1335,7 +1372,7 @@ static bool test_chained(struct smbcli_state *cli, TALLOC_CTX *tctx)
const char *buf = "test";
char buf2[4];
- printf("Checking RAW_OPEN_OPENX chained with READX\n");
+ torture_comment(tctx, "Checking RAW_OPEN_OPENX chained with READX\n");
smbcli_unlink(cli->tree, fname);
fnum = create_complex_file(cli, tctx, fname);
@@ -1366,7 +1403,8 @@ static bool test_chained(struct smbcli_state *cli, TALLOC_CTX *tctx)
fnum = io.openxreadx.out.file.fnum;
if (memcmp(buf, buf2, sizeof(buf)) != 0) {
- d_printf("wrong data in reply buffer\n");
+ torture_result(tctx, TORTURE_FAIL,
+ "wrong data in reply buffer\n");
ret = false;
}
@@ -1391,15 +1429,16 @@ static bool test_no_leading_slash(struct smbcli_state *cli, TALLOC_CTX *tctx)
bool ret = true;
const char *buf = "test";
- printf("Checking RAW_OPEN_OPENX without leading slash on path\n");
+ torture_comment(tctx, "Checking RAW_OPEN_OPENX without leading "
+ "slash on path\n");
smbcli_unlink(cli->tree, fname);
- /* Create the file */
+ /* Create the file */
fnum = create_complex_file(cli, tctx, fname);
smbcli_write(cli->tree, fnum, 0, buf, 0, sizeof(buf));
smbcli_close(cli->tree, fnum);
- /* Prepare to open the file using path without leading slash */
+ /* Prepare to open the file using path without leading slash */
io.openx.level = RAW_OPEN_OPENX;
io.openx.in.fname = fname + 1;
io.openx.in.flags = OPENX_FLAGS_ADDITIONAL_INFO;
@@ -1437,14 +1476,14 @@ static bool test_openx_over_dir(struct smbcli_state *cli, TALLOC_CTX *tctx)
int fnum = -1;
bool ret = true;
- printf("Checking RAW_OPEN_OPENX over an existing directory\n");
+ torture_comment(tctx, "Checking RAW_OPEN_OPENX over an existing directory\n");
smbcli_unlink(cli->tree, fname);
- /* Create the Directory */
+ /* Create the Directory */
status = create_directory_handle(cli->tree, fname, &d_fnum);
smbcli_close(cli->tree, d_fnum);
- /* Prepare to open the file over the directory. */
+ /* Prepare to open the file over the directory. */
io.openx.level = RAW_OPEN_OPENX;
io.openx.in.fname = fname;
io.openx.in.flags = OPENX_FLAGS_ADDITIONAL_INFO;
@@ -1492,7 +1531,8 @@ static bool test_raw_open_multi(struct torture_context *tctx)
ios = talloc_array(mem_ctx, union smb_open, num_files);
if ((tctx->ev == NULL) || (clients == NULL) || (requests == NULL) ||
(ios == NULL)) {
- DEBUG(0, ("talloc failed\n"));
+ torture_result(tctx, TORTURE_FAIL, "(%s): talloc failed\n",
+ __location__);
return false;
}
@@ -1505,7 +1545,9 @@ static bool test_raw_open_multi(struct torture_context *tctx)
for (i=0; i<num_files; i++) {
if (!torture_open_connection_share(mem_ctx, &(clients[i]),
tctx, host, share, tctx->ev)) {
- DEBUG(0, ("Could not open %d'th connection\n", i));
+ torture_result(tctx, TORTURE_FAIL,
+ "(%s): Could not open %d'th connection\n",
+ __location__, i);
return false;
}
clients[i]->tree->session->transport->options.request_timeout = 60;
@@ -1518,7 +1560,7 @@ static bool test_raw_open_multi(struct torture_context *tctx)
base ntcreatex parms
*/
io.generic.level = RAW_OPEN_NTCREATEX;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL;
io.ntcreatex.in.alloc_size = 0;
io.ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL;
@@ -1536,12 +1578,14 @@ static bool test_raw_open_multi(struct torture_context *tctx)
ios[i] = io;
requests[i] = smb_raw_open_send(clients[i]->tree, &ios[i]);
if (requests[i] == NULL) {
- DEBUG(0, ("could not send %d'th request\n", i));
+ torture_result(tctx, TORTURE_FAIL,
+ "(%s): could not send %d'th request\n",
+ __location__, i);
return false;
}
}
- DEBUG(10, ("waiting for replies\n"));
+ torture_comment(tctx, "waiting for replies\n");
while (1) {
bool unreplied = false;
for (i=0; i<num_files; i++) {
@@ -1555,8 +1599,8 @@ static bool test_raw_open_multi(struct torture_context *tctx)
status = smb_raw_open_recv(requests[i], mem_ctx,
&ios[i]);
- DEBUG(0, ("File %d returned status %s\n", i,
- nt_errstr(status)));
+ torture_comment(tctx, "File %d returned status %s\n", i,
+ nt_errstr(status));
if (NT_STATUS_IS_OK(status)) {
num_ok += 1;
@@ -1574,7 +1618,8 @@ static bool test_raw_open_multi(struct torture_context *tctx)
}
if (event_loop_once(tctx->ev) != 0) {
- DEBUG(0, ("event_loop_once failed\n"));
+ torture_result(tctx, TORTURE_FAIL,
+ "(%s): event_loop_once failed\n", __location__);
return false;
}
}
@@ -1602,12 +1647,12 @@ static bool test_open_for_delete(struct smbcli_state *cli, struct torture_contex
int fnum = -1;
bool ret = true;
- printf("Checking RAW_NTCREATEX for delete on a readonly file.\n");
+ torture_comment(tctx, "Checking RAW_NTCREATEX for delete on a readonly file.\n");
/* reasonable default parameters */
io.generic.level = RAW_OPEN_NTCREATEX;
io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.alloc_size = 0;
io.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL;
io.ntcreatex.in.file_attr = FILE_ATTRIBUTE_READONLY;
@@ -1647,8 +1692,175 @@ done:
return ret;
}
+/*
+ test chained RAW_OPEN_NTCREATEX_READX
+ Send chained NTCREATEX_READX on a file that doesn't exist, then create
+ the file and try again.
+*/
+static bool test_chained_ntcreatex_readx(struct smbcli_state *cli, struct torture_context *tctx)
+{
+ TALLOC_CTX *mem_ctx = talloc_new(tctx);
+ union smb_open io;
+ const char *fname = BASEDIR "\\torture_chained.txt";
+ NTSTATUS status;
+ int fnum = -1;
+ bool ret = true;
+ const char *buf = "test";
+ char buf2[4];
+
+ torture_comment(tctx, "Checking RAW_NTCREATEX_READX chained on "
+ "non-existant file \n");
+ smbcli_unlink(cli->tree, fname);
+
+ /* ntcreatex parameters */
+ io.generic.level = RAW_OPEN_NTCREATEX_READX;
+ io.ntcreatexreadx.in.flags = 0;
+ io.ntcreatexreadx.in.root_fid.fnum = 0;
+ io.ntcreatexreadx.in.access_mask = SEC_FILE_READ_DATA;
+ io.ntcreatexreadx.in.alloc_size = 0;
+ io.ntcreatexreadx.in.file_attr = FILE_ATTRIBUTE_NORMAL;
+ io.ntcreatexreadx.in.share_access = NTCREATEX_SHARE_ACCESS_READ |
+ NTCREATEX_SHARE_ACCESS_WRITE | NTCREATEX_SHARE_ACCESS_DELETE;
+ io.ntcreatexreadx.in.open_disposition = NTCREATEX_DISP_OPEN;
+ io.ntcreatexreadx.in.create_options = 0;
+ io.ntcreatexreadx.in.impersonation = NTCREATEX_IMPERSONATION_IMPERSONATION;
+ io.ntcreatexreadx.in.security_flags = 0;
+ io.ntcreatexreadx.in.fname = fname;
+
+ /* readx parameters */
+ io.ntcreatexreadx.in.offset = 0;
+ io.ntcreatexreadx.in.mincnt = sizeof(buf);
+ io.ntcreatexreadx.in.maxcnt = sizeof(buf);
+ io.ntcreatexreadx.in.remaining = 0;
+ io.ntcreatexreadx.out.data = (uint8_t *)buf2;
+
+ /* try to open the non-existant file */
+ status = smb_raw_open(cli->tree, mem_ctx, &io);
+ CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_NOT_FOUND);
+ fnum = io.ntcreatexreadx.out.file.fnum;
+
+ smbcli_close(cli->tree, fnum);
+ smbcli_unlink(cli->tree, fname);
+
+ torture_comment(tctx, "Checking RAW_NTCREATEX_READX chained on "
+ "existing file \n");
+
+ fnum = create_complex_file(cli, mem_ctx, fname);
+ smbcli_write(cli->tree, fnum, 0, buf, 0, sizeof(buf));
+ smbcli_close(cli->tree, fnum);
+
+ status = smb_raw_open(cli->tree, mem_ctx, &io);
+ CHECK_STATUS(status, NT_STATUS_OK);
+ fnum = io.ntcreatexreadx.out.file.fnum;
+
+ if (memcmp(buf, buf2, sizeof(buf)) != 0) {
+ torture_result(tctx, TORTURE_FAIL,
+ "(%s): wrong data in reply buffer\n", __location__);
+ ret = false;
+ }
+
+done:
+ smbcli_close(cli->tree, fnum);
+ smbcli_unlink(cli->tree, fname);
+ talloc_free(mem_ctx);
+
+ return ret;
+}
+
+#define FILL_NTCREATEX(_struct, _init...) \
+ do { \
+ (_struct)->generic.level = RAW_OPEN_NTCREATEX; \
+ (_struct)->ntcreatex.in \
+ = (typeof((_struct)->ntcreatex.in)) {_init};\
+ } while (0)
+
+static bool test_ntcreatex_opendisp_dir(struct smbcli_state *cli,
+ struct torture_context *tctx)
+{
+ union smb_open io;
+ const char *dname = BASEDIR "\\torture_ntcreatex_opendisp_dir";
+ NTSTATUS status;
+ bool ret = true;
+ int i;
+ struct {
+ uint32_t open_disp;
+ bool dir_exists;
+ NTSTATUS correct_status;
+ } open_funcs_dir[] = {
+ { NTCREATEX_DISP_SUPERSEDE, true, NT_STATUS_INVALID_PARAMETER },
+ { NTCREATEX_DISP_SUPERSEDE, false, NT_STATUS_INVALID_PARAMETER },
+ { NTCREATEX_DISP_OPEN, true, NT_STATUS_OK },
+ { NTCREATEX_DISP_OPEN, false, NT_STATUS_OBJECT_NAME_NOT_FOUND },
+ { NTCREATEX_DISP_CREATE, true, NT_STATUS_OBJECT_NAME_COLLISION },
+ { NTCREATEX_DISP_CREATE, false, NT_STATUS_OK },
+ { NTCREATEX_DISP_OPEN_IF, true, NT_STATUS_OK },
+ { NTCREATEX_DISP_OPEN_IF, false, NT_STATUS_OK },
+ { NTCREATEX_DISP_OVERWRITE, true, NT_STATUS_INVALID_PARAMETER },
+ { NTCREATEX_DISP_OVERWRITE, false, NT_STATUS_INVALID_PARAMETER },
+ { NTCREATEX_DISP_OVERWRITE_IF, true, NT_STATUS_INVALID_PARAMETER },
+ { NTCREATEX_DISP_OVERWRITE_IF, false, NT_STATUS_INVALID_PARAMETER },
+ { 6, true, NT_STATUS_INVALID_PARAMETER },
+ { 6, false, NT_STATUS_INVALID_PARAMETER },
+ };
+
+ if (!torture_setup_dir(cli, BASEDIR)) {
+ return false;
+ }
+
+ FILL_NTCREATEX(&io,
+ .flags = NTCREATEX_FLAGS_EXTENDED,
+ .access_mask = SEC_FLAG_MAXIMUM_ALLOWED,
+ .file_attr = FILE_ATTRIBUTE_DIRECTORY,
+ .share_access = NTCREATEX_SHARE_ACCESS_READ | NTCREATEX_SHARE_ACCESS_WRITE,
+ .create_options = NTCREATEX_OPTIONS_DIRECTORY,
+ .fname = dname,
+ );
+
+ smbcli_rmdir(cli->tree, dname);
+ smbcli_unlink(cli->tree, dname);
+
+ /* test the open disposition for directories */
+ torture_comment(tctx, "Testing open dispositions for directories...\n");
+
+ for (i=0; i<ARRAY_SIZE(open_funcs_dir); i++) {
+ if (open_funcs_dir[i].dir_exists) {
+ status = smbcli_mkdir(cli->tree, dname);
+ if (!NT_STATUS_IS_OK(status)) {
+ torture_result(tctx, TORTURE_FAIL,
+ "(%s): Failed to make directory "
+ "%s - %s\n", __location__, dname,
+ smbcli_errstr(cli->tree));
+ ret = false;
+ goto done;
+ }
+ }
+
+ io.ntcreatex.in.open_disposition = open_funcs_dir[i].open_disp;
+ status = smb_raw_open(cli->tree, tctx, &io);
+ if (!NT_STATUS_EQUAL(status, open_funcs_dir[i].correct_status)) {
+ torture_result(tctx, TORTURE_FAIL,
+ "(%s) incorrect status %s should be %s "
+ "(i=%d dir_exists=%d open_disp=%d)\n",
+ __location__, nt_errstr(status),
+ nt_errstr(open_funcs_dir[i].correct_status),
+ i, (int)open_funcs_dir[i].dir_exists,
+ (int)open_funcs_dir[i].open_disp);
+ ret = false;
+ }
+ if (NT_STATUS_IS_OK(status) || open_funcs_dir[i].dir_exists) {
+ smbcli_close(cli->tree, io.ntcreatex.out.file.fnum);
+ smbcli_rmdir(cli->tree, dname);
+ }
+ }
+
+done:
+ smbcli_rmdir(cli->tree, dname);
+ smbcli_deltree(cli->tree, BASEDIR);
+ return ret;
+}
+
-/* basic testing of all RAW_OPEN_* calls
+/* basic testing of all RAW_OPEN_* calls
*/
bool torture_raw_open(struct torture_context *torture, struct smbcli_state *cli)
{
@@ -1669,9 +1881,11 @@ bool torture_raw_open(struct torture_context *torture, struct smbcli_state *cli)
ret &= test_create(cli, torture);
ret &= test_ctemp(cli, torture);
ret &= test_chained(cli, torture);
+ ret &= test_chained_ntcreatex_readx(cli, torture);
ret &= test_no_leading_slash(cli, torture);
ret &= test_openx_over_dir(cli, torture);
ret &= test_open_for_delete(cli, torture);
+ ret &= test_ntcreatex_opendisp_dir(cli, torture);
smb_raw_exit(cli->session);
smbcli_deltree(cli->tree, BASEDIR);
diff --git a/source4/torture/raw/openbench.c b/source4/torture/raw/openbench.c
index bdad2b16a5..2716f6a528 100644
--- a/source4/torture/raw/openbench.c
+++ b/source4/torture/raw/openbench.c
@@ -173,7 +173,7 @@ static void next_open(struct benchopen_state *state)
DEBUG(2,("[%d] opening %u\n", state->client_num, state->pending_file_num));
state->open_parms.ntcreatex.level = RAW_OPEN_NTCREATEX;
state->open_parms.ntcreatex.in.flags = 0;
- state->open_parms.ntcreatex.in.root_fid = 0;
+ state->open_parms.ntcreatex.in.root_fid.fnum = 0;
state->open_parms.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL;
state->open_parms.ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL;
state->open_parms.ntcreatex.in.alloc_size = 0;
diff --git a/source4/torture/raw/oplock.c b/source4/torture/raw/oplock.c
index 1eaa7e214b..1b9d8e95c9 100644
--- a/source4/torture/raw/oplock.c
+++ b/source4/torture/raw/oplock.c
@@ -204,6 +204,60 @@ static bool open_connection_no_level2_oplocks(struct torture_context *tctx,
return true;
}
+/*
+ Timer handler function notifies the registering function that time is up
+*/
+static void timeout_cb(struct tevent_context *ev,
+ struct tevent_timer *te,
+ struct timeval current_time,
+ void *private_data)
+{
+ bool *timesup = (bool *)private_data;
+ *timesup = true;
+ return;
+}
+
+/*
+ Wait a short period of time to receive a single oplock break request
+*/
+static void torture_wait_for_oplock_break(struct torture_context *tctx)
+{
+ TALLOC_CTX *tmp_ctx = talloc_new(NULL);
+ struct tevent_timer *te = NULL;
+ struct timeval ne;
+ bool timesup = false;
+ int old_count = break_info.count;
+
+ /* Wait .1 seconds for an oplock break */
+ ne = tevent_timeval_current_ofs(0, 100000);
+
+ if ((te = event_add_timed(tctx->ev, tmp_ctx, ne, timeout_cb, &timesup))
+ == NULL)
+ {
+ torture_comment(tctx, "Failed to wait for an oplock break. "
+ "test results may not be accurate.");
+ goto done;
+ }
+
+ while (!timesup && break_info.count < old_count + 1) {
+ if (event_loop_once(tctx->ev) != 0) {
+ torture_comment(tctx, "Failed to wait for an oplock "
+ "break. test results may not be "
+ "accurate.");
+ goto done;
+ }
+ }
+
+done:
+ /* We don't know if the timed event fired and was freed, we received
+ * our oplock break, or some other event triggered the loop. Thus,
+ * we create a tmp_ctx to be able to safely free/remove the timed
+ * event in all 3 cases. */
+ talloc_free(tmp_ctx);
+
+ return;
+}
+
static bool test_raw_oplock_exclusive1(struct torture_context *tctx, struct smbcli_state *cli1, struct smbcli_state *cli2)
{
const char *fname = BASEDIR "\\test_exclusive1.dat";
@@ -226,7 +280,7 @@ static bool test_raw_oplock_exclusive1(struct torture_context *tctx, struct smbc
base ntcreatex parms
*/
io.generic.level = RAW_OPEN_NTCREATEX;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL;
io.ntcreatex.in.alloc_size = 0;
io.ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL;
@@ -249,6 +303,7 @@ static bool test_raw_oplock_exclusive1(struct torture_context *tctx, struct smbc
torture_comment(tctx, "a 2nd open should not cause a break\n");
status = smb_raw_open(cli2->tree, tctx, &io);
CHECK_STATUS(tctx, status, NT_STATUS_SHARING_VIOLATION);
+ torture_wait_for_oplock_break(tctx);
CHECK_VAL(break_info.count, 0);
CHECK_VAL(break_info.failures, 0);
@@ -257,6 +312,7 @@ static bool test_raw_oplock_exclusive1(struct torture_context *tctx, struct smbc
unl.unlink.in.attrib = 0;
status = smb_raw_unlink(cli2->tree, &unl);
CHECK_STATUS(tctx, status, NT_STATUS_SHARING_VIOLATION);
+ torture_wait_for_oplock_break(tctx);
CHECK_VAL(break_info.count, 0);
CHECK_VAL(break_info.failures, 0);
@@ -291,7 +347,7 @@ static bool test_raw_oplock_exclusive2(struct torture_context *tctx, struct smbc
base ntcreatex parms
*/
io.generic.level = RAW_OPEN_NTCREATEX;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL;
io.ntcreatex.in.alloc_size = 0;
io.ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL;
@@ -318,6 +374,7 @@ static bool test_raw_oplock_exclusive2(struct torture_context *tctx, struct smbc
status = smb_raw_open(cli2->tree, tctx, &io);
CHECK_STATUS(tctx, status, NT_STATUS_OK);
fnum2 = io.ntcreatex.out.file.fnum;
+ torture_wait_for_oplock_break(tctx);
CHECK_VAL(io.ntcreatex.out.oplock_level, LEVEL_II_OPLOCK_RETURN);
CHECK_VAL(break_info.count, 1);
CHECK_VAL(break_info.fnum, fnum);
@@ -331,6 +388,7 @@ static bool test_raw_oplock_exclusive2(struct torture_context *tctx, struct smbc
unl.unlink.in.attrib = 0;
status = smb_raw_unlink(cli2->tree, &unl);
CHECK_STATUS(tctx, status, NT_STATUS_SHARING_VIOLATION);
+ torture_wait_for_oplock_break(tctx);
CHECK_VAL(break_info.count, 0);
CHECK_VAL(break_info.failures, 0);
@@ -342,10 +400,11 @@ static bool test_raw_oplock_exclusive2(struct torture_context *tctx, struct smbc
unl.unlink.in.attrib = 0;
status = smb_raw_unlink(cli2->tree, &unl);
CHECK_STATUS(tctx, status, NT_STATUS_SHARING_VIOLATION);
+ torture_wait_for_oplock_break(tctx);
CHECK_VAL(break_info.count, 0);
CHECK_VAL(break_info.failures, 0);
- torture_comment(tctx, "close 1st handle\n");
+ torture_comment(tctx, "close 2nd handle\n");
smbcli_close(cli2->tree, fnum2);
torture_comment(tctx, "unlink it\n");
@@ -353,6 +412,7 @@ static bool test_raw_oplock_exclusive2(struct torture_context *tctx, struct smbc
unl.unlink.in.attrib = 0;
status = smb_raw_unlink(cli2->tree, &unl);
CHECK_STATUS(tctx, status, NT_STATUS_OK);
+ torture_wait_for_oplock_break(tctx);
CHECK_VAL(break_info.count, 0);
CHECK_VAL(break_info.failures, 0);
@@ -385,7 +445,7 @@ static bool test_raw_oplock_exclusive3(struct torture_context *tctx, struct smbc
base ntcreatex parms
*/
io.generic.level = RAW_OPEN_NTCREATEX;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL;
io.ntcreatex.in.alloc_size = 0;
io.ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL;
@@ -415,6 +475,7 @@ static bool test_raw_oplock_exclusive3(struct torture_context *tctx, struct smbc
status = smb_raw_setpathinfo(cli2->tree, &sfi);
CHECK_STATUS(tctx, status, NT_STATUS_OK);
+ torture_wait_for_oplock_break(tctx);
CHECK_VAL(break_info.count, 1);
CHECK_VAL(break_info.failures, 0);
CHECK_VAL(break_info.level, OPLOCK_BREAK_TO_NONE);
@@ -449,7 +510,7 @@ static bool test_raw_oplock_exclusive4(struct torture_context *tctx, struct smbc
base ntcreatex parms
*/
io.generic.level = RAW_OPEN_NTCREATEX;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL;
io.ntcreatex.in.alloc_size = 0;
io.ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL;
@@ -479,6 +540,7 @@ static bool test_raw_oplock_exclusive4(struct torture_context *tctx, struct smbc
CHECK_STATUS(tctx, status, NT_STATUS_OK);
fnum2 = io.ntcreatex.out.file.fnum;
CHECK_VAL(io.ntcreatex.out.oplock_level, NO_OPLOCK_RETURN);
+ torture_wait_for_oplock_break(tctx);
CHECK_VAL(break_info.count, 0);
CHECK_VAL(break_info.failures, 0);
@@ -514,7 +576,7 @@ static bool test_raw_oplock_exclusive5(struct torture_context *tctx, struct smbc
base ntcreatex parms
*/
io.generic.level = RAW_OPEN_NTCREATEX;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL;
io.ntcreatex.in.alloc_size = 0;
io.ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL;
@@ -550,6 +612,7 @@ static bool test_raw_oplock_exclusive5(struct torture_context *tctx, struct smbc
CHECK_STATUS(tctx, status, NT_STATUS_OK);
fnum2 = io.ntcreatex.out.file.fnum;
CHECK_VAL(io.ntcreatex.out.oplock_level, LEVEL_II_OPLOCK_RETURN);
+ torture_wait_for_oplock_break(tctx);
CHECK_VAL(break_info.count, 1);
CHECK_VAL(break_info.failures, 0);
@@ -587,7 +650,7 @@ static bool test_raw_oplock_exclusive6(struct torture_context *tctx, struct smbc
base ntcreatex parms
*/
io.generic.level = RAW_OPEN_NTCREATEX;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL;
io.ntcreatex.in.alloc_size = 0;
io.ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL;
@@ -620,6 +683,7 @@ static bool test_raw_oplock_exclusive6(struct torture_context *tctx, struct smbc
status = smb_raw_rename(cli2->tree, &rn);
CHECK_STATUS(tctx, status, NT_STATUS_SHARING_VIOLATION);
+ torture_wait_for_oplock_break(tctx);
CHECK_VAL(break_info.count, 0);
CHECK_VAL(break_info.failures, 0);
@@ -655,7 +719,7 @@ static bool test_raw_oplock_batch1(struct torture_context *tctx, struct smbcli_s
base ntcreatex parms
*/
io.generic.level = RAW_OPEN_NTCREATEX;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL;
io.ntcreatex.in.alloc_size = 0;
io.ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL;
@@ -685,6 +749,7 @@ static bool test_raw_oplock_batch1(struct torture_context *tctx, struct smbcli_s
status = smb_raw_unlink(cli2->tree, &unl);
CHECK_STATUS(tctx, status, NT_STATUS_SHARING_VIOLATION);
+ torture_wait_for_oplock_break(tctx);
CHECK_VAL(break_info.count, 1);
CHECK_VAL(break_info.fnum, fnum);
CHECK_VAL(break_info.level, OPLOCK_BREAK_TO_LEVEL_II);
@@ -695,13 +760,14 @@ static bool test_raw_oplock_batch1(struct torture_context *tctx, struct smbcli_s
status = smb_raw_unlink(cli2->tree, &unl);
CHECK_STATUS(tctx, status, NT_STATUS_SHARING_VIOLATION);
+ torture_wait_for_oplock_break(tctx);
CHECK_VAL(break_info.count, 0);
torture_comment(tctx, "writing should generate a self break to none\n");
smbcli_write(cli1->tree, fnum, 0, &c, 0, 1);
- msleep(100);
- smbcli_write(cli1->tree, fnum, 0, &c, 1, 1);
+ torture_wait_for_oplock_break(tctx);
+ torture_wait_for_oplock_break(tctx);
CHECK_VAL(break_info.count, 1);
CHECK_VAL(break_info.fnum, fnum);
CHECK_VAL(break_info.level, OPLOCK_BREAK_TO_NONE);
@@ -739,7 +805,7 @@ static bool test_raw_oplock_batch2(struct torture_context *tctx, struct smbcli_s
base ntcreatex parms
*/
io.generic.level = RAW_OPEN_NTCREATEX;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL;
io.ntcreatex.in.alloc_size = 0;
io.ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL;
@@ -767,6 +833,7 @@ static bool test_raw_oplock_batch2(struct torture_context *tctx, struct smbcli_s
status = smb_raw_unlink(cli2->tree, &unl);
CHECK_STATUS(tctx, status, NT_STATUS_SHARING_VIOLATION);
+ torture_wait_for_oplock_break(tctx);
CHECK_VAL(break_info.count, 1);
CHECK_VAL(break_info.fnum, fnum);
CHECK_VAL(break_info.level, OPLOCK_BREAK_TO_LEVEL_II);
@@ -777,13 +844,13 @@ static bool test_raw_oplock_batch2(struct torture_context *tctx, struct smbcli_s
status = smb_raw_unlink(cli2->tree, &unl);
CHECK_STATUS(tctx, status, NT_STATUS_SHARING_VIOLATION);
+ torture_wait_for_oplock_break(tctx);
CHECK_VAL(break_info.count, 0);
torture_comment(tctx, "writing should not generate a break\n");
smbcli_write(cli1->tree, fnum, 0, &c, 0, 1);
- msleep(100);
- smbcli_write(cli1->tree, fnum, 0, &c, 1, 1);
+ torture_wait_for_oplock_break(tctx);
CHECK_VAL(break_info.count, 0);
smbcli_close(cli1->tree, fnum);
@@ -817,7 +884,7 @@ static bool test_raw_oplock_batch3(struct torture_context *tctx, struct smbcli_s
base ntcreatex parms
*/
io.generic.level = RAW_OPEN_NTCREATEX;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL;
io.ntcreatex.in.alloc_size = 0;
io.ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL;
@@ -845,6 +912,7 @@ static bool test_raw_oplock_batch3(struct torture_context *tctx, struct smbcli_s
status = smb_raw_unlink(cli2->tree, &unl);
CHECK_STATUS(tctx, status, NT_STATUS_OK);
+ torture_wait_for_oplock_break(tctx);
CHECK_VAL(break_info.count, 1);
CHECK_VAL(break_info.fnum, fnum);
CHECK_VAL(break_info.level, 1);
@@ -881,7 +949,7 @@ static bool test_raw_oplock_batch4(struct torture_context *tctx, struct smbcli_s
base ntcreatex parms
*/
io.generic.level = RAW_OPEN_NTCREATEX;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL;
io.ntcreatex.in.alloc_size = 0;
io.ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL;
@@ -911,6 +979,7 @@ static bool test_raw_oplock_batch4(struct torture_context *tctx, struct smbcli_s
rd.read.in.remaining = 0;
status = smb_raw_read(cli1->tree, &rd);
CHECK_STATUS(tctx, status, NT_STATUS_OK);
+ torture_wait_for_oplock_break(tctx);
CHECK_VAL(break_info.count, 0);
CHECK_VAL(break_info.failures, 0);
@@ -944,7 +1013,7 @@ static bool test_raw_oplock_batch5(struct torture_context *tctx, struct smbcli_s
base ntcreatex parms
*/
io.generic.level = RAW_OPEN_NTCREATEX;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL;
io.ntcreatex.in.alloc_size = 0;
io.ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL;
@@ -973,6 +1042,7 @@ static bool test_raw_oplock_batch5(struct torture_context *tctx, struct smbcli_s
status = smb_raw_open(cli2->tree, tctx, &io);
CHECK_STATUS(tctx, status, NT_STATUS_SHARING_VIOLATION);
+ torture_wait_for_oplock_break(tctx);
CHECK_VAL(break_info.count, 1);
CHECK_VAL(break_info.fnum, fnum);
CHECK_VAL(break_info.level, 1);
@@ -1004,12 +1074,13 @@ static bool test_raw_oplock_batch6(struct torture_context *tctx, struct smbcli_s
smbcli_unlink(cli1->tree, fname);
smbcli_oplock_handler(cli1->transport, oplock_handler_ack_to_given, cli1->tree);
+ smbcli_oplock_handler(cli2->transport, oplock_handler_ack_to_given, cli2->tree);
/*
base ntcreatex parms
*/
io.generic.level = RAW_OPEN_NTCREATEX;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL;
io.ntcreatex.in.alloc_size = 0;
io.ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL;
@@ -1022,8 +1093,6 @@ static bool test_raw_oplock_batch6(struct torture_context *tctx, struct smbcli_s
torture_comment(tctx, "BATCH6: a 2nd open should give a break to level II if the first open allowed shared read\n");
ZERO_STRUCT(break_info);
- smbcli_oplock_handler(cli1->transport, oplock_handler_ack_to_given, cli1->tree);
- smbcli_oplock_handler(cli2->transport, oplock_handler_ack_to_given, cli2->tree);
io.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_READ | SEC_RIGHTS_FILE_WRITE;
io.ntcreatex.in.share_access = NTCREATEX_SHARE_ACCESS_READ | NTCREATEX_SHARE_ACCESS_WRITE;
@@ -1042,6 +1111,7 @@ static bool test_raw_oplock_batch6(struct torture_context *tctx, struct smbcli_s
fnum2 = io.ntcreatex.out.file.fnum;
CHECK_VAL(io.ntcreatex.out.oplock_level, LEVEL_II_OPLOCK_RETURN);
+ //torture_wait_for_oplock_break(tctx);
CHECK_VAL(break_info.count, 1);
CHECK_VAL(break_info.fnum, fnum);
CHECK_VAL(break_info.level, 1);
@@ -1050,8 +1120,10 @@ static bool test_raw_oplock_batch6(struct torture_context *tctx, struct smbcli_s
torture_comment(tctx, "write should trigger a break to none on both\n");
smbcli_write(cli1->tree, fnum, 0, &c, 0, 1);
- msleep(100);
- smbcli_write(cli1->tree, fnum, 0, &c, 1, 1);
+
+ /* We expect two breaks */
+ torture_wait_for_oplock_break(tctx);
+ torture_wait_for_oplock_break(tctx);
CHECK_VAL(break_info.count, 2);
CHECK_VAL(break_info.level, 0);
@@ -1060,7 +1132,6 @@ static bool test_raw_oplock_batch6(struct torture_context *tctx, struct smbcli_s
smbcli_close(cli1->tree, fnum);
smbcli_close(cli2->tree, fnum2);
-
done:
smb_raw_exit(cli1->session);
smb_raw_exit(cli2->session);
@@ -1089,7 +1160,7 @@ static bool test_raw_oplock_batch7(struct torture_context *tctx, struct smbcli_s
base ntcreatex parms
*/
io.generic.level = RAW_OPEN_NTCREATEX;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL;
io.ntcreatex.in.alloc_size = 0;
io.ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL;
@@ -1124,11 +1195,12 @@ static bool test_raw_oplock_batch7(struct torture_context *tctx, struct smbcli_s
fnum = io.ntcreatex.out.file.fnum;
CHECK_VAL(io.ntcreatex.out.oplock_level, BATCH_OPLOCK_RETURN);
+ torture_wait_for_oplock_break(tctx);
CHECK_VAL(break_info.count, 1);
CHECK_VAL(break_info.fnum, fnum2);
CHECK_VAL(break_info.level, 1);
CHECK_VAL(break_info.failures, 0);
-
+
smbcli_close(cli2->tree, fnum);
done:
@@ -1159,7 +1231,7 @@ static bool test_raw_oplock_batch8(struct torture_context *tctx, struct smbcli_s
base ntcreatex parms
*/
io.generic.level = RAW_OPEN_NTCREATEX;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL;
io.ntcreatex.in.alloc_size = 0;
io.ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL;
@@ -1193,6 +1265,7 @@ static bool test_raw_oplock_batch8(struct torture_context *tctx, struct smbcli_s
CHECK_STATUS(tctx, status, NT_STATUS_OK);
fnum2 = io.ntcreatex.out.file.fnum;
CHECK_VAL(io.ntcreatex.out.oplock_level, NO_OPLOCK_RETURN);
+ torture_wait_for_oplock_break(tctx);
CHECK_VAL(break_info.count, 0);
CHECK_VAL(break_info.failures, 0);
@@ -1228,7 +1301,7 @@ static bool test_raw_oplock_batch9(struct torture_context *tctx, struct smbcli_s
base ntcreatex parms
*/
io.generic.level = RAW_OPEN_NTCREATEX;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL;
io.ntcreatex.in.alloc_size = 0;
io.ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL;
@@ -1264,6 +1337,7 @@ static bool test_raw_oplock_batch9(struct torture_context *tctx, struct smbcli_s
status = smb_raw_open(cli2->tree, tctx, &io);
CHECK_STATUS(tctx, status, NT_STATUS_OK);
fnum2 = io.ntcreatex.out.file.fnum;
+ torture_wait_for_oplock_break(tctx);
CHECK_VAL(break_info.count, 1);
CHECK_VAL(break_info.fnum, fnum);
CHECK_VAL(break_info.failures, 0);
@@ -1283,6 +1357,7 @@ static bool test_raw_oplock_batch9(struct torture_context *tctx, struct smbcli_s
status = smb_raw_open(cli2->tree, tctx, &io);
CHECK_STATUS(tctx, status, NT_STATUS_OK);
fnum2 = io.ntcreatex.out.file.fnum;
+ torture_wait_for_oplock_break(tctx);
CHECK_VAL(break_info.count, 0);
CHECK_VAL(break_info.failures, 0);
CHECK_VAL(io.ntcreatex.out.oplock_level, LEVEL_II_OPLOCK_RETURN);
@@ -1292,11 +1367,9 @@ static bool test_raw_oplock_batch9(struct torture_context *tctx, struct smbcli_s
torture_comment(tctx, "write should trigger a break to none on both\n");
smbcli_write(cli2->tree, fnum2, 0, &c, 0, 1);
- /* Now the oplock break request comes in. But right now we can't
- * answer it. Do another write */
-
- msleep(100);
- smbcli_write(cli2->tree, fnum2, 0, &c, 1, 1);
+ /* We expect two breaks */
+ torture_wait_for_oplock_break(tctx);
+ torture_wait_for_oplock_break(tctx);
CHECK_VAL(break_info.count, 2);
CHECK_VAL(break_info.level, 0);
@@ -1333,7 +1406,7 @@ static bool test_raw_oplock_batch10(struct torture_context *tctx, struct smbcli_
base ntcreatex parms
*/
io.generic.level = RAW_OPEN_NTCREATEX;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL;
io.ntcreatex.in.alloc_size = 0;
io.ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL;
@@ -1354,6 +1427,7 @@ static bool test_raw_oplock_batch10(struct torture_context *tctx, struct smbcli_
status = smb_raw_open(cli1->tree, tctx, &io);
CHECK_STATUS(tctx, status, NT_STATUS_OK);
fnum = io.ntcreatex.out.file.fnum;
+ torture_wait_for_oplock_break(tctx);
CHECK_VAL(break_info.count, 0);
CHECK_VAL(break_info.failures, 0);
CHECK_VAL(io.ntcreatex.out.oplock_level, 0);
@@ -1371,6 +1445,7 @@ static bool test_raw_oplock_batch10(struct torture_context *tctx, struct smbcli_
status = smb_raw_open(cli2->tree, tctx, &io);
CHECK_STATUS(tctx, status, NT_STATUS_OK);
fnum2 = io.ntcreatex.out.file.fnum;
+ torture_wait_for_oplock_break(tctx);
CHECK_VAL(break_info.count, 0);
CHECK_VAL(break_info.failures, 0);
CHECK_VAL(io.ntcreatex.out.oplock_level, LEVEL_II_OPLOCK_RETURN);
@@ -1388,22 +1463,7 @@ static bool test_raw_oplock_batch10(struct torture_context *tctx, struct smbcli_
CHECK_STATUS(tctx, status, NT_STATUS_OK);
}
- /* Now the oplock break request comes in. But right now we can't
- * answer it. Do another write */
-
- msleep(100);
-
- {
- union smb_write wr;
- wr.write.level = RAW_WRITE_WRITE;
- wr.write.in.file.fnum = fnum;
- wr.write.in.count = 1;
- wr.write.in.offset = 0;
- wr.write.in.remaining = 0;
- wr.write.in.data = (const uint8_t *)"x";
- status = smb_raw_write(cli1->tree, &wr);
- CHECK_STATUS(tctx, status, NT_STATUS_OK);
- }
+ torture_wait_for_oplock_break(tctx);
CHECK_VAL(break_info.count, 1);
CHECK_VAL(break_info.fnum, fnum2);
@@ -1442,7 +1502,7 @@ static bool test_raw_oplock_batch11(struct torture_context *tctx, struct smbcli_
base ntcreatex parms
*/
io.generic.level = RAW_OPEN_NTCREATEX;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL;
io.ntcreatex.in.alloc_size = 0;
io.ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL;
@@ -1457,10 +1517,9 @@ static bool test_raw_oplock_batch11(struct torture_context *tctx, struct smbcli_
torture_comment(tctx, "BATCH11: Test if setpathinfo set EOF breaks oplocks.\n");
ZERO_STRUCT(break_info);
- smbcli_oplock_handler(cli1->transport, oplock_handler_ack_to_given, cli1->tree);
io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED |
- NTCREATEX_FLAGS_REQUEST_OPLOCK |
+ NTCREATEX_FLAGS_REQUEST_OPLOCK |
NTCREATEX_FLAGS_REQUEST_BATCH_OPLOCK;
io.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL;
io.ntcreatex.in.share_access = NTCREATEX_SHARE_ACCESS_READ|
@@ -1470,18 +1529,20 @@ static bool test_raw_oplock_batch11(struct torture_context *tctx, struct smbcli_
status = smb_raw_open(cli1->tree, tctx, &io);
CHECK_STATUS(tctx, status, NT_STATUS_OK);
fnum = io.ntcreatex.out.file.fnum;
+ torture_wait_for_oplock_break(tctx);
CHECK_VAL(break_info.count, 0);
CHECK_VAL(break_info.failures, 0);
CHECK_VAL(io.ntcreatex.out.oplock_level, BATCH_OPLOCK_RETURN);
-
+
ZERO_STRUCT(sfi);
sfi.generic.level = RAW_SFILEINFO_END_OF_FILE_INFORMATION;
sfi.generic.in.file.path = fname;
sfi.end_of_file_info.in.size = 100;
status = smb_raw_setpathinfo(cli2->tree, &sfi);
-
CHECK_STATUS(tctx, status, NT_STATUS_OK);
+
+ torture_wait_for_oplock_break(tctx);
CHECK_VAL(break_info.count, 1);
CHECK_VAL(break_info.failures, 0);
CHECK_VAL(break_info.level, 0);
@@ -1517,7 +1578,7 @@ static bool test_raw_oplock_batch12(struct torture_context *tctx, struct smbcli_
base ntcreatex parms
*/
io.generic.level = RAW_OPEN_NTCREATEX;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL;
io.ntcreatex.in.alloc_size = 0;
io.ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL;
@@ -1535,7 +1596,7 @@ static bool test_raw_oplock_batch12(struct torture_context *tctx, struct smbcli_
smbcli_oplock_handler(cli1->transport, oplock_handler_ack_to_given, cli1->tree);
io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED |
- NTCREATEX_FLAGS_REQUEST_OPLOCK |
+ NTCREATEX_FLAGS_REQUEST_OPLOCK |
NTCREATEX_FLAGS_REQUEST_BATCH_OPLOCK;
io.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL;
io.ntcreatex.in.share_access = NTCREATEX_SHARE_ACCESS_READ|
@@ -1545,18 +1606,20 @@ static bool test_raw_oplock_batch12(struct torture_context *tctx, struct smbcli_
status = smb_raw_open(cli1->tree, tctx, &io);
CHECK_STATUS(tctx, status, NT_STATUS_OK);
fnum = io.ntcreatex.out.file.fnum;
+ torture_wait_for_oplock_break(tctx);
CHECK_VAL(break_info.count, 0);
CHECK_VAL(break_info.failures, 0);
CHECK_VAL(io.ntcreatex.out.oplock_level, BATCH_OPLOCK_RETURN);
-
+
ZERO_STRUCT(sfi);
sfi.generic.level = SMB_SFILEINFO_ALLOCATION_INFORMATION;
sfi.generic.in.file.path = fname;
sfi.allocation_info.in.alloc_size = 65536 * 8;
status = smb_raw_setpathinfo(cli2->tree, &sfi);
-
CHECK_STATUS(tctx, status, NT_STATUS_OK);
+
+ torture_wait_for_oplock_break(tctx);
CHECK_VAL(break_info.count, 1);
CHECK_VAL(break_info.failures, 0);
CHECK_VAL(break_info.level, 0);
@@ -1592,7 +1655,7 @@ static bool test_raw_oplock_batch13(struct torture_context *tctx, struct smbcli_
base ntcreatex parms
*/
io.generic.level = RAW_OPEN_NTCREATEX;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL;
io.ntcreatex.in.alloc_size = 0;
io.ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL;
@@ -1605,8 +1668,6 @@ static bool test_raw_oplock_batch13(struct torture_context *tctx, struct smbcli_
torture_comment(tctx, "BATCH13: open with batch oplock\n");
ZERO_STRUCT(break_info);
- smbcli_oplock_handler(cli1->transport, oplock_handler_ack_to_given, cli1->tree);
-
io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED |
NTCREATEX_FLAGS_REQUEST_OPLOCK |
@@ -1634,6 +1695,7 @@ static bool test_raw_oplock_batch13(struct torture_context *tctx, struct smbcli_
status = smb_raw_open(cli2->tree, tctx, &io);
CHECK_STATUS(tctx, status, NT_STATUS_OK);
fnum2 = io.ntcreatex.out.file.fnum;
+ torture_wait_for_oplock_break(tctx);
CHECK_VAL(io.ntcreatex.out.oplock_level, LEVEL_II_OPLOCK_RETURN);
CHECK_VAL(break_info.count, 1);
CHECK_VAL(break_info.failures, 0);
@@ -1669,7 +1731,7 @@ static bool test_raw_oplock_batch14(struct torture_context *tctx, struct smbcli_
base ntcreatex parms
*/
io.generic.level = RAW_OPEN_NTCREATEX;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL;
io.ntcreatex.in.alloc_size = 0;
io.ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL;
@@ -1682,7 +1744,6 @@ static bool test_raw_oplock_batch14(struct torture_context *tctx, struct smbcli_
torture_comment(tctx, "BATCH14: open with batch oplock\n");
ZERO_STRUCT(break_info);
- smbcli_oplock_handler(cli1->transport, oplock_handler_ack_to_given, cli1->tree);
io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED |
NTCREATEX_FLAGS_REQUEST_OPLOCK |
@@ -1711,6 +1772,8 @@ static bool test_raw_oplock_batch14(struct torture_context *tctx, struct smbcli_
CHECK_STATUS(tctx, status, NT_STATUS_OK);
fnum2 = io.ntcreatex.out.file.fnum;
CHECK_VAL(io.ntcreatex.out.oplock_level, LEVEL_II_OPLOCK_RETURN);
+
+ torture_wait_for_oplock_break(tctx);
CHECK_VAL(break_info.count, 1);
CHECK_VAL(break_info.failures, 0);
@@ -1745,7 +1808,7 @@ static bool test_raw_oplock_batch15(struct torture_context *tctx, struct smbcli_
base ntcreatex parms
*/
io.generic.level = RAW_OPEN_NTCREATEX;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL;
io.ntcreatex.in.alloc_size = 0;
io.ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL;
@@ -1760,7 +1823,6 @@ static bool test_raw_oplock_batch15(struct torture_context *tctx, struct smbcli_
torture_comment(tctx, "BATCH15: Test if qpathinfo all info breaks a batch oplock (should not).\n");
ZERO_STRUCT(break_info);
- smbcli_oplock_handler(cli1->transport, oplock_handler_ack_to_given, cli1->tree);
io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED |
NTCREATEX_FLAGS_REQUEST_OPLOCK |
@@ -1774,6 +1836,8 @@ static bool test_raw_oplock_batch15(struct torture_context *tctx, struct smbcli_
status = smb_raw_open(cli1->tree, tctx, &io);
CHECK_STATUS(tctx, status, NT_STATUS_OK);
fnum = io.ntcreatex.out.file.fnum;
+
+ torture_wait_for_oplock_break(tctx);
CHECK_VAL(break_info.count, 0);
CHECK_VAL(break_info.failures, 0);
CHECK_VAL(io.ntcreatex.out.oplock_level, BATCH_OPLOCK_RETURN);
@@ -1783,8 +1847,9 @@ static bool test_raw_oplock_batch15(struct torture_context *tctx, struct smbcli_
qfi.generic.in.file.path = fname;
status = smb_raw_pathinfo(cli2->tree, tctx, &qfi);
-
CHECK_STATUS(tctx, status, NT_STATUS_OK);
+
+ torture_wait_for_oplock_break(tctx);
CHECK_VAL(break_info.count, 0);
smbcli_close(cli1->tree, fnum);
@@ -1818,7 +1883,7 @@ static bool test_raw_oplock_batch16(struct torture_context *tctx, struct smbcli_
base ntcreatex parms
*/
io.generic.level = RAW_OPEN_NTCREATEX;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL;
io.ntcreatex.in.alloc_size = 0;
io.ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL;
@@ -1831,8 +1896,6 @@ static bool test_raw_oplock_batch16(struct torture_context *tctx, struct smbcli_
torture_comment(tctx, "BATCH16: open with batch oplock\n");
ZERO_STRUCT(break_info);
- smbcli_oplock_handler(cli1->transport, oplock_handler_ack_to_given, cli1->tree);
-
io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED |
NTCREATEX_FLAGS_REQUEST_OPLOCK |
@@ -1861,6 +1924,8 @@ static bool test_raw_oplock_batch16(struct torture_context *tctx, struct smbcli_
CHECK_STATUS(tctx, status, NT_STATUS_OK);
fnum2 = io.ntcreatex.out.file.fnum;
CHECK_VAL(io.ntcreatex.out.oplock_level, LEVEL_II_OPLOCK_RETURN);
+
+ torture_wait_for_oplock_break(tctx);
CHECK_VAL(break_info.count, 1);
CHECK_VAL(break_info.failures, 0);
@@ -1898,7 +1963,7 @@ static bool test_raw_oplock_batch17(struct torture_context *tctx, struct smbcli_
base ntcreatex parms
*/
io.generic.level = RAW_OPEN_NTCREATEX;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL;
io.ntcreatex.in.alloc_size = 0;
io.ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL;
@@ -1930,8 +1995,9 @@ static bool test_raw_oplock_batch17(struct torture_context *tctx, struct smbcli_
torture_comment(tctx, "trying rename while first file open\n");
status = smb_raw_rename(cli2->tree, &rn);
-
CHECK_STATUS(tctx, status, NT_STATUS_SHARING_VIOLATION);
+
+ torture_wait_for_oplock_break(tctx);
CHECK_VAL(break_info.count, 1);
CHECK_VAL(break_info.failures, 0);
CHECK_VAL(break_info.level, OPLOCK_BREAK_TO_LEVEL_II);
@@ -1969,7 +2035,7 @@ static bool test_raw_oplock_batch18(struct torture_context *tctx, struct smbcli_
base ntcreatex parms
*/
io.generic.level = RAW_OPEN_NTCREATEX;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL;
io.ntcreatex.in.alloc_size = 0;
io.ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL;
@@ -2001,8 +2067,9 @@ static bool test_raw_oplock_batch18(struct torture_context *tctx, struct smbcli_
rn.ntrename.in.new_name = fname2;
torture_comment(tctx, "trying rename while first file open\n");
status = smb_raw_rename(cli2->tree, &rn);
-
CHECK_STATUS(tctx, status, NT_STATUS_SHARING_VIOLATION);
+
+ torture_wait_for_oplock_break(tctx);
CHECK_VAL(break_info.count, 1);
CHECK_VAL(break_info.failures, 0);
CHECK_VAL(break_info.level, OPLOCK_BREAK_TO_LEVEL_II);
@@ -2043,7 +2110,7 @@ static bool test_raw_oplock_batch19(struct torture_context *tctx, struct smbcli_
base ntcreatex parms
*/
io.generic.level = RAW_OPEN_NTCREATEX;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL;
io.ntcreatex.in.alloc_size = 0;
io.ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL;
@@ -2073,8 +2140,9 @@ static bool test_raw_oplock_batch19(struct torture_context *tctx, struct smbcli_
sfi.rename_information.in.new_name = fname2+strlen(BASEDIR)+1;
status = smb_raw_setpathinfo(cli2->tree, &sfi);
-
CHECK_STATUS(tctx, status, NT_STATUS_OK);
+
+ torture_wait_for_oplock_break(tctx);
CHECK_VAL(break_info.count, 0);
ZERO_STRUCT(qfi);
@@ -2095,6 +2163,8 @@ static bool test_raw_oplock_batch19(struct torture_context *tctx, struct smbcli_
status = smb_raw_setfileinfo(cli1->tree, &sfi);
CHECK_STATUS(tctx, status, NT_STATUS_OK);
+
+ torture_wait_for_oplock_break(tctx);
CHECK_VAL(break_info.count, 0);
ZERO_STRUCT(qfi);
@@ -2146,7 +2216,7 @@ bool test_trans2rename(struct torture_context *tctx, struct smbcli_state *cli1,
base ntcreatex parms
*/
io.generic.level = RAW_OPEN_NTCREATEX;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL;
io.ntcreatex.in.alloc_size = 0;
io.ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL;
@@ -2177,6 +2247,8 @@ bool test_trans2rename(struct torture_context *tctx, struct smbcli_state *cli1,
status = smb_raw_setpathinfo(cli2->tree, &sfi);
CHECK_STATUS(tctx, status, NT_STATUS_OK);
+
+ torture_wait_for_oplock_break(tctx);
CHECK_VAL(break_info.count, 0);
ZERO_STRUCT(qfi);
@@ -2197,6 +2269,8 @@ bool test_trans2rename(struct torture_context *tctx, struct smbcli_state *cli1,
status = smb_raw_setfileinfo(cli1->tree, &sfi);
CHECK_STATUS(tctx, status, NT_STATUS_OK);
+
+ torture_wait_for_oplock_break(tctx);
CHECK_VAL(break_info.count, 0);
ZERO_STRUCT(qfi);
@@ -2246,7 +2320,7 @@ bool test_nttransrename(struct torture_context *tctx, struct smbcli_state *cli1)
base ntcreatex parms
*/
io.generic.level = RAW_OPEN_NTCREATEX;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL;
io.ntcreatex.in.alloc_size = 0;
io.ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL;
@@ -2274,8 +2348,9 @@ bool test_nttransrename(struct torture_context *tctx, struct smbcli_state *cli1)
rn.nttrans.in.new_name = fname2+strlen(BASEDIR)+1;
status = smb_raw_rename(cli1->tree, &rn);
-
CHECK_STATUS(tctx, status, NT_STATUS_OK);
+
+ torture_wait_for_oplock_break(tctx);
CHECK_VAL(break_info.count, 0);
/* w2k3 does nothing, it doesn't rename the file */
@@ -2367,7 +2442,7 @@ static bool test_raw_oplock_batch20(struct torture_context *tctx, struct smbcli_
base ntcreatex parms
*/
io.generic.level = RAW_OPEN_NTCREATEX;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL;
io.ntcreatex.in.alloc_size = 0;
io.ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL;
@@ -2400,8 +2475,9 @@ static bool test_raw_oplock_batch20(struct torture_context *tctx, struct smbcli_
sfi.rename_information.in.new_name = fname2+strlen(BASEDIR)+1;
status = smb_raw_setpathinfo(cli2->tree, &sfi);
-
CHECK_STATUS(tctx, status, NT_STATUS_OK);
+
+ torture_wait_for_oplock_break(tctx);
CHECK_VAL(break_info.count, 0);
ZERO_STRUCT(qfi);
@@ -2425,6 +2501,8 @@ static bool test_raw_oplock_batch20(struct torture_context *tctx, struct smbcli_
CHECK_STATUS(tctx, status, NT_STATUS_OK);
fnum2 = io.ntcreatex.out.file.fnum;
CHECK_VAL(io.ntcreatex.out.oplock_level, LEVEL_II_OPLOCK_RETURN);
+
+ torture_wait_for_oplock_break(tctx);
CHECK_VAL(break_info.count, 1);
CHECK_VAL(break_info.failures, 0);
CHECK_VAL(break_info.level, OPLOCK_BREAK_TO_LEVEL_II);
@@ -2439,6 +2517,8 @@ static bool test_raw_oplock_batch20(struct torture_context *tctx, struct smbcli_
status = smb_raw_setfileinfo(cli1->tree, &sfi);
CHECK_STATUS(tctx, status, NT_STATUS_OK);
+
+ torture_wait_for_oplock_break(tctx);
CHECK_VAL(break_info.count, 1);
CHECK_VAL(break_info.failures, 0);
CHECK_VAL(break_info.level, OPLOCK_BREAK_TO_LEVEL_II);
@@ -2492,7 +2572,7 @@ static bool test_raw_oplock_batch21(struct torture_context *tctx, struct smbcli_
base ntcreatex parms
*/
io.generic.level = RAW_OPEN_NTCREATEX;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL;
io.ntcreatex.in.alloc_size = 0;
io.ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL;
@@ -2526,6 +2606,7 @@ static bool test_raw_oplock_batch21(struct torture_context *tctx, struct smbcli_
status = smb_raw_echo(cli1->transport, &e);
CHECK_STATUS(tctx, status, NT_STATUS_OK);
+ torture_wait_for_oplock_break(tctx);
CHECK_VAL(break_info.count, 0);
smbcli_close(cli1->tree, fnum);
@@ -2565,7 +2646,7 @@ static bool test_raw_oplock_batch22(struct torture_context *tctx, struct smbcli_
base ntcreatex parms
*/
io.generic.level = RAW_OPEN_NTCREATEX;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL;
io.ntcreatex.in.alloc_size = 0;
io.ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL;
@@ -2592,11 +2673,13 @@ static bool test_raw_oplock_batch22(struct torture_context *tctx, struct smbcli_
fnum = io.ntcreatex.out.file.fnum;
CHECK_VAL(io.ntcreatex.out.oplock_level, BATCH_OPLOCK_RETURN);
- torture_comment(tctx, "a 2nd open shoud not succeed after the oplock break timeout\n");
+ torture_comment(tctx, "a 2nd open should not succeed after the oplock "
+ "break timeout\n");
tv = timeval_current();
smbcli_oplock_handler(cli1->transport, oplock_handler_timeout, cli1->tree);
status = smb_raw_open(cli1->tree, tctx, &io);
CHECK_STATUS(tctx, status, NT_STATUS_SHARING_VIOLATION);
+ torture_wait_for_oplock_break(tctx);
te = (int)timeval_elapsed(&tv);
CHECK_RANGE(te, timeout - 1, timeout + 15);
@@ -2606,12 +2689,14 @@ static bool test_raw_oplock_batch22(struct torture_context *tctx, struct smbcli_
CHECK_VAL(break_info.failures, 0);
ZERO_STRUCT(break_info);
- torture_comment(tctx, "a 2nd open shoud succeed after the oplock release without break\n");
+ torture_comment(tctx, "a 2nd open should succeed after the oplock "
+ "release without break\n");
tv = timeval_current();
smbcli_oplock_handler(cli1->transport, oplock_handler_ack_to_given, cli1->tree);
status = smb_raw_open(cli1->tree, tctx, &io);
CHECK_STATUS(tctx, status, NT_STATUS_OK);
CHECK_VAL(io.ntcreatex.out.oplock_level, LEVEL_II_OPLOCK_RETURN);
+ torture_wait_for_oplock_break(tctx);
te = (int)timeval_elapsed(&tv);
/* it should come in without delay */
CHECK_RANGE(te+1, 0, timeout);
@@ -2645,16 +2730,18 @@ static bool test_raw_oplock_batch23(struct torture_context *tctx, struct smbcli_
/* cleanup */
smbcli_unlink(cli1->tree, fname);
- smbcli_oplock_handler(cli1->transport, oplock_handler_ack_to_given, cli1->tree);
-
ret = open_connection_no_level2_oplocks(tctx, &cli3);
CHECK_VAL(ret, true);
+ smbcli_oplock_handler(cli1->transport, oplock_handler_ack_to_given, cli1->tree);
+ smbcli_oplock_handler(cli2->transport, oplock_handler_ack_to_given, cli2->tree);
+ smbcli_oplock_handler(cli3->transport, oplock_handler_ack_to_given, cli3->tree);
+
/*
base ntcreatex parms
*/
io.generic.level = RAW_OPEN_NTCREATEX;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL;
io.ntcreatex.in.alloc_size = 0;
io.ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL;
@@ -2667,9 +2754,6 @@ static bool test_raw_oplock_batch23(struct torture_context *tctx, struct smbcli_
torture_comment(tctx, "BATCH23: a open and ask for a batch oplock\n");
ZERO_STRUCT(break_info);
- smbcli_oplock_handler(cli1->transport, oplock_handler_ack_to_given, cli1->tree);
- smbcli_oplock_handler(cli2->transport, oplock_handler_ack_to_given, cli2->tree);
- smbcli_oplock_handler(cli3->transport, oplock_handler_ack_to_given, cli3->tree);
io.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_READ | SEC_RIGHTS_FILE_WRITE;
io.ntcreatex.in.share_access = NTCREATEX_SHARE_ACCESS_READ | NTCREATEX_SHARE_ACCESS_WRITE;
@@ -2689,6 +2773,7 @@ static bool test_raw_oplock_batch23(struct torture_context *tctx, struct smbcli_
fnum3 = io.ntcreatex.out.file.fnum;
CHECK_VAL(io.ntcreatex.out.oplock_level, NO_OPLOCK_RETURN);
+ torture_wait_for_oplock_break(tctx);
CHECK_VAL(break_info.count, 1);
CHECK_VAL(break_info.fnum, fnum);
CHECK_VAL(break_info.level, OPLOCK_BREAK_TO_LEVEL_II);
@@ -2702,6 +2787,7 @@ static bool test_raw_oplock_batch23(struct torture_context *tctx, struct smbcli_
fnum2 = io.ntcreatex.out.file.fnum;
CHECK_VAL(io.ntcreatex.out.oplock_level, LEVEL_II_OPLOCK_RETURN);
+ torture_wait_for_oplock_break(tctx);
CHECK_VAL(break_info.count, 0);
smbcli_close(cli1->tree, fnum);
@@ -2732,16 +2818,18 @@ static bool test_raw_oplock_batch24(struct torture_context *tctx, struct smbcli_
/* cleanup */
smbcli_unlink(cli1->tree, fname);
- smbcli_oplock_handler(cli1->transport, oplock_handler_ack_to_given, cli1->tree);
-
ret = open_connection_no_level2_oplocks(tctx, &cli3);
CHECK_VAL(ret, true);
+ smbcli_oplock_handler(cli1->transport, oplock_handler_ack_to_given, cli1->tree);
+ smbcli_oplock_handler(cli2->transport, oplock_handler_ack_to_given, cli2->tree);
+ smbcli_oplock_handler(cli3->transport, oplock_handler_ack_to_given, cli3->tree);
+
/*
base ntcreatex parms
*/
io.generic.level = RAW_OPEN_NTCREATEX;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL;
io.ntcreatex.in.alloc_size = 0;
io.ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL;
@@ -2754,9 +2842,6 @@ static bool test_raw_oplock_batch24(struct torture_context *tctx, struct smbcli_
torture_comment(tctx, "BATCH24: a open without level support and ask for a batch oplock\n");
ZERO_STRUCT(break_info);
- smbcli_oplock_handler(cli1->transport, oplock_handler_ack_to_given, cli1->tree);
- smbcli_oplock_handler(cli2->transport, oplock_handler_ack_to_given, cli2->tree);
- smbcli_oplock_handler(cli3->transport, oplock_handler_ack_to_given, cli3->tree);
io.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_READ | SEC_RIGHTS_FILE_WRITE;
io.ntcreatex.in.share_access = NTCREATEX_SHARE_ACCESS_READ | NTCREATEX_SHARE_ACCESS_WRITE;
@@ -2776,6 +2861,7 @@ static bool test_raw_oplock_batch24(struct torture_context *tctx, struct smbcli_
fnum2 = io.ntcreatex.out.file.fnum;
CHECK_VAL(io.ntcreatex.out.oplock_level, LEVEL_II_OPLOCK_RETURN);
+ torture_wait_for_oplock_break(tctx);
CHECK_VAL(break_info.count, 1);
CHECK_VAL(break_info.fnum, fnum3);
CHECK_VAL(break_info.level, OPLOCK_BREAK_TO_NONE);
@@ -2816,7 +2902,7 @@ static bool test_raw_oplock_batch25(struct torture_context *tctx,
base ntcreatex parms
*/
io.generic.level = RAW_OPEN_NTCREATEX;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL;
io.ntcreatex.in.alloc_size = 0;
io.ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL;
@@ -2848,8 +2934,9 @@ static bool test_raw_oplock_batch25(struct torture_context *tctx,
sfi.setattr.in.write_time = 0;
status = smb_raw_setpathinfo(cli2->tree, &sfi);
-
CHECK_STATUS(tctx, status, NT_STATUS_OK);
+
+ torture_wait_for_oplock_break(tctx);
CHECK_VAL(break_info.count, 0);
smbcli_close(cli1->tree, fnum);
@@ -2880,25 +2967,25 @@ static bool test_raw_oplock_stream1(struct torture_context *tctx,
NTCREATEX_FLAGS_REQUEST_BATCH_OPLOCK | NTCREATEX_FLAGS_EXTENDED;
uint32_t exclusive_req = NTCREATEX_FLAGS_REQUEST_OPLOCK |
NTCREATEX_FLAGS_EXTENDED;
- /* Try some permutations of taking oplocks on streams. */
+
#define NSTREAM_OPLOCK_RESULTS 8
struct {
- const char *fname;
+ const char **fname;
bool open_base_file;
uint32_t oplock_req;
uint32_t oplock_granted;
} stream_oplock_results[NSTREAM_OPLOCK_RESULTS] = {
/* Request oplock on stream without the base file open. */
- {fname_stream, false, batch_req, NO_OPLOCK_RETURN},
- {fname_default_stream, false, batch_req, NO_OPLOCK_RETURN},
- {fname_stream, false, exclusive_req, EXCLUSIVE_OPLOCK_RETURN},
- {fname_default_stream, false, exclusive_req, EXCLUSIVE_OPLOCK_RETURN},
+ {&fname_stream, false, batch_req, NO_OPLOCK_RETURN},
+ {&fname_default_stream, false, batch_req, NO_OPLOCK_RETURN},
+ {&fname_stream, false, exclusive_req, EXCLUSIVE_OPLOCK_RETURN},
+ {&fname_default_stream, false, exclusive_req, EXCLUSIVE_OPLOCK_RETURN},
/* Request oplock on stream with the base file open. */
- {fname_stream, true, batch_req, NO_OPLOCK_RETURN},
- {fname_default_stream, true, batch_req, NO_OPLOCK_RETURN},
- {fname_stream, true, exclusive_req, EXCLUSIVE_OPLOCK_RETURN},
- {fname_default_stream, true, exclusive_req, LEVEL_II_OPLOCK_RETURN},
+ {&fname_stream, true, batch_req, NO_OPLOCK_RETURN},
+ {&fname_default_stream, true, batch_req, NO_OPLOCK_RETURN},
+ {&fname_stream, true, exclusive_req, EXCLUSIVE_OPLOCK_RETURN},
+ {&fname_default_stream, true, exclusive_req, LEVEL_II_OPLOCK_RETURN},
};
@@ -2918,12 +3005,12 @@ static bool test_raw_oplock_stream1(struct torture_context *tctx,
}
smbcli_unlink(cli1->tree, fname_base);
- smbcli_oplock_handler(cli2->transport, oplock_handler_ack_to_given, cli2->tree);
smbcli_oplock_handler(cli1->transport, oplock_handler_ack_to_given, cli1->tree);
+ smbcli_oplock_handler(cli2->transport, oplock_handler_ack_to_given, cli2->tree);
/* Setup generic open parameters. */
io.generic.level = RAW_OPEN_NTCREATEX;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.access_mask = (SEC_FILE_READ_DATA|SEC_FILE_WRITE_DATA|
SEC_FILE_APPEND_DATA|SEC_STD_READ_CONTROL);
io.ntcreatex.in.create_options = 0;
@@ -2945,8 +3032,9 @@ static bool test_raw_oplock_stream1(struct torture_context *tctx,
/* Change the disposition to open now that the file has been created. */
io.ntcreatex.in.open_disposition = NTCREATEX_DISP_OPEN;
+ /* Try some permutations of taking oplocks on streams. */
for (i = 0; i < NSTREAM_OPLOCK_RESULTS; i++) {
- const char *fname = stream_oplock_results[i].fname;
+ const char *fname = *stream_oplock_results[i].fname;
bool open_base_file = stream_oplock_results[i].open_base_file;
uint32_t oplock_req = stream_oplock_results[i].oplock_req;
uint32_t oplock_granted =
@@ -2955,7 +3043,7 @@ static bool test_raw_oplock_stream1(struct torture_context *tctx,
if (open_base_file) {
torture_comment(tctx, "Opening base file: %s with "
- "%d\n", fname_base, oplock_req);
+ "%d\n", fname_base, batch_req);
io.ntcreatex.in.fname = fname_base;
io.ntcreatex.in.flags = batch_req;
status = smb_raw_open(cli2->tree, tctx, &io);
@@ -3004,6 +3092,7 @@ static bool test_raw_oplock_stream1(struct torture_context *tctx,
BATCH_OPLOCK_RETURN);
smbcli_close(cli2->tree, io.ntcreatex.out.file.fnum);
+ torture_wait_for_oplock_break(tctx);
CHECK_VAL(break_info.count, 0);
CHECK_VAL(break_info.failures, 0);
@@ -3019,6 +3108,7 @@ static bool test_raw_oplock_stream1(struct torture_context *tctx,
LEVEL_II_OPLOCK_RETURN);
smbcli_close(cli2->tree, io.ntcreatex.out.file.fnum);
+ torture_wait_for_oplock_break(tctx);
CHECK_VAL(break_info.count, 1);
CHECK_VAL(break_info.level, OPLOCK_BREAK_TO_LEVEL_II);
CHECK_VAL(break_info.failures, 0);
@@ -3059,7 +3149,7 @@ static bool test_raw_oplock_doc(struct torture_context *tctx,
base ntcreatex parms
*/
io.generic.level = RAW_OPEN_NTCREATEX;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL;
io.ntcreatex.in.alloc_size = 0;
io.ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL;
@@ -3122,7 +3212,7 @@ static bool test_raw_oplock_brl1(struct torture_context *tctx,
base ntcreatex parms
*/
io.generic.level = RAW_OPEN_NTCREATEX;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_READ |
SEC_RIGHTS_FILE_WRITE;
io.ntcreatex.in.alloc_size = 0;
@@ -3160,8 +3250,6 @@ static bool test_raw_oplock_brl1(struct torture_context *tctx,
torture_comment(tctx, "a 2nd open should give a break\n");
ZERO_STRUCT(break_info);
- smbcli_oplock_handler(cli1->transport, oplock_handler_ack_to_given,
- cli1->tree);
io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED;
status = smb_raw_open(cli2->tree, tctx, &io);
@@ -3173,19 +3261,13 @@ static bool test_raw_oplock_brl1(struct torture_context *tctx,
CHECK_VAL(break_info.fnum, fnum);
ZERO_STRUCT(break_info);
- smbcli_oplock_handler(cli1->transport, oplock_handler_ack_to_given,
- cli1->tree);
- torture_comment(tctx, "attempt BRL test\n");
+ torture_comment(tctx, "a self BRL acquisition should break to none\n");
status = smbcli_lock(cli1->tree, fnum, 0, 4, 0, WRITE_LOCK);
CHECK_STATUS(tctx, status, NT_STATUS_OK);
- /*
- * Even though level 2 oplock breaks are asynchronous, with self
- * contention we'll always break the oplock before the contending
- * operation's response is sent.
- */
+ torture_wait_for_oplock_break(tctx);
CHECK_VAL(break_info.count, 1);
CHECK_VAL(break_info.level, OPLOCK_BREAK_TO_NONE);
CHECK_VAL(break_info.fnum, fnum);
@@ -3196,6 +3278,7 @@ static bool test_raw_oplock_brl1(struct torture_context *tctx,
status = smbcli_lock(cli1->tree, fnum, 2, 4, 0, WRITE_LOCK);
CHECK_STATUS(tctx, status, NT_STATUS_LOCK_NOT_GRANTED);
+ torture_wait_for_oplock_break(tctx);
CHECK_VAL(break_info.count, 0);
CHECK_VAL(break_info.level, 0);
CHECK_VAL(break_info.fnum, 0);
@@ -3240,7 +3323,7 @@ static bool test_raw_oplock_brl2(struct torture_context *tctx, struct smbcli_sta
base ntcreatex parms
*/
io.generic.level = RAW_OPEN_NTCREATEX;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_READ |
SEC_RIGHTS_FILE_WRITE;
io.ntcreatex.in.alloc_size = 0;
@@ -3278,10 +3361,8 @@ static bool test_raw_oplock_brl2(struct torture_context *tctx, struct smbcli_sta
goto done;
}
- smbcli_oplock_handler(cli1->transport, oplock_handler_ack_to_given,
- cli1->tree);
-
- torture_comment(tctx, "attempt BRL test\n");
+ torture_comment(tctx, "a self BRL acquisition should not break to "
+ "none\n");
status = smbcli_lock(cli1->tree, fnum, 0, 4, 0, WRITE_LOCK);
CHECK_STATUS(tctx, status, NT_STATUS_OK);
@@ -3292,6 +3373,7 @@ static bool test_raw_oplock_brl2(struct torture_context *tctx, struct smbcli_sta
/* With one file handle open a BRL should not contend our oplock.
* Thus, no oplock break will be received and the entire break_info
* struct will be 0 */
+ torture_wait_for_oplock_break(tctx);
CHECK_VAL(break_info.fnum, 0);
CHECK_VAL(break_info.count, 0);
CHECK_VAL(break_info.level, 0);
@@ -3334,7 +3416,7 @@ static bool test_raw_oplock_brl3(struct torture_context *tctx,
base ntcreatex parms
*/
io.generic.level = RAW_OPEN_NTCREATEX;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_READ |
SEC_RIGHTS_FILE_WRITE;
io.ntcreatex.in.alloc_size = 0;
@@ -3373,8 +3455,6 @@ static bool test_raw_oplock_brl3(struct torture_context *tctx,
torture_comment(tctx, "a 2nd open should give a break\n");
ZERO_STRUCT(break_info);
- smbcli_oplock_handler(cli1->transport, oplock_handler_ack_to_given,
- cli1->tree);
io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED;
status = smb_raw_open(cli1->tree, tctx, &io);
@@ -3386,19 +3466,13 @@ static bool test_raw_oplock_brl3(struct torture_context *tctx,
CHECK_VAL(break_info.fnum, fnum);
ZERO_STRUCT(break_info);
- smbcli_oplock_handler(cli1->transport, oplock_handler_ack_to_given,
- cli1->tree);
- torture_comment(tctx, "attempt BRL test\n");
+ torture_comment(tctx, "a self BRL acquisition should break to none\n");
status = smbcli_lock(cli1->tree, fnum, 0, 4, 0, WRITE_LOCK);
CHECK_STATUS(tctx, status, NT_STATUS_OK);
- /*
- * Even though level 2 oplock breaks are asynchrounous, with self
- * contention we'll always break the oplock before the contending
- * operation's response is sent.
- */
+ torture_wait_for_oplock_break(tctx);
CHECK_VAL(break_info.count, 1);
CHECK_VAL(break_info.level, OPLOCK_BREAK_TO_NONE);
CHECK_VAL(break_info.fnum, fnum);
@@ -3409,6 +3483,7 @@ static bool test_raw_oplock_brl3(struct torture_context *tctx,
status = smbcli_lock(cli1->tree, fnum, 2, 4, 0, WRITE_LOCK);
CHECK_STATUS(tctx, status, NT_STATUS_LOCK_NOT_GRANTED);
+ torture_wait_for_oplock_break(tctx);
CHECK_VAL(break_info.count, 0);
CHECK_VAL(break_info.level, 0);
CHECK_VAL(break_info.fnum, 0);
@@ -3421,7 +3496,6 @@ done:
smb_raw_exit(cli1->session);
smbcli_deltree(cli1->tree, BASEDIR);
return ret;
-
}
/*
@@ -3503,7 +3577,7 @@ bool torture_bench_oplock(struct torture_context *torture)
}
io.ntcreatex.level = RAW_OPEN_NTCREATEX;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL;
io.ntcreatex.in.alloc_size = 0;
io.ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL;
@@ -3629,7 +3703,7 @@ bool torture_hold_oplock(struct torture_context *torture,
char c = 1;
io.generic.level = RAW_OPEN_NTCREATEX;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL;
io.ntcreatex.in.alloc_size = 0;
io.ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL;
diff --git a/source4/torture/raw/read.c b/source4/torture/raw/read.c
index f99da8fb1e..ea1fc125a7 100644
--- a/source4/torture/raw/read.c
+++ b/source4/torture/raw/read.c
@@ -815,7 +815,7 @@ static bool test_read_for_execute(struct torture_context *tctx,
printf("Testing RAW_READ_READX with read_for_execute\n");
op.generic.level = RAW_OPEN_NTCREATEX;
- op.ntcreatex.in.root_fid = 0;
+ op.ntcreatex.in.root_fid.fnum = 0;
op.ntcreatex.in.flags = 0;
op.ntcreatex.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
op.ntcreatex.in.create_options = 0;
@@ -846,7 +846,7 @@ static bool test_read_for_execute(struct torture_context *tctx,
printf("open file with SEC_FILE_EXECUTE\n");
op.generic.level = RAW_OPEN_NTCREATEX;
- op.ntcreatex.in.root_fid = 0;
+ op.ntcreatex.in.root_fid.fnum = 0;
op.ntcreatex.in.flags = 0;
op.ntcreatex.in.access_mask = SEC_FILE_EXECUTE;
op.ntcreatex.in.create_options = 0;
@@ -893,7 +893,7 @@ static bool test_read_for_execute(struct torture_context *tctx,
printf("open file with SEC_FILE_READ_DATA\n");
op.generic.level = RAW_OPEN_NTCREATEX;
- op.ntcreatex.in.root_fid = 0;
+ op.ntcreatex.in.root_fid.fnum = 0;
op.ntcreatex.in.flags = 0;
op.ntcreatex.in.access_mask = SEC_FILE_READ_DATA;
op.ntcreatex.in.create_options = 0;
diff --git a/source4/torture/raw/rename.c b/source4/torture/raw/rename.c
index 15fed0e3d8..cf04769764 100644
--- a/source4/torture/raw/rename.c
+++ b/source4/torture/raw/rename.c
@@ -67,7 +67,7 @@ static bool test_mv(struct torture_context *tctx,
torture_comment(tctx, "Trying simple rename\n");
op.generic.level = RAW_OPEN_NTCREATEX;
- op.ntcreatex.in.root_fid = 0;
+ op.ntcreatex.in.root_fid.fnum = 0;
op.ntcreatex.in.flags = 0;
op.ntcreatex.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
op.ntcreatex.in.create_options = 0;
@@ -208,7 +208,7 @@ static bool test_osxrename(struct torture_context *tctx,
return false;
}
op.generic.level = RAW_OPEN_NTCREATEX;
- op.ntcreatex.in.root_fid = 0;
+ op.ntcreatex.in.root_fid.fnum = 0;
op.ntcreatex.in.flags = 0;
op.ntcreatex.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
op.ntcreatex.in.create_options = 0;
@@ -528,8 +528,9 @@ static bool test_dir_rename(struct torture_context *tctx, struct smbcli_state *c
NTSTATUS status;
const char *dname1 = BASEDIR "\\dir_for_rename";
const char *dname2 = BASEDIR "\\renamed_dir";
+ const char *dname1_long = BASEDIR "\\dir_for_rename_long";
const char *fname = BASEDIR "\\dir_for_rename\\file.txt";
- const char *sname = BASEDIR "\\dir_for_rename:a stream:$DATA";
+ const char *sname = BASEDIR "\\renamed_dir:a stream:$DATA";
bool ret = true;
int fnum = -1;
@@ -542,8 +543,10 @@ static bool test_dir_rename(struct torture_context *tctx, struct smbcli_state *c
/* create a directory */
smbcli_rmdir(cli->tree, dname1);
smbcli_rmdir(cli->tree, dname2);
+ smbcli_rmdir(cli->tree, dname1_long);
smbcli_unlink(cli->tree, dname1);
smbcli_unlink(cli->tree, dname2);
+ smbcli_unlink(cli->tree, dname1_long);
ZERO_STRUCT(io);
io.generic.level = RAW_OPEN_NTCREATEX;
@@ -561,12 +564,20 @@ static bool test_dir_rename(struct torture_context *tctx, struct smbcli_state *c
fnum = io.ntcreatex.out.file.fnum;
smbcli_close(cli->tree, fnum);
+ /* create the longname directory */
+ io.ntcreatex.in.fname = dname1_long;
+ status = smb_raw_open(cli->tree, tctx, &io);
+ CHECK_STATUS(status, NT_STATUS_OK);
+
+ fnum = io.ntcreatex.out.file.fnum;
+ smbcli_close(cli->tree, fnum);
+
/* Now create and hold open a file. */
ZERO_STRUCT(io);
io.generic.level = RAW_OPEN_NTCREATEX;
io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.alloc_size = 0;
io.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL;
io.ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL;
@@ -625,6 +636,31 @@ static bool test_dir_rename(struct torture_context *tctx, struct smbcli_state *c
/* close our handle to the directory. */
smbcli_close(cli->tree, fnum);
+ /* Open a handle on the long name, and then
+ * try a rename. This would catch a regression
+ * in bug #6781.
+ */
+ io.ntcreatex.in.fname = dname1_long;
+ io.ntcreatex.in.open_disposition = NTCREATEX_DISP_OPEN_IF;
+
+ io.ntcreatex.in.access_mask = SEC_STD_READ_CONTROL |
+ SEC_FILE_READ_ATTRIBUTE | SEC_FILE_READ_EA | SEC_FILE_READ_DATA;
+
+ status = smb_raw_open(cli->tree, tctx, &io);
+ CHECK_STATUS(status, NT_STATUS_OK);
+ fnum = io.ntcreatex.out.file.fnum;
+
+ ren_io.generic.level = RAW_RENAME_RENAME;
+ ren_io.rename.in.pattern1 = dname1;
+ ren_io.rename.in.pattern2 = dname2;
+ ren_io.rename.in.attrib = 0;
+
+ status = smb_raw_rename(cli->tree, &ren_io);
+ CHECK_STATUS(status, NT_STATUS_OK);
+
+ /* close our handle to the longname directory. */
+ smbcli_close(cli->tree, fnum);
+
/*
* Now try opening a stream on the directory and holding it open
* across a rename. This should be allowed.
@@ -636,15 +672,15 @@ static bool test_dir_rename(struct torture_context *tctx, struct smbcli_state *c
fnum = io.ntcreatex.out.file.fnum;
ren_io.generic.level = RAW_RENAME_RENAME;
- ren_io.rename.in.pattern1 = dname1;
- ren_io.rename.in.pattern2 = dname2;
+ ren_io.rename.in.pattern1 = dname2;
+ ren_io.rename.in.pattern2 = dname1;
ren_io.rename.in.attrib = 0;
status = smb_raw_rename(cli->tree, &ren_io);
CHECK_STATUS(status, NT_STATUS_OK);
done:
-
+
if (fnum != -1) {
smbcli_close(cli->tree, fnum);
}
diff --git a/source4/torture/raw/samba3misc.c b/source4/torture/raw/samba3misc.c
index 6d6eabce2d..e8dc12fd40 100644
--- a/source4/torture/raw/samba3misc.c
+++ b/source4/torture/raw/samba3misc.c
@@ -90,7 +90,7 @@ bool torture_samba3_checkfsp(struct torture_context *torture)
union smb_open io;
io.generic.level = RAW_OPEN_NTCREATEX;
io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.security_flags = 0;
io.ntcreatex.in.open_disposition = NTCREATEX_DISP_CREATE;
io.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL;
@@ -304,7 +304,7 @@ static NTSTATUS raw_smbcli_ntcreate(struct smbcli_tree *tree, const char *fname,
memset(&io, '\0', sizeof(io));
io.generic.level = RAW_OPEN_NTCREATEX;
io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL;
io.ntcreatex.in.alloc_size = 0;
io.ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL;
@@ -887,7 +887,7 @@ bool torture_samba3_rootdirfid(struct torture_context *tctx)
ZERO_STRUCT(io);
io.generic.level = RAW_OPEN_NTCREATEX;
io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.security_flags = 0;
io.ntcreatex.in.access_mask =
SEC_STD_SYNCHRONIZE | SEC_FILE_EXECUTE;
@@ -912,7 +912,7 @@ bool torture_samba3_rootdirfid(struct torture_context *tctx)
io.ntcreatex.in.flags =
NTCREATEX_FLAGS_REQUEST_OPLOCK
| NTCREATEX_FLAGS_REQUEST_BATCH_OPLOCK;
- io.ntcreatex.in.root_fid = dnum;
+ io.ntcreatex.in.root_fid.fnum = dnum;
io.ntcreatex.in.security_flags = 0;
io.ntcreatex.in.open_disposition = NTCREATEX_DISP_OVERWRITE_IF;
io.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL;
@@ -961,7 +961,7 @@ bool torture_samba3_oplock_logoff(struct torture_context *tctx)
ZERO_STRUCT(io);
io.generic.level = RAW_OPEN_NTCREATEX;
io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.security_flags = 0;
io.ntcreatex.in.access_mask =
SEC_STD_SYNCHRONIZE | SEC_FILE_EXECUTE;
diff --git a/source4/torture/raw/streams.c b/source4/torture/raw/streams.c
index 6c5dc85a10..5c6bd63157 100644
--- a/source4/torture/raw/streams.c
+++ b/source4/torture/raw/streams.c
@@ -221,7 +221,7 @@ static bool test_stream_dir(struct torture_context *tctx,
printf("(%s) opening non-existant directory stream\n", __location__);
io.generic.level = RAW_OPEN_NTCREATEX;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.flags = 0;
io.ntcreatex.in.access_mask = SEC_FILE_WRITE_DATA;
io.ntcreatex.in.create_options = NTCREATEX_OPTIONS_DIRECTORY;
@@ -237,7 +237,7 @@ static bool test_stream_dir(struct torture_context *tctx,
printf("(%s) opening basedir stream\n", __location__);
io.generic.level = RAW_OPEN_NTCREATEX;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.flags = 0;
io.ntcreatex.in.access_mask = SEC_FILE_WRITE_DATA;
io.ntcreatex.in.create_options = NTCREATEX_OPTIONS_DIRECTORY;
@@ -253,7 +253,7 @@ static bool test_stream_dir(struct torture_context *tctx,
printf("(%s) opening basedir ::$DATA stream\n", __location__);
io.generic.level = RAW_OPEN_NTCREATEX;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.flags = 0x10;
io.ntcreatex.in.access_mask = SEC_FILE_WRITE_DATA;
io.ntcreatex.in.create_options = 0;
@@ -297,7 +297,7 @@ static bool test_stream_io(struct torture_context *tctx,
printf("(%s) creating a stream on a non-existant file\n", __location__);
io.generic.level = RAW_OPEN_NTCREATEX;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.flags = 0;
io.ntcreatex.in.access_mask = SEC_FILE_WRITE_DATA;
io.ntcreatex.in.create_options = 0;
@@ -434,7 +434,7 @@ static bool test_stream_sharemodes(struct torture_context *tctx,
printf("(%s) testing stream share mode conflicts\n", __location__);
io.generic.level = RAW_OPEN_NTCREATEX;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.flags = 0;
io.ntcreatex.in.access_mask = SEC_FILE_WRITE_DATA;
io.ntcreatex.in.create_options = 0;
@@ -523,7 +523,7 @@ static bool test_stream_delete(struct torture_context *tctx,
printf("(%s) opening non-existant file stream\n", __location__);
io.generic.level = RAW_OPEN_NTCREATEX;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.flags = 0;
io.ntcreatex.in.access_mask = SEC_FILE_READ_DATA|SEC_FILE_WRITE_DATA;
io.ntcreatex.in.create_options = 0;
@@ -698,7 +698,7 @@ static bool test_stream_names(struct torture_context *tctx,
printf("(%s) testing stream names\n", __location__);
io.generic.level = RAW_OPEN_NTCREATEX;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.flags = 0;
io.ntcreatex.in.access_mask = SEC_FILE_WRITE_DATA;
io.ntcreatex.in.create_options = 0;
@@ -966,7 +966,7 @@ static bool test_stream_names2(struct torture_context *tctx,
printf("(%s) testing stream names\n", __location__);
io.generic.level = RAW_OPEN_NTCREATEX;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.flags = 0;
io.ntcreatex.in.access_mask = SEC_FILE_WRITE_DATA;
io.ntcreatex.in.create_options = 0;
@@ -1060,7 +1060,7 @@ static bool test_stream_rename(struct torture_context *tctx,
printf("(%s) testing stream renames\n", __location__);
io.generic.level = RAW_OPEN_NTCREATEX;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.flags = 0;
io.ntcreatex.in.access_mask = SEC_FILE_READ_ATTRIBUTE |
SEC_FILE_WRITE_ATTRIBUTE |
@@ -1135,7 +1135,7 @@ static bool test_stream_rename2(struct torture_context *tctx,
sname2 = talloc_asprintf(mem_ctx, "%s:%s", fname1, "Stream Two");
io.generic.level = RAW_OPEN_NTCREATEX;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.flags = 0;
io.ntcreatex.in.access_mask = (SEC_FILE_READ_DATA|SEC_FILE_WRITE_DATA|
SEC_STD_DELETE|SEC_FILE_APPEND_DATA|SEC_STD_READ_CONTROL);
@@ -1318,7 +1318,7 @@ static bool create_file_with_stream(struct torture_context *tctx,
/* Create a file with a stream */
io.generic.level = RAW_OPEN_NTCREATEX;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.flags = 0;
io.ntcreatex.in.access_mask = (SEC_FILE_READ_DATA|SEC_FILE_WRITE_DATA|
SEC_FILE_APPEND_DATA|SEC_STD_READ_CONTROL);
@@ -1365,7 +1365,7 @@ static bool test_stream_create_disposition(struct torture_context *tctx,
/* Open the base file with OPEN */
io.generic.level = RAW_OPEN_NTCREATEX;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.flags = 0;
io.ntcreatex.in.access_mask = (SEC_FILE_READ_DATA|SEC_FILE_WRITE_DATA|
SEC_FILE_APPEND_DATA|SEC_STD_READ_CONTROL);
@@ -1573,7 +1573,7 @@ static bool test_stream_attributes(struct torture_context *tctx,
/* Now open the stream name. */
io.generic.level = RAW_OPEN_NTCREATEX;
- io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.root_fid.fnum = 0;
io.ntcreatex.in.flags = 0;
io.ntcreatex.in.access_mask = (SEC_FILE_READ_DATA|SEC_FILE_WRITE_DATA|
SEC_FILE_APPEND_DATA|SEC_STD_READ_CONTROL|SEC_FILE_WRITE_ATTRIBUTE);
diff --git a/source4/torture/raw/tconrate.c b/source4/torture/raw/tconrate.c
index 076e5be31f..06cb7650c1 100644
--- a/source4/torture/raw/tconrate.c
+++ b/source4/torture/raw/tconrate.c
@@ -112,6 +112,7 @@ static int fork_tcon_client(struct torture_context *tctx,
}
smbcli_tdis(cli);
+ talloc_free(cli);
*tcon_count = *tcon_count + 1;
now = timeval_current();
diff --git a/source4/torture/raw/unlink.c b/source4/torture/raw/unlink.c
index a9f635b637..28218b26fd 100644
--- a/source4/torture/raw/unlink.c
+++ b/source4/torture/raw/unlink.c
@@ -327,7 +327,7 @@ static bool test_delete_on_close(struct torture_context *tctx,
smbcli_close(cli->tree, fnum2);
op.generic.level = RAW_OPEN_NTCREATEX;
- op.ntcreatex.in.root_fid = 0;
+ op.ntcreatex.in.root_fid.fnum = 0;
op.ntcreatex.in.flags = 0;
op.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL;
op.ntcreatex.in.create_options = NTCREATEX_OPTIONS_DIRECTORY |NTCREATEX_OPTIONS_DELETE_ON_CLOSE;
@@ -359,7 +359,7 @@ static bool test_delete_on_close(struct torture_context *tctx,
smbcli_close(cli->tree, fnum2);
op.generic.level = RAW_OPEN_NTCREATEX;
- op.ntcreatex.in.root_fid = 0;
+ op.ntcreatex.in.root_fid.fnum = 0;
op.ntcreatex.in.flags = 0;
op.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL;
op.ntcreatex.in.create_options = NTCREATEX_OPTIONS_DIRECTORY |NTCREATEX_OPTIONS_DELETE_ON_CLOSE;
@@ -394,7 +394,7 @@ static bool test_delete_on_close(struct torture_context *tctx,
/* we have a dir with a file in it, no handles open */
op.generic.level = RAW_OPEN_NTCREATEX;
- op.ntcreatex.in.root_fid = 0;
+ op.ntcreatex.in.root_fid.fnum = 0;
op.ntcreatex.in.flags = 0;
op.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL;
op.ntcreatex.in.create_options = NTCREATEX_OPTIONS_DIRECTORY |NTCREATEX_OPTIONS_DELETE_ON_CLOSE;