summaryrefslogtreecommitdiff
path: root/source4/torture/rpc/lsa.c
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/rpc/lsa.c
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/rpc/lsa.c')
-rw-r--r--source4/torture/rpc/lsa.c87
1 files changed, 84 insertions, 3 deletions
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;