From 4f51b0246db3242ee02ee16905cba13a5dc5633a Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Mon, 14 Apr 2008 12:43:37 -0400 Subject: Fix problems with event context not being the parent. (This used to be commit 957c4d893acf9e6db06a3fc3a4687ab6bb238635) --- source4/torture/libnet/libnet_domain.c | 11 +++++------ source4/torture/libnet/libnet_group.c | 6 +++--- source4/torture/libnet/libnet_lookup.c | 8 ++++---- source4/torture/libnet/libnet_rpc.c | 2 +- source4/torture/libnet/libnet_share.c | 4 ++-- source4/torture/libnet/libnet_user.c | 10 +++++----- source4/torture/rpc/dfs.c | 4 ++-- source4/torture/rpc/testjoin.c | 4 ++-- source4/torture/smbtorture.c | 4 +++- source4/torture/ui.c | 6 +++--- source4/torture/ui.h | 2 +- source4/torture/util_smb.c | 3 +-- 12 files changed, 32 insertions(+), 32 deletions(-) (limited to 'source4/torture') diff --git a/source4/torture/libnet/libnet_domain.c b/source4/torture/libnet/libnet_domain.c index 3c8d574f0e..eb6abc45d5 100644 --- a/source4/torture/libnet/libnet_domain.c +++ b/source4/torture/libnet/libnet_domain.c @@ -136,7 +136,7 @@ bool torture_domain_open_lsa(struct torture_context *torture) of specific server name. */ domain_name = lp_workgroup(torture->lp_ctx); - ctx = libnet_context_init(NULL, torture->lp_ctx); + ctx = libnet_context_init(torture->ev, torture->lp_ctx); if (ctx == NULL) { d_printf("failed to create libnet context\n"); return false; @@ -190,7 +190,7 @@ bool torture_domain_close_lsa(struct torture_context *torture) return false; } - ctx = libnet_context_init(NULL, torture->lp_ctx); + ctx = libnet_context_init(torture->ev, torture->lp_ctx); if (ctx == NULL) { d_printf("failed to create libnet context\n"); ret = false; @@ -245,7 +245,6 @@ bool torture_domain_open_samr(struct torture_context *torture) { NTSTATUS status; struct libnet_context *ctx; - struct event_context *evt_ctx=NULL; TALLOC_CTX *mem_ctx; struct policy_handle domain_handle, handle; struct libnet_DomainOpen io; @@ -255,7 +254,7 @@ bool torture_domain_open_samr(struct torture_context *torture) mem_ctx = talloc_init("test_domainopen_lsa"); - ctx = libnet_context_init(evt_ctx, torture->lp_ctx); + ctx = libnet_context_init(torture->ev, torture->lp_ctx); ctx->cred = cmdline_credentials; /* we're accessing domain controller so the domain name should be @@ -320,7 +319,7 @@ bool torture_domain_close_samr(struct torture_context *torture) return false; } - ctx = libnet_context_init(NULL, torture->lp_ctx); + ctx = libnet_context_init(torture->ev, torture->lp_ctx); if (ctx == NULL) { d_printf("failed to create libnet context\n"); ret = false; @@ -388,7 +387,7 @@ bool torture_domain_list(struct torture_context *torture) return false; } - ctx = libnet_context_init(NULL, torture->lp_ctx); + ctx = libnet_context_init(torture->ev, torture->lp_ctx); if (ctx == NULL) { d_printf("failed to create libnet context\n"); ret = false; diff --git a/source4/torture/libnet/libnet_group.c b/source4/torture/libnet/libnet_group.c index cabccdbe66..12b8167a86 100644 --- a/source4/torture/libnet/libnet_group.c +++ b/source4/torture/libnet/libnet_group.c @@ -235,7 +235,7 @@ bool torture_groupinfo_api(struct torture_context *torture) prep_mem_ctx = talloc_init("prepare torture group info"); - ctx = libnet_context_init(NULL, torture->lp_ctx); + ctx = libnet_context_init(torture->ev, torture->lp_ctx); ctx->cred = cmdline_credentials; status = torture_rpc_connection(torture, @@ -300,7 +300,7 @@ bool torture_grouplist(struct torture_context *torture) struct libnet_GroupList req; int i; - ctx = libnet_context_init(NULL, torture->lp_ctx); + ctx = libnet_context_init(torture->ev, torture->lp_ctx); ctx->cred = cmdline_credentials; domain_name.string = lp_workgroup(torture->lp_ctx); @@ -361,7 +361,7 @@ bool torture_creategroup(struct torture_context *torture) mem_ctx = talloc_init("test_creategroup"); - ctx = libnet_context_init(NULL, torture->lp_ctx); + ctx = libnet_context_init(torture->ev, torture->lp_ctx); ctx->cred = cmdline_credentials; req.in.group_name = TEST_GROUPNAME; diff --git a/source4/torture/libnet/libnet_lookup.c b/source4/torture/libnet/libnet_lookup.c index 9167d1de3e..b25b51b7d9 100644 --- a/source4/torture/libnet/libnet_lookup.c +++ b/source4/torture/libnet/libnet_lookup.c @@ -40,7 +40,7 @@ bool torture_lookup(struct torture_context *torture) mem_ctx = talloc_init("test_lookup"); - ctx = libnet_context_init(NULL, torture->lp_ctx); + ctx = libnet_context_init(torture->ev, torture->lp_ctx); ctx->cred = cmdline_credentials; lookup.in.hostname = torture_setting_string(torture, "host", NULL); @@ -84,7 +84,7 @@ bool torture_lookup_host(struct torture_context *torture) mem_ctx = talloc_init("test_lookup_host"); - ctx = libnet_context_init(NULL, torture->lp_ctx); + ctx = libnet_context_init(torture->ev, torture->lp_ctx); ctx->cred = cmdline_credentials; lookup.in.hostname = torture_setting_string(torture, "host", NULL); @@ -127,7 +127,7 @@ bool torture_lookup_pdc(struct torture_context *torture) mem_ctx = talloc_init("test_lookup_pdc"); - ctx = libnet_context_init(NULL, torture->lp_ctx); + ctx = libnet_context_init(torture->ev, torture->lp_ctx); ctx->cred = cmdline_credentials; talloc_steal(ctx, mem_ctx); @@ -171,7 +171,7 @@ bool torture_lookup_sam_name(struct torture_context *torture) struct libnet_context *ctx; struct libnet_LookupName r; - ctx = libnet_context_init(NULL, torture->lp_ctx); + ctx = libnet_context_init(torture->ev, torture->lp_ctx); ctx->cred = cmdline_credentials; mem_ctx = talloc_init("torture lookup sam name"); diff --git a/source4/torture/libnet/libnet_rpc.c b/source4/torture/libnet/libnet_rpc.c index 282837d3fe..f25c1ecc48 100644 --- a/source4/torture/libnet/libnet_rpc.c +++ b/source4/torture/libnet/libnet_rpc.c @@ -89,7 +89,7 @@ static bool torture_rpc_connect(struct torture_context *torture, { struct libnet_context *ctx; - ctx = libnet_context_init(NULL, torture->lp_ctx); + ctx = libnet_context_init(torture->ev, torture->lp_ctx); ctx->cred = cmdline_credentials; d_printf("Testing connection to LSA interface\n"); diff --git a/source4/torture/libnet/libnet_share.c b/source4/torture/libnet/libnet_share.c index eb1edff18d..6bc5be40a6 100644 --- a/source4/torture/libnet/libnet_share.c +++ b/source4/torture/libnet/libnet_share.c @@ -131,7 +131,7 @@ bool torture_listshares(struct torture_context *torture) goto done; } - libnetctx = libnet_context_init(NULL, torture->lp_ctx); + libnetctx = libnet_context_init(torture->ev, torture->lp_ctx); if (!libnetctx) { printf("Couldn't allocate libnet context\n"); ret = false; @@ -210,7 +210,7 @@ bool torture_delshare(struct torture_context *torture) status = torture_rpc_binding(torture, &binding); torture_assert_ntstatus_ok(torture, status, "Failed to get binding"); - libnetctx = libnet_context_init(NULL, torture->lp_ctx); + libnetctx = libnet_context_init(torture->ev, torture->lp_ctx); libnetctx->cred = cmdline_credentials; status = torture_rpc_connection(torture, diff --git a/source4/torture/libnet/libnet_user.c b/source4/torture/libnet/libnet_user.c index 5446087034..15e3f03506 100644 --- a/source4/torture/libnet/libnet_user.c +++ b/source4/torture/libnet/libnet_user.c @@ -241,7 +241,7 @@ bool torture_createuser(struct torture_context *torture) mem_ctx = talloc_init("test_createuser"); - ctx = libnet_context_init(NULL, torture->lp_ctx); + ctx = libnet_context_init(torture->ev, torture->lp_ctx); ctx->cred = cmdline_credentials; req.in.user_name = TEST_USERNAME; @@ -287,7 +287,7 @@ bool torture_deleteuser(struct torture_context *torture) prep_mem_ctx = talloc_init("prepare test_deleteuser"); - ctx = libnet_context_init(NULL, torture->lp_ctx); + ctx = libnet_context_init(torture->ev, torture->lp_ctx); ctx->cred = cmdline_credentials; req.in.user_name = TEST_USERNAME; @@ -482,7 +482,7 @@ bool torture_modifyuser(struct torture_context *torture) prep_mem_ctx = talloc_init("prepare test_deleteuser"); - ctx = libnet_context_init(NULL, torture->lp_ctx); + ctx = libnet_context_init(torture->ev, torture->lp_ctx); ctx->cred = cmdline_credentials; status = torture_rpc_connection(torture, @@ -616,7 +616,7 @@ bool torture_userinfo_api(struct torture_context *torture) prep_mem_ctx = talloc_init("prepare torture user info"); - ctx = libnet_context_init(NULL, torture->lp_ctx); + ctx = libnet_context_init(torture->ev, torture->lp_ctx); ctx->cred = cmdline_credentials; status = torture_rpc_connection(torture, @@ -681,7 +681,7 @@ bool torture_userlist(struct torture_context *torture) struct libnet_UserList req; int i; - ctx = libnet_context_init(NULL, torture->lp_ctx); + ctx = libnet_context_init(torture->ev, torture->lp_ctx); ctx->cred = cmdline_credentials; domain_name.string = lp_workgroup(torture->lp_ctx); diff --git a/source4/torture/rpc/dfs.c b/source4/torture/rpc/dfs.c index 9cfdd80578..5656476922 100644 --- a/source4/torture/rpc/dfs.c +++ b/source4/torture/rpc/dfs.c @@ -56,7 +56,7 @@ static bool test_NetShareAdd(TALLOC_CTX *mem_ctx, printf("Creating share %s\n", sharename); - if (!(libnetctx = libnet_context_init(NULL, tctx->lp_ctx))) { + if (!(libnetctx = libnet_context_init(tctx->ev, tctx->lp_ctx))) { return false; } @@ -96,7 +96,7 @@ static bool test_NetShareDel(TALLOC_CTX *mem_ctx, printf("Deleting share %s\n", sharename); - if (!(libnetctx = libnet_context_init(NULL, tctx->lp_ctx))) { + if (!(libnetctx = libnet_context_init(tctx->ev, tctx->lp_ctx))) { return false; } diff --git a/source4/torture/rpc/testjoin.c b/source4/torture/rpc/testjoin.c index 892886c08c..100e7cead2 100644 --- a/source4/torture/rpc/testjoin.c +++ b/source4/torture/rpc/testjoin.c @@ -311,7 +311,7 @@ _PUBLIC_ struct test_join *torture_join_domain(struct torture_context *tctx, struct samr_SetUserInfo s; union samr_UserInfo u; - tj = talloc(NULL, struct test_join); + tj = talloc(tctx, struct test_join); if (!tj) return NULL; libnet_r = talloc(tj, struct libnet_JoinDomain); @@ -320,7 +320,7 @@ _PUBLIC_ struct test_join *torture_join_domain(struct torture_context *tctx, return NULL; } - libnet_ctx = libnet_context_init(NULL, tctx->lp_ctx); + libnet_ctx = libnet_context_init(tctx->ev, tctx->lp_ctx); if (!libnet_ctx) { talloc_free(tj); return NULL; diff --git a/source4/torture/smbtorture.c b/source4/torture/smbtorture.c index 4eeea73003..faae784e4b 100644 --- a/source4/torture/smbtorture.c +++ b/source4/torture/smbtorture.c @@ -36,6 +36,8 @@ #include "librpc/rpc/dcerpc.h" #include "param/param.h" +#include "auth/credentials/credentials.h" + static bool run_matching(struct torture_context *torture, const char *prefix, const char *expr, @@ -673,7 +675,7 @@ int main(int argc,char *argv[]) exit(1); } - torture = torture_context_init(talloc_autofree_context(), ui_ops); + torture = torture_context_init(cli_credentials_get_event_context(cmdline_credentials), ui_ops); if (basedir != NULL) { if (basedir[0] != '/') { fprintf(stderr, "Please specify an absolute path to --basedir\n"); diff --git a/source4/torture/ui.c b/source4/torture/ui.c index a7025aac95..efa584ebea 100644 --- a/source4/torture/ui.c +++ b/source4/torture/ui.c @@ -27,14 +27,14 @@ #include "auth/credentials/credentials.h" #include "lib/cmdline/popt_common.h" -struct torture_context *torture_context_init(TALLOC_CTX *mem_ctx, +struct torture_context *torture_context_init(struct event_context *event_ctx, const struct torture_ui_ops *ui_ops) { - struct torture_context *torture = talloc_zero(mem_ctx, + struct torture_context *torture = talloc_zero(event_ctx, struct torture_context); torture->ui_ops = ui_ops; torture->returncode = true; - torture->ev = cli_credentials_get_event_context(cmdline_credentials); + torture->ev = event_ctx; if (ui_ops->init) ui_ops->init(torture); diff --git a/source4/torture/ui.h b/source4/torture/ui.h index ec4a658d74..15b04c2397 100644 --- a/source4/torture/ui.h +++ b/source4/torture/ui.h @@ -390,7 +390,7 @@ bool torture_suite_init_tcase(struct torture_suite *suite, struct torture_tcase *tcase, const char *name); -struct torture_context *torture_context_init(TALLOC_CTX *mem_ctx, +struct torture_context *torture_context_init(struct event_context *event_ctx, const struct torture_ui_ops *ui_ops); #endif /* __TORTURE_UI_H__ */ diff --git a/source4/torture/util_smb.c b/source4/torture/util_smb.c index 513070500e..c1a20094f3 100644 --- a/source4/torture/util_smb.c +++ b/source4/torture/util_smb.c @@ -553,8 +553,7 @@ _PUBLIC_ bool torture_open_connection_ev(struct smbcli_state **c, _PUBLIC_ bool torture_open_connection(struct smbcli_state **c, struct torture_context *tctx, int conn_index) { - return torture_open_connection_ev(c, conn_index, tctx, - cli_credentials_get_event_context(cmdline_credentials)); + return torture_open_connection_ev(c, conn_index, tctx, tctx->ev); } -- cgit