2 Unix SMB/CIFS implementation.
6 Copyright (C) Matthieu Patou <mat@matws.net> 2009-2010
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
23 #include "torture/ndr/ndr.h"
24 #include "librpc/gen_ndr/ndr_dfsblobs.h"
25 #include "librpc/gen_ndr/dfsblobs.h"
28 static const uint8_t dfs_get_ref_in
[] = {
29 0x03, 0x00, 0x5c, 0x00, 0x57, 0x00, 0x32, 0x00,
30 0x4b, 0x00, 0x33, 0x00, 0x00, 0x00 };
32 static const uint8_t dfs_get_ref_out
[] = {
33 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
34 0x03, 0x00, 0x22, 0x00, 0x00, 0x00, 0x02, 0x00,
35 0x58, 0x02, 0x00, 0x00, 0x22, 0x00, 0x01, 0x00,
36 0x3a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
37 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
38 0x00, 0x00, 0x5c, 0x00, 0x6d, 0x00, 0x73, 0x00,
39 0x77, 0x00, 0x32, 0x00, 0x6b, 0x00, 0x33, 0x00,
40 0x2e, 0x00, 0x74, 0x00, 0x73, 0x00, 0x74, 0x00,
41 0x00, 0x00, 0x5c, 0x00, 0x77, 0x00, 0x32, 0x00,
42 0x6b, 0x00, 0x33, 0x00, 0x61, 0x00, 0x64, 0x00,
43 0x76, 0x00, 0x7a, 0x00, 0x30, 0x00, 0x31, 0x00,
44 0x2e, 0x00, 0x6d, 0x00, 0x73, 0x00, 0x77, 0x00,
45 0x32, 0x00, 0x6b, 0x00, 0x33, 0x00, 0x2e, 0x00,
46 0x74, 0x00, 0x73, 0x00, 0x74, 0x00, 0x00, 0x00};
48 static const uint8_t dfs_get_ref_out2
[] = {
49 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
50 0x03, 0x00, 0x12, 0x00, 0x00, 0x00, 0x02, 0x00,
51 0x58, 0x02, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00,
52 0x00, 0x00, 0x03, 0x00, 0x12, 0x00, 0x00, 0x00,
53 0x02, 0x00, 0x58, 0x02, 0x00, 0x00, 0x22, 0x00,
54 0x00, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x57, 0x00,
55 0x32, 0x00, 0x4b, 0x00, 0x38, 0x00, 0x52, 0x00,
56 0x32, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x77, 0x00,
57 0x32, 0x00, 0x6b, 0x00, 0x38, 0x00, 0x72, 0x00,
58 0x32, 0x00, 0x2e, 0x00, 0x6d, 0x00, 0x61, 0x00,
59 0x74, 0x00, 0x77, 0x00, 0x73, 0x00, 0x2e, 0x00,
60 0x6e, 0x00, 0x65, 0x00, 0x74, 0x00, 0x00, 0x00
62 static bool dfs_referral_out_check(struct torture_context
*tctx
, struct dfs_referral_resp
*r
)
64 torture_assert_str_equal(tctx
,
65 r
->referral_entries
[0].referral
.v3
.data
.referrals
.r2
.special_name
,
66 "\\msw2k3.tst", "Special name");
67 ndr_push_struct_blob(&blob
, tctx
, r
, (ndr_push_flags_fn_t
)ndr_push_dfs_referral_resp
);
68 torture_assert_int_equal(tctx
, blob
.data
[blob
.length
-2], 0, "expanded names not null terminated");
69 torture_assert_int_equal(tctx
, blob
.data
[blob
.length
-1], 0, "expanded names not null terminated");
73 struct torture_suite
*ndr_dfsblob_suite(TALLOC_CTX
*ctx
)
75 struct torture_suite
*suite
= torture_suite_create(ctx
, "dfsblob");
77 torture_suite_add_ndr_pull_fn_test(suite
, dfs_GetDFSReferral_in
, dfs_get_ref_in
, NDR_IN
, NULL
);
79 torture_suite_add_ndr_pull_fn_test(suite
, dfs_referral_resp
, dfs_get_ref_out2
, NDR_BUFFERS
|NDR_SCALARS
, NULL
);
81 torture_suite_add_ndr_pull_fn_test(suite
, dfs_referral_resp
, dfs_get_ref_out
, NDR_BUFFERS
|NDR_SCALARS
,dfs_referral_out_check
);