| 1 |
/* |
| 2 |
Unix SMB/CIFS implementation. |
| 3 |
test suite for epmap ndr operations |
| 4 |
|
| 5 |
Copyright (C) Jelmer Vernooij 2007 |
| 6 |
|
| 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. |
| 11 |
|
| 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. |
| 16 |
|
| 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/>. |
| 19 |
*/ |
| 20 |
|
| 21 |
#include "includes.h" |
| 22 |
#include "torture/ndr/ndr.h" |
| 23 |
#include "librpc/gen_ndr/ndr_epmapper.h" |
| 24 |
#include "torture/ndr/proto.h" |
| 25 |
|
| 26 |
static const uint8_t map_in_data[] = { |
| 27 |
0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 28 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, |
| 29 |
0x4b, 0x00, 0x00, 0x00, 0x4b, 0x00, 0x00, 0x00, 0x05, 0x00, 0x13, 0x00, |
| 30 |
0x0d, 0x78, 0x57, 0x34, 0x12, 0x34, 0x12, 0xcd, 0xab, 0xef, 0x00, 0x01, |
| 31 |
0x23, 0x45, 0x67, 0x89, 0xac, 0x01, 0x00, 0x02, 0x00, 0x00, 0x00, 0x13, |
| 32 |
0x00, 0x0d, 0x04, 0x5d, 0x88, 0x8a, 0xeb, 0x1c, 0xc9, 0x11, 0x9f, 0xe8, |
| 33 |
0x08, 0x00, 0x2b, 0x10, 0x48, 0x60, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, |
| 34 |
0x01, 0x00, 0x0b, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0x02, 0x00, |
| 35 |
0x00, 0x00, 0x01, 0x00, 0x09, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 36 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 37 |
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00 |
| 38 |
}; |
| 39 |
|
| 40 |
static bool map_in_check(struct torture_context *tctx, |
| 41 |
struct epm_Map *r) |
| 42 |
{ |
| 43 |
/* FIXME: Object */ |
| 44 |
torture_assert_int_equal(tctx, r->in.max_towers, 1, "max towers"); |
| 45 |
torture_assert(tctx, r->in.map_tower != NULL, "map tower"); |
| 46 |
torture_assert_int_equal(tctx, r->in.map_tower->tower_length, 75, "tower len"); |
| 47 |
/* FIXME: entry handle */ |
| 48 |
|
| 49 |
return true; |
| 50 |
} |
| 51 |
|
| 52 |
#if 0 |
| 53 |
static const uint8_t map_out_data[] = { |
| 54 |
0x00, 0x00, 0x00, 0x00, 0x18, 0xc3, 0x47, 0xdd, 0xe6, 0x5a, 0x8b, 0x42, |
| 55 |
0xb3, 0xb7, 0xc7, 0x79, 0x7b, 0xf0, 0x45, 0xe0, 0x01, 0x00, 0x00, 0x00, |
| 56 |
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, |
| 57 |
0x05, 0x00, 0x00, 0x00, 0x4b, 0x00, 0x00, 0x00 |
| 58 |
}; |
| 59 |
|
| 60 |
static bool map_out_check(struct torture_context *tctx, |
| 61 |
struct epm_Map *r) |
| 62 |
{ |
| 63 |
torture_assert_int_equal(tctx, *r->out.num_towers, 1, "num towers"); |
| 64 |
torture_assert_int_equal(tctx, r->out.result, 0x4b, "return code"); |
| 65 |
/* FIXME: entry handle */ |
| 66 |
|
| 67 |
return true; |
| 68 |
} |
| 69 |
#endif |
| 70 |
|
| 71 |
struct torture_suite *ndr_epmap_suite(TALLOC_CTX *ctx) |
| 72 |
{ |
| 73 |
struct torture_suite *suite = torture_suite_create(ctx, "epmap"); |
| 74 |
|
| 75 |
torture_suite_add_ndr_pull_fn_test(suite, epm_Map, map_in_data, NDR_IN, map_in_check ); |
| 76 |
/* torture_suite_add_ndr_pull_fn_test(suite, epm_Map, map_out_data, NDR_OUT, map_out_check ); */ |
| 77 |
|
| 78 |
return suite; |
| 79 |
} |
| 80 |
|