From dda32aa5ba8237dcb6e619621562a27bcf031452 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 31 Dec 2004 10:49:35 +0000 Subject: r4451: added initial RPC-DSSETUP torture test. It works for level1 of ds_RolerGetPrimaryDomainInformation() (This used to be commit 7aec3dac6fd5165cfca5c650aaa29234e278d95d) --- source4/torture/rpc/dssetup.c | 69 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 source4/torture/rpc/dssetup.c (limited to 'source4/torture/rpc/dssetup.c') diff --git a/source4/torture/rpc/dssetup.c b/source4/torture/rpc/dssetup.c new file mode 100644 index 0000000000..1819c523a5 --- /dev/null +++ b/source4/torture/rpc/dssetup.c @@ -0,0 +1,69 @@ +/* + Unix SMB/CIFS implementation. + + test suite for dssetup rpc operations + + Copyright (C) Andrew Tridgell 2004 + + 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 2 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, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include "includes.h" +#include "librpc/gen_ndr/ndr_dssetup.h" + + +static BOOL test_RolerGetPrimaryDomainInformation(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) +{ + struct ds_RolerGetPrimaryDomainInformation r; + NTSTATUS status; + + printf("\ntesting RolerGetPrimaryDomainInformation\n"); + + r.in.level = 1; + + status = dcerpc_ds_RolerGetPrimaryDomainInformation(p, mem_ctx, &r); + if (!NT_STATUS_IS_OK(status)) { + printf("RolerGetPrimaryDomainInformation failed - %s\n", nt_errstr(status)); + return False; + } + + return True; +} + +BOOL torture_rpc_dssetup(void) +{ + NTSTATUS status; + struct dcerpc_pipe *p; + TALLOC_CTX *mem_ctx; + BOOL ret = True; + + mem_ctx = talloc_init("torture_rpc_dssetup"); + + status = torture_rpc_connection(&p, + DCERPC_DSSETUP_NAME, + DCERPC_DSSETUP_UUID, + DCERPC_DSSETUP_VERSION); + if (!NT_STATUS_IS_OK(status)) { + return False; + } + + ret &= test_RolerGetPrimaryDomainInformation(p, mem_ctx); + + talloc_destroy(mem_ctx); + + torture_rpc_close(p); + + return ret; +} -- cgit From d487cca5cb39cfd4b41b83ae32f07d2b7deb6cf1 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 1 Jan 2005 01:32:01 +0000 Subject: r4461: finished the remaining information levels in the DSSETUP pipe. The pipe is now complete! The only glitch is that I am returning DS_ROLE_MEMBER_SERVER when I should be returning DS_ROLE_PRIMARY_DC. This is needed for the moment or ACL editing doesn't work from w2k3. Once we have some more ADS calls we should be able to fix this. (This used to be commit 6566dc2805a9f6473ebab70b0dbd381c4dbd42c8) --- source4/torture/rpc/dssetup.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'source4/torture/rpc/dssetup.c') diff --git a/source4/torture/rpc/dssetup.c b/source4/torture/rpc/dssetup.c index 1819c523a5..7e63243e8a 100644 --- a/source4/torture/rpc/dssetup.c +++ b/source4/torture/rpc/dssetup.c @@ -28,18 +28,23 @@ static BOOL test_RolerGetPrimaryDomainInformation(struct dcerpc_pipe *p, TALLOC_ { struct ds_RolerGetPrimaryDomainInformation r; NTSTATUS status; + BOOL ret = True; + int i; printf("\ntesting RolerGetPrimaryDomainInformation\n"); - r.in.level = 1; + for (i=DS_BASIC_INFORMATION;i<=DS_ROLE_OP_STATUS;i++) { + r.in.level = i; - status = dcerpc_ds_RolerGetPrimaryDomainInformation(p, mem_ctx, &r); - if (!NT_STATUS_IS_OK(status)) { - printf("RolerGetPrimaryDomainInformation failed - %s\n", nt_errstr(status)); - return False; + status = dcerpc_ds_RolerGetPrimaryDomainInformation(p, mem_ctx, &r); + if (!NT_STATUS_IS_OK(status)) { + printf("RolerGetPrimaryDomainInformation level %d failed - %s\n", + i, nt_errstr(status)); + ret = False; + } } - return True; + return ret; } BOOL torture_rpc_dssetup(void) -- cgit From fa010c96766fb97e5c4f02f485a5ea774ac07d63 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Sun, 2 Jan 2005 16:11:59 +0000 Subject: r4483: - rename same structs, enums and uninons of the dssetup pipe to match the style we are using in other pipes - first fillin local vars and only set the out parameter on success - for the server code only to the samdb lookup when it's needed NOTE: the DsRoleGetPrimaryDomainInformation() code with DS_ROLE_MEMBER_SERVER is not tested yet, does someone has a w2k3 member server to test with? metze (This used to be commit e6d1136497f501fe0687bfb34a155db6a9d87bde) --- source4/torture/rpc/dssetup.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'source4/torture/rpc/dssetup.c') diff --git a/source4/torture/rpc/dssetup.c b/source4/torture/rpc/dssetup.c index 7e63243e8a..eb9dc83df6 100644 --- a/source4/torture/rpc/dssetup.c +++ b/source4/torture/rpc/dssetup.c @@ -24,22 +24,30 @@ #include "librpc/gen_ndr/ndr_dssetup.h" -static BOOL test_RolerGetPrimaryDomainInformation(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) +static BOOL test_DsRoleGetPrimaryDomainInformation(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) { - struct ds_RolerGetPrimaryDomainInformation r; + struct dssetup_DsRoleGetPrimaryDomainInformation r; NTSTATUS status; BOOL ret = True; int i; - printf("\ntesting RolerGetPrimaryDomainInformation\n"); + printf("\ntesting DsRoleGetPrimaryDomainInformation\n"); - for (i=DS_BASIC_INFORMATION;i<=DS_ROLE_OP_STATUS;i++) { + for (i=DS_ROLE_BASIC_INFORMATION; i <= DS_ROLE_OP_STATUS; i++) { r.in.level = i; - status = dcerpc_ds_RolerGetPrimaryDomainInformation(p, mem_ctx, &r); + status = dcerpc_dssetup_DsRoleGetPrimaryDomainInformation(p, mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { - printf("RolerGetPrimaryDomainInformation level %d failed - %s\n", - i, nt_errstr(status)); + const char *errstr = nt_errstr(status); + if (NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT)) { + errstr = dcerpc_errstr(mem_ctx, p->last_fault_code); + } + printf("dcerpc_dssetup_DsRoleGetPrimaryDomainInformation level %d failed - %s\n", + i, errstr); + ret = False; + } else if (!W_ERROR_IS_OK(r.out.result)) { + printf("DsRoleGetPrimaryDomainInformation level %d failed - %s\n", + i, win_errstr(r.out.result)); ret = False; } } @@ -64,7 +72,7 @@ BOOL torture_rpc_dssetup(void) return False; } - ret &= test_RolerGetPrimaryDomainInformation(p, mem_ctx); + ret &= test_DsRoleGetPrimaryDomainInformation(p, mem_ctx); talloc_destroy(mem_ctx); -- cgit From ab9ca559269f9ef921eb3e6ec3007d2e249c6cfe Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 9 Jan 2005 09:38:16 +0000 Subject: r4617: basic alter_context requests now work in our client library. The test just does a simple LSA/DSSETUP combo, which is what w2k does in the ACL editor rpc calls that triggered this work (This used to be commit 0129ec947aa1fa5a7104dc3a666af3cb9bd104f1) --- source4/torture/rpc/dssetup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/torture/rpc/dssetup.c') diff --git a/source4/torture/rpc/dssetup.c b/source4/torture/rpc/dssetup.c index eb9dc83df6..bafe562cdb 100644 --- a/source4/torture/rpc/dssetup.c +++ b/source4/torture/rpc/dssetup.c @@ -24,7 +24,7 @@ #include "librpc/gen_ndr/ndr_dssetup.h" -static BOOL test_DsRoleGetPrimaryDomainInformation(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) +BOOL test_DsRoleGetPrimaryDomainInformation(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) { struct dssetup_DsRoleGetPrimaryDomainInformation r; NTSTATUS status; -- cgit From 759da3b915e2006d4c87b5ace47f399accd9ce91 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 27 Jan 2005 07:08:20 +0000 Subject: r5037: got rid of all of the TALLOC_DEPRECATED stuff. My apologies for the large commit. I thought this was worthwhile to get done for consistency. (This used to be commit ec32b22ed5ec224f6324f5e069d15e92e38e15c0) --- source4/torture/rpc/dssetup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/torture/rpc/dssetup.c') diff --git a/source4/torture/rpc/dssetup.c b/source4/torture/rpc/dssetup.c index bafe562cdb..bd20a695e2 100644 --- a/source4/torture/rpc/dssetup.c +++ b/source4/torture/rpc/dssetup.c @@ -74,7 +74,7 @@ BOOL torture_rpc_dssetup(void) ret &= test_DsRoleGetPrimaryDomainInformation(p, mem_ctx); - talloc_destroy(mem_ctx); + talloc_free(mem_ctx); torture_rpc_close(p); -- cgit From 645711c602313940dcf80ec786557920ecfbf884 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Tue, 22 Mar 2005 08:00:45 +0000 Subject: r5941: Commit this patch much earlier than I would normally prefer, but metze needs a working tree... The main volume of this patch was what I started working on today: - Cleans up memory handling around DCE/RPC pipes, to have a parent talloc context. - Uses sepereate inner loops for some of the DCE/RPC tests The other and more important part of this patch fixes issues surrounding the new credentials framwork: This makes the struct cli_credentials always a talloc() structure, rather than on the stack. Parts of the cli_credentials code already assumed this. There were other issues, particularly in the DCERPC over SMB handling, as well as little things that had to be tidied up before test_w2k3.sh would start to pass. Andrew Bartlett (This used to be commit 0453f9d05d2e336fba1f85dbf2718d01fa2bf778) --- source4/torture/rpc/dssetup.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source4/torture/rpc/dssetup.c') diff --git a/source4/torture/rpc/dssetup.c b/source4/torture/rpc/dssetup.c index bd20a695e2..d4f76fea90 100644 --- a/source4/torture/rpc/dssetup.c +++ b/source4/torture/rpc/dssetup.c @@ -64,11 +64,13 @@ BOOL torture_rpc_dssetup(void) mem_ctx = talloc_init("torture_rpc_dssetup"); - status = torture_rpc_connection(&p, + status = torture_rpc_connection(mem_ctx, &p, DCERPC_DSSETUP_NAME, DCERPC_DSSETUP_UUID, DCERPC_DSSETUP_VERSION); if (!NT_STATUS_IS_OK(status)) { + talloc_free(mem_ctx); + return False; } @@ -76,7 +78,5 @@ BOOL torture_rpc_dssetup(void) talloc_free(mem_ctx); - torture_rpc_close(p); - return ret; } -- cgit From acd6a086b341096fcbea1775ce748587fcc8020a Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 27 Dec 2005 14:28:01 +0000 Subject: r12510: Change the DCE/RPC interfaces to take a pointer to a dcerpc_interface_table struct rather then a tuple of interface name, UUID and version. This removes the requirement for having a global list of DCE/RPC interfaces, except for these parts of the code that use that list explicitly (ndrdump and the scanner torture test). This should also allow us to remove the hack that put the authservice parameter in the dcerpc_binding struct as it can now be read directly from dcerpc_interface_table. I will now modify some of these functions to take a dcerpc_syntax_id structure rather then a full dcerpc_interface_table. (This used to be commit 8aae0f168e54c01d0866ad6e0da141dbd828574f) --- source4/torture/rpc/dssetup.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'source4/torture/rpc/dssetup.c') diff --git a/source4/torture/rpc/dssetup.c b/source4/torture/rpc/dssetup.c index d4f76fea90..2469d66330 100644 --- a/source4/torture/rpc/dssetup.c +++ b/source4/torture/rpc/dssetup.c @@ -64,10 +64,7 @@ BOOL torture_rpc_dssetup(void) mem_ctx = talloc_init("torture_rpc_dssetup"); - status = torture_rpc_connection(mem_ctx, &p, - DCERPC_DSSETUP_NAME, - DCERPC_DSSETUP_UUID, - DCERPC_DSSETUP_VERSION); + status = torture_rpc_connection(mem_ctx, &p, &dcerpc_table_dssetup); if (!NT_STATUS_IS_OK(status)) { talloc_free(mem_ctx); -- cgit From 25bb00fbcd409572e1c19c05fdc42c883936780b Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 3 Jan 2006 13:41:17 +0000 Subject: r12693: Move core data structures out of smb.h into core.h torture prototypes in seperate header (This used to be commit 73610639b23ca3743077193fa0b1de7c7f65944d) --- source4/torture/rpc/dssetup.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source4/torture/rpc/dssetup.c') diff --git a/source4/torture/rpc/dssetup.c b/source4/torture/rpc/dssetup.c index 2469d66330..ea5925db0c 100644 --- a/source4/torture/rpc/dssetup.c +++ b/source4/torture/rpc/dssetup.c @@ -21,6 +21,7 @@ */ #include "includes.h" +#include "torture/torture.h" #include "librpc/gen_ndr/ndr_dssetup.h" -- cgit From eefe30b7d8e17ed744318417954669bacf2b3ac0 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 14 Mar 2006 15:02:05 +0000 Subject: r14379: Build torture/rpc/ as a seperate smbtorture module. Move helper functions for rpc out of torture/torture.c (This used to be commit 1d2d970f3b8aef3f36c2befb94b5dd72c0086639) --- source4/torture/rpc/dssetup.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source4/torture/rpc/dssetup.c') diff --git a/source4/torture/rpc/dssetup.c b/source4/torture/rpc/dssetup.c index ea5925db0c..70f8c99dde 100644 --- a/source4/torture/rpc/dssetup.c +++ b/source4/torture/rpc/dssetup.c @@ -23,6 +23,7 @@ #include "includes.h" #include "torture/torture.h" #include "librpc/gen_ndr/ndr_dssetup.h" +#include "torture/rpc/rpc.h" BOOL test_DsRoleGetPrimaryDomainInformation(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) -- cgit From 1060f6b3f621cb70b075a879f129e57f10fdbf8a Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 14 Mar 2006 23:35:30 +0000 Subject: r14402: Generate seperate headers for RPC client functions. (This used to be commit 7054ebf0249930843a2baf4d023ae8f62cedb109) --- source4/torture/rpc/dssetup.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source4/torture/rpc/dssetup.c') diff --git a/source4/torture/rpc/dssetup.c b/source4/torture/rpc/dssetup.c index 70f8c99dde..cc285b3eef 100644 --- a/source4/torture/rpc/dssetup.c +++ b/source4/torture/rpc/dssetup.c @@ -23,6 +23,7 @@ #include "includes.h" #include "torture/torture.h" #include "librpc/gen_ndr/ndr_dssetup.h" +#include "librpc/gen_ndr/ndr_dssetup_c.h" #include "torture/rpc/rpc.h" -- cgit From 4f1c8daa36a7a0372c5fd9eab51f3c16ee81c49d Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 16 Mar 2006 12:43:28 +0000 Subject: r14470: Remove some unnecessary headers. (This used to be commit f7312dab3b9aba2b2b82e8a6e0c483a32a03a63a) --- source4/torture/rpc/dssetup.c | 1 - 1 file changed, 1 deletion(-) (limited to 'source4/torture/rpc/dssetup.c') diff --git a/source4/torture/rpc/dssetup.c b/source4/torture/rpc/dssetup.c index cc285b3eef..828c017c00 100644 --- a/source4/torture/rpc/dssetup.c +++ b/source4/torture/rpc/dssetup.c @@ -22,7 +22,6 @@ #include "includes.h" #include "torture/torture.h" -#include "librpc/gen_ndr/ndr_dssetup.h" #include "librpc/gen_ndr/ndr_dssetup_c.h" #include "torture/rpc/rpc.h" -- cgit From 909b111f587705a45f63540b39968f1af58a9b5d Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 25 Mar 2006 16:01:28 +0000 Subject: r14720: Add torture_context argument to all torture tests (This used to be commit 3c7a5ce29108dd82210dc3e1f00414f545949e1d) --- source4/torture/rpc/dssetup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/torture/rpc/dssetup.c') diff --git a/source4/torture/rpc/dssetup.c b/source4/torture/rpc/dssetup.c index 828c017c00..d1ba3b414f 100644 --- a/source4/torture/rpc/dssetup.c +++ b/source4/torture/rpc/dssetup.c @@ -57,7 +57,7 @@ BOOL test_DsRoleGetPrimaryDomainInformation(struct dcerpc_pipe *p, TALLOC_CTX *m return ret; } -BOOL torture_rpc_dssetup(void) +BOOL torture_rpc_dssetup(struct torture_context *torture) { NTSTATUS status; struct dcerpc_pipe *p; -- cgit From 0479a2f1cbae51fcd8dbdc3c148c808421fb4d25 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 10 Jul 2007 02:07:03 +0000 Subject: r23792: convert Samba4 to GPLv3 There are still a few tidyups of old FSF addresses to come (in both s3 and s4). More commits soon. (This used to be commit fcf38a38ac691abd0fa51b89dc951a08e89fdafa) --- source4/torture/rpc/dssetup.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'source4/torture/rpc/dssetup.c') diff --git a/source4/torture/rpc/dssetup.c b/source4/torture/rpc/dssetup.c index d1ba3b414f..08cb958cab 100644 --- a/source4/torture/rpc/dssetup.c +++ b/source4/torture/rpc/dssetup.c @@ -7,7 +7,7 @@ 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 2 of the License, or + 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, @@ -16,8 +16,7 @@ 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, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program. If not, see . */ #include "includes.h" -- cgit From f14bd1a90ab47a418c0ec2492990a417a0bb3bf6 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Sun, 19 Aug 2007 21:23:03 +0000 Subject: r24557: rename 'dcerpc_table_' -> 'ndr_table_' metze (This used to be commit 84651aee81aaabbebf52ffc3fbcbabb2eec6eed5) --- source4/torture/rpc/dssetup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/torture/rpc/dssetup.c') diff --git a/source4/torture/rpc/dssetup.c b/source4/torture/rpc/dssetup.c index 08cb958cab..4d90b242c4 100644 --- a/source4/torture/rpc/dssetup.c +++ b/source4/torture/rpc/dssetup.c @@ -65,7 +65,7 @@ BOOL torture_rpc_dssetup(struct torture_context *torture) mem_ctx = talloc_init("torture_rpc_dssetup"); - status = torture_rpc_connection(mem_ctx, &p, &dcerpc_table_dssetup); + status = torture_rpc_connection(mem_ctx, &p, &ndr_table_dssetup); if (!NT_STATUS_IS_OK(status)) { talloc_free(mem_ctx); -- cgit From 919aa6b27e5fe49b70c814210aa026c19be66e8a Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 28 Aug 2007 12:54:27 +0000 Subject: r24735: Use torture API in more places. (This used to be commit 1319d88c099496be29dd9214fa2492c81e848369) --- source4/torture/rpc/dssetup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/torture/rpc/dssetup.c') diff --git a/source4/torture/rpc/dssetup.c b/source4/torture/rpc/dssetup.c index 4d90b242c4..c80e37eb7d 100644 --- a/source4/torture/rpc/dssetup.c +++ b/source4/torture/rpc/dssetup.c @@ -65,7 +65,7 @@ BOOL torture_rpc_dssetup(struct torture_context *torture) mem_ctx = talloc_init("torture_rpc_dssetup"); - status = torture_rpc_connection(mem_ctx, &p, &ndr_table_dssetup); + status = torture_rpc_connection(torture, &p, &ndr_table_dssetup); if (!NT_STATUS_IS_OK(status)) { talloc_free(mem_ctx); -- cgit From b53ecda303d7c156c913300578d6dffa277aaf16 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 2 Sep 2007 03:14:32 +0000 Subject: r24885: Convert to new torture API. (This used to be commit 2918a056787467186a491574da95ea38c9aea1ee) --- source4/torture/rpc/dssetup.c | 49 +++++++++++-------------------------------- 1 file changed, 12 insertions(+), 37 deletions(-) (limited to 'source4/torture/rpc/dssetup.c') diff --git a/source4/torture/rpc/dssetup.c b/source4/torture/rpc/dssetup.c index c80e37eb7d..006d69acaf 100644 --- a/source4/torture/rpc/dssetup.c +++ b/source4/torture/rpc/dssetup.c @@ -25,56 +25,31 @@ #include "torture/rpc/rpc.h" -BOOL test_DsRoleGetPrimaryDomainInformation(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) +bool test_DsRoleGetPrimaryDomainInformation(struct torture_context *tctx, + struct dcerpc_pipe *p) { struct dssetup_DsRoleGetPrimaryDomainInformation r; NTSTATUS status; - BOOL ret = True; int i; - printf("\ntesting DsRoleGetPrimaryDomainInformation\n"); - for (i=DS_ROLE_BASIC_INFORMATION; i <= DS_ROLE_OP_STATUS; i++) { r.in.level = i; + torture_comment(tctx, "dcerpc_dssetup_DsRoleGetPrimaryDomainInformation level %d\n", i); - status = dcerpc_dssetup_DsRoleGetPrimaryDomainInformation(p, mem_ctx, &r); - if (!NT_STATUS_IS_OK(status)) { - const char *errstr = nt_errstr(status); - if (NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT)) { - errstr = dcerpc_errstr(mem_ctx, p->last_fault_code); - } - printf("dcerpc_dssetup_DsRoleGetPrimaryDomainInformation level %d failed - %s\n", - i, errstr); - ret = False; - } else if (!W_ERROR_IS_OK(r.out.result)) { - printf("DsRoleGetPrimaryDomainInformation level %d failed - %s\n", - i, win_errstr(r.out.result)); - ret = False; - } + status = dcerpc_dssetup_DsRoleGetPrimaryDomainInformation(p, tctx, &r); + torture_assert_ntstatus_ok(tctx, status, "DsRoleGetPrimaryDomainInformation failed"); + torture_assert_werr_ok(tctx, r.out.result, "DsRoleGetPrimaryDomainInformation failed"); } - return ret; + return true; } -BOOL torture_rpc_dssetup(struct torture_context *torture) +struct torture_suite *torture_rpc_dssetup(TALLOC_CTX *mem_ctx) { - NTSTATUS status; - struct dcerpc_pipe *p; - TALLOC_CTX *mem_ctx; - BOOL ret = True; - - mem_ctx = talloc_init("torture_rpc_dssetup"); - - status = torture_rpc_connection(torture, &p, &ndr_table_dssetup); - if (!NT_STATUS_IS_OK(status)) { - talloc_free(mem_ctx); - - return False; - } - - ret &= test_DsRoleGetPrimaryDomainInformation(p, mem_ctx); + struct torture_suite *suite = torture_suite_create(mem_ctx, "DSSETUP"); + struct torture_rpc_tcase *tcase = torture_suite_add_rpc_iface_tcase(suite, "dssetup", &ndr_table_dssetup); - talloc_free(mem_ctx); + torture_rpc_tcase_add_test(tcase, "DsRoleGetPrimaryDomainInformation", test_DsRoleGetPrimaryDomainInformation); - return ret; + return suite; } -- cgit From c0091046263d9568a379f8ed9afd4a08f86b6c84 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Sun, 2 Sep 2007 17:27:40 +0000 Subject: r24900: - if we use try to create a 3rd dcerpc_pipe then use a 3rd variable instead of overwritting the one of the 2nd connection - make it possible to specify the expected ntstatus for DsRoleGetPrimaryDomainInformation as the alter_context wants it to fail when used on the wrong pipe metze (This used to be commit c7c72ab36b15c5ffac1740b7df93fa92fe4620e9) --- source4/torture/rpc/dssetup.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'source4/torture/rpc/dssetup.c') diff --git a/source4/torture/rpc/dssetup.c b/source4/torture/rpc/dssetup.c index 006d69acaf..aa5f12eb92 100644 --- a/source4/torture/rpc/dssetup.c +++ b/source4/torture/rpc/dssetup.c @@ -25,8 +25,9 @@ #include "torture/rpc/rpc.h" -bool test_DsRoleGetPrimaryDomainInformation(struct torture_context *tctx, - struct dcerpc_pipe *p) +bool test_DsRoleGetPrimaryDomainInformation_ext(struct torture_context *tctx, + struct dcerpc_pipe *p, + NTSTATUS ext_status) { struct dssetup_DsRoleGetPrimaryDomainInformation r; NTSTATUS status; @@ -37,13 +38,21 @@ bool test_DsRoleGetPrimaryDomainInformation(struct torture_context *tctx, torture_comment(tctx, "dcerpc_dssetup_DsRoleGetPrimaryDomainInformation level %d\n", i); status = dcerpc_dssetup_DsRoleGetPrimaryDomainInformation(p, tctx, &r); - torture_assert_ntstatus_ok(tctx, status, "DsRoleGetPrimaryDomainInformation failed"); - torture_assert_werr_ok(tctx, r.out.result, "DsRoleGetPrimaryDomainInformation failed"); + torture_assert_ntstatus_equal(tctx, ext_status, status, "DsRoleGetPrimaryDomainInformation failed"); + if (NT_STATUS_IS_OK(ext_status)) { + torture_assert_werr_ok(tctx, r.out.result, "DsRoleGetPrimaryDomainInformation failed"); + } } return true; } +bool test_DsRoleGetPrimaryDomainInformation(struct torture_context *tctx, + struct dcerpc_pipe *p) +{ + return test_DsRoleGetPrimaryDomainInformation_ext(tctx, p, NT_STATUS_OK); +} + struct torture_suite *torture_rpc_dssetup(TALLOC_CTX *mem_ctx) { struct torture_suite *suite = torture_suite_create(mem_ctx, "DSSETUP"); -- cgit