The branch, master has been updated via 97a974e... s4-smbtorture: use torture_context for debugging output everywhere in libnet torture tests. via f5eb8eb... s4-smbtorture: remove trailing whitespace in libnet torture tests. from fad0629... s3-builtin: Add missing builtin groups.
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 97a974e5b7b4645544b10ff48459125c5580580d Author: Günther Deschner <g...@samba.org> Date: Tue Mar 23 15:31:27 2010 +0100 s4-smbtorture: use torture_context for debugging output everywhere in libnet torture tests. Mimir, please check. Guenther commit f5eb8eb97fb494501359e0c5ee368f2bb64ad717 Author: Günther Deschner <g...@samba.org> Date: Tue Mar 23 16:04:30 2010 +0100 s4-smbtorture: remove trailing whitespace in libnet torture tests. Guenther ----------------------------------------------------------------------- Summary of changes: source4/torture/libnet/domain.c | 22 ++-- source4/torture/libnet/groupinfo.c | 31 +++--- source4/torture/libnet/groupman.c | 20 ++-- source4/torture/libnet/grouptest.h | 8 +- source4/torture/libnet/libnet_domain.c | 101 +++++++++-------- source4/torture/libnet/libnet_group.c | 129 +++++++++++---------- source4/torture/libnet/libnet_lookup.c | 22 ++-- source4/torture/libnet/libnet_rpc.c | 68 ++++++------ source4/torture/libnet/libnet_share.c | 50 +++++---- source4/torture/libnet/libnet_user.c | 194 ++++++++++++++++--------------- source4/torture/libnet/userinfo.c | 46 ++++---- source4/torture/libnet/userman.c | 95 ++++++++-------- source4/torture/libnet/utils.c | 80 +++++++------- source4/torture/libnet/utils.h | 20 ++-- 14 files changed, 456 insertions(+), 430 deletions(-) Changeset truncated at 500 lines: diff --git a/source4/torture/libnet/domain.c b/source4/torture/libnet/domain.c index 02cdc8a..7e8a2d0 100644 --- a/source4/torture/libnet/domain.c +++ b/source4/torture/libnet/domain.c @@ -1,19 +1,19 @@ -/* +/* Unix SMB/CIFS implementation. Test suite for libnet calls. Copyright (C) Rafal Szczesniak 2005 - + 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 3 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, see <http://www.gnu.org/licenses/>. */ @@ -30,9 +30,9 @@ static bool test_domainopen(struct libnet_context *net_ctx, TALLOC_CTX *mem_ctx, { NTSTATUS status; struct libnet_DomainOpen io; - + printf("opening domain\n"); - + io.in.domain_name = talloc_strdup(mem_ctx, domname->string); io.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED; @@ -56,15 +56,15 @@ static bool test_cleanup(struct dcerpc_binding_handle *b, TALLOC_CTX *mem_ctx, r.in.handle = domain_handle; r.out.handle = &handle; - + printf("closing domain handle\n"); - + status = dcerpc_samr_Close_r(b, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("Close failed - %s\n", nt_errstr(status)); return false; } - + return true; } @@ -82,10 +82,10 @@ bool torture_domainopen(struct torture_context *torture) net_ctx = libnet_context_init(torture->ev, torture->lp_ctx); - status = torture_rpc_connection(torture, + status = torture_rpc_connection(torture, &net_ctx->samr.pipe, &ndr_table_samr); - + if (!NT_STATUS_IS_OK(status)) { return false; } diff --git a/source4/torture/libnet/groupinfo.c b/source4/torture/libnet/groupinfo.c index c2d8edf..6b58ddf 100644 --- a/source4/torture/libnet/groupinfo.c +++ b/source4/torture/libnet/groupinfo.c @@ -1,19 +1,19 @@ -/* +/* Unix SMB/CIFS implementation. Test suite for libnet calls. Copyright (C) Rafal Szczesniak 2007 - + 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 3 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, see <http://www.gnu.org/licenses/>. */ @@ -29,7 +29,8 @@ #define TEST_GROUPNAME "libnetgroupinfotest" -static bool test_groupinfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, +static bool test_groupinfo(struct torture_context *tctx, + struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *domain_handle, struct dom_sid2 *domain_sid, const char* group_name, uint32_t *rid) @@ -38,17 +39,17 @@ static bool test_groupinfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, NTSTATUS status; struct libnet_rpc_groupinfo group; struct dom_sid *group_sid; - + group_sid = dom_sid_add_rid(mem_ctx, domain_sid, *rid); - + group.in.domain_handle = *domain_handle; group.in.sid = dom_sid_string(mem_ctx, group_sid); group.in.level = level; /* this should be extended */ - printf("Testing sync libnet_rpc_groupinfo (SID argument)\n"); + torture_comment(tctx, "Testing sync libnet_rpc_groupinfo (SID argument)\n"); status = libnet_rpc_groupinfo(p, mem_ctx, &group); if (!NT_STATUS_IS_OK(status)) { - printf("Failed to call sync libnet_rpc_userinfo - %s\n", nt_errstr(status)); + torture_comment(tctx, "Failed to call sync libnet_rpc_userinfo - %s\n", nt_errstr(status)); return false; } @@ -62,7 +63,7 @@ static bool test_groupinfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, printf("Testing sync libnet_rpc_groupinfo (groupname argument)\n"); status = libnet_rpc_groupinfo(p, mem_ctx, &group); if (!NT_STATUS_IS_OK(status)) { - printf("Failed to call sync libnet_rpc_groupinfo - %s\n", nt_errstr(status)); + torture_comment(tctx, "Failed to call sync libnet_rpc_groupinfo - %s\n", nt_errstr(status)); return false; } @@ -84,10 +85,10 @@ bool torture_groupinfo(struct torture_context *torture) mem_ctx = talloc_init("test_userinfo"); - status = torture_rpc_connection(torture, + status = torture_rpc_connection(torture, &p, &ndr_table_samr); - + if (!NT_STATUS_IS_OK(status)) { return false; } @@ -103,17 +104,17 @@ bool torture_groupinfo(struct torture_context *torture) goto done; } - if (!test_group_create(b, mem_ctx, &h, TEST_GROUPNAME, &rid)) { + if (!test_group_create(torture, b, mem_ctx, &h, TEST_GROUPNAME, &rid)) { ret = false; goto done; } - if (!test_groupinfo(p, mem_ctx, &h, &sid, TEST_GROUPNAME, &rid)) { + if (!test_groupinfo(torture, p, mem_ctx, &h, &sid, TEST_GROUPNAME, &rid)) { ret = false; goto done; } - if (!test_group_cleanup(b, mem_ctx, &h, TEST_GROUPNAME)) { + if (!test_group_cleanup(torture, 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 213e88e..e2b5657 100644 --- a/source4/torture/libnet/groupman.c +++ b/source4/torture/libnet/groupman.c @@ -1,19 +1,19 @@ -/* +/* Unix SMB/CIFS implementation. Test suite for libnet calls. Copyright (C) Rafal Szczesniak 2007 - + 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 3 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, see <http://www.gnu.org/licenses/>. */ @@ -37,7 +37,7 @@ static bool test_groupadd(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, group.in.domain_handle = *domain_handle; group.in.groupname = name; - + printf("Testing libnet_rpc_groupadd\n"); status = libnet_rpc_groupadd(p, mem_ctx, &group); @@ -45,7 +45,7 @@ static bool test_groupadd(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, printf("Failed to call sync libnet_rpc_groupadd - %s\n", nt_errstr(status)); return false; } - + return ret; } @@ -64,10 +64,10 @@ bool torture_groupadd(struct torture_context *torture) mem_ctx = talloc_init("test_groupadd"); - status = torture_rpc_connection(torture, + status = torture_rpc_connection(torture, &p, &ndr_table_samr); - + torture_assert_ntstatus_ok(torture, status, "RPC connection"); b = p->binding_handle; @@ -82,11 +82,11 @@ bool torture_groupadd(struct torture_context *torture) goto done; } - if (!test_group_cleanup(b, mem_ctx, &h, name)) { + if (!test_group_cleanup(torture, b, mem_ctx, &h, name)) { ret = false; goto done; } - + done: talloc_free(mem_ctx); return ret; diff --git a/source4/torture/libnet/grouptest.h b/source4/torture/libnet/grouptest.h index 9d030ac..8b65e6e 100644 --- a/source4/torture/libnet/grouptest.h +++ b/source4/torture/libnet/grouptest.h @@ -1,18 +1,18 @@ -/* +/* Unix SMB/CIFS implementation. Copyright (C) Rafal Szczesniak 2007 - + 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 3 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, see <http://www.gnu.org/licenses/>. */ diff --git a/source4/torture/libnet/libnet_domain.c b/source4/torture/libnet/libnet_domain.c index 1010f00..bd0e1fa 100644 --- a/source4/torture/libnet/libnet_domain.c +++ b/source4/torture/libnet/libnet_domain.c @@ -1,19 +1,19 @@ -/* +/* Unix SMB/CIFS implementation. Test suite for libnet calls. 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 3 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, see <http://www.gnu.org/licenses/>. */ @@ -28,7 +28,8 @@ #include "param/param.h" -static bool test_opendomain_samr(struct dcerpc_binding_handle *b, TALLOC_CTX *mem_ctx, +static bool test_opendomain_samr(struct torture_context *tctx, + struct dcerpc_binding_handle *b, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct lsa_String *domname, uint32_t *access_mask, struct dom_sid **sid_p) { @@ -38,30 +39,30 @@ static bool test_opendomain_samr(struct dcerpc_binding_handle *b, TALLOC_CTX *me struct samr_LookupDomain r2; struct dom_sid2 *sid = NULL; struct samr_OpenDomain r3; - - printf("connecting\n"); + + torture_comment(tctx, "connecting\n"); *access_mask = SEC_FLAG_MAXIMUM_ALLOWED; - + r1.in.system_name = 0; r1.in.access_mask = *access_mask; r1.out.connect_handle = &h; - + status = dcerpc_samr_Connect_r(b, mem_ctx, &r1); if (!NT_STATUS_IS_OK(status)) { - printf("Connect failed - %s\n", nt_errstr(status)); + torture_comment(tctx, "Connect failed - %s\n", nt_errstr(status)); return false; } - + r2.in.connect_handle = &h; r2.in.domain_name = domname; r2.out.sid = &sid; - printf("domain lookup on %s\n", domname->string); + torture_comment(tctx, "domain lookup on %s\n", domname->string); status = dcerpc_samr_LookupDomain_r(b, mem_ctx, &r2); if (!NT_STATUS_IS_OK(status)) { - printf("LookupDomain failed - %s\n", nt_errstr(status)); + torture_comment(tctx, "LookupDomain failed - %s\n", nt_errstr(status)); return false; } @@ -70,11 +71,11 @@ static bool test_opendomain_samr(struct dcerpc_binding_handle *b, TALLOC_CTX *me r3.in.sid = *sid_p = *r2.out.sid; r3.out.domain_handle = &domain_handle; - printf("opening domain\n"); + torture_comment(tctx, "opening domain\n"); status = dcerpc_samr_OpenDomain_r(b, mem_ctx, &r3); if (!NT_STATUS_IS_OK(status)) { - printf("OpenDomain failed - %s\n", nt_errstr(status)); + torture_comment(tctx, "OpenDomain failed - %s\n", nt_errstr(status)); return false; } else { *handle = domain_handle; @@ -102,14 +103,14 @@ static bool test_opendomain_lsa(struct dcerpc_binding_handle *b, TALLOC_CTX *mem qos.impersonation_level = 2; qos.context_mode = 1; qos.effective_only = 0; - + attr.sec_qos = &qos; open.in.system_name = domname->string; open.in.attr = &attr; open.in.access_mask = *access_mask; open.out.handle = handle; - + status = dcerpc_lsa_OpenPolicy2_r(b, mem_ctx, &open); if (!NT_STATUS_IS_OK(status)) { return false; @@ -135,7 +136,7 @@ bool torture_domain_open_lsa(struct torture_context *torture) ctx = libnet_context_init(torture->ev, torture->lp_ctx); if (ctx == NULL) { - d_printf("failed to create libnet context\n"); + torture_comment(torture, "failed to create libnet context\n"); return false; } @@ -148,7 +149,7 @@ bool torture_domain_open_lsa(struct torture_context *torture) status = libnet_DomainOpen(ctx, torture, &r); if (!NT_STATUS_IS_OK(status)) { - d_printf("failed to open domain on lsa service: %s\n", nt_errstr(status)); + torture_comment(torture, "failed to open domain on lsa service: %s\n", nt_errstr(status)); ret = false; goto done; } @@ -156,10 +157,10 @@ bool torture_domain_open_lsa(struct torture_context *torture) ZERO_STRUCT(lsa_close); lsa_close.in.handle = &ctx->lsa.handle; lsa_close.out.handle = &h; - + status = dcerpc_lsa_Close_r(ctx->lsa.pipe->binding_handle, ctx, &lsa_close); if (!NT_STATUS_IS_OK(status)) { - d_printf("failed to close domain on lsa service: %s\n", nt_errstr(status)); + torture_comment(torture, "failed to close domain on lsa service: %s\n", nt_errstr(status)); ret = false; } @@ -189,7 +190,7 @@ bool torture_domain_close_lsa(struct torture_context *torture) ctx = libnet_context_init(torture->ev, torture->lp_ctx); if (ctx == NULL) { - d_printf("failed to create libnet context\n"); + torture_comment(torture, "failed to create libnet context\n"); ret = false; goto done; } @@ -200,19 +201,19 @@ bool torture_domain_close_lsa(struct torture_context *torture) status = dcerpc_pipe_connect_b(mem_ctx, &p, binding, &ndr_table_lsarpc, cmdline_credentials, torture->ev, torture->lp_ctx); if (!NT_STATUS_IS_OK(status)) { - d_printf("failed to connect to server: %s\n", nt_errstr(status)); + torture_comment(torture, "failed to connect to server: %s\n", nt_errstr(status)); ret = false; goto done; } domain_name.string = lp_workgroup(torture->lp_ctx); - + if (!test_opendomain_lsa(p->binding_handle, torture, &h, &domain_name, &access_mask)) { - d_printf("failed to open domain on lsa service\n"); + torture_comment(torture, "failed to open domain on lsa service\n"); ret = false; goto done; } - + ctx->lsa.pipe = p; ctx->lsa.name = domain_name.string; ctx->lsa.access_mask = access_mask; @@ -224,7 +225,7 @@ bool torture_domain_close_lsa(struct torture_context *torture) ZERO_STRUCT(r); r.in.type = DOMAIN_LSA; r.in.domain_name = domain_name.string; - + status = libnet_DomainClose(ctx, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { ret = false; @@ -262,15 +263,15 @@ bool torture_domain_open_samr(struct torture_context *torture) /* * Testing synchronous version */ - printf("opening domain\n"); - + torture_comment(torture, "opening domain\n"); + io.in.type = DOMAIN_SAMR; io.in.domain_name = domain_name; io.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED; status = libnet_DomainOpen(ctx, mem_ctx, &io); if (!NT_STATUS_IS_OK(status)) { - printf("Composite domain open failed - %s\n", nt_errstr(status)); + torture_comment(torture, "Composite domain open failed - %s\n", nt_errstr(status)); ret = false; goto done; } @@ -279,12 +280,12 @@ bool torture_domain_open_samr(struct torture_context *torture) r.in.handle = &domain_handle; r.out.handle = &handle; - - printf("closing domain handle\n"); - + + torture_comment(torture, "closing domain handle\n"); + status = dcerpc_samr_Close_r(ctx->samr.pipe->binding_handle, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { - printf("Close failed - %s\n", nt_errstr(status)); + torture_comment(torture, "Close failed - %s\n", nt_errstr(status)); ret = false; goto done; } @@ -318,7 +319,7 @@ bool torture_domain_close_samr(struct torture_context *torture) ctx = libnet_context_init(torture->ev, torture->lp_ctx); if (ctx == NULL) { - d_printf("failed to create libnet context\n"); + torture_comment(torture, "failed to create libnet context\n"); ret = false; goto done; -- Samba Shared Repository