summaryrefslogtreecommitdiff
path: root/source4/torture
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2007-05-17 08:47:04 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:52:34 -0500
commitc42219d7352bd2e7a6413f7ae1cd0fd5cded1d95 (patch)
treec45f3949f0e5f434f129c6346a99d3fa0aab96df /source4/torture
parentad1cde253e5938acf2c57458b5af04f32f45edbf (diff)
downloadsamba-c42219d7352bd2e7a6413f7ae1cd0fd5cded1d95.tar.gz
samba-c42219d7352bd2e7a6413f7ae1cd0fd5cded1d95.tar.bz2
samba-c42219d7352bd2e7a6413f7ae1cd0fd5cded1d95.zip
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)
Diffstat (limited to 'source4/torture')
-rw-r--r--source4/torture/auth/pac.c7
-rw-r--r--source4/torture/basic/misc.c2
-rw-r--r--source4/torture/libnet/libnet_BecomeDC.c2
-rw-r--r--source4/torture/local/irpc.c2
-rw-r--r--source4/torture/local/messaging.c2
-rw-r--r--source4/torture/local/resolve.c2
-rw-r--r--source4/torture/raw/composite.c2
-rw-r--r--source4/torture/raw/open.c4
-rw-r--r--source4/torture/rpc/async_bind.c8
-rw-r--r--source4/torture/torture.c7
-rw-r--r--source4/torture/ui.h1
-rw-r--r--source4/torture/util_smb.c4
12 files changed, 27 insertions, 16 deletions
diff --git a/source4/torture/auth/pac.c b/source4/torture/auth/pac.c
index d23a9c1b5a..46690890fa 100644
--- a/source4/torture/auth/pac.c
+++ b/source4/torture/auth/pac.c
@@ -56,7 +56,9 @@ static bool torture_pac_self_check(struct torture_context *tctx)
TALLOC_CTX *mem_ctx = tctx;
- torture_assert(tctx, 0 == smb_krb5_init_context(mem_ctx, &smb_krb5_context),
+ torture_assert(tctx, 0 == smb_krb5_init_context(mem_ctx,
+ NULL,
+ &smb_krb5_context),
"smb_krb5_init_context");
generate_random_buffer(server_bytes, 16);
@@ -282,7 +284,8 @@ static bool torture_pac_saved_check(struct torture_context *tctx)
time_t authtime;
TALLOC_CTX *mem_ctx = tctx;
- torture_assert(tctx, 0 == smb_krb5_init_context(mem_ctx, &smb_krb5_context),
+ torture_assert(tctx, 0 == smb_krb5_init_context(mem_ctx, NULL,
+ &smb_krb5_context),
"smb_krb5_init_context");
pac_kdc_key = torture_setting_string(tctx, "pac_kdc_key",
diff --git a/source4/torture/basic/misc.c b/source4/torture/basic/misc.c
index 33f0b9eff6..933e4334c0 100644
--- a/source4/torture/basic/misc.c
+++ b/source4/torture/basic/misc.c
@@ -843,7 +843,7 @@ BOOL run_benchrw(struct torture_context *tctx)
torture_numops, torture_nprocs);
/*init talloc context*/
- ev = event_context_init(tctx);
+ ev = tctx->ev;
state = talloc_array(tctx, struct benchrw_state *, torture_nprocs);
/* init params using lp_parm_xxx */
diff --git a/source4/torture/libnet/libnet_BecomeDC.c b/source4/torture/libnet/libnet_BecomeDC.c
index b164ee4906..a2b65e260c 100644
--- a/source4/torture/libnet/libnet_BecomeDC.c
+++ b/source4/torture/libnet/libnet_BecomeDC.c
@@ -755,7 +755,7 @@ BOOL torture_net_become_dc(struct torture_context *torture)
return False;
}
- s->ctx = libnet_context_init(event_context_init(s));
+ s->ctx = libnet_context_init(torture->ev);
s->ctx->cred = cmdline_credentials;
s->ldb = ldb_init(s);
diff --git a/source4/torture/local/irpc.c b/source4/torture/local/irpc.c
index bd52be09e2..3c177c4ece 100644
--- a/source4/torture/local/irpc.c
+++ b/source4/torture/local/irpc.c
@@ -217,7 +217,7 @@ static BOOL irpc_setup(struct torture_context *tctx, void **_data)
lp_set_cmdline("lock dir", "lockdir.tmp");
- data->ev = event_context_init(tctx);
+ data->ev = tctx->ev;
torture_assert(tctx, data->msg_ctx1 =
messaging_init(tctx,
cluster_id(MSG_ID1), data->ev),
diff --git a/source4/torture/local/messaging.c b/source4/torture/local/messaging.c
index f6ae8a3e8c..ce9928d91d 100644
--- a/source4/torture/local/messaging.c
+++ b/source4/torture/local/messaging.c
@@ -70,7 +70,7 @@ static bool test_ping_speed(struct torture_context *tctx)
lp_set_cmdline("pid directory", "piddir.tmp");
- ev = event_context_init(mem_ctx);
+ ev = tctx->ev;
msg_server_ctx = messaging_init(mem_ctx, cluster_id(1), ev);
diff --git a/source4/torture/local/resolve.c b/source4/torture/local/resolve.c
index 21a7392a14..d3bae21184 100644
--- a/source4/torture/local/resolve.c
+++ b/source4/torture/local/resolve.c
@@ -35,7 +35,7 @@ static bool test_async_resolve(struct torture_context *tctx)
struct timeval tv = timeval_current();
TALLOC_CTX *mem_ctx = tctx;
- ev = event_context_init(mem_ctx);
+ ev = tctx->ev;
ZERO_STRUCT(n);
n.name = host;
diff --git a/source4/torture/raw/composite.c b/source4/torture/raw/composite.c
index b551af00b1..e68ebcc824 100644
--- a/source4/torture/raw/composite.c
+++ b/source4/torture/raw/composite.c
@@ -164,7 +164,7 @@ static BOOL test_fetchfile(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
printf("testing parallel fetchfile with %d ops\n", torture_numops);
- event_ctx = event_context_init(mem_ctx);
+ event_ctx = cli->transport->socket->event.ctx;
c = talloc_array(mem_ctx, struct composite_context *, torture_numops);
for (i=0; i<torture_numops; i++) {
diff --git a/source4/torture/raw/open.c b/source4/torture/raw/open.c
index 3c6b1e2fa5..035d689016 100644
--- a/source4/torture/raw/open.c
+++ b/source4/torture/raw/open.c
@@ -27,6 +27,8 @@
#include "lib/events/events.h"
#include "libcli/libcli.h"
#include "torture/util.h"
+#include "auth/credentials/credentials.h"
+#include "lib/cmdline/popt_common.h"
/* enum for whether reads/writes are possible on a file */
enum rdwr_mode {RDWR_NONE, RDWR_RDONLY, RDWR_WRONLY, RDWR_RDWR};
@@ -1351,7 +1353,7 @@ static BOOL test_raw_open_multi(void)
int num_ok = 0;
int num_collision = 0;
- ev = event_context_init(mem_ctx);
+ ev = cli_credentials_get_event_context(cmdline_credentials);
clients = talloc_array(mem_ctx, struct smbcli_state *, num_files);
requests = talloc_array(mem_ctx, struct smbcli_request *, num_files);
ios = talloc_array(mem_ctx, union smb_open, num_files);
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;
diff --git a/source4/torture/torture.c b/source4/torture/torture.c
index 66d7bbb101..b48bf78e7e 100644
--- a/source4/torture/torture.c
+++ b/source4/torture/torture.c
@@ -24,6 +24,8 @@
#include "torture/torture.h"
#include "build.h"
#include "lib/util/dlinklist.h"
+#include "auth/credentials/credentials.h"
+#include "lib/cmdline/popt_common.h"
_PUBLIC_ int torture_numops=10;
_PUBLIC_ int torture_entries=1000;
@@ -42,12 +44,13 @@ bool torture_register_suite(struct torture_suite *suite)
}
struct torture_context *torture_context_init(TALLOC_CTX *mem_ctx,
- const struct torture_ui_ops *ui_ops)
+ const struct torture_ui_ops *ui_ops)
{
struct torture_context *torture = talloc_zero(mem_ctx,
- struct torture_context);
+ struct torture_context);
torture->ui_ops = ui_ops;
torture->returncode = true;
+ torture->ev = cli_credentials_get_event_context(cmdline_credentials);
if (ui_ops->init)
ui_ops->init(torture);
diff --git a/source4/torture/ui.h b/source4/torture/ui.h
index 70b86b0424..b41da77138 100644
--- a/source4/torture/ui.h
+++ b/source4/torture/ui.h
@@ -90,6 +90,7 @@ struct torture_context
char *outputdir;
int level;
+ struct event_context *ev;
};
/*
diff --git a/source4/torture/util_smb.c b/source4/torture/util_smb.c
index 4cadbe20fe..23b98fc7b6 100644
--- a/source4/torture/util_smb.c
+++ b/source4/torture/util_smb.c
@@ -31,6 +31,7 @@
#include "torture/ui.h"
#include "torture/torture.h"
#include "util/dlinklist.h"
+#include "auth/credentials/credentials.h"
/**
@@ -541,7 +542,8 @@ _PUBLIC_ bool torture_open_connection_ev(struct smbcli_state **c,
_PUBLIC_ bool torture_open_connection(struct smbcli_state **c, int conn_index)
{
- return torture_open_connection_ev(c, conn_index, NULL);
+ return torture_open_connection_ev(c, conn_index,
+ cli_credentials_get_event_context(cmdline_credentials));
}