summaryrefslogtreecommitdiff
path: root/source4/torture
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2010-01-22 00:47:42 +0100
committerGünther Deschner <gd@samba.org>2010-01-27 11:24:42 +0100
commit098fc8c09c64c9fa37ae70638e3b30340a7ae183 (patch)
treef1f0d549bb745d660754ef34864e2f78ca37b94d /source4/torture
parent0a33b20f70506d0a01b4c543ab57ca2488187ee9 (diff)
downloadsamba-098fc8c09c64c9fa37ae70638e3b30340a7ae183.tar.gz
samba-098fc8c09c64c9fa37ae70638e3b30340a7ae183.tar.bz2
samba-098fc8c09c64c9fa37ae70638e3b30340a7ae183.zip
s4:torture: refactor querying of domain info out into test_QueryDomainInfo2_level()
Used in several places. (Note: The _level suffix in the function name is just because test_QueryDomainInfo2() already exists as an overall test for all levels.) Michael Signed-off-by: Günther Deschner <gd@samba.org>
Diffstat (limited to 'source4/torture')
-rw-r--r--source4/torture/rpc/samr.c92
1 files changed, 40 insertions, 52 deletions
diff --git a/source4/torture/rpc/samr.c b/source4/torture/rpc/samr.c
index 7aab956589..4ab4a2cdc7 100644
--- a/source4/torture/rpc/samr.c
+++ b/source4/torture/rpc/samr.c
@@ -3487,6 +3487,24 @@ static bool test_SetDomainInfo_ntstatus(struct dcerpc_pipe *p,
return true;
}
+static bool test_QueryDomainInfo2_level(struct dcerpc_pipe *p,
+ struct torture_context *tctx,
+ struct policy_handle *domain_handle,
+ enum samr_DomainInfoClass level,
+ union samr_DomainInfo **q_info)
+{
+ struct samr_QueryDomainInfo2 r;
+
+ r.in.domain_handle = domain_handle;
+ r.in.level = level;
+ r.out.info = q_info;
+
+ torture_assert_ntstatus_ok(tctx,
+ dcerpc_samr_QueryDomainInfo2(p, tctx, &r),
+ "failed to query domain info");
+
+ return true;
+}
static bool test_Password_badpwdcount(struct dcerpc_pipe *p,
struct dcerpc_pipe *np,
@@ -3730,35 +3748,20 @@ static bool test_Password_badpwdcount_wrap(struct dcerpc_pipe *p,
/* backup old policies */
- {
- struct samr_QueryDomainInfo2 r;
-
- r.in.domain_handle = domain_handle;
- r.in.level = DomainPasswordInformation;
- r.out.info = &q_info;
-
- torture_assert_ntstatus_ok(tctx,
- dcerpc_samr_QueryDomainInfo2(p, tctx, &r),
- "failed to query domain info level 1");
-
- info1 = q_info->info1;
- }
-
- {
- struct samr_QueryDomainInfo2 r;
-
- r.in.domain_handle = domain_handle;
- r.in.level = DomainLockoutInformation;
- r.out.info = &q_info;
+ torture_assert(tctx,
+ test_QueryDomainInfo2_level(p, tctx, domain_handle,
+ DomainPasswordInformation, &q_info),
+ "failed to query domain info level 1");
- torture_assert_ntstatus_ok(tctx,
- dcerpc_samr_QueryDomainInfo2(p, tctx, &r),
- "failed to query domain info level 12");
+ info1 = q_info->info1;
+ _info1 = info1;
- info12 = q_info->info12;
- }
+ torture_assert(tctx,
+ test_QueryDomainInfo2_level(p, tctx, domain_handle,
+ DomainLockoutInformation, &q_info),
+ "failed to query domain info level 12");
- _info1 = info1;
+ info12 = q_info->info12;
_info12 = info12;
/* run tests */
@@ -4064,35 +4067,20 @@ static bool test_Password_lockout_wrap(struct dcerpc_pipe *p,
/* backup old policies */
- {
- struct samr_QueryDomainInfo2 r;
-
- r.in.domain_handle = domain_handle;
- r.in.level = DomainPasswordInformation;
- r.out.info = &q_info;
-
- torture_assert_ntstatus_ok(tctx,
- dcerpc_samr_QueryDomainInfo2(p, tctx, &r),
- "failed to query domain info level 1");
-
- info1 = q_info->info1;
- }
-
- {
- struct samr_QueryDomainInfo2 r;
-
- r.in.domain_handle = domain_handle;
- r.in.level = DomainLockoutInformation;
- r.out.info = &q_info;
+ torture_assert(tctx,
+ test_QueryDomainInfo2_level(p, tctx, domain_handle,
+ DomainPasswordInformation, &q_info),
+ "failed to query domain info level 1");
- torture_assert_ntstatus_ok(tctx,
- dcerpc_samr_QueryDomainInfo2(p, tctx, &r),
- "failed to query domain info level 12");
+ info1 = q_info->info1;
+ _info1 = info1;
- info12 = q_info->info12;
- }
+ torture_assert(tctx,
+ test_QueryDomainInfo2_level(p, tctx, domain_handle,
+ DomainLockoutInformation, &q_info),
+ "failed to query domain info level 12");
- _info1 = info1;
+ info12 = q_info->info12;
_info12 = info12;
/* run tests */