diff options
author | Günther Deschner <gd@samba.org> | 2010-03-23 16:04:30 +0100 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2010-03-23 16:13:54 +0100 |
commit | f5eb8eb97fb494501359e0c5ee368f2bb64ad717 (patch) | |
tree | a4015810c334f6ef64b995093bcd5fd7a3538724 /source4/torture/libnet | |
parent | fad0629e78c8672ea9b4eeb709b1d21c43abac06 (diff) | |
download | samba-f5eb8eb97fb494501359e0c5ee368f2bb64ad717.tar.gz samba-f5eb8eb97fb494501359e0c5ee368f2bb64ad717.tar.bz2 samba-f5eb8eb97fb494501359e0c5ee368f2bb64ad717.zip |
s4-smbtorture: remove trailing whitespace in libnet torture tests.
Guenther
Diffstat (limited to 'source4/torture/libnet')
-rw-r--r-- | source4/torture/libnet/domain.c | 22 | ||||
-rw-r--r-- | source4/torture/libnet/groupinfo.c | 16 | ||||
-rw-r--r-- | source4/torture/libnet/groupman.c | 18 | ||||
-rw-r--r-- | source4/torture/libnet/grouptest.h | 8 | ||||
-rw-r--r-- | source4/torture/libnet/libnet_domain.c | 46 | ||||
-rw-r--r-- | source4/torture/libnet/libnet_group.c | 36 | ||||
-rw-r--r-- | source4/torture/libnet/libnet_lookup.c | 8 | ||||
-rw-r--r-- | source4/torture/libnet/libnet_rpc.c | 18 | ||||
-rw-r--r-- | source4/torture/libnet/libnet_share.c | 16 | ||||
-rw-r--r-- | source4/torture/libnet/libnet_user.c | 54 | ||||
-rw-r--r-- | source4/torture/libnet/userinfo.c | 16 | ||||
-rw-r--r-- | source4/torture/libnet/userman.c | 50 | ||||
-rw-r--r-- | source4/torture/libnet/utils.c | 48 | ||||
-rw-r--r-- | source4/torture/libnet/utils.h | 14 |
14 files changed, 185 insertions, 185 deletions
diff --git a/source4/torture/libnet/domain.c b/source4/torture/libnet/domain.c index 02cdc8a0db..7e8a2d0b3a 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 c2d8edf01c..055f156351 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/>. */ @@ -38,9 +38,9 @@ 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 */ @@ -84,10 +84,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; } diff --git a/source4/torture/libnet/groupman.c b/source4/torture/libnet/groupman.c index 213e88ef13..ada17b4809 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; @@ -86,7 +86,7 @@ bool torture_groupadd(struct torture_context *torture) 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 9d030acd17..8b65e6e57a 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 1010f00225..d6b389fede 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/>. */ @@ -38,21 +38,21 @@ 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"); *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)); return false; } - + r2.in.connect_handle = &h; r2.in.domain_name = domname; r2.out.sid = &sid; @@ -102,14 +102,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; @@ -156,7 +156,7 @@ 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)); @@ -206,13 +206,13 @@ bool torture_domain_close_lsa(struct torture_context *torture) } 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"); ret = false; goto done; } - + ctx->lsa.pipe = p; ctx->lsa.name = domain_name.string; ctx->lsa.access_mask = access_mask; @@ -224,7 +224,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; @@ -263,7 +263,7 @@ bool torture_domain_open_samr(struct torture_context *torture) * Testing synchronous version */ printf("opening domain\n"); - + io.in.type = DOMAIN_SAMR; io.in.domain_name = domain_name; io.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED; @@ -279,9 +279,9 @@ bool torture_domain_open_samr(struct torture_context *torture) r.in.handle = &domain_handle; r.out.handle = &handle; - + printf("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)); @@ -335,13 +335,13 @@ bool torture_domain_close_samr(struct torture_context *torture) } domain_name.string = talloc_strdup(mem_ctx, lp_workgroup(torture->lp_ctx)); - + if (!test_opendomain_samr(p->binding_handle, torture, &h, &domain_name, &access_mask, &sid)) { d_printf("failed to open domain on samr service\n"); ret = false; goto done; } - + ctx->samr.pipe = p; ctx->samr.name = talloc_steal(ctx, domain_name.string); ctx->samr.access_mask = access_mask; @@ -355,7 +355,7 @@ bool torture_domain_close_samr(struct torture_context *torture) ZERO_STRUCT(r); r.in.type = DOMAIN_SAMR; r.in.domain_name = domain_name.string; - + status = libnet_DomainClose(ctx, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { ret = false; @@ -392,7 +392,7 @@ bool torture_domain_list(struct torture_context *torture) } ctx->cred = cmdline_credentials; - + mem_ctx = talloc_init("torture_domain_close_samr"); /* @@ -409,7 +409,7 @@ bool torture_domain_list(struct torture_context *torture) } d_printf("Received list or domains (everything in one piece):\n"); - + for (i = 0; i < r.out.count; i++) { d_printf("Name[%d]: %s\n", i, r.out.domains[i].name); } @@ -430,7 +430,7 @@ bool torture_domain_list(struct torture_context *torture) } d_printf("Received list or domains (collected in more than one round):\n"); - + for (i = 0; i < r.out.count; i++) { d_printf("Name[%d]: %s\n", i, r.out.domains[i].name); } diff --git a/source4/torture/libnet/libnet_group.c b/source4/torture/libnet/libnet_group.c index ac9072f49c..531820564c 100644 --- a/source4/torture/libnet/libnet_group.c +++ b/source4/torture/libnet/libnet_group.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/>. */ @@ -50,7 +50,7 @@ static bool test_cleanup(struct dcerpc_binding_handle *b, TALLOC_CTX *mem_ctx, r1.in.names = names; r1.out.rids = &rids; r1.out.types = &types; - + printf("group account lookup '%s'\n", groupname); status = dcerpc_samr_LookupNames_r(b, mem_ctx, &r1); @@ -60,7 +60,7 @@ static bool test_cleanup(struct dcerpc_binding_handle *b, TALLOC_CTX *mem_ctx, } rid = r1.out.rids->ids[0]; - + r2.in.domain_handle = domain_handle; r2.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED; r2.in.rid = rid; @@ -78,7 +78,7 @@ static bool test_cleanup(struct dcerpc_binding_handle *b, TALLOC_CTX *mem_ctx, r3.out.group_handle = &group_handle; printf("deleting group account\n"); - + status = dcerpc_samr_DeleteDomainGroup_r(b, mem_ctx, &r3); if (!NT_STATUS_IS_OK(status)) { printf("DeleteGroup failed - %s\n", nt_errstr(status)); @@ -97,9 +97,9 @@ static bool test_creategroup(struct dcerpc_binding_handle *b, TALLOC_CTX *mem_ct struct samr_CreateDomainGroup r; struct policy_handle group_handle; uint32_t group_rid; - + groupname.string = name; - + r.in.domain_handle = handle; r.in.name = &groupname; r.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED; @@ -119,7 +119,7 @@ static bool test_creategroup(struct dcerpc_binding_handle *b, TALLOC_CTX *mem_ct } printf("creating group account\n"); - + status = dcerpc_samr_CreateDomainGroup_r(b, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("CreateGroup failed - %s\n", nt_errstr(status)); @@ -143,19 +143,19 @@ static bool test_opendomain(struct dcerpc_binding_handle *b, TALLOC_CTX *mem_ctx struct samr_LookupDomain r2; struct dom_sid2 *sid = NULL; struct samr_OpenDomain r3; - + printf("connecting\n"); - + r1.in.system_name = 0; r1.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED; 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)); return false; } - + r2.in.connect_handle = &h; r2.in.domain_name = domname; r2.out.sid = &sid; @@ -192,7 +192,7 @@ static bool test_samr_close(struct dcerpc_binding_handle *b, TALLOC_CTX *mem_ctx { NTSTATUS status; struct samr_Close r; - + r.in.handle = domain_handle; r.out.handle = domain_handle; @@ -201,7 +201,7 @@ static bool test_samr_close(struct dcerpc_binding_handle *b, TALLOC_CTX *mem_ctx printf("Close samr domain failed - %s\n", nt_errstr(status)); return false; } - + return true; } @@ -214,7 +214,7 @@ static bool test_lsa_close(struct dcerpc_binding_handle *b, TALLOC_CTX *mem_ctx, r.in.handle = domain_handle; r.out.handle = domain_handle; - + status = dcerpc_lsa_Close_r(b, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("Close lsa domain failed - %s\n", nt_errstr(status)); @@ -313,7 +313,7 @@ bool torture_grouplist(struct torture_context *torture) ZERO_STRUCT(req); printf("listing group accounts:\n"); - + do { req.in.domain_name = domain_name.string; req.in.page_size = 128; diff --git a/source4/torture/libnet/libnet_lookup.c b/source4/torture/libnet/libnet_lookup.c index b7d0704f30..6cf615b3a8 100644 --- a/source4/torture/libnet/libnet_lookup.c +++ b/source4/torture/libnet/libnet_lookup.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/>. */ diff --git a/source4/torture/libnet/libnet_rpc.c b/source4/torture/libnet/libnet_rpc.c index 0177789543..d30053d79c 100644 --- a/source4/torture/libnet/libnet_rpc.c +++ b/source4/torture/libnet/libnet_rpc.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/>. */ @@ -89,7 +89,7 @@ static bool torture_rpc_connect(struct torture_context *torture, ctx = libnet_context_init(torture->ev, torture->lp_ctx); ctx->cred = cmdline_credentials; - + d_printf("Testing connection to LSA interface\n"); if (!test_connect_service(ctx, &ndr_table_lsarpc, bindstr, hostname, level, false, NT_STATUS_OK)) { @@ -152,7 +152,7 @@ bool torture_rpc_connect_pdc(struct torture_context *torture) NTSTATUS status; struct dcerpc_binding *binding; const char *domain_name; - + status = torture_rpc_binding(torture, &binding); if (!NT_STATUS_IS_OK(status)) { return false; @@ -172,7 +172,7 @@ bool torture_rpc_connect_dc(struct torture_context *torture) NTSTATUS status; struct dcerpc_binding *binding; const char *domain_name; - + status = torture_rpc_binding(torture, &binding); if (!NT_STATUS_IS_OK(status)) { return false; @@ -192,7 +192,7 @@ bool torture_rpc_connect_dc_info(struct torture_context *torture) NTSTATUS status; struct dcerpc_binding *binding; const char *domain_name; - + status = torture_rpc_binding(torture, &binding); if (!NT_STATUS_IS_OK(status)) { return false; @@ -212,7 +212,7 @@ bool torture_rpc_connect_binding(struct torture_context *torture) NTSTATUS status; struct dcerpc_binding *binding; const char *bindstr; - + status = torture_rpc_binding(torture, &binding); if (!NT_STATUS_IS_OK(status)) { return false; diff --git a/source4/torture/libnet/libnet_share.c b/source4/torture/libnet/libnet_share.c index 960b351c96..1d64f558ad 100644 --- a/source4/torture/libnet/libnet_share.c +++ b/source4/torture/libnet/libnet_share.c @@ -1,20 +1,20 @@ -/* +/* Unix SMB/CIFS implementation. Test suite for libnet calls. Copyright (C) Gregory LEOCADIE <gleocadie@idealx.com> 2005 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/>. */ @@ -139,9 +139,9 @@ bool torture_listshares(struct torture_context *torture) } libnetctx->cred = cmdline_credentials; - + printf("Testing libnet_ListShare\n"); - + share.in.server_name = talloc_asprintf(mem_ctx, "%s", binding->host); for (i = 0; i < ARRAY_SIZE(levels); i++) { @@ -172,7 +172,7 @@ static bool test_addshare(struct dcerpc_binding_handle *b, TALLOC_CTX *mem_ctx, struct srvsvc_NetShareAdd add; union srvsvc_NetShareInfo info; struct srvsvc_NetShareInfo2 i; - + i.name = share; i.type = STYPE_DISKTREE; i.path = "C:\\WINDOWS\\TEMP"; @@ -208,7 +208,7 @@ bool torture_delshare(struct torture_context *torture) NTSTATUS status; bool ret = true; struct libnet_DelShare share; - + host = torture_setting_string(torture, "host", NULL); status = torture_rpc_binding(torture, &binding); torture_assert_ntstatus_ok(torture, status, "Failed to get binding"); diff --git a/source4/torture/libnet/libnet_user.c b/source4/torture/libnet/libnet_user.c index dfcc5ed526..873a701ca9 100644 --- a/source4/torture/libnet/libnet_user.c +++ b/source4/torture/libnet/libnet_user.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/>. */ @@ -48,7 +48,7 @@ static bool test_cleanup(struct dcerpc_binding_handle *b, TALLOC_CTX *mem_ctx, r1.in.names = names; r1.out.rids = &rids; r1.out.types = &types; - + printf("user account lookup '%s'\n", username); status = dcerpc_samr_LookupNames_r(b, mem_ctx, &r1); @@ -58,7 +58,7 @@ static bool test_cleanup(struct dcerpc_binding_handle *b, TALLOC_CTX *mem_ctx, } rid = r1.out.rids->ids[0]; - + r2.in.domain_handle = domain_handle; r2.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED; r2.in.rid = rid; @@ -76,7 +76,7 @@ static bool test_cleanup(struct dcerpc_binding_handle *b, TALLOC_CTX *mem_ctx, r3.out.user_handle = &user_handle; printf("deleting user account\n"); - + status = dcerpc_samr_DeleteUser_r(b, mem_ctx, &r3); if (!NT_STATUS_IS_OK(status)) { printf("DeleteUser failed - %s\n", nt_errstr(status)); @@ -96,19 +96,19 @@ static bool test_opendomain(struct dcerpc_binding_handle *b, TALLOC_CTX *mem_ctx struct samr_LookupDomain r2; struct dom_sid2 *sid = NULL; struct samr_OpenDomain r3; - + printf("connecting\n"); - + r1.in.system_name = 0; r1.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED; 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)); return false; } - + r2.in.connect_handle = &h; r2.in.domain_name = domname; r2.out.sid = &sid; @@ -145,7 +145,7 @@ static bool test_samr_close(struct dcerpc_binding_handle *b, TALLOC_CTX *mem_ctx { NTSTATUS status; struct samr_Close r; - + r.in.handle = domain_handle; r.out.handle = domain_handle; @@ -154,7 +154,7 @@ static bool test_samr_close(struct dcerpc_binding_handle *b, TALLOC_CTX *mem_ctx printf("Close samr domain failed - %s\n", nt_errstr(status)); return false; } - + return true; } @@ -167,7 +167,7 @@ static bool test_lsa_close(struct dcerpc_binding_handle *b, TALLOC_CTX *mem_ctx, r.in.handle = domain_handle; r.out.handle = domain_handle; - + status = dcerpc_lsa_Close_r(b, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("Close lsa domain failed - %s\n", nt_errstr(status)); @@ -189,7 +189,7 @@ static bool test_createuser(struct dcerpc_binding_handle *b, TALLOC_CTX *mem_ctx 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; @@ -197,7 +197,7 @@ static bool test_createuser(struct dcerpc_binding_handle *b, TALLOC_CTX *mem_ctx r1.out.rid = &user_rid; printf("creating user '%s'\n", username.string); - + status = dcerpc_samr_CreateUser_r(b, mem_ctx, &r1); if (!NT_STATUS_IS_OK(status)) { printf("CreateUser failed - %s\n", nt_errstr(status)); @@ -209,20 +209,20 @@ static bool test_createuser(struct dcerpc_binding_handle *b, TALLOC_CTX *mem_ctx } printf("creating user account\n"); - + status = dcerpc_samr_CreateUser_r(b, mem_ctx, &r1); if (!NT_STATUS_IS_OK(status)) { printf("CreateUser failed - %s\n", nt_errstr(status)); return false; } return true; - } + } return false; } r2.in.handle = &user_handle; r2.out.handle = &user_handle; - + printf("closing user '%s'\n", username.string); status = dcerpc_samr_Close_r(b, mem_ctx, &r2); @@ -359,14 +359,14 @@ static void set_test_changes(TALLOC_CTX *mem_ctx, struct libnet_ModifyUser *r, /* get one in case we hit time field this time */ gettimeofday(&now, NULL); - + switch (testfld) { case account_name: continue_if_field_set(r->in.account_name); r->in.account_name = talloc_asprintf(mem_ctx, TEST_CHG_ACCOUNTNAME, (int)(random() % 100)); fldname = "account_name"; - + /* update the test's user name in case it's about to change */ *user_name = talloc_strdup(mem_ctx, r->in.account_name); break; @@ -412,7 +412,7 @@ static void set_test_changes(TALLOC_CTX *mem_ctx, struct libnet_ModifyUser *r, r->in.logon_script = talloc_strdup(mem_ctx, logonscript); fldname = "logon_script"; break; - + case profile_path: continue_if_field_set(r->in.profile_path); r->in.profile_path = talloc_asprintf(mem_ctx, TEST_CHG_PROFILEPATH, @@ -436,7 +436,7 @@ static void set_test_changes(TALLOC_CTX *mem_ctx, struct libnet_ModifyUser *r, default: fldname = "unknown_field"; } - + printf(((i < num_changes - 1) ? "%s," : "%s"), fldname); /* disable requested field (it's supposed to be the only one used) */ @@ -578,14 +578,14 @@ bool torture_modifyuser(struct torture_context *torture) req.in.domain_name = lp_workgroup(torture->lp_ctx); req.in.user_name = name; req.in.account_name = TEST_USERNAME; - + status = libnet_ModifyUser(ctx, torture, &req); if (!NT_STATUS_IS_OK(status)) { printf("libnet_ModifyUser call failed: %s\n", nt_errstr(status)); ret = false; goto done; } - + name = talloc_strdup(torture, TEST_USERNAME); } } @@ -649,7 +649,7 @@ bool torture_userinfo_api(struct torture_context *torture) mem_ctx = talloc_init("torture user info"); ZERO_STRUCT(req); - + req.in.domain_name = domain_name.string; req.in.data.user_name = name; req.in.level = USER_INFO_BY_NAME; @@ -699,7 +699,7 @@ bool torture_userlist(struct torture_context *torture) ZERO_STRUCT(req); printf("listing user accounts:\n"); - + do { req.in.domain_name = domain_name.string; diff --git a/source4/torture/libnet/userinfo.c b/source4/torture/libnet/userinfo.c index e273299160..50e994f3bf 100644 --- a/source4/torture/libnet/userinfo.c +++ b/source4/torture/libnet/userinfo.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/>. */ @@ -38,9 +38,9 @@ static bool test_userinfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, NTSTATUS status; struct libnet_rpc_userinfo user; struct dom_sid *user_sid; - + user_sid = dom_sid_add_rid(mem_ctx, domain_sid, *rid); - + user.in.domain_handle = *domain_handle; user.in.sid = dom_sid_string(mem_ctx, user_sid); user.in.level = level; /* this should be extended */ @@ -140,10 +140,10 @@ bool torture_userinfo(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; } diff --git a/source4/torture/libnet/userman.c b/source4/torture/libnet/userman.c index 72c87ab8bd..e38c4693f7 100644 --- a/source4/torture/libnet/userman.c +++ b/source4/torture/libnet/userman.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/>. */ @@ -35,7 +35,7 @@ static bool test_useradd(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, NTSTATUS status; bool ret = true; struct libnet_rpc_useradd user; - + user.in.domain_handle = *domain_handle; user.in.username = name; @@ -46,7 +46,7 @@ static bool test_useradd(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, printf("Failed to call libnet_rpc_useradd - %s\n", nt_errstr(status)); return false; } - + return ret; } @@ -60,9 +60,9 @@ static bool test_useradd_async(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, user.in.domain_handle = *handle; user.in.username = username; - + printf("Testing async libnet_rpc_useradd\n"); - + c = libnet_rpc_useradd_send(p, &user, msg_handler); if (!c) { printf("Failed to call async libnet_rpc_useradd\n"); @@ -79,7 +79,7 @@ static bool test_useradd_async(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, } -static bool test_usermod(struct torture_context *tctx, struct dcerpc_pipe *p, +static bool test_usermod(struct torture_context *tctx, struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle, int num_changes, struct libnet_rpc_usermod *mod, char **username) @@ -103,7 +103,7 @@ static bool test_usermod(struct torture_context *tctx, struct dcerpc_pipe *p, mod->in.username = talloc_strdup(mem_ctx, *username); mod->in.domain_handle = *handle; - torture_comment(tctx, "modifying user (%d simultaneous change(s))\n", + torture_comment(tctx, "modifying user (%d simultaneous change(s))\n", num_changes); torture_comment(tctx, "fields to change: ["); @@ -140,7 +140,7 @@ static bool test_usermod(struct torture_context *tctx, struct dcerpc_pipe *p, mod->in.change.fields |= USERMOD_FIELD_DESCRIPTION; fldname = "description"; break; - + case home_directory: continue_if_field_set(mod->in.change.home_directory); homedir = home_dirs[random() % (sizeof(home_dirs)/sizeof(char*))]; @@ -217,10 +217,10 @@ static bool test_userdel(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, { NTSTATUS status; struct libnet_rpc_userdel user; - + user.in.domain_handle = *handle; user.in.username = username; - + status = libnet_rpc_userdel(p, mem_ctx, &user); if (!NT_STATUS_IS_OK(status)) { printf("Failed to call sync libnet_rpc_userdel - %s\n", nt_errstr(status)); @@ -265,7 +265,7 @@ static bool test_userdel(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, } -static bool test_compare(struct torture_context *tctx, +static bool test_compare(struct torture_context *tctx, struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle, struct libnet_rpc_usermod *mod, const char *username) @@ -315,10 +315,10 @@ bool torture_useradd(struct torture_context *torture) mem_ctx = talloc_init("test_useradd"); - status = torture_rpc_connection(torture, + status = torture_rpc_connection(torture, &p, &ndr_table_samr); - + torture_assert_ntstatus_ok(torture, status, "RPC connect failed"); b = p->binding_handle; @@ -374,10 +374,10 @@ bool torture_userdel(struct torture_context *torture) mem_ctx = talloc_init("test_userdel"); - status = torture_rpc_connection(torture, + status = torture_rpc_connection(torture, &p, &ndr_table_samr); - + if (!NT_STATUS_IS_OK(status)) { return false; } @@ -393,12 +393,12 @@ bool torture_userdel(struct torture_context *torture) ret = false; goto done; } - + if (!test_userdel(p, mem_ctx, &h, name)) { ret = false; goto done; } - + done: talloc_free(mem_ctx); return ret; @@ -421,10 +421,10 @@ bool torture_usermod(struct torture_context *torture) mem_ctx = talloc_init("test_userdel"); - status = torture_rpc_connection(torture, + status = torture_rpc_connection(torture, &p, &ndr_table_samr); - + torture_assert_ntstatus_ok(torture, status, "RPC connect"); b = p->binding_handle; @@ -440,7 +440,7 @@ bool torture_usermod(struct torture_context *torture) ret = false; goto done; } - + for (i = 1; i < FIELDS_NUM; i++) { struct libnet_rpc_usermod m; @@ -454,8 +454,8 @@ bool torture_usermod(struct torture_context *torture) goto cleanup; } } - -cleanup: + +cleanup: 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 e47b32931d..46e152c2c4 100644 --- a/source4/torture/libnet/utils.c +++ b/source4/torture/libnet/utils.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/>. */ @@ -28,7 +28,7 @@ #include "librpc/gen_ndr/ndr_samr_c.h" #include "torture/libnet/utils.h" -bool test_opendomain(struct torture_context *tctx, +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 dom_sid2 *sid_p) @@ -39,16 +39,16 @@ bool test_opendomain(struct torture_context *tctx, 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; - + status = dcerpc_samr_Connect_r(b, mem_ctx, &r1); torture_assert_ntstatus_ok(tctx, status, "Connect failed"); - + r2.in.connect_handle = &h; r2.in.domain_name = domname; r2.out.sid = &sid; @@ -95,14 +95,14 @@ bool test_user_cleanup(struct torture_context *tctx, r1.in.names = names; r1.out.rids = &rids; r1.out.types = &types; - + torture_comment(tctx, "user account lookup '%s'\n", name); status = dcerpc_samr_LookupNames_r(b, mem_ctx, &r1); torture_assert_ntstatus_ok(tctx, status, "LookupNames failed"); rid = r1.out.rids->ids[0]; - + r2.in.domain_handle = domain_handle; r2.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED; r2.in.rid = rid; @@ -117,15 +117,15 @@ bool test_user_cleanup(struct torture_context *tctx, r3.out.user_handle = &user_handle; torture_comment(tctx, "deleting user account\n"); - + status = dcerpc_samr_DeleteUser_r(b, mem_ctx, &r3); torture_assert_ntstatus_ok(tctx, status, "DeleteUser failed"); - + return true; } -bool test_user_create(struct torture_context *tctx, +bool test_user_create(struct torture_context *tctx, struct dcerpc_binding_handle *b, TALLOC_CTX *mem_ctx, struct policy_handle *handle, const char *name, @@ -135,9 +135,9 @@ bool test_user_create(struct torture_context *tctx, struct lsa_String username; struct samr_CreateUser r; struct policy_handle user_handle; - + username.string = name; - + r.in.domain_handle = handle; r.in.account_name = &username; r.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED; @@ -157,7 +157,7 @@ bool test_user_create(struct torture_context *tctx, } torture_comment(tctx, "creating user account\n"); - + status = dcerpc_samr_CreateUser_r(b, mem_ctx, &r); torture_assert_ntstatus_ok(tctx, status, "CreateUser failed"); return true; @@ -189,7 +189,7 @@ bool test_group_cleanup(struct dcerpc_binding_handle *b, TALLOC_CTX *mem_ctx, r1.in.names = names; r1.out.rids = &rids; r1.out.types = &types; - + printf("group account lookup '%s'\n", name); status = dcerpc_samr_LookupNames_r(b, mem_ctx, &r1); @@ -199,7 +199,7 @@ bool test_group_cleanup(struct dcerpc_binding_handle *b, TALLOC_CTX *mem_ctx, } rid = r1.out.rids->ids[0]; - + r2.in.domain_handle = domain_handle; r2.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED; r2.in.rid = rid; @@ -217,13 +217,13 @@ bool test_group_cleanup(struct dcerpc_binding_handle *b, TALLOC_CTX *mem_ctx, r3.out.group_handle = &group_handle; printf("deleting group account\n"); - + status = dcerpc_samr_DeleteDomainGroup_r(b, mem_ctx, &r3); if (!NT_STATUS_IS_OK(status)) { printf("DeleteGroup failed - %s\n", nt_errstr(status)); return false; } - + return true; } @@ -236,9 +236,9 @@ bool test_group_create(struct dcerpc_binding_handle *b, TALLOC_CTX *mem_ctx, struct lsa_String groupname; struct samr_CreateDomainGroup r; struct policy_handle group_handle; - + groupname.string = name; - + r.in.domain_handle = handle; r.in.name = &groupname; r.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED; @@ -258,7 +258,7 @@ bool test_group_create(struct dcerpc_binding_handle *b, TALLOC_CTX *mem_ctx, } printf("creating group account\n"); - + status = dcerpc_samr_CreateDomainGroup_r(b, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { printf("CreateGroup failed - %s\n", nt_errstr(status)); diff --git a/source4/torture/libnet/utils.h b/source4/torture/libnet/utils.h index e5bd3e1247..94a971dd97 100644 --- a/source4/torture/libnet/utils.h +++ b/source4/torture/libnet/utils.h @@ -1,37 +1,37 @@ -/* +/* 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/>. */ -bool test_opendomain(struct torture_context *tctx, +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 dom_sid2 *sid); -bool test_user_create(struct torture_context *tctx, +bool test_user_create(struct torture_context *tctx, 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, +bool test_user_cleanup(struct torture_context *tctx, struct dcerpc_binding_handle *b, TALLOC_CTX *mem_ctx, struct policy_handle *domain_handle, |