From 098fc8c09c64c9fa37ae70638e3b30340a7ae183 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 22 Jan 2010 00:47:42 +0100 Subject: s4:torture: refactor querying of domain info out into test_QueryDomainInfo2_level() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- source4/torture/rpc/samr.c | 92 ++++++++++++++++++++-------------------------- 1 file 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 */ -- cgit