summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2009-04-05 23:20:45 +0200
committerVolker Lendecke <vl@samba.org>2009-04-06 21:32:07 +0200
commit86b09e84aefefdb9c06b66f46886f1bad70797a3 (patch)
tree66b0c8ff9e02b938f81a70a4efd767bcaa935e99 /source3
parent025eb40fbc9db7de9c2497390c3d7449a0169cac (diff)
downloadsamba-86b09e84aefefdb9c06b66f46886f1bad70797a3.tar.gz
samba-86b09e84aefefdb9c06b66f46886f1bad70797a3.tar.bz2
samba-86b09e84aefefdb9c06b66f46886f1bad70797a3.zip
Re-add the CHAIN1 test
Diffstat (limited to 'source3')
-rwxr-xr-xsource3/script/tests/test_smbtorture_s3.sh2
-rw-r--r--source3/torture/torture.c81
2 files changed, 82 insertions, 1 deletions
diff --git a/source3/script/tests/test_smbtorture_s3.sh b/source3/script/tests/test_smbtorture_s3.sh
index 842277b357..70c6d34c88 100755
--- a/source3/script/tests/test_smbtorture_s3.sh
+++ b/source3/script/tests/test_smbtorture_s3.sh
@@ -27,7 +27,7 @@ tests="$tests UNLINK BROWSE ATTR TRANS2 TORTURE "
tests="$tests OPLOCK1 OPLOCK2 OPLOCK3"
tests="$tests DIR DIR1 TCON TCONDEV RW1 RW2 RW3"
tests="$tests OPEN XCOPY RENAME DELETE PROPERTIES W2K"
-tests="$tests TCON2 IOCTL CHKPATH FDSESS LOCAL-SUBSTITUTE"
+tests="$tests TCON2 IOCTL CHKPATH FDSESS LOCAL-SUBSTITUTE CHAIN1"
skipped1="RANDOMIPC NEGNOWAIT NBENCH ERRMAPEXTRACT TRANS2SCAN NTTRANSSCAN"
skipped2="DENY1 DENY2 OPENATTR CASETABLE EATEST"
diff --git a/source3/torture/torture.c b/source3/torture/torture.c
index a4c1721fe6..22e1104d79 100644
--- a/source3/torture/torture.c
+++ b/source3/torture/torture.c
@@ -5023,6 +5023,86 @@ static bool subst_test(const char *str, const char *user, const char *domain,
return result;
}
+static void chain1_open_completion(struct tevent_req *req)
+{
+ int fnum;
+ NTSTATUS status;
+ status = cli_open_recv(req, &fnum);
+ TALLOC_FREE(req);
+
+ d_printf("cli_open_recv returned %s: %d\n",
+ nt_errstr(status),
+ NT_STATUS_IS_OK(status) ? fnum : -1);
+}
+
+static void chain1_write_completion(struct tevent_req *req)
+{
+ size_t written;
+ NTSTATUS status;
+ status = cli_write_andx_recv(req, &written);
+ TALLOC_FREE(req);
+
+ d_printf("cli_write_andx_recv returned %s: %d\n",
+ nt_errstr(status),
+ NT_STATUS_IS_OK(status) ? (int)written : -1);
+}
+
+static void chain1_close_completion(struct tevent_req *req)
+{
+ NTSTATUS status;
+ bool *done = (bool *)tevent_req_callback_data_void(req);
+
+ status = cli_close_recv(req);
+ *done = true;
+
+ TALLOC_FREE(req);
+
+ d_printf("cli_close returned %s\n", nt_errstr(status));
+}
+
+static bool run_chain1(int dummy)
+{
+ struct cli_state *cli1;
+ struct event_context *evt = event_context_init(NULL);
+ struct tevent_req *reqs[3], *smbreqs[3];
+ bool done = false;
+ const char *str = "foobar";
+
+ printf("starting chain1 test\n");
+ if (!torture_open_connection(&cli1, 0)) {
+ return False;
+ }
+
+ cli_sockopt(cli1, sockops);
+
+ reqs[0] = cli_open_create(talloc_tos(), evt, cli1, "\\test",
+ O_CREAT|O_RDWR, 0, &smbreqs[0]);
+ if (reqs[0] == NULL) return false;
+ tevent_req_set_callback(reqs[0], chain1_open_completion, NULL);
+
+
+ reqs[1] = cli_write_andx_create(talloc_tos(), evt, cli1, 0, 0,
+ (uint8_t *)str, 0, strlen(str)+1,
+ smbreqs, 1, &smbreqs[1]);
+ if (reqs[1] == NULL) return false;
+ tevent_req_set_callback(reqs[1], chain1_write_completion, NULL);
+
+ reqs[2] = cli_close_create(talloc_tos(), evt, cli1, 0, &smbreqs[2]);
+ if (reqs[2] == NULL) return false;
+ tevent_req_set_callback(reqs[2], chain1_close_completion, &done);
+
+ if (!cli_smb_chain_send(smbreqs, ARRAY_SIZE(smbreqs))) {
+ return false;
+ }
+
+ while (!done) {
+ event_loop_once(evt);
+ }
+
+ torture_close_connection(cli1);
+ return True;
+}
+
static size_t null_source(uint8_t *buf, size_t n, void *priv)
{
size_t *to_pull = (size_t *)priv;
@@ -5717,6 +5797,7 @@ static struct {
{"FDSESS", run_fdsesstest, 0},
{ "EATEST", run_eatest, 0},
{ "SESSSETUP_BENCH", run_sesssetup_bench, 0},
+ { "CHAIN1", run_chain1, 0},
{ "WINDOWS-WRITE", run_windows_write, 0},
{ "CLI_ECHO", run_cli_echo, 0},
{ "LOCAL-SUBSTITUTE", run_local_substitute, 0},