summaryrefslogtreecommitdiff
path: root/source4/torture/rpc/async_bind.c
diff options
context:
space:
mode:
authorRafal Szczesniak <mimir@samba.org>2006-05-05 09:52:12 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:05:37 -0500
commit9604b161add82ed4e9039b81c59235ea678defca (patch)
tree9fc6ebabeb1dbf35e2e7d66c19ac9aa573b6c5ae /source4/torture/rpc/async_bind.c
parentb2154e79b127d655a9ad875f7d4fd6e21cb1d8b8 (diff)
downloadsamba-9604b161add82ed4e9039b81c59235ea678defca.tar.gz
samba-9604b161add82ed4e9039b81c59235ea678defca.tar.bz2
samba-9604b161add82ed4e9039b81c59235ea678defca.zip
r15456: Inspired by a short discussion with abartlet on IRC.
- create "async" parameter for smbtorture to categorise async tests potentially hard for windows servers - create "num-async" parameter to specify the number of simultaneous async requests to be made - move RPC-ASYNCBIND test from "dangerous" to "async" (I should probably do the same for many others async tests...) It's an interesting way to determine resources availability on windows servers... rafal (This used to be commit 0d008fbea0aec279d389cff676a4319262475d17)
Diffstat (limited to 'source4/torture/rpc/async_bind.c')
-rw-r--r--source4/torture/rpc/async_bind.c31
1 files changed, 22 insertions, 9 deletions
diff --git a/source4/torture/rpc/async_bind.c b/source4/torture/rpc/async_bind.c
index 960f099c9b..aeac909e9d 100644
--- a/source4/torture/rpc/async_bind.c
+++ b/source4/torture/rpc/async_bind.c
@@ -24,6 +24,7 @@
#include "includes.h"
#include "torture/torture.h"
#include "lib/events/events.h"
+#include "libcli/composite/composite.h"
#include "librpc/gen_ndr/ndr_lsa.h"
#include "lib/cmdline/popt_common.h"
#include "librpc/rpc/dcerpc.h"
@@ -43,23 +44,30 @@ BOOL torture_async_bind(struct torture_context *torture)
int i;
const char *binding_string;
struct cli_credentials *creds;
+ extern int torture_numasync;
-#define ASYNC_COUNT 100
- struct composite_context *bind_req[ASYNC_COUNT];
- struct dcerpc_pipe *pipe[ASYNC_COUNT];
- struct dcerpc_interface_table *table[ASYNC_COUNT];
+ struct composite_context **bind_req;
+ struct dcerpc_pipe **pipe;
+ const struct dcerpc_interface_table **table;
- if (!lp_parm_bool(-1, "torture", "dangerous", False)) {
+ if (!lp_parm_bool(-1, "torture", "async", False)) {
printf("async bind test disabled - enable dangerous tests to use\n");
return True;
}
-
+
binding_string = lp_parm_string(-1, "torture", "binding");
/* talloc context */
mem_ctx = talloc_init("torture_async_bind");
if (mem_ctx == NULL) return False;
+ bind_req = talloc_array(torture, struct composite_context*, torture_numasync);
+ if (bind_req == NULL) return False;
+ pipe = talloc_array(torture, struct dcerpc_pipe*, torture_numasync);
+ if (pipe == NULL) return False;
+ table = talloc_array(torture, const struct dcerpc_interface_table*, torture_numasync);
+ if (table == NULL) return False;
+
/* event context */
evt_ctx = event_context_init(mem_ctx);
if (evt_ctx == NULL) return False;
@@ -67,15 +75,20 @@ BOOL torture_async_bind(struct torture_context *torture)
/* credentials */
creds = cmdline_credentials;
- for (i = 0; i < ASYNC_COUNT; i++) {
+ /* send bind requests */
+ for (i = 0; i < torture_numasync; i++) {
table[i] = &dcerpc_table_lsarpc;
bind_req[i] = dcerpc_pipe_connect_send(mem_ctx, &pipe[i], binding_string,
table[i], creds, evt_ctx);
}
- for (i = 0; i < ASYNC_COUNT; i++) {
+ /* recv bind requests */
+ for (i = 0; i < torture_numasync; i++) {
status = dcerpc_pipe_connect_recv(bind_req[i], mem_ctx, &pipe[i]);
- if (!NT_STATUS_IS_OK(status)) return False;
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("async rpc connection failed: %s\n", nt_errstr(status));
+ return False;
+ }
}
talloc_free(mem_ctx);