From b369ffd1d50a79e0d9d901c3e6d159d9ce1762df Mon Sep 17 00:00:00 2001 From: Rafal Szczesniak Date: Tue, 2 May 2006 13:08:38 +0000 Subject: r15394: Put initial code for testing async dcerpc binding. Currently it only tests multiple simultaneous bind requests using transport specified in command line. It will be interesting to use various transports at the same time and test it agains windows servers... rafal (This used to be commit 7e4756116e59f9a0599a80fb5ac06118817f4326) --- source4/torture/rpc/async_bind.c | 78 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 source4/torture/rpc/async_bind.c (limited to 'source4/torture/rpc/async_bind.c') diff --git a/source4/torture/rpc/async_bind.c b/source4/torture/rpc/async_bind.c new file mode 100644 index 0000000000..14a2146e5e --- /dev/null +++ b/source4/torture/rpc/async_bind.c @@ -0,0 +1,78 @@ +/* + Unix SMB/CIFS implementation. + + dcerpc torture tests + + Copyright (C) Andrew Tridgell 2003 + Copyright (C) Rafal Szczesniak 2006 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include "includes.h" +#include "torture/torture.h" +#include "lib/events/events.h" +#include "librpc/gen_ndr/ndr_lsa.h" +#include "lib/cmdline/popt_common.h" +#include "librpc/rpc/dcerpc.h" +#include "torture/rpc/rpc.h" + +/* + This test initiates multiple rpc bind requests and verifies + whether all of them are served. +*/ + + +BOOL torture_async_bind(struct torture_context *torture) +{ + NTSTATUS status; + TALLOC_CTX *mem_ctx; + struct event_context *evt_ctx; + int i; + const char *binding_string; + struct cli_credentials *creds; + +#define ASYNC_COUNT 100 + struct composite_context *bind_req[ASYNC_COUNT]; + struct dcerpc_pipe *pipe[ASYNC_COUNT]; + struct dcerpc_interface_table *table[ASYNC_COUNT]; + + binding_string = lp_parm_string(-1, "torture", "binding"); + + /* talloc context */ + mem_ctx = talloc_init("torture_async_bind"); + if (mem_ctx == NULL) return False; + + /* event context */ + evt_ctx = event_context_init(mem_ctx); + if (evt_ctx == NULL) return False; + + /* credentials */ + creds = cmdline_credentials; + + for (i = 0; i < ASYNC_COUNT; 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++) { + status = dcerpc_pipe_connect_recv(bind_req[i], mem_ctx, &pipe[i]); + if (!NT_STATUS_IS_OK(status)) return False; + } + + talloc_free(mem_ctx); + return True; +} -- cgit From 5adcc59265dad33d912563e1538345fa26c8c07b Mon Sep 17 00:00:00 2001 From: Rafal Szczesniak Date: Wed, 3 May 2006 11:24:17 +0000 Subject: r15412: Put the test in a dangerous category. rafal (This used to be commit 52b4ef14a02ca1c72cef2467b214518bbe32c8f6) --- source4/torture/rpc/async_bind.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'source4/torture/rpc/async_bind.c') diff --git a/source4/torture/rpc/async_bind.c b/source4/torture/rpc/async_bind.c index 14a2146e5e..960f099c9b 100644 --- a/source4/torture/rpc/async_bind.c +++ b/source4/torture/rpc/async_bind.c @@ -49,6 +49,11 @@ BOOL torture_async_bind(struct torture_context *torture) struct dcerpc_pipe *pipe[ASYNC_COUNT]; struct dcerpc_interface_table *table[ASYNC_COUNT]; + if (!lp_parm_bool(-1, "torture", "dangerous", False)) { + printf("async bind test disabled - enable dangerous tests to use\n"); + return True; + } + binding_string = lp_parm_string(-1, "torture", "binding"); /* talloc context */ -- cgit From 9604b161add82ed4e9039b81c59235ea678defca Mon Sep 17 00:00:00 2001 From: Rafal Szczesniak Date: Fri, 5 May 2006 09:52:12 +0000 Subject: 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) --- source4/torture/rpc/async_bind.c | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) (limited to 'source4/torture/rpc/async_bind.c') 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); -- cgit From bbc6e216bdc858e70bfdebbab69d96c7dd23c3d2 Mon Sep 17 00:00:00 2001 From: Rafal Szczesniak Date: Sun, 7 May 2006 19:26:48 +0000 Subject: r15502: Typo fix. rafal (This used to be commit f076041ff16cbc3f58d0d6244fc0857b34533dda) --- source4/torture/rpc/async_bind.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/torture/rpc/async_bind.c') diff --git a/source4/torture/rpc/async_bind.c b/source4/torture/rpc/async_bind.c index aeac909e9d..18ed139ac7 100644 --- a/source4/torture/rpc/async_bind.c +++ b/source4/torture/rpc/async_bind.c @@ -51,7 +51,7 @@ BOOL torture_async_bind(struct torture_context *torture) const struct dcerpc_interface_table **table; if (!lp_parm_bool(-1, "torture", "async", False)) { - printf("async bind test disabled - enable dangerous tests to use\n"); + printf("async bind test disabled - enable async tests to use\n"); return True; } -- cgit From 57b8c5cd227d33b2eec34ed503b0b14c04344a87 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Fri, 13 Oct 2006 13:01:48 +0000 Subject: r19266: Add a target_hostname element to the binding struct. This allows us to perform a lookup once, resolve the name to an IP, while still communicating the full name to the lower layers, for kerberos etc. This fixes 'net samdump', which was failing due to the schannel target name being *smbserver. Andrew Bartlett (This used to be commit 0546f487f4cc99b5549dc1e457ea243d4bd66333) --- source4/torture/rpc/async_bind.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/torture/rpc/async_bind.c') diff --git a/source4/torture/rpc/async_bind.c b/source4/torture/rpc/async_bind.c index 18ed139ac7..952baacbf4 100644 --- a/source4/torture/rpc/async_bind.c +++ b/source4/torture/rpc/async_bind.c @@ -78,7 +78,7 @@ BOOL torture_async_bind(struct torture_context *torture) /* 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, + bind_req[i] = dcerpc_pipe_connect_send(mem_ctx, binding_string, table[i], creds, evt_ctx); } -- cgit From a39f239cb28e4ac6be207d4179bacffce97f1b3e Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 18 Oct 2006 14:23:19 +0000 Subject: r19392: Use torture_setting_* rather than lp_parm_* where possible. (This used to be commit b28860978fe29c5b10abfb8c59d7182864e21dd6) --- source4/torture/rpc/async_bind.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source4/torture/rpc/async_bind.c') diff --git a/source4/torture/rpc/async_bind.c b/source4/torture/rpc/async_bind.c index 952baacbf4..70333845ff 100644 --- a/source4/torture/rpc/async_bind.c +++ b/source4/torture/rpc/async_bind.c @@ -50,12 +50,12 @@ BOOL torture_async_bind(struct torture_context *torture) struct dcerpc_pipe **pipe; const struct dcerpc_interface_table **table; - if (!lp_parm_bool(-1, "torture", "async", False)) { + if (!torture_setting_bool(torture, "async", False)) { printf("async bind test disabled - enable async tests to use\n"); return True; } - binding_string = lp_parm_string(-1, "torture", "binding"); + binding_string = torture_setting_string(torture, "binding", NULL); /* talloc context */ mem_ctx = talloc_init("torture_async_bind"); -- cgit From c42219d7352bd2e7a6413f7ae1cd0fd5cded1d95 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 17 May 2007 08:47:04 +0000 Subject: r22969: fix some more places where we could end up with more than one event context. We now have an event context on the torture_context, and we can also get one from the cli_credentials structure (This used to be commit c0f65eb6562e13530337c23e3447a6aa6eb8fc17) --- source4/torture/rpc/async_bind.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'source4/torture/rpc/async_bind.c') diff --git a/source4/torture/rpc/async_bind.c b/source4/torture/rpc/async_bind.c index 70333845ff..e5ff25ed85 100644 --- a/source4/torture/rpc/async_bind.c +++ b/source4/torture/rpc/async_bind.c @@ -68,13 +68,13 @@ BOOL torture_async_bind(struct torture_context *torture) 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; - /* credentials */ creds = cmdline_credentials; + /* event context */ + evt_ctx = cli_credentials_get_event_context(creds); + if (evt_ctx == NULL) return False; + /* send bind requests */ for (i = 0; i < torture_numasync; i++) { table[i] = &dcerpc_table_lsarpc; -- cgit From 0479a2f1cbae51fcd8dbdc3c148c808421fb4d25 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 10 Jul 2007 02:07:03 +0000 Subject: r23792: convert Samba4 to GPLv3 There are still a few tidyups of old FSF addresses to come (in both s3 and s4). More commits soon. (This used to be commit fcf38a38ac691abd0fa51b89dc951a08e89fdafa) --- source4/torture/rpc/async_bind.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'source4/torture/rpc/async_bind.c') diff --git a/source4/torture/rpc/async_bind.c b/source4/torture/rpc/async_bind.c index e5ff25ed85..36b0756208 100644 --- a/source4/torture/rpc/async_bind.c +++ b/source4/torture/rpc/async_bind.c @@ -8,7 +8,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -17,8 +17,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program. If not, see . */ #include "includes.h" -- cgit From b8cdadced4d2a26a63b8bbe397c12df949783ed4 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Sun, 19 Aug 2007 20:46:45 +0000 Subject: r24551: rename dcerpc_interface_table -> ndr_interface_table rename dcerpc_interface_list -> ndr_interface_list and move them to libndr.h metze (This used to be commit 4adbebef5df2f833d2d4bfcdda72a34179d52f5c) --- source4/torture/rpc/async_bind.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source4/torture/rpc/async_bind.c') diff --git a/source4/torture/rpc/async_bind.c b/source4/torture/rpc/async_bind.c index 36b0756208..585266219c 100644 --- a/source4/torture/rpc/async_bind.c +++ b/source4/torture/rpc/async_bind.c @@ -47,7 +47,7 @@ BOOL torture_async_bind(struct torture_context *torture) struct composite_context **bind_req; struct dcerpc_pipe **pipe; - const struct dcerpc_interface_table **table; + const struct ndr_interface_table **table; if (!torture_setting_bool(torture, "async", False)) { printf("async bind test disabled - enable async tests to use\n"); @@ -64,7 +64,7 @@ BOOL torture_async_bind(struct torture_context *torture) 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); + table = talloc_array(torture, const struct ndr_interface_table*, torture_numasync); if (table == NULL) return False; /* credentials */ -- cgit From f14bd1a90ab47a418c0ec2492990a417a0bb3bf6 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Sun, 19 Aug 2007 21:23:03 +0000 Subject: r24557: rename 'dcerpc_table_' -> 'ndr_table_' metze (This used to be commit 84651aee81aaabbebf52ffc3fbcbabb2eec6eed5) --- source4/torture/rpc/async_bind.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/torture/rpc/async_bind.c') diff --git a/source4/torture/rpc/async_bind.c b/source4/torture/rpc/async_bind.c index 585266219c..155f3f8244 100644 --- a/source4/torture/rpc/async_bind.c +++ b/source4/torture/rpc/async_bind.c @@ -76,7 +76,7 @@ BOOL torture_async_bind(struct torture_context *torture) /* send bind requests */ for (i = 0; i < torture_numasync; i++) { - table[i] = &dcerpc_table_lsarpc; + table[i] = &ndr_table_lsarpc; bind_req[i] = dcerpc_pipe_connect_send(mem_ctx, binding_string, table[i], creds, evt_ctx); } -- cgit From 2151cde58014ea2e822c13d2f8a369b45dc19ca8 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 6 Oct 2007 22:28:14 +0000 Subject: r25554: Convert last instances of BOOL, True and False to the standard types. (This used to be commit 566aa14139510788548a874e9213d91317f83ca9) --- source4/torture/rpc/async_bind.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'source4/torture/rpc/async_bind.c') diff --git a/source4/torture/rpc/async_bind.c b/source4/torture/rpc/async_bind.c index 155f3f8244..70743bd433 100644 --- a/source4/torture/rpc/async_bind.c +++ b/source4/torture/rpc/async_bind.c @@ -35,7 +35,7 @@ */ -BOOL torture_async_bind(struct torture_context *torture) +bool torture_async_bind(struct torture_context *torture) { NTSTATUS status; TALLOC_CTX *mem_ctx; @@ -49,30 +49,30 @@ BOOL torture_async_bind(struct torture_context *torture) struct dcerpc_pipe **pipe; const struct ndr_interface_table **table; - if (!torture_setting_bool(torture, "async", False)) { + if (!torture_setting_bool(torture, "async", false)) { printf("async bind test disabled - enable async tests to use\n"); - return True; + return true; } binding_string = torture_setting_string(torture, "binding", NULL); /* talloc context */ mem_ctx = talloc_init("torture_async_bind"); - if (mem_ctx == NULL) return False; + if (mem_ctx == NULL) return false; bind_req = talloc_array(torture, struct composite_context*, torture_numasync); - if (bind_req == NULL) return False; + if (bind_req == NULL) return false; pipe = talloc_array(torture, struct dcerpc_pipe*, torture_numasync); - if (pipe == NULL) return False; + if (pipe == NULL) return false; table = talloc_array(torture, const struct ndr_interface_table*, torture_numasync); - if (table == NULL) return False; + if (table == NULL) return false; /* credentials */ creds = cmdline_credentials; /* event context */ evt_ctx = cli_credentials_get_event_context(creds); - if (evt_ctx == NULL) return False; + if (evt_ctx == NULL) return false; /* send bind requests */ for (i = 0; i < torture_numasync; i++) { @@ -86,10 +86,10 @@ BOOL torture_async_bind(struct torture_context *torture) status = dcerpc_pipe_connect_recv(bind_req[i], mem_ctx, &pipe[i]); if (!NT_STATUS_IS_OK(status)) { printf("async rpc connection failed: %s\n", nt_errstr(status)); - return False; + return false; } } talloc_free(mem_ctx); - return True; + return true; } -- cgit From 4c4323009fa83f00ed319de59a3aad48fcd65994 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Fri, 7 Dec 2007 02:37:04 +0100 Subject: r26327: Explicit loadparm_context for RPC client functions. (This used to be commit eeb2251d22b3d6e0379444a73af69d1014692b07) --- source4/torture/rpc/async_bind.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/torture/rpc/async_bind.c') diff --git a/source4/torture/rpc/async_bind.c b/source4/torture/rpc/async_bind.c index 70743bd433..1ca3c62df0 100644 --- a/source4/torture/rpc/async_bind.c +++ b/source4/torture/rpc/async_bind.c @@ -78,7 +78,7 @@ bool torture_async_bind(struct torture_context *torture) for (i = 0; i < torture_numasync; i++) { table[i] = &ndr_table_lsarpc; bind_req[i] = dcerpc_pipe_connect_send(mem_ctx, binding_string, - table[i], creds, evt_ctx); + table[i], creds, evt_ctx, torture->lp_ctx); } /* recv bind requests */ -- cgit From 1efbd5fbf6b0f606ed29a763e2adfa6f99c6beac Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 17 Apr 2008 01:03:18 +0200 Subject: Remove event context tracking from the credentials struct. (This used to be commit 4d7fc946b2ec50e774689c9036423b6feef99b8e) --- source4/torture/rpc/async_bind.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'source4/torture/rpc/async_bind.c') diff --git a/source4/torture/rpc/async_bind.c b/source4/torture/rpc/async_bind.c index 1ca3c62df0..0ebbef1ce6 100644 --- a/source4/torture/rpc/async_bind.c +++ b/source4/torture/rpc/async_bind.c @@ -39,7 +39,6 @@ bool torture_async_bind(struct torture_context *torture) { NTSTATUS status; TALLOC_CTX *mem_ctx; - struct event_context *evt_ctx; int i; const char *binding_string; struct cli_credentials *creds; @@ -70,15 +69,11 @@ bool torture_async_bind(struct torture_context *torture) /* credentials */ creds = cmdline_credentials; - /* event context */ - evt_ctx = cli_credentials_get_event_context(creds); - if (evt_ctx == NULL) return false; - /* send bind requests */ for (i = 0; i < torture_numasync; i++) { table[i] = &ndr_table_lsarpc; bind_req[i] = dcerpc_pipe_connect_send(mem_ctx, binding_string, - table[i], creds, evt_ctx, torture->lp_ctx); + table[i], creds, torture->ev, torture->lp_ctx); } /* recv bind requests */ -- cgit