s4:torture-ndr add lsarSetForestTrustInformation ndr test
authorSimo Sorce <idra@samba.org>
Fri, 26 Feb 2010 02:40:27 +0000 (21:40 -0500)
committerGünther Deschner <gd@samba.org>
Tue, 16 Mar 2010 14:12:19 +0000 (15:12 +0100)
Signed-off-by: Günther Deschner <gd@samba.org>
source4/torture/ndr/lsa.c

index ce562c66320f55230c84cce7fc274c98e431930f..216bf42a224c4bd40d7bedaf9b71b8813556e932 100644 (file)
@@ -1981,6 +1981,55 @@ static bool lsarenumerateprivileges_out_check(struct torture_context *tctx,
        return true;
 }
 
+static const uint8_t lsarsetforesttrustsinformation_in_data[] = {
+  0x00, 0x00, 0x00, 0x00, 0x42, 0x3e, 0xd4, 0x20, 0x20, 0xe8, 0xa1, 0x43,
+  0x96, 0x67, 0x8c, 0xd1, 0xb9, 0x48, 0xa0, 0x3d, 0x0e, 0x00, 0x10, 0x00,
+  0x00, 0x00, 0x02, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x07, 0x00, 0x00, 0x00, 0x66, 0x00, 0x31, 0x00, 0x2e, 0x00, 0x74, 0x00,
+  0x65, 0x00, 0x73, 0x00, 0x74, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00,
+  0x04, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x02, 0x00,
+  0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x10, 0x00, 0x0c, 0x00, 0x02, 0x00,
+  0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+  0x66, 0x00, 0x31, 0x00, 0x2e, 0x00, 0x74, 0x00, 0x65, 0x00, 0x73, 0x00,
+  0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+  0x14, 0x00, 0x02, 0x00, 0x0e, 0x00, 0x10, 0x00, 0x18, 0x00, 0x02, 0x00,
+  0x04, 0x00, 0x06, 0x00, 0x1c, 0x00, 0x02, 0x00, 0x04, 0x00, 0x00, 0x00,
+  0x01, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x15, 0x00, 0x00, 0x00,
+  0x60, 0xcc, 0x85, 0x53, 0x92, 0x64, 0x11, 0x5e, 0x37, 0xa1, 0x11, 0x65,
+  0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
+  0x66, 0x00, 0x31, 0x00, 0x2e, 0x00, 0x74, 0x00, 0x65, 0x00, 0x73, 0x00,
+  0x74, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x02, 0x00, 0x00, 0x00, 0x46, 0x00, 0x31, 0x00, 0x01
+};
+
+static bool lsarsetforesttrustsinformation_in_check(struct torture_context *tctx,
+                                                    struct lsa_lsaRSetForestTrustInformation *r)
+{
+       /* FIXME: Handle */
+       torture_assert_str_equal(tctx, r->in.trusted_domain_name->string, "f1.test", "trusted domain name");
+       torture_assert_int_equal(tctx, r->in.highest_record_type, 2, "highest record type");
+       torture_assert(tctx, r->in.forest_trust_info != NULL, "forest trust info");
+       torture_assert_int_equal(tctx, r->in.forest_trust_info->count, 2, "number fo forest trust records");
+       torture_assert_int_equal(tctx, r->in.forest_trust_info->entries[0]->flags, 0, "first entry flags");
+       torture_assert_int_equal(tctx, r->in.forest_trust_info->entries[0]->type, 0, "first entry type");
+       torture_assert_int_equal(tctx, r->in.forest_trust_info->entries[0]->time, 0, "first entry time");
+       torture_assert_str_equal(tctx, r->in.forest_trust_info->entries[0]->forest_trust_data.top_level_name.string, "f1.test", "first entry data");
+       torture_assert_int_equal(tctx, r->in.forest_trust_info->entries[1]->flags, 0, "second entry flags");
+       torture_assert_int_equal(tctx, r->in.forest_trust_info->entries[1]->type, 2, "second entry type");
+       torture_assert_int_equal(tctx, r->in.forest_trust_info->entries[1]->time, 0, "second entry time");
+       torture_assert_str_equal(tctx, r->in.forest_trust_info->entries[1]->forest_trust_data.domain_info.dns_domain_name.string, "f1.test", "second entry data");
+       torture_assert_str_equal(tctx, r->in.forest_trust_info->entries[1]->forest_trust_data.domain_info.netbios_domain_name.string, "F1", "second entry data");
+       torture_assert_int_equal(tctx, r->in.check_only, 1, "check only");
+
+       torture_assert_ntstatus_ok(tctx, r->out.result, "return code");
+
+       return true;
+}
+
+
 struct torture_suite *ndr_lsa_suite(TALLOC_CTX *ctx)
 {
        struct torture_suite *suite = torture_suite_create(ctx, "lsa");
@@ -2036,6 +2085,8 @@ struct torture_suite *ndr_lsa_suite(TALLOC_CTX *ctx)
        torture_suite_add_ndr_pull_fn_test(suite, lsa_EnumPrivs, lsarenumerateprivileges_in_data, NDR_IN, lsarenumerateprivileges_in_check);
        torture_suite_add_ndr_pull_fn_test(suite, lsa_EnumPrivs, lsarenumerateprivileges_out_data, NDR_OUT, lsarenumerateprivileges_out_check);
 
+       torture_suite_add_ndr_pull_fn_test(suite, lsa_lsaRSetForestTrustInformation, lsarsetforesttrustsinformation_in_data, NDR_IN, lsarsetforesttrustsinformation_in_check);
+
        return suite;
 }