summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2014-09-29 11:01:32 +0200
committerMichael Adam <obnox@samba.org>2014-09-30 23:35:08 +0200
commit04d0110594d72e0953af1f78676e936a67ddf060 (patch)
tree55b458db61a615b73a75bdf98bc2f43d9bc418b6
parenta8d1f261a7ba2142e60d2bfc7a1db132cee74593 (diff)
downloadsamba-04d0110594d72e0953af1f78676e936a67ddf060.tar.gz
s4:torture/smb2: use torture_smb2_tree_connect() in notify.c
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
-rw-r--r--source4/torture/smb2/notify.c60
1 files changed, 9 insertions, 51 deletions
diff --git a/source4/torture/smb2/notify.c b/source4/torture/smb2/notify.c
index a7376614088..c721d5ff775 100644
--- a/source4/torture/smb2/notify.c
+++ b/source4/torture/smb2/notify.c
@@ -1859,56 +1859,6 @@ done:
return ret;
}
-
-/*
- create a secondary tree connect - used to test for a bug in Samba3 messaging
- with change notify
-*/
-static struct smb2_tree *secondary_tcon(struct smb2_tree *tree,
- struct torture_context *tctx)
-{
- NTSTATUS status;
- const char *share, *host;
- struct smb2_tree *tree1;
- union smb_tcon tcon;
-
- share = torture_setting_string(tctx, "share", NULL);
- host = torture_setting_string(tctx, "host", NULL);
-
- torture_comment(tctx,
- "create a second tree context on the same session\n");
- tree1 = smb2_tree_init(tree->session, tctx, false);
- if (tree1 == NULL) {
- torture_comment(tctx, "Out of memory\n");
- return NULL;
- }
-
- ZERO_STRUCT(tcon.smb2);
- tcon.generic.level = RAW_TCON_SMB2;
- tcon.smb2.in.path = talloc_asprintf(tctx, "\\\\%s\\%s", host, share);
- status = smb2_tree_connect(tree->session, &(tcon.smb2));
- if (!NT_STATUS_IS_OK(status)) {
- talloc_free(tree1);
- torture_comment(tctx,"Failed to create secondary tree\n");
- return NULL;
- }
-
- smb2cli_tcon_set_values(tree1->smbXcli,
- tree1->session->smbXcli,
- tcon.smb2.out.tid,
- tcon.smb2.out.share_type,
- tcon.smb2.out.flags,
- tcon.smb2.out.capabilities,
- tcon.smb2.out.access_mask);
-
- torture_comment(tctx,"tid1=%d tid2=%d\n",
- smb2cli_tcon_current_id(tree->smbXcli),
- smb2cli_tcon_current_id(tree1->smbXcli));
-
- return tree1;
-}
-
-
/*
very simple change notify test
*/
@@ -1993,7 +1943,15 @@ static bool torture_smb2_notify_tcon(struct torture_context *torture,
torture_comment(torture, "SIMPLE CHANGE NOTIFY OK\n");
torture_comment(torture, "TESTING WITH SECONDARY TCON\n");
- tree1 = secondary_tcon(tree, torture);
+ if (!torture_smb2_tree_connect(torture, tree->session, tree, &tree1)) {
+ torture_warning(torture, "couldn't reconnect to share, bailing\n");
+ ret = false;
+ goto done;
+ }
+
+ torture_comment(torture, "tid1=%d tid2=%d\n",
+ smb2cli_tcon_current_id(tree->smbXcli),
+ smb2cli_tcon_current_id(tree1->smbXcli));
torture_comment(torture, "Testing notify mkdir\n");
req = smb2_notify_send(tree, &(notify.smb2));