diff options
Diffstat (limited to 'source4/torture')
-rw-r--r-- | source4/torture/dfs/domaindfs.c | 15 | ||||
-rw-r--r-- | source4/torture/ndr/dfsblob.c | 54 |
2 files changed, 59 insertions, 10 deletions
diff --git a/source4/torture/dfs/domaindfs.c b/source4/torture/dfs/domaindfs.c index 18c84396d3..022aafff99 100644 --- a/source4/torture/dfs/domaindfs.c +++ b/source4/torture/dfs/domaindfs.c @@ -47,6 +47,10 @@ static bool test_getdomainreferral(struct torture_context *tctx, "0 domains referrals returned"); torture_assert_int_equal(tctx, resp.header_flags, 0, "Header flag different it's not a referral server"); + torture_assert_int_equal(tctx, resp.referral_entries[1].version, 3, + talloc_asprintf(tctx, + "Not expected version for referral entry 1 got %d expected 3", + resp.referral_entries[1].version)); torture_assert_int_equal(tctx, resp.referral_entries[0].version, 3, talloc_asprintf(tctx, "Not expected version for referral entry 0 got %d expected 3", @@ -74,6 +78,7 @@ static bool test_getdcreferral(struct torture_context *tctx, struct dfs_GetDFSReferral r, r2, r3; struct dfs_referral_resp resp, resp2, resp3; const char* str; + const char* str2; r.in.req.max_referral_level = 3; r.in.req.servername = ""; @@ -125,6 +130,16 @@ static bool test_getdcreferral(struct torture_context *tctx, resp2.referral_entries[0].referral.v3.data.referrals.r2.expanded_names[0]) > 0, 1, "Length of first dc is less than 0"); + str = strchr(resp2.referral_entries[0].referral.v3.data.referrals.r2.expanded_names[0], '.'); + str2 = resp2.referral_entries[0].referral.v3.data.referrals.r2.special_name; + if (str2[0] == '\\') { + str2++; + } + torture_assert_int_equal(tctx, strlen(str) >0, 1 ,"Length of domain too short"); + str++; + torture_assert_int_equal(tctx, strcmp(str,str2), 0, + talloc_asprintf(tctx, "Pb domain of the dc is not"\ + "the same as the requested: domain = %s got =%s",str2 ,str)); r3.in.req.max_referral_level = 3; /* diff --git a/source4/torture/ndr/dfsblob.c b/source4/torture/ndr/dfsblob.c index 96d3407815..23a32e163f 100644 --- a/source4/torture/ndr/dfsblob.c +++ b/source4/torture/ndr/dfsblob.c @@ -3,7 +3,7 @@ Test DFS blobs. - Copyright (C) Matthieu Patou <mat@matws.net> 2009 + Copyright (C) Matthieu Patou <mat@matws.net> 2009-2010 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -22,29 +22,63 @@ #include "includes.h" #include "torture/ndr/ndr.h" #include "librpc/gen_ndr/ndr_dfsblobs.h" +#include "librpc/gen_ndr/dfsblobs.h" +DATA_BLOB blob; static const uint8_t dfs_get_ref_in[] = { 0x03, 0x00, 0x5c, 0x00, 0x57, 0x00, 0x32, 0x00, 0x4b, 0x00, 0x33, 0x00, 0x00, 0x00 }; static const uint8_t dfs_get_ref_out[] = { - 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x03, 0x00, 0x22, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x58, 0x02, 0x00, 0x00, 0x22, 0x00, - 0x01, 0x00, 0x2e, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x22, 0x00, 0x00, 0x00, 0x02, 0x00, + 0x58, 0x02, 0x00, 0x00, 0x22, 0x00, 0x01, 0x00, + 0x3a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x5c, 0x00, 0x6d, 0x00, 0x73, 0x00, + 0x77, 0x00, 0x32, 0x00, 0x6b, 0x00, 0x33, 0x00, + 0x2e, 0x00, 0x74, 0x00, 0x73, 0x00, 0x74, 0x00, + 0x00, 0x00, 0x5c, 0x00, 0x77, 0x00, 0x32, 0x00, + 0x6b, 0x00, 0x33, 0x00, 0x61, 0x00, 0x64, 0x00, + 0x76, 0x00, 0x7a, 0x00, 0x30, 0x00, 0x31, 0x00, + 0x2e, 0x00, 0x6d, 0x00, 0x73, 0x00, 0x77, 0x00, + 0x32, 0x00, 0x6b, 0x00, 0x33, 0x00, 0x2e, 0x00, + 0x74, 0x00, 0x73, 0x00, 0x74, 0x00, 0x00, 0x00}; + +static const uint8_t dfs_get_ref_out2[] = { + 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x12, 0x00, 0x00, 0x00, 0x02, 0x00, + 0x58, 0x02, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x03, 0x00, 0x12, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x58, 0x02, 0x00, 0x00, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x57, 0x00, - 0x32, 0x00, 0x4b, 0x00, 0x33, 0x00, 0x00, 0x00, - 0x5c, 0x00, 0x57, 0x00, 0x32, 0x00, 0x4b, 0x00, - 0x33, 0x00, 0x2d, 0x00, 0x31, 0x00, 0x30, 0x00, - 0x31, 0x00, 0x00, 0x00 }; + 0x32, 0x00, 0x4b, 0x00, 0x38, 0x00, 0x52, 0x00, + 0x32, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x77, 0x00, + 0x32, 0x00, 0x6b, 0x00, 0x38, 0x00, 0x72, 0x00, + 0x32, 0x00, 0x2e, 0x00, 0x6d, 0x00, 0x61, 0x00, + 0x74, 0x00, 0x77, 0x00, 0x73, 0x00, 0x2e, 0x00, + 0x6e, 0x00, 0x65, 0x00, 0x74, 0x00, 0x00, 0x00 +}; +static bool dfs_referral_out_check(struct torture_context *tctx, struct dfs_referral_resp *r) +{ + torture_assert_str_equal(tctx, + r->referral_entries[0].referral.v3.data.referrals.r2.special_name, + "\\msw2k3.tst", "Special name"); + ndr_push_struct_blob(&blob, tctx, r, (ndr_push_flags_fn_t)ndr_push_dfs_referral_resp); + torture_assert_int_equal(tctx, blob.data[blob.length-2], 0, "expanded names not null terminated"); + torture_assert_int_equal(tctx, blob.data[blob.length-1], 0, "expanded names not null terminated"); + return true; +} struct torture_suite *ndr_dfsblob_suite(TALLOC_CTX *ctx) { struct torture_suite *suite = torture_suite_create(ctx, "dfsblob"); torture_suite_add_ndr_pull_fn_test(suite, dfs_GetDFSReferral_in, dfs_get_ref_in, NDR_IN, NULL); - torture_suite_add_ndr_pull_fn_test(suite, dfs_referral_resp, dfs_get_ref_out, NDR_BUFFERS|NDR_SCALARS, NULL); + + torture_suite_add_ndr_pull_fn_test(suite, dfs_referral_resp, dfs_get_ref_out2, NDR_BUFFERS|NDR_SCALARS, NULL); + + torture_suite_add_ndr_pull_fn_test(suite, dfs_referral_resp, dfs_get_ref_out, NDR_BUFFERS|NDR_SCALARS,dfs_referral_out_check); return suite; } |