summaryrefslogtreecommitdiff
path: root/source4/torture
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2005-11-02 05:34:17 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:45:41 -0500
commit66d3ee9ccb9807ca443962ef2a887627505c537c (patch)
tree44802dcc76d9271d0ba02408c9fd87423623cf7e /source4/torture
parent66caa3234d14321b579e5d8befa3a12579c6a68e (diff)
downloadsamba-66d3ee9ccb9807ca443962ef2a887627505c537c.tar.gz
samba-66d3ee9ccb9807ca443962ef2a887627505c537c.tar.bz2
samba-66d3ee9ccb9807ca443962ef2a887627505c537c.zip
r11473: Based on work by Jelmer, implement the [async] flag for rpc requests. If it's
not there (it's not yet on *any* call... :-)), the rpc client strictly sequences calls to an rpc pipe. Might need some more work on the exact sequencing semantics when a pipe with both sync and async calls is actually deployed, but I want it in for winbind simplification. Volker (This used to be commit b8f324e4f000971b7dafc263c16dd4af958ee7f9)
Diffstat (limited to 'source4/torture')
-rw-r--r--source4/torture/rpc/autoidl.c8
-rw-r--r--source4/torture/rpc/countcalls.c2
-rw-r--r--source4/torture/rpc/lsa.c87
-rw-r--r--source4/torture/rpc/scanner.c2
4 files changed, 90 insertions, 9 deletions
diff --git a/source4/torture/rpc/autoidl.c b/source4/torture/rpc/autoidl.c
index 22768c964b..4cfee1a379 100644
--- a/source4/torture/rpc/autoidl.c
+++ b/source4/torture/rpc/autoidl.c
@@ -130,7 +130,7 @@ static void try_expand(TALLOC_CTX *mem_ctx, const struct dcerpc_interface_table
memcpy(stub_in.data, base_in->data, insert_ofs);
memcpy(stub_in.data+insert_ofs+n, base_in->data+insert_ofs, base_in->length-insert_ofs);
- status = dcerpc_request(p, NULL, opnum, mem_ctx, &stub_in, &stub_out);
+ status = dcerpc_request(p, NULL, opnum, False, mem_ctx, &stub_in, &stub_out);
if (!NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT)) {
print_depth(depth);
@@ -171,7 +171,7 @@ static void test_ptr_scan(TALLOC_CTX *mem_ctx, const struct dcerpc_interface_tab
/* work out which elements are pointers */
for (ofs=min_ofs;ofs<=max_ofs-4;ofs+=4) {
SIVAL(stub_in.data, ofs, 1);
- status = dcerpc_request(p, NULL, opnum, mem_ctx, &stub_in, &stub_out);
+ status = dcerpc_request(p, NULL, opnum, False, mem_ctx, &stub_in, &stub_out);
if (NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT)) {
print_depth(depth);
@@ -213,7 +213,7 @@ static void test_scan_call(TALLOC_CTX *mem_ctx, const struct dcerpc_interface_ta
data_blob_clear(&stub_in);
- status = dcerpc_request(p, NULL, opnum, mem_ctx, &stub_in, &stub_out);
+ status = dcerpc_request(p, NULL, opnum, False, mem_ctx, &stub_in, &stub_out);
if (NT_STATUS_IS_OK(status)) {
printf("opnum %d min_input %d - output %d\n",
@@ -226,7 +226,7 @@ static void test_scan_call(TALLOC_CTX *mem_ctx, const struct dcerpc_interface_ta
fill_blob_handle(&stub_in, mem_ctx, &handle);
- status = dcerpc_request(p, NULL, opnum, mem_ctx, &stub_in, &stub_out);
+ status = dcerpc_request(p, NULL, opnum, False, mem_ctx, &stub_in, &stub_out);
if (NT_STATUS_IS_OK(status)) {
printf("opnum %d min_input %d - output %d (with handle)\n",
diff --git a/source4/torture/rpc/countcalls.c b/source4/torture/rpc/countcalls.c
index ac4788f349..cd78e2eba4 100644
--- a/source4/torture/rpc/countcalls.c
+++ b/source4/torture/rpc/countcalls.c
@@ -56,7 +56,7 @@ BOOL torture_rpc_countcalls(void)
printf("\nScanning pipe '%s'\n", iface->name);
for (i=0;i<5000;i++) {
- status = dcerpc_request(p, NULL, i, p, &stub_in, &stub_out);
+ status = dcerpc_request(p, NULL, i, False, p, &stub_in, &stub_out);
if (NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT) &&
p->last_fault_code == DCERPC_FAULT_OP_RNG_ERROR) break;
if (NT_STATUS_EQUAL(status, NT_STATUS_CONNECTION_DISCONNECTED)) {
diff --git a/source4/torture/rpc/lsa.c b/source4/torture/rpc/lsa.c
index 7180986a65..9e5129bf5a 100644
--- a/source4/torture/rpc/lsa.c
+++ b/source4/torture/rpc/lsa.c
@@ -22,6 +22,7 @@
#include "includes.h"
#include "librpc/gen_ndr/ndr_lsa.h"
+#include "lib/events/events.h"
static void init_lsa_String(struct lsa_String *name, const char *s)
{
@@ -457,7 +458,8 @@ BOOL test_many_LookupSids(struct dcerpc_pipe *p,
r.out.names = &names;
status = dcerpc_lsa_LookupSids(p, mem_ctx, &r);
- if (!NT_STATUS_IS_OK(status) && !NT_STATUS_EQUAL(status, STATUS_SOME_UNMAPPED)) {
+ if (!NT_STATUS_IS_OK(status) &&
+ !NT_STATUS_EQUAL(status, STATUS_SOME_UNMAPPED)) {
printf("LookupSids failed - %s\n", nt_errstr(status));
return False;
}
@@ -508,6 +510,83 @@ BOOL test_many_LookupSids(struct dcerpc_pipe *p,
return True;
}
+#define NUM_ASYNC_REQUESTS 1000
+
+static void lookupsids_cb(struct rpc_request *req)
+{
+ int *replies = (int *)req->async.private;
+ NTSTATUS status;
+
+ status = dcerpc_ndr_request_recv(req);
+ DEBUG(3, ("lookupsids returned %s\n", nt_errstr(status)));
+ if (!NT_STATUS_IS_OK(status)) {
+ *replies = -1;
+ }
+
+ *replies += 1;
+}
+
+static BOOL test_LookupSids_async(struct dcerpc_pipe *p,
+ TALLOC_CTX *mem_ctx,
+ struct policy_handle *handle)
+{
+ struct lsa_SidArray sids;
+ struct lsa_SidPtr sidptr;
+
+ uint32_t count[NUM_ASYNC_REQUESTS];
+ struct lsa_TransNameArray names[NUM_ASYNC_REQUESTS];
+ struct lsa_LookupSids r[NUM_ASYNC_REQUESTS];
+ struct rpc_request **req;
+
+ int i, replies;
+ BOOL ret = True;
+
+ printf("\nTesting %d async lookupsids request\n", 100);
+
+ req = talloc_array(mem_ctx, struct rpc_request *, NUM_ASYNC_REQUESTS);
+
+ sids.num_sids = 1;
+ sids.sids = &sidptr;
+ sidptr.sid = dom_sid_parse_talloc(mem_ctx, "S-1-5-32-545");
+
+ replies = 0;
+
+ for (i=0; i<NUM_ASYNC_REQUESTS; i++) {
+ count[i] = 0;
+ names[i].count = 0;
+ names[i].names = NULL;
+
+ r[i].in.handle = handle;
+ r[i].in.sids = &sids;
+ r[i].in.names = &names[i];
+ r[i].in.level = 1;
+ r[i].in.count = &names[i].count;
+ r[i].out.count = &count[i];
+ r[i].out.names = &names[i];
+
+ req[i] = dcerpc_lsa_LookupSids_send(p, req, &r[i]);
+ if (req[i] == NULL) {
+ ret = False;
+ break;
+ }
+
+ req[i]->async.callback = lookupsids_cb;
+ req[i]->async.private = &replies;
+ }
+
+ while (replies < NUM_ASYNC_REQUESTS) {
+ event_loop_once(p->conn->event_ctx);
+ if (replies < 0) {
+ ret = False;
+ break;
+ }
+ }
+
+ talloc_free(req);
+
+ return ret;
+}
+
static BOOL test_LookupPrivValue(struct dcerpc_pipe *p,
TALLOC_CTX *mem_ctx,
struct policy_handle *handle,
@@ -1758,6 +1837,10 @@ BOOL torture_rpc_lsa(void)
}
if (handle) {
+ if (!test_LookupSids_async(p, mem_ctx, handle)) {
+ ret = False;
+ }
+
if (!test_QueryDomainInfoPolicy(p, mem_ctx, handle)) {
ret = False;
}
@@ -1813,8 +1896,6 @@ BOOL torture_rpc_lsa(void)
}
}
-
-
talloc_free(mem_ctx);
return ret;
diff --git a/source4/torture/rpc/scanner.c b/source4/torture/rpc/scanner.c
index 9741273c64..a0adcea0ac 100644
--- a/source4/torture/rpc/scanner.c
+++ b/source4/torture/rpc/scanner.c
@@ -53,7 +53,7 @@ static BOOL test_num_calls(const struct dcerpc_interface_table *iface,
memset(stub_in.data, 0xFF, stub_in.length);
for (i=0;i<200;i++) {
- status = dcerpc_request(p, NULL, i, mem_ctx, &stub_in, &stub_out);
+ status = dcerpc_request(p, NULL, False, i, mem_ctx, &stub_in, &stub_out);
if (!NT_STATUS_IS_OK(status) &&
p->last_fault_code == DCERPC_FAULT_OP_RNG_ERROR) {
break;