s4:provision_users.ldif - fix up and reorder the well-known security principals
[Samba/ekacnet.git] / source4 / torture / ndr / drsblobs.c
blob77cbe5f80faaee16e46b7e9df9d5eaad7c27f3e4
1 /*
2 Unix SMB/CIFS implementation.
3 test suite for drsblobs ndr operations
5 Copyright (C) Guenther Deschner 2010
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>.
21 #include "includes.h"
22 #include "torture/ndr/ndr.h"
23 #include "librpc/gen_ndr/ndr_drsblobs.h"
25 static const uint8_t forest_trust_info_data_out[] = {
26 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00,
27 0x00, 0x00, 0x00, 0x00, 0x3e, 0xca, 0xca, 0x01, 0x00, 0xaf, 0xd5, 0x9b,
28 0x00, 0x07, 0x00, 0x00, 0x00, 0x66, 0x32, 0x2e, 0x74, 0x65, 0x73, 0x74,
29 0x3a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0xca, 0xca, 0x01,
30 0x00, 0xaf, 0xd5, 0x9b, 0x02, 0x18, 0x00, 0x00, 0x00, 0x01, 0x04, 0x00,
31 0x00, 0x00, 0x00, 0x00, 0x05, 0x15, 0x00, 0x00, 0x00, 0x68, 0x4a, 0x64,
32 0x28, 0xac, 0x88, 0xa2, 0x74, 0x17, 0x3e, 0x2d, 0x8f, 0x07, 0x00, 0x00,
33 0x00, 0x66, 0x32, 0x2e, 0x74, 0x65, 0x73, 0x74, 0x02, 0x00, 0x00, 0x00,
34 0x46, 0x32
37 static bool forest_trust_info_check_out(struct torture_context *tctx,
38 struct ForestTrustInfo *r)
40 torture_assert_int_equal(tctx, r->version, 1, "version");
41 torture_assert_int_equal(tctx, r->count, 2, "count");
42 torture_assert_int_equal(tctx, r->records[0].record_size, 0x00000018, "record size");
43 torture_assert_int_equal(tctx, r->records[0].record.flags, 0, "record flags");
44 torture_assert_u64_equal(tctx, r->records[0].record.timestamp, 0x9BD5AF0001CACA3E, "record timestamp");
45 torture_assert_int_equal(tctx, r->records[0].record.type, FOREST_TRUST_TOP_LEVEL_NAME, "record type");
46 torture_assert_int_equal(tctx, r->records[0].record.data.name.size, 7, "record name size");
47 torture_assert_str_equal(tctx, r->records[0].record.data.name.string, "f2.test", "record name string");
48 torture_assert_int_equal(tctx, r->records[1].record_size, 0x0000003a, "record size");
49 torture_assert_int_equal(tctx, r->records[1].record.flags, 0, "record flags");
50 torture_assert_u64_equal(tctx, r->records[1].record.timestamp, 0x9BD5AF0001CACA3E, "record timestamp");
51 torture_assert_int_equal(tctx, r->records[1].record.type, FOREST_TRUST_DOMAIN_INFO, "record type");
52 torture_assert_int_equal(tctx, r->records[1].record.data.info.sid_size, 0x00000018, "record info sid_size");
53 torture_assert_sid_equal(tctx, &r->records[1].record.data.info.sid, dom_sid_parse_talloc(tctx, "S-1-5-21-677661288-1956808876-2402106903"), "record info sid");
54 torture_assert_int_equal(tctx, r->records[1].record.data.info.dns_name.size, 7, "record name size");
55 torture_assert_str_equal(tctx, r->records[1].record.data.info.dns_name.string, "f2.test", "record info dns_name string");
56 torture_assert_int_equal(tctx, r->records[1].record.data.info.netbios_name.size, 2, "record info netbios_name size");
57 torture_assert_str_equal(tctx, r->records[1].record.data.info.netbios_name.string, "F2", "record info netbios_name string");
59 return true;
62 struct torture_suite *ndr_drsblobs_suite(TALLOC_CTX *ctx)
64 struct torture_suite *suite = torture_suite_create(ctx, "drsblobs");
66 torture_suite_add_ndr_pull_fn_test(suite, ForestTrustInfo, forest_trust_info_data_out, NDR_IN, forest_trust_info_check_out);
68 return suite;