summaryrefslogtreecommitdiff
path: root/source4/torture
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2007-02-16 01:08:59 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:48:23 -0500
commit3a93b655dd0d29ad9227d4530dde1996061f7116 (patch)
tree401bcbccf86fbd5679119020e98bde62355a9e8f /source4/torture
parentf88c667e6a901aa401980503d29d0f68870dfa10 (diff)
downloadsamba-3a93b655dd0d29ad9227d4530dde1996061f7116.tar.gz
samba-3a93b655dd0d29ad9227d4530dde1996061f7116.tar.bz2
samba-3a93b655dd0d29ad9227d4530dde1996061f7116.zip
r21378: Add simple NDR epmap test.
(This used to be commit b29170c8eaafa3a573b0e26efecd6cacd68250b6)
Diffstat (limited to 'source4/torture')
-rw-r--r--source4/torture/config.mk3
-rw-r--r--source4/torture/ndr/epmap.c78
-rw-r--r--source4/torture/ndr/ndr.c1
3 files changed, 81 insertions, 1 deletions
diff --git a/source4/torture/config.mk b/source4/torture/config.mk
index 15d34c0def..2c0a474174 100644
--- a/source4/torture/config.mk
+++ b/source4/torture/config.mk
@@ -103,7 +103,8 @@ PRIVATE_PROTO_HEADER = ndr/proto.h
OBJ_FILES = ndr/ndr.o \
ndr/winreg.o \
ndr/atsvc.o \
- ndr/lsa.o
+ ndr/lsa.o \
+ ndr/epmap.o
[MODULE::torture_rpc]
# TORTURE_NET and TORTURE_NBT use functions from torture_rpc...
diff --git a/source4/torture/ndr/epmap.c b/source4/torture/ndr/epmap.c
new file mode 100644
index 0000000000..cb69fbcf13
--- /dev/null
+++ b/source4/torture/ndr/epmap.c
@@ -0,0 +1,78 @@
+/*
+ Unix SMB/CIFS implementation.
+ test suite for epmap ndr operations
+
+ Copyright (C) Jelmer Vernooij 2007
+
+ 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
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include "includes.h"
+#include "torture/ndr/ndr.h"
+#include "librpc/gen_ndr/ndr_epmapper.h"
+
+static const uint8_t map_in_data[] = {
+ 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x4b, 0x00, 0x00, 0x00, 0x4b, 0x00, 0x00, 0x00, 0x05, 0x00, 0x13, 0x00,
+ 0x0d, 0x78, 0x57, 0x34, 0x12, 0x34, 0x12, 0xcd, 0xab, 0xef, 0x00, 0x01,
+ 0x23, 0x45, 0x67, 0x89, 0xac, 0x01, 0x00, 0x02, 0x00, 0x00, 0x00, 0x13,
+ 0x00, 0x0d, 0x04, 0x5d, 0x88, 0x8a, 0xeb, 0x1c, 0xc9, 0x11, 0x9f, 0xe8,
+ 0x08, 0x00, 0x2b, 0x10, 0x48, 0x60, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x0b, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0x02, 0x00,
+ 0x00, 0x00, 0x01, 0x00, 0x09, 0x04, 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, 0x00, 0x01, 0x00, 0x00, 0x00
+};
+
+static bool map_in_check(struct torture_context *tctx,
+ struct epm_Map *r)
+{
+ /* FIXME: Object */
+ torture_assert_int_equal(tctx, r->in.max_towers, 1, "max towers");
+ torture_assert(tctx, r->in.map_tower != NULL, "map tower");
+ torture_assert_int_equal(tctx, r->in.map_tower->tower_length, 75, "tower len");
+ /* FIXME: entry handle */
+
+ return true;
+}
+
+static const uint8_t map_out_data[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x18, 0xc3, 0x47, 0xdd, 0xe6, 0x5a, 0x8b, 0x42,
+ 0xb3, 0xb7, 0xc7, 0x79, 0x7b, 0xf0, 0x45, 0xe0, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x00, 0x4b, 0x00, 0x00, 0x00
+};
+
+static bool map_out_check(struct torture_context *tctx,
+ struct epm_Map *r)
+{
+ torture_assert_int_equal(tctx, *r->out.num_towers, 1, "num towers");
+ torture_assert_int_equal(tctx, r->out.result, 0x4b, "return code");
+ /* FIXME: entry handle */
+
+ return true;
+}
+
+struct torture_suite *ndr_epmap_suite(TALLOC_CTX *ctx)
+{
+ struct torture_suite *suite = torture_suite_create(ctx, "epmap");
+
+ torture_suite_add_ndr_pull_fn_test(suite, epm_Map, map_in_data, NDR_IN, map_in_check );
+ /* torture_suite_add_ndr_pull_fn_test(suite, epm_Map, map_out_data, NDR_OUT, map_out_check ); */
+
+ return suite;
+}
+
diff --git a/source4/torture/ndr/ndr.c b/source4/torture/ndr/ndr.c
index 463311613d..2d949ae044 100644
--- a/source4/torture/ndr/ndr.c
+++ b/source4/torture/ndr/ndr.c
@@ -88,6 +88,7 @@ NTSTATUS torture_ndr_init(void)
torture_suite_add_suite(suite, ndr_winreg_suite(suite));
torture_suite_add_suite(suite, ndr_atsvc_suite(suite));
torture_suite_add_suite(suite, ndr_lsa_suite(suite));
+ torture_suite_add_suite(suite, ndr_epmap_suite(suite));
torture_register_suite(suite);