From f49d5e3288bc1b45d22fff0e68b11add2c4691ab Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Mon, 15 Mar 2010 09:37:42 +0100 Subject: s4:tortore/libnet: fix crash bugs because of incorrect function prototypes metze --- source4/torture/libnet/groupinfo.c | 8 +++++--- source4/torture/libnet/groupman.c | 6 ++++-- source4/torture/libnet/userinfo.c | 14 ++++++++------ source4/torture/libnet/userman.c | 24 +++++++++++++++--------- source4/torture/libnet/utils.c | 2 +- source4/torture/libnet/utils.h | 15 ++++++++++----- 6 files changed, 43 insertions(+), 26 deletions(-) (limited to 'source4/torture/libnet') diff --git a/source4/torture/libnet/groupinfo.c b/source4/torture/libnet/groupinfo.c index 4ddb1cefbe..c2d8edf01c 100644 --- a/source4/torture/libnet/groupinfo.c +++ b/source4/torture/libnet/groupinfo.c @@ -80,6 +80,7 @@ bool torture_groupinfo(struct torture_context *torture) struct lsa_String name; struct dom_sid2 sid; uint32_t rid; + struct dcerpc_binding_handle *b; mem_ctx = talloc_init("test_userinfo"); @@ -90,18 +91,19 @@ bool torture_groupinfo(struct torture_context *torture) if (!NT_STATUS_IS_OK(status)) { return false; } + b = p->binding_handle; name.string = lp_workgroup(torture->lp_ctx); /* * Testing synchronous version */ - if (!test_opendomain(torture, p, mem_ctx, &h, &name, &sid)) { + if (!test_opendomain(torture, b, mem_ctx, &h, &name, &sid)) { ret = false; goto done; } - if (!test_group_create(p, mem_ctx, &h, TEST_GROUPNAME, &rid)) { + if (!test_group_create(b, mem_ctx, &h, TEST_GROUPNAME, &rid)) { ret = false; goto done; } @@ -111,7 +113,7 @@ bool torture_groupinfo(struct torture_context *torture) goto done; } - if (!test_group_cleanup(p, mem_ctx, &h, TEST_GROUPNAME)) { + if (!test_group_cleanup(b, mem_ctx, &h, TEST_GROUPNAME)) { ret = false; goto done; } diff --git a/source4/torture/libnet/groupman.c b/source4/torture/libnet/groupman.c index 51b1c65b30..213e88ef13 100644 --- a/source4/torture/libnet/groupman.c +++ b/source4/torture/libnet/groupman.c @@ -60,6 +60,7 @@ bool torture_groupadd(struct torture_context *torture) const char *name = TEST_GROUPNAME; TALLOC_CTX *mem_ctx; bool ret = true; + struct dcerpc_binding_handle *b; mem_ctx = talloc_init("test_groupadd"); @@ -68,9 +69,10 @@ bool torture_groupadd(struct torture_context *torture) &ndr_table_samr); torture_assert_ntstatus_ok(torture, status, "RPC connection"); + b = p->binding_handle; domain_name.string = lp_workgroup(torture->lp_ctx); - if (!test_opendomain(torture, p, mem_ctx, &h, &domain_name, &sid)) { + if (!test_opendomain(torture, b, mem_ctx, &h, &domain_name, &sid)) { ret = false; goto done; } @@ -80,7 +82,7 @@ bool torture_groupadd(struct torture_context *torture) goto done; } - if (!test_group_cleanup(p, mem_ctx, &h, name)) { + if (!test_group_cleanup(b, mem_ctx, &h, name)) { ret = false; goto done; } diff --git a/source4/torture/libnet/userinfo.c b/source4/torture/libnet/userinfo.c index 11e57f852d..e273299160 100644 --- a/source4/torture/libnet/userinfo.c +++ b/source4/torture/libnet/userinfo.c @@ -136,6 +136,7 @@ bool torture_userinfo(struct torture_context *torture) struct lsa_String name; struct dom_sid2 sid; uint32_t rid; + struct dcerpc_binding_handle *b; mem_ctx = talloc_init("test_userinfo"); @@ -146,18 +147,19 @@ bool torture_userinfo(struct torture_context *torture) if (!NT_STATUS_IS_OK(status)) { return false; } + b = p->binding_handle; name.string = lp_workgroup(torture->lp_ctx); /* * Testing synchronous version */ - if (!test_opendomain(torture, p, mem_ctx, &h, &name, &sid)) { + if (!test_opendomain(torture, b, mem_ctx, &h, &name, &sid)) { ret = false; goto done; } - if (!test_user_create(torture, p, mem_ctx, &h, TEST_USERNAME, &rid)) { + if (!test_user_create(torture, b, mem_ctx, &h, TEST_USERNAME, &rid)) { ret = false; goto done; } @@ -167,7 +169,7 @@ bool torture_userinfo(struct torture_context *torture) goto done; } - if (!test_user_cleanup(torture, p, mem_ctx, &h, TEST_USERNAME)) { + if (!test_user_cleanup(torture, b, mem_ctx, &h, TEST_USERNAME)) { ret = false; goto done; } @@ -175,12 +177,12 @@ bool torture_userinfo(struct torture_context *torture) /* * Testing asynchronous version and monitor messages */ - if (!test_opendomain(torture, p, mem_ctx, &h, &name, &sid)) { + if (!test_opendomain(torture, b, mem_ctx, &h, &name, &sid)) { ret = false; goto done; } - if (!test_user_create(torture, p, mem_ctx, &h, TEST_USERNAME, &rid)) { + if (!test_user_create(torture, b, mem_ctx, &h, TEST_USERNAME, &rid)) { ret = false; goto done; } @@ -190,7 +192,7 @@ bool torture_userinfo(struct torture_context *torture) goto done; } - if (!test_user_cleanup(torture, p, mem_ctx, &h, TEST_USERNAME)) { + if (!test_user_cleanup(torture, b, mem_ctx, &h, TEST_USERNAME)) { ret = false; goto done; } diff --git a/source4/torture/libnet/userman.c b/source4/torture/libnet/userman.c index a5d8540d7b..72c87ab8bd 100644 --- a/source4/torture/libnet/userman.c +++ b/source4/torture/libnet/userman.c @@ -311,6 +311,7 @@ bool torture_useradd(struct torture_context *torture) const char *name = TEST_USERNAME; TALLOC_CTX *mem_ctx; bool ret = true; + struct dcerpc_binding_handle *b; mem_ctx = talloc_init("test_useradd"); @@ -319,9 +320,10 @@ bool torture_useradd(struct torture_context *torture) &ndr_table_samr); torture_assert_ntstatus_ok(torture, status, "RPC connect failed"); + b = p->binding_handle; domain_name.string = lp_workgroup(torture->lp_ctx); - if (!test_opendomain(torture, p, mem_ctx, &h, &domain_name, &sid)) { + if (!test_opendomain(torture, b, mem_ctx, &h, &domain_name, &sid)) { ret = false; goto done; } @@ -331,12 +333,12 @@ bool torture_useradd(struct torture_context *torture) goto done; } - if (!test_user_cleanup(torture, p, mem_ctx, &h, name)) { + if (!test_user_cleanup(torture, b, mem_ctx, &h, name)) { ret = false; goto done; } - if (!test_opendomain(torture, p, mem_ctx, &h, &domain_name, &sid)) { + if (!test_opendomain(torture, b, mem_ctx, &h, &domain_name, &sid)) { ret = false; goto done; } @@ -346,7 +348,7 @@ bool torture_useradd(struct torture_context *torture) goto done; } - if (!test_user_cleanup(torture, p, mem_ctx, &h, name)) { + if (!test_user_cleanup(torture, b, mem_ctx, &h, name)) { ret = false; goto done; } @@ -368,6 +370,7 @@ bool torture_userdel(struct torture_context *torture) const char *name = TEST_USERNAME; TALLOC_CTX *mem_ctx; bool ret = true; + struct dcerpc_binding_handle *b; mem_ctx = talloc_init("test_userdel"); @@ -378,14 +381,15 @@ bool torture_userdel(struct torture_context *torture) if (!NT_STATUS_IS_OK(status)) { return false; } + b = p->binding_handle; domain_name.string = lp_workgroup(torture->lp_ctx); - if (!test_opendomain(torture, p, mem_ctx, &h, &domain_name, &sid)) { + if (!test_opendomain(torture, b, mem_ctx, &h, &domain_name, &sid)) { ret = false; goto done; } - if (!test_user_create(torture, p, mem_ctx, &h, name, &rid)) { + if (!test_user_create(torture, b, mem_ctx, &h, name, &rid)) { ret = false; goto done; } @@ -413,6 +417,7 @@ bool torture_usermod(struct torture_context *torture) char *name; TALLOC_CTX *mem_ctx; bool ret = true; + struct dcerpc_binding_handle *b; mem_ctx = talloc_init("test_userdel"); @@ -421,16 +426,17 @@ bool torture_usermod(struct torture_context *torture) &ndr_table_samr); torture_assert_ntstatus_ok(torture, status, "RPC connect"); + b = p->binding_handle; domain_name.string = lp_workgroup(torture->lp_ctx); name = talloc_strdup(mem_ctx, TEST_USERNAME); - if (!test_opendomain(torture, p, mem_ctx, &h, &domain_name, &sid)) { + if (!test_opendomain(torture, b, mem_ctx, &h, &domain_name, &sid)) { ret = false; goto done; } - if (!test_user_create(torture, p, mem_ctx, &h, name, &rid)) { + if (!test_user_create(torture, b, mem_ctx, &h, name, &rid)) { ret = false; goto done; } @@ -450,7 +456,7 @@ bool torture_usermod(struct torture_context *torture) } cleanup: - if (!test_user_cleanup(torture, p, mem_ctx, &h, name)) { + if (!test_user_cleanup(torture, b, mem_ctx, &h, name)) { ret = false; goto done; } diff --git a/source4/torture/libnet/utils.c b/source4/torture/libnet/utils.c index f6fdb39721..e47b32931d 100644 --- a/source4/torture/libnet/utils.c +++ b/source4/torture/libnet/utils.c @@ -26,7 +26,7 @@ #include "torture/rpc/rpc.h" #include "libnet/libnet.h" #include "librpc/gen_ndr/ndr_samr_c.h" - +#include "torture/libnet/utils.h" bool test_opendomain(struct torture_context *tctx, struct dcerpc_binding_handle *b, TALLOC_CTX *mem_ctx, diff --git a/source4/torture/libnet/utils.h b/source4/torture/libnet/utils.h index b513b1a29e..e5bd3e1247 100644 --- a/source4/torture/libnet/utils.h +++ b/source4/torture/libnet/utils.h @@ -20,25 +20,30 @@ bool test_opendomain(struct torture_context *tctx, - struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, + struct dcerpc_binding_handle *b, + TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_String *domname, struct dom_sid2 *sid); bool test_user_create(struct torture_context *tctx, - struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, + struct dcerpc_binding_handle *b, + TALLOC_CTX *mem_ctx, struct policy_handle *handle, const char *name, uint32_t *rid); bool test_user_cleanup(struct torture_context *tctx, - struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, + struct dcerpc_binding_handle *b, + TALLOC_CTX *mem_ctx, struct policy_handle *domain_handle, const char *name); -bool test_group_create(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +bool test_group_create(struct dcerpc_binding_handle *b, + TALLOC_CTX *mem_ctx, struct policy_handle *handle, const char *name, uint32_t *rid); -bool test_group_cleanup(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +bool test_group_cleanup(struct dcerpc_binding_handle *b, + TALLOC_CTX *mem_ctx, struct policy_handle *domain_handle, const char *name); -- cgit