The branch, master has been updated via c9c8de3... s4/test-libnet: Remove multiple test_samr_close() impelementations via c742f59... s4/test-libnet-user: Remove test_createuser() via 0f22630... s4/test-libnet-utils: refactor test_user_create() via 8dedb4d... s4/test: remove local impl for open_domain and use common one via fce4271... s4/test: remove torture/libnet/utils.h as we are using proto.h now via 1118c7b... s4/test: change prototype for test_opendomain() via 8e3a433... s4/test: Refactor test_opendomain to address following via 3a899e2... s4/test: make samr_close handle functio public via cf79435... s4/test: refactor NET-USERINFO test to be more 'torture' friendly via 2053403... s4/test: test_userinfo/_async tests should use passed user_name param value from f11cf62... s4:web_server/wsgi.c - provide a better out-of-memory handling for an "asprintf" call
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit c9c8de3dcb19c96ee9fab7f462b28f3a2f1997a1 Author: Kamen Mazdrashki <kame...@samba.org> Date: Fri May 28 22:14:39 2010 +0300 s4/test-libnet: Remove multiple test_samr_close() impelementations We now have a nice common test_samr_close_handle() function to use commit c742f59bd24a3a35732489aa013187c35edde0a2 Author: Kamen Mazdrashki <kame...@samba.org> Date: Fri May 28 21:20:03 2010 +0300 s4/test-libnet-user: Remove test_createuser() We have same functionality already implemented by test_user_create() in libnet/utils.c commit 0f2263016fc7afd949af65e6e84b5c5455250191 Author: Kamen Mazdrashki <kame...@samba.org> Date: Fri May 28 17:59:25 2010 +0300 s4/test-libnet-utils: refactor test_user_create() - param names made more clear what they stand for - user RID out param is now optional, so that this function may be used in cases where we don't need user RID - SAMR connection handle is closed as it is not used further (we should play nice with servers) commit 8dedb4d06ec84224f1b491cb76edb87b37550c56 Author: Kamen Mazdrashki <kame...@samba.org> Date: Fri May 28 05:20:18 2010 +0300 s4/test: remove local impl for open_domain and use common one commit fce427134d1a8fba216ff82d48d7f7cb6be7c3ce Author: Kamen Mazdrashki <kame...@samba.org> Date: Fri May 28 05:14:47 2010 +0300 s4/test: remove torture/libnet/utils.h as we are using proto.h now commit 1118c7b0e4d311becfcc0d6e3c53405649526a2c Author: Kamen Mazdrashki <kame...@samba.org> Date: Fri May 28 05:06:55 2010 +0300 s4/test: change prototype for test_opendomain() - name changed to test_domain_open to be more alike athore functions in utils.c file - output parameters moved to the end param list definition just after mem_ctx so it is somehow more clear those params are OUT commit 8e3a433f93618d6cadc58c19b54b9255acccec6e Author: Kamen Mazdrashki <kame...@samba.org> Date: Fri May 28 05:04:56 2010 +0300 s4/test: Refactor test_opendomain to address following - param names made more clear what they stand for - dom_sid out param is now optional, so that this function may be used in cases where we don't need dom_sid - SAMR connection handle is closed as it is not used further commit 3a899e24d513de7c56363e39efb74b2c88c29854 Author: Kamen Mazdrashki <kame...@samba.org> Date: Fri May 28 04:45:40 2010 +0300 s4/test: make samr_close handle functio public It is to be used further for closing opened handles when testing using SAMR interface commit cf794355456b82927cecfd183e49b47be6568385 Author: Kamen Mazdrashki <kame...@samba.org> Date: Thu May 27 17:24:10 2010 +0300 s4/test: refactor NET-USERINFO test to be more 'torture' friendly Test may be further refactored to be converted as a test case (what it is actually) commit 2053403045cb8786abe778279a68b431b9c5977c Author: Kamen Mazdrashki <kame...@samba.org> Date: Thu May 27 17:10:31 2010 +0300 s4/test: test_userinfo/_async tests should use passed user_name param value ----------------------------------------------------------------------- Summary of changes: source4/torture/libnet/groupinfo.c | 4 +- source4/torture/libnet/groupman.c | 4 +- source4/torture/libnet/libnet_group.c | 29 ++----- source4/torture/libnet/libnet_user.c | 157 +++----------------------------- source4/torture/libnet/userinfo.c | 40 +++------ source4/torture/libnet/userman.c | 10 +- source4/torture/libnet/utils.c | 129 ++++++++++++++++++++------- source4/torture/libnet/utils.h | 52 ----------- 8 files changed, 139 insertions(+), 286 deletions(-) delete mode 100644 source4/torture/libnet/utils.h Changeset truncated at 500 lines: diff --git a/source4/torture/libnet/groupinfo.c b/source4/torture/libnet/groupinfo.c index affd1e5..772427c 100644 --- a/source4/torture/libnet/groupinfo.c +++ b/source4/torture/libnet/groupinfo.c @@ -24,7 +24,7 @@ #include "libcli/security/security.h" #include "librpc/gen_ndr/ndr_samr_c.h" #include "param/param.h" -#include "torture/libnet/utils.h" +#include "torture/libnet/proto.h" #define TEST_GROUPNAME "libnetgroupinfotest" @@ -99,7 +99,7 @@ bool torture_groupinfo(struct torture_context *torture) /* * Testing synchronous version */ - if (!test_opendomain(torture, b, mem_ctx, &h, &name, &sid)) { + if (!test_domain_open(torture, b, &name, mem_ctx, &h, &sid)) { ret = false; goto done; } diff --git a/source4/torture/libnet/groupman.c b/source4/torture/libnet/groupman.c index 7788ee8..02a94a8 100644 --- a/source4/torture/libnet/groupman.c +++ b/source4/torture/libnet/groupman.c @@ -24,7 +24,7 @@ #include "libnet/libnet.h" #include "librpc/gen_ndr/ndr_samr_c.h" #include "param/param.h" -#include "torture/libnet/utils.h" +#include "torture/libnet/proto.h" static bool test_groupadd(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, @@ -72,7 +72,7 @@ bool torture_groupadd(struct torture_context *torture) b = p->binding_handle; domain_name.string = lp_workgroup(torture->lp_ctx); - if (!test_opendomain(torture, b, mem_ctx, &h, &domain_name, &sid)) { + if (!test_domain_open(torture, b, &domain_name, mem_ctx, &h, &sid)) { ret = false; goto done; } diff --git a/source4/torture/libnet/libnet_group.c b/source4/torture/libnet/libnet_group.c index 10d1f1c..f26f988 100644 --- a/source4/torture/libnet/libnet_group.c +++ b/source4/torture/libnet/libnet_group.c @@ -25,6 +25,7 @@ #include "librpc/gen_ndr/ndr_samr_c.h" #include "librpc/gen_ndr/ndr_lsa_c.h" #include "torture/rpc/torture_rpc.h" +#include "torture/libnet/proto.h" #include "param/param.h" @@ -191,25 +192,6 @@ static bool test_opendomain(struct torture_context *tctx, } -static bool test_samr_close(struct torture_context *tctx, - struct dcerpc_binding_handle *b, TALLOC_CTX *mem_ctx, - struct policy_handle *domain_handle) -{ - struct samr_Close r; - - r.in.handle = domain_handle; - r.out.handle = domain_handle; - - torture_assert_ntstatus_ok(tctx, - dcerpc_samr_Close_r(b, mem_ctx, &r), - "Close samr domain failed"); - torture_assert_ntstatus_ok(tctx, r.out.result, - "Close samr domain failed"); - - return true; -} - - static bool test_lsa_close(struct torture_context *tctx, struct dcerpc_binding_handle *b, TALLOC_CTX *mem_ctx, struct policy_handle *domain_handle) @@ -285,7 +267,8 @@ bool torture_groupinfo_api(struct torture_context *torture) goto done; } - if (!test_samr_close(torture, ctx->samr.pipe->binding_handle, mem_ctx, &ctx->samr.handle)) { + if (!test_samr_close_handle(torture, + ctx->samr.pipe->binding_handle, mem_ctx, &ctx->samr.handle)) { torture_comment(torture, "domain close failed\n"); ret = false; } @@ -341,7 +324,8 @@ bool torture_grouplist(struct torture_context *torture) goto done; } - if (!test_samr_close(torture, ctx->samr.pipe->binding_handle, mem_ctx, &ctx->samr.handle)) { + if (!test_samr_close_handle(torture, + ctx->samr.pipe->binding_handle, mem_ctx, &ctx->samr.handle)) { torture_comment(torture, "domain close failed\n"); ret = false; } @@ -389,7 +373,8 @@ bool torture_creategroup(struct torture_context *torture) goto done; } - if (!test_samr_close(torture, ctx->samr.pipe->binding_handle, mem_ctx, &ctx->samr.handle)) { + if (!test_samr_close_handle(torture, + ctx->samr.pipe->binding_handle, mem_ctx, &ctx->samr.handle)) { torture_comment(torture, "domain close failed\n"); ret = false; } diff --git a/source4/torture/libnet/libnet_user.c b/source4/torture/libnet/libnet_user.c index 4bda763..587676a 100644 --- a/source4/torture/libnet/libnet_user.c +++ b/source4/torture/libnet/libnet_user.c @@ -26,6 +26,7 @@ #include "librpc/gen_ndr/ndr_lsa_c.h" #include "torture/rpc/torture_rpc.h" #include "torture/libnet/usertest.h" +#include "torture/libnet/proto.h" #include "param/param.h" #include "lib/ldb_wrap.h" @@ -156,78 +157,6 @@ static bool test_cleanup(struct torture_context *tctx, } -static bool test_opendomain(struct torture_context *tctx, - struct dcerpc_binding_handle *b, TALLOC_CTX *mem_ctx, - struct policy_handle *handle, struct lsa_String *domname) -{ - struct policy_handle h, domain_handle; - struct samr_Connect r1; - struct samr_LookupDomain r2; - struct dom_sid2 *sid = NULL; - struct samr_OpenDomain r3; - - torture_comment(tctx, "connecting\n"); - - r1.in.system_name = 0; - r1.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED; - r1.out.connect_handle = &h; - - torture_assert_ntstatus_ok(tctx, - dcerpc_samr_Connect_r(b, mem_ctx, &r1), - "Connect failed"); - torture_assert_ntstatus_ok(tctx, r1.out.result, - "Connect failed"); - - r2.in.connect_handle = &h; - r2.in.domain_name = domname; - r2.out.sid = &sid; - - torture_comment(tctx, "domain lookup on %s\n", domname->string); - - torture_assert_ntstatus_ok(tctx, - dcerpc_samr_LookupDomain_r(b, mem_ctx, &r2), - "LookupDomain failed"); - torture_assert_ntstatus_ok(tctx, r2.out.result, - "LookupDomain failed"); - - r3.in.connect_handle = &h; - r3.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED; - r3.in.sid = *r2.out.sid; - r3.out.domain_handle = &domain_handle; - - torture_comment(tctx, "opening domain\n"); - - torture_assert_ntstatus_ok(tctx, - dcerpc_samr_OpenDomain_r(b, mem_ctx, &r3), - "OpenDomain failed"); - torture_assert_ntstatus_ok(tctx, r3.out.result, - "OpenDomain failed"); - - *handle = domain_handle; - - return true; -} - - -static bool test_samr_close(struct torture_context *tctx, - struct dcerpc_binding_handle *b, TALLOC_CTX *mem_ctx, - struct policy_handle *domain_handle) -{ - struct samr_Close r; - - r.in.handle = domain_handle; - r.out.handle = domain_handle; - - torture_assert_ntstatus_ok(tctx, - dcerpc_samr_Close_r(b, mem_ctx, &r), - "Close samr domain failed"); - torture_assert_ntstatus_ok(tctx, r.out.result, - "Close samr domain failed"); - - return true; -} - - static bool test_lsa_close(struct torture_context *tctx, struct dcerpc_binding_handle *b, TALLOC_CTX *mem_ctx, struct policy_handle *domain_handle) @@ -247,66 +176,6 @@ static bool test_lsa_close(struct torture_context *tctx, } -static bool test_createuser(struct torture_context *tctx, - struct dcerpc_binding_handle *b, TALLOC_CTX *mem_ctx, - struct policy_handle *handle, const char* user) -{ - struct policy_handle user_handle; - struct lsa_String username; - struct samr_CreateUser r1; - struct samr_Close r2; - uint32_t user_rid; - - username.string = user; - - r1.in.domain_handle = handle; - r1.in.account_name = &username; - r1.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED; - r1.out.user_handle = &user_handle; - r1.out.rid = &user_rid; - - torture_comment(tctx, "creating user '%s'\n", username.string); - - torture_assert_ntstatus_ok(tctx, - dcerpc_samr_CreateUser_r(b, mem_ctx, &r1), - "CreateUser failed"); - if (!NT_STATUS_IS_OK(r1.out.result)) { - torture_comment(tctx, "CreateUser failed - %s\n", nt_errstr(r1.out.result)); - - if (NT_STATUS_EQUAL(r1.out.result, NT_STATUS_USER_EXISTS)) { - torture_comment(tctx, "User (%s) already exists - attempting to delete and recreate account again\n", user); - if (!test_cleanup(tctx, b, mem_ctx, handle, user)) { - return false; - } - - torture_comment(tctx, "creating user account\n"); - - torture_assert_ntstatus_ok(tctx, - dcerpc_samr_CreateUser_r(b, mem_ctx, &r1), - "CreateUser failed"); - torture_assert_ntstatus_ok(tctx, r1.out.result, - "CreateUser failed"); - - return true; - } - return false; - } - - r2.in.handle = &user_handle; - r2.out.handle = &user_handle; - - torture_comment(tctx, "closing user '%s'\n", username.string); - - torture_assert_ntstatus_ok(tctx, - dcerpc_samr_Close_r(b, mem_ctx, &r2), - "Close failed"); - torture_assert_ntstatus_ok(tctx, r2.out.result, - "Close failed"); - - return true; -} - - bool torture_createuser(struct torture_context *torture) { NTSTATUS status; @@ -337,7 +206,8 @@ bool torture_createuser(struct torture_context *torture) goto done; } - if (!test_samr_close(torture, ctx->samr.pipe->binding_handle, mem_ctx, &ctx->samr.handle)) { + if (!test_samr_close_handle(torture, + ctx->samr.pipe->binding_handle, mem_ctx, &ctx->samr.handle)) { torture_comment(torture, "domain close failed\n"); ret = false; } @@ -378,12 +248,12 @@ bool torture_deleteuser(struct torture_context *torture) } domain_name.string = lp_workgroup(torture->lp_ctx); - if (!test_opendomain(torture, p->binding_handle, prep_mem_ctx, &h, &domain_name)) { + if (!test_domain_open(torture, p->binding_handle, &domain_name, prep_mem_ctx, &h, NULL)) { ret = false; goto done; } - if (!test_createuser(torture, p->binding_handle, prep_mem_ctx, &h, name)) { + if (!test_user_create(torture, p->binding_handle, prep_mem_ctx, &h, name, NULL)) { ret = false; goto done; } @@ -599,12 +469,12 @@ bool torture_modifyuser(struct torture_context *torture) name = talloc_strdup(prep_mem_ctx, TEST_USERNAME); domain_name.string = lp_workgroup(torture->lp_ctx); - if (!test_opendomain(torture, b, prep_mem_ctx, &h, &domain_name)) { + if (!test_domain_open(torture, b, &domain_name, prep_mem_ctx, &h, NULL)) { ret = false; goto done; } - if (!test_createuser(torture, b, prep_mem_ctx, &h, name)) { + if (!test_user_create(torture, b, prep_mem_ctx, &h, name, NULL)) { ret = false; goto done; } @@ -675,7 +545,8 @@ cleanup: goto done; } - if (!test_samr_close(torture, ctx->samr.pipe->binding_handle, torture, &ctx->samr.handle)) { + if (!test_samr_close_handle(torture, + ctx->samr.pipe->binding_handle, torture, &ctx->samr.handle)) { torture_comment(torture, "domain close failed\n"); ret = false; } @@ -714,12 +585,12 @@ bool torture_userinfo_api(struct torture_context *torture) b = p->binding_handle; domain_name.string = lp_workgroup(torture->lp_ctx); - if (!test_opendomain(torture, b, prep_mem_ctx, &h, &domain_name)) { + if (!test_domain_open(torture, b, &domain_name, prep_mem_ctx, &h, NULL)) { ret = false; goto done; } - if (!test_createuser(torture, b, prep_mem_ctx, &h, name)) { + if (!test_user_create(torture, b, prep_mem_ctx, &h, name, NULL)) { ret = false; goto done; } @@ -745,7 +616,8 @@ bool torture_userinfo_api(struct torture_context *torture) goto done; } - if (!test_samr_close(torture, ctx->samr.pipe->binding_handle, mem_ctx, &ctx->samr.handle)) { + if (!test_samr_close_handle(torture, + ctx->samr.pipe->binding_handle, mem_ctx, &ctx->samr.handle)) { torture_comment(torture, "domain close failed\n"); ret = false; } @@ -802,7 +674,8 @@ bool torture_userlist(struct torture_context *torture) goto done; } - if (!test_samr_close(torture, ctx->samr.pipe->binding_handle, mem_ctx, &ctx->samr.handle)) { + if (!test_samr_close_handle(torture, + ctx->samr.pipe->binding_handle, mem_ctx, &ctx->samr.handle)) { torture_comment(torture, "samr domain close failed\n"); ret = false; goto done; diff --git a/source4/torture/libnet/userinfo.c b/source4/torture/libnet/userinfo.c index aa5b8e8..686f1f1 100644 --- a/source4/torture/libnet/userinfo.c +++ b/source4/torture/libnet/userinfo.c @@ -24,7 +24,7 @@ #include "libcli/security/security.h" #include "librpc/gen_ndr/ndr_samr_c.h" #include "param/param.h" -#include "torture/libnet/utils.h" +#include "torture/libnet/proto.h" #define TEST_USERNAME "libnetuserinfotest" @@ -48,24 +48,18 @@ static bool test_userinfo(struct torture_context *tctx, torture_comment(tctx, "Testing sync libnet_rpc_userinfo (SID argument)\n"); status = libnet_rpc_userinfo(p, mem_ctx, &user); - if (!NT_STATUS_IS_OK(status)) { - torture_comment(tctx, "Failed to call sync libnet_rpc_userinfo - %s\n", nt_errstr(status)); - return false; - } + torture_assert_ntstatus_ok(tctx, status, "Calling sync libnet_rpc_userinfo() failed"); ZERO_STRUCT(user); user.in.domain_handle = *domain_handle; user.in.sid = NULL; - user.in.username = TEST_USERNAME; + user.in.username = user_name; user.in.level = level; torture_comment(tctx, "Testing sync libnet_rpc_userinfo (username argument)\n"); status = libnet_rpc_userinfo(p, mem_ctx, &user); - if (!NT_STATUS_IS_OK(status)) { - torture_comment(tctx, "Failed to call sync libnet_rpc_userinfo - %s\n", nt_errstr(status)); - return false; - } + torture_assert_ntstatus_ok(tctx, status, "Calling sync libnet_rpc_userinfo failed"); return true; } @@ -92,37 +86,25 @@ static bool test_userinfo_async(struct torture_context *tctx, torture_comment(tctx, "Testing async libnet_rpc_userinfo (SID argument)\n"); c = libnet_rpc_userinfo_send(p, &user, msg_handler); - if (!c) { - torture_comment(tctx, "Failed to call sync libnet_rpc_userinfo_send\n"); - return false; - } + torture_assert(tctx, c != NULL, "Failed to call async libnet_rpc_userinfo_send"); status = libnet_rpc_userinfo_recv(c, mem_ctx, &user); - if (!NT_STATUS_IS_OK(status)) { - torture_comment(tctx, "Calling async libnet_rpc_userinfo failed - %s\n", nt_errstr(status)); - return false; - } + torture_assert_ntstatus_ok(tctx, status, "Calling async libnet_rpc_userinfo_recv failed"); ZERO_STRUCT(user); user.in.domain_handle = *domain_handle; user.in.sid = NULL; - user.in.username = TEST_USERNAME; + user.in.username = user_name; user.in.level = level; torture_comment(tctx, "Testing async libnet_rpc_userinfo (username argument)\n"); c = libnet_rpc_userinfo_send(p, &user, msg_handler); - if (!c) { - torture_comment(tctx, "Failed to call sync libnet_rpc_userinfo_send\n"); - return false; - } + torture_assert(tctx, c != NULL, "Failed to call async libnet_rpc_userinfo_send"); status = libnet_rpc_userinfo_recv(c, mem_ctx, &user); - if (!NT_STATUS_IS_OK(status)) { - torture_comment(tctx, "Calling async libnet_rpc_userinfo failed - %s\n", nt_errstr(status)); - return false; - } + torture_assert_ntstatus_ok(tctx, status, "Calling async libnet_rpc_userinfo_recv failed"); return true; } @@ -156,7 +138,7 @@ bool torture_userinfo(struct torture_context *torture) /* * Testing synchronous version */ - if (!test_opendomain(torture, b, mem_ctx, &h, &name, &sid)) { + if (!test_domain_open(torture, b, &name, mem_ctx, &h, &sid)) { ret = false; goto done; } @@ -179,7 +161,7 @@ bool torture_userinfo(struct torture_context *torture) /* * Testing asynchronous version and monitor messages */ - if (!test_opendomain(torture, b, mem_ctx, &h, &name, &sid)) { + if (!test_domain_open(torture, b, &name, mem_ctx, &h, &sid)) { ret = false; goto done; } diff --git a/source4/torture/libnet/userman.c b/source4/torture/libnet/userman.c index b1699cf..0faca57 100644 --- a/source4/torture/libnet/userman.c +++ b/source4/torture/libnet/userman.c @@ -25,7 +25,7 @@ #include "librpc/gen_ndr/ndr_samr_c.h" #include "param/param.h" -#include "torture/libnet/utils.h" +#include "torture/libnet/proto.h" static bool test_useradd(struct torture_context *tctx, @@ -326,7 +326,7 @@ bool torture_useradd(struct torture_context *torture) b = p->binding_handle; domain_name.string = lp_workgroup(torture->lp_ctx); - if (!test_opendomain(torture, b, mem_ctx, &h, &domain_name, &sid)) { + if (!test_domain_open(torture, b, &domain_name, mem_ctx, &h, &sid)) { ret = false; goto done; } @@ -341,7 +341,7 @@ bool torture_useradd(struct torture_context *torture) goto done; } - if (!test_opendomain(torture, b, mem_ctx, &h, &domain_name, &sid)) { + if (!test_domain_open(torture, b, &domain_name, mem_ctx, &h, &sid)) { ret = false; goto done; } @@ -387,7 +387,7 @@ bool torture_userdel(struct torture_context *torture) b = p->binding_handle; domain_name.string = lp_workgroup(torture->lp_ctx); - if (!test_opendomain(torture, b, mem_ctx, &h, &domain_name, &sid)) { + if (!test_domain_open(torture, b, &domain_name, mem_ctx, &h, &sid)) { ret = false; goto done; } @@ -434,7 +434,7 @@ bool torture_usermod(struct torture_context *torture) domain_name.string = lp_workgroup(torture->lp_ctx); name = talloc_strdup(mem_ctx, TEST_USERNAME); -- Samba Shared Repository