summaryrefslogtreecommitdiff
path: root/source4/torture/ndr
diff options
context:
space:
mode:
authorMatthieu Patou <mat@matws.net>2010-09-04 12:04:18 +0400
committerMatthieu Patou <mat@sn-devel-104.sn.samba.org>2010-10-05 08:01:39 +0000
commit906e3f12973a26e387116508ea745dc554221764 (patch)
treecd8012b0170d90a0a72b1cf44cc88f95b0dc7667 /source4/torture/ndr
parent8a0095b930f7ad2a4451f56f204fb0bd73bce66b (diff)
downloadsamba-906e3f12973a26e387116508ea745dc554221764.tar.gz
samba-906e3f12973a26e387116508ea745dc554221764.tar.bz2
samba-906e3f12973a26e387116508ea745dc554221764.zip
torture: complete dfs referral tests
Autobuild-User: Matthieu Patou <mat@samba.org> Autobuild-Date: Tue Oct 5 08:01:39 UTC 2010 on sn-devel-104
Diffstat (limited to 'source4/torture/ndr')
-rw-r--r--source4/torture/ndr/dfsblob.c54
1 files changed, 44 insertions, 10 deletions
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;
}