add simple WINBIND-NDR-GETDCINFO test v4-0-wb-torture
authorStefan Metzmacher <metze@sernet.de>
Wed, 19 Sep 2007 15:50:37 +0000 (17:50 +0200)
committerStefan Metzmacher <metze@samba.org>
Thu, 10 Jan 2008 19:19:35 +0000 (20:19 +0100)
which tests WINBIND_DC_INFO_LEVEL_COMPAT_NT4

metze

source/torture/winbind/ndr_based.c

index d41262bd3fd8b5a51e65f0cb1af31663e29decca..ba5b9c1a345a210a324197307679bbb59637958a 100644 (file)
@@ -20,8 +20,8 @@
 #include "includes.h"
 #include "torture/torture.h"
 #include "torture/winbind/proto.h"
-
 #include "nsswitch/wb_ndr_protocol.h"
+#include "param/param.h"
 
 #define DO_NDR_REQ_REP(op,r) do { \
        bool _ok; \
@@ -52,11 +52,39 @@ static bool torture_winbind_ndr_ping(struct torture_context *torture)
        return true;
 }
 
+static bool torture_winbind_ndr_get_dc_info(struct torture_context *torture)
+{
+       struct winbind_get_dc_info r;
+       enum winbind_dc_info_level level;
+
+       ZERO_STRUCT(r);
+       r.in.level      = &level;
+
+       *r.in.level             = WINBIND_DC_INFO_LEVEL_COMPAT_NT4;
+       r.in.domain_name        = lp_workgroup();
+       r.in.dc_name            = NULL;
+
+       DO_NDR_REQ_REP(NDR_WINBIND_GET_DC_INFO, &r);
+
+       torture_assert_int_equal(torture, *r.out.level,
+                                WINBIND_DC_INFO_LEVEL_COMPAT_NT4,
+                                __STRING(WINBIND_GET_DC_INFO));
+
+       torture_assert(torture, r.out.dc_info->name,
+                      __STRING(WINBIND_GET_DC_INFO));
+
+       /*
+        * TODO: test name string not only the pointer
+        */
+       return true;
+}
+
 struct torture_suite *torture_winbind_ndr_init(void)
 {
        struct torture_suite *suite = torture_suite_create(talloc_autofree_context(), "NDR");
 
        torture_suite_add_simple_test(suite, "PING", torture_winbind_ndr_ping);
+       torture_suite_add_simple_test(suite, "GETDCINFO", torture_winbind_ndr_get_dc_info);
 
        suite->description = talloc_strdup(suite, "WINBIND - ndr based protocol tests");