From 612cfb84d955c31192ae1429198c580d3585bc24 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 15 Feb 2007 22:59:10 +0000 Subject: r21375: More lsa tests. (This used to be commit 88fa90778a0e1f5efca08e5e6ba1b165399de30c) --- source4/torture/ndr/lsa.c | 220 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 216 insertions(+), 4 deletions(-) (limited to 'source4/torture/ndr/lsa.c') diff --git a/source4/torture/ndr/lsa.c b/source4/torture/ndr/lsa.c index 4cfcce5c37..d54acc7b77 100644 --- a/source4/torture/ndr/lsa.c +++ b/source4/torture/ndr/lsa.c @@ -1092,22 +1092,234 @@ static bool lsaropenpolicy_out_check(struct torture_context *tctx, return true; } +static const uint8_t lsarcreateaccount_in_data[] = { + 0x00, 0x00, 0x00, 0x00, 0x2a, 0xab, 0xb8, 0x84, 0x36, 0xc6, 0xed, 0x4f, + 0x83, 0x16, 0x04, 0xe8, 0x63, 0x15, 0xeb, 0x84, 0x03, 0x00, 0x00, 0x00, + 0x01, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0xb4, 0x71, 0xbc, 0x00, + 0xe1, 0x10, 0x00, 0x00, 0x26, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02 +}; + +static bool lsarcreateaccount_in_check(struct torture_context *tctx, + struct lsa_CreateAccount *r) +{ + /* FIXME: Handle */ + /* FIXME: Sid */ + torture_assert_int_equal(tctx, r->in.access_mask, 0x2000000, "access mask"); + return true; +} + +static const uint8_t lsarcreateaccount_out_data[] = { + 0x00, 0x00, 0x00, 0x00, 0x3d, 0x28, 0x64, 0xd8, 0x9a, 0xad, 0x2f, 0x48, + 0xa5, 0x37, 0x26, 0xb4, 0x17, 0x71, 0x3a, 0xe8, 0x00, 0x00, 0x00, 0x00 +}; + +static bool lsarcreateaccount_out_check(struct torture_context *tctx, + struct lsa_CreateAccount *r) +{ + /* FIXME */ + torture_assert_ntstatus_ok(tctx, r->out.result, "return code"); + return true; +} + +static const uint8_t lsardelete_in_data[] = { + 0x00, 0x00, 0x00, 0x00, 0x3d, 0x28, 0x64, 0xd8, 0x9a, 0xad, 0x2f, 0x48, + 0xa5, 0x37, 0x26, 0xb4, 0x17, 0x71, 0x3a, 0xe8 +}; + +static bool lsardelete_in_check(struct torture_context *tctx, + struct lsa_Delete *r) +{ + /* FIXME: Handle */ + return true; +} + +static const uint8_t lsardelete_out_data[] = { + 0x00, 0x00, 0x00, 0x00 +}; + +static bool lsardelete_out_check(struct torture_context *tctx, + struct lsa_Delete *r) +{ + torture_assert_ntstatus_ok(tctx, r->out.result, "return code"); + return true; +} + +static const uint8_t lsarcreatesecret_in_data[] = { + 0x00, 0x00, 0x00, 0x00, 0x2a, 0xab, 0xb8, 0x84, 0x36, 0xc6, 0xed, 0x4f, + 0x83, 0x16, 0x04, 0xe8, 0x63, 0x15, 0xeb, 0x84, 0x2e, 0x00, 0x2e, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x17, 0x00, 0x00, 0x00, 0x74, 0x00, 0x6f, 0x00, 0x72, 0x00, 0x74, 0x00, + 0x75, 0x00, 0x72, 0x00, 0x65, 0x00, 0x73, 0x00, 0x65, 0x00, 0x63, 0x00, + 0x72, 0x00, 0x65, 0x00, 0x74, 0x00, 0x2d, 0x00, 0x38, 0x00, 0x35, 0x00, + 0x32, 0x00, 0x38, 0x00, 0x38, 0x00, 0x35, 0x00, 0x33, 0x00, 0x35, 0x00, + 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02 +}; + +static bool lsarcreatesecret_in_check(struct torture_context *tctx, + struct lsa_CreateSecret *r) +{ + /* FIXME: Handle */ + torture_assert_str_equal(tctx, r->in.name.string, "torturesecret-852885356", "name"); + torture_assert_int_equal(tctx, r->in.access_mask, 0x2000000, "access mask"); + return true; +} + +static const uint8_t lsarcreatesecret_out_data[] = { + 0x00, 0x00, 0x00, 0x00, 0x08, 0x2d, 0x02, 0x15, 0x3d, 0xfb, 0x27, 0x4c, + 0xaa, 0x22, 0x13, 0x79, 0x20, 0x14, 0x7f, 0xad, 0x00, 0x00, 0x00, 0x00 +}; + +static bool lsarcreatesecret_out_check(struct torture_context *tctx, + struct lsa_CreateSecret *r) +{ + /* FIXME: Handle */ + torture_assert_ntstatus_ok(tctx, r->out.result, "return code"); + return true; +} + +static const uint8_t lsaropensecret_in_data[] = { + 0x00, 0x00, 0x00, 0x00, 0x2a, 0xab, 0xb8, 0x84, 0x36, 0xc6, 0xed, 0x4f, + 0x83, 0x16, 0x04, 0xe8, 0x63, 0x15, 0xeb, 0x84, 0x2e, 0x00, 0x2e, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x17, 0x00, 0x00, 0x00, 0x74, 0x00, 0x6f, 0x00, 0x72, 0x00, 0x74, 0x00, + 0x75, 0x00, 0x72, 0x00, 0x65, 0x00, 0x73, 0x00, 0x65, 0x00, 0x63, 0x00, + 0x72, 0x00, 0x65, 0x00, 0x74, 0x00, 0x2d, 0x00, 0x38, 0x00, 0x35, 0x00, + 0x32, 0x00, 0x38, 0x00, 0x38, 0x00, 0x35, 0x00, 0x33, 0x00, 0x35, 0x00, + 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02 +}; + +static bool lsaropensecret_in_check(struct torture_context *tctx, + struct lsa_OpenSecret *r) +{ + /* FIXME: Handle */ + torture_assert_str_equal(tctx, r->in.name.string, "torturesecret-852885356", "name"); + torture_assert_int_equal(tctx, r->in.access_mask, 0x2000000, "access mask"); + return true; +} + +static const uint8_t lsaropensecret_out_data[] = { + 0x00, 0x00, 0x00, 0x00, 0x9f, 0x6d, 0x07, 0x35, 0x08, 0x43, 0xd9, 0x4b, + 0xbb, 0xcf, 0xeb, 0x4a, 0x91, 0xd2, 0x24, 0xe7, 0x00, 0x00, 0x00, 0x00 +}; + +static bool lsaropensecret_out_check(struct torture_context *tctx, + struct lsa_OpenSecret *r) +{ + /* FIXME: Handle */ + torture_assert_ntstatus_ok(tctx, r->out.result, "return code"); + return true; +} + +static const uint8_t lsarsetsecret_in_data[] = { + 0x00, 0x00, 0x00, 0x00, 0x08, 0x2d, 0x02, 0x15, 0x3d, 0xfb, 0x27, 0x4c, + 0xaa, 0x22, 0x13, 0x79, 0x20, 0x14, 0x7f, 0xad, 0x01, 0x00, 0x00, 0x00, + 0x20, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, + 0xda, 0xb8, 0x19, 0xb6, 0xaf, 0x8c, 0x0f, 0xf5, 0x28, 0x81, 0xca, 0xce, + 0xcc, 0x8b, 0x70, 0xc4, 0x8a, 0xe5, 0xad, 0x51, 0x1a, 0x0e, 0xb5, 0xaa, + 0x3b, 0xdc, 0xbf, 0x38, 0x30, 0xb4, 0x18, 0x6d, 0x00, 0x00, 0x00, 0x00 +}; + +static bool lsarsetsecret_in_check(struct torture_context *tctx, + struct lsa_SetSecret *r) +{ + /* FIXME: Handle */ + torture_assert(tctx, r->in.new_val != NULL, "new val ptr"); + torture_assert(tctx, r->in.old_val == NULL, "old val ptr"); + torture_assert_int_equal(tctx, r->in.new_val->length, 32, "new val len"); + torture_assert_int_equal(tctx, r->in.new_val->size, 32, "new val size"); + return true; +} + + +static const uint8_t lsarsetsecret_out_data[] = { + 0x00, 0x00, 0x00, 0x00 +}; + +static bool lsarsetsecret_out_check(struct torture_context *tctx, + struct lsa_SetSecret *r) +{ + torture_assert_ntstatus_ok(tctx, r->out.result, "return code"); + return true; +} + +static const uint8_t lsarquerysecret_in_data[] = { + 0x00, 0x00, 0x00, 0x00, 0x08, 0x2d, 0x02, 0x15, 0x3d, 0xfb, 0x27, 0x4c, + 0xaa, 0x22, 0x13, 0x79, 0x20, 0x14, 0x7f, 0xad, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +}; + +static bool lsarquerysecret_in_check(struct torture_context *tctx, + struct lsa_QuerySecret *r) +{ + /* FIXME: Handle */ + torture_assert(tctx, r->in.new_val != NULL, "new val ptr"); + torture_assert(tctx, r->in.new_val->buf == NULL, "new val ptr ptr"); + torture_assert(tctx, r->in.new_mtime != NULL, "new mtime ptr"); + /* FIXME: *new_mtime */ + torture_assert(tctx, r->in.old_val == NULL, "old val ptr"); + torture_assert(tctx, r->in.old_mtime == NULL, "old mtime ptr"); + return true; +} + + +static const uint8_t lsarquerysecret_out_data[] = { + 0x00, 0x00, 0x02, 0x00, 0x04, 0x00, 0x02, 0x00, 0x20, 0x00, 0x00, 0x00, + 0x20, 0x00, 0x00, 0x00, 0x08, 0x00, 0x02, 0x00, 0x20, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0xda, 0xb8, 0x19, 0xb6, + 0xaf, 0x8c, 0x0f, 0xf5, 0x28, 0x81, 0xca, 0xce, 0xcc, 0x8b, 0x70, 0xc4, + 0x8a, 0xe5, 0xad, 0x51, 0x1a, 0x0e, 0xb5, 0xaa, 0x3b, 0xdc, 0xbf, 0x38, + 0x30, 0xb4, 0x18, 0x6d, 0x0c, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x90, 0x3e, 0x63, 0x7e, 0xee, 0xf1, 0xc4, 0x01, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +}; + +static bool lsarquerysecret_out_check(struct torture_context *tctx, + struct lsa_QuerySecret *r) +{ + /* FIXME: Handle */ + torture_assert(tctx, r->out.new_val != NULL, "new val ptr"); + torture_assert(tctx, r->out.new_mtime != NULL, "new mtime ptr"); + /* FIXME: *new_mtime */ + torture_assert(tctx, r->out.old_val == NULL, "old val ptr"); + torture_assert(tctx, r->out.old_mtime == NULL, "old mtime ptr"); + return true; +} + struct torture_suite *ndr_lsa_suite(TALLOC_CTX *ctx) { struct torture_suite *suite = torture_suite_create(ctx, "lsa"); torture_suite_add_ndr_pull_fn_test(suite, lsa_OpenPolicy, lsaropenpolicy_in_data, NDR_IN, lsaropenpolicy_in_check); - /* torture_suite_add_ndr_pull_fn_test(suite, lsa_OpenPolicy, lsaropenpolicy_out_data, NDR_IN, lsaropenpolicy_out_check); */ + torture_suite_add_ndr_pull_fn_test(suite, lsa_OpenPolicy, lsaropenpolicy_out_data, NDR_OUT, lsaropenpolicy_out_check); torture_suite_add_ndr_pull_fn_test(suite, lsa_OpenPolicy2, lsaropenpolicy2_in_data, NDR_IN, lsaropenpolicy2_in_check); - /* torture_suite_add_ndr_pull_fn_test(suite, lsa_OpenPolicy2, lsaropenpolicy2_out_data, NDR_IN, lsaropenpolicy2_out_check); */ + torture_suite_add_ndr_pull_fn_test(suite, lsa_OpenPolicy2, lsaropenpolicy2_out_data, NDR_OUT, lsaropenpolicy2_out_check); torture_suite_add_ndr_pull_fn_test(suite, lsa_LookupNames, lsarlookupnames_in_data, NDR_IN, lsarlookupnames_in_check); - /* torture_suite_add_ndr_pull_fn_test(suite, lsa_LookupNames, lsarlookupnames_out_data, NDR_IN, lsarlookupnames_out_check); */ + torture_suite_add_ndr_pull_fn_test(suite, lsa_LookupNames, lsarlookupnames_out_data, NDR_OUT, lsarlookupnames_out_check); torture_suite_add_ndr_pull_fn_test(suite, lsa_LookupSids, lsarlookupsids_in_data, NDR_IN, lsarlookupsids_in_check); - /* torture_suite_add_ndr_pull_fn_test(suite, lsa_LookupSids, lsarlookupsids_out_data, NDR_IN, lsarlookupsids_out_check); */ + torture_suite_add_ndr_pull_fn_test(suite, lsa_LookupSids, lsarlookupsids_out_data, NDR_OUT, lsarlookupsids_out_check); + + torture_suite_add_ndr_pull_fn_test(suite, lsa_CreateAccount, lsarcreateaccount_in_data, NDR_IN, lsarcreateaccount_in_check); + torture_suite_add_ndr_pull_fn_test(suite, lsa_CreateAccount, lsarcreateaccount_out_data, NDR_OUT, lsarcreateaccount_out_check); + + torture_suite_add_ndr_pull_fn_test(suite, lsa_Delete, lsardelete_in_data, NDR_IN, lsardelete_in_check); + torture_suite_add_ndr_pull_fn_test(suite, lsa_Delete, lsardelete_out_data, NDR_OUT, lsardelete_out_check); + + torture_suite_add_ndr_pull_fn_test(suite, lsa_CreateSecret, lsarcreatesecret_in_data, NDR_IN, lsarcreatesecret_in_check); + torture_suite_add_ndr_pull_fn_test(suite, lsa_CreateSecret, lsarcreatesecret_out_data, NDR_OUT, lsarcreatesecret_out_check); + + torture_suite_add_ndr_pull_fn_test(suite, lsa_OpenSecret, lsaropensecret_in_data, NDR_IN, lsaropensecret_in_check); + torture_suite_add_ndr_pull_fn_test(suite, lsa_OpenSecret, lsaropensecret_out_data, NDR_OUT, lsaropensecret_out_check); + + torture_suite_add_ndr_pull_fn_test(suite, lsa_SetSecret, lsarsetsecret_in_data, NDR_IN, lsarsetsecret_in_check); + torture_suite_add_ndr_pull_fn_test(suite, lsa_SetSecret, lsarsetsecret_out_data, NDR_OUT, lsarsetsecret_out_check); + torture_suite_add_ndr_pull_fn_test(suite, lsa_QuerySecret, lsarquerysecret_in_data, NDR_IN, lsarquerysecret_in_check); + torture_suite_add_ndr_pull_fn_test(suite, lsa_QuerySecret, lsarquerysecret_out_data, NDR_OUT, lsarquerysecret_out_check); return suite; } -- cgit