r25667: Start on frsapi testsuite.
authorGünther Deschner <gd@samba.org>
Tue, 16 Oct 2007 11:44:43 +0000 (13:44 +0200)
committerStefan Metzmacher <metze@samba.org>
Fri, 21 Dec 2007 04:43:06 +0000 (05:43 +0100)
Guenther
(This used to be commit ebcbdb5fbdb30005a60431687a738df5f26d3472)

source4/librpc/config.mk
source4/librpc/idl/frsapi.idl
source4/torture/config.mk
source4/torture/rpc/frsapi.c [new file with mode: 0644]
source4/torture/rpc/rpc.c

index 01f7b80490942fa559fa767e497c1d1d112d1ecf..40bfb5cb0f3b659fa149ac8c74f42bd82aacf3ad 100644 (file)
@@ -329,6 +329,10 @@ PUBLIC_DEPENDENCIES = dcerpc NDR_LSA
 OBJ_FILES = gen_ndr/ndr_dfs_c.o
 PUBLIC_DEPENDENCIES = dcerpc NDR_DFS
 
+[SUBSYSTEM::RPC_NDR_FRSAPI]
+OBJ_FILES = gen_ndr/ndr_frsapi_c.o
+PUBLIC_DEPENDENCIES = dcerpc NDR_FRSAPI
+
 [SUBSYSTEM::RPC_NDR_DRSUAPI]
 OBJ_FILES = gen_ndr/ndr_drsuapi_c.o
 PUBLIC_DEPENDENCIES = dcerpc NDR_DRSUAPI
index 2f8e1ba9df3ffa11677ec44d53771d4e16060325..d75be0ec04260ab998e141850f2394cb8b91a0c0 100644 (file)
@@ -29,14 +29,18 @@ interface frsapi
 
        /****************/
        /* Function 0x04 */
+
+       /* The DsPollingLongInterval and DsPollingShortInterval attributes
+          represent registry attributes below HKLM\System\CCS\Services\NtFrs */
+
        WERROR frsapi_SetDsPollingIntervalW(
                [in] uint32 CurrentInterval,
                [in] uint32 DsPollingLongInterval,
                [in] uint32 DsPollingShortInterval
        );
 
-        /****************/
-        /* Function 0x05 */
+       /****************/
+       /* Function 0x05 */
        WERROR frsapi_GetDsPollingIntervalW(
                [out] uint32 *CurrentInterval,
                [out] uint32 *DsPollingLongInterval,
index 02188d856062d2461269011bf5f2b98d509bec5b..d9c70131e6df4e4b5ae931afdd63c2a31c50932e 100644 (file)
@@ -159,12 +159,13 @@ OBJ_FILES = \
                rpc/samba3rpc.o \
                rpc/rpc.o \
                rpc/async_bind.o \
-               rpc/handles.o
+               rpc/handles.o \
+               rpc/frsapi.o
 PRIVATE_DEPENDENCIES = \
                NDR_TABLE RPC_NDR_UNIXINFO dcerpc_samr RPC_NDR_WINREG RPC_NDR_INITSHUTDOWN \
                RPC_NDR_OXIDRESOLVER RPC_NDR_EVENTLOG RPC_NDR_ECHO RPC_NDR_SVCCTL \
                RPC_NDR_NETLOGON dcerpc_atsvc dcerpc_mgmt RPC_NDR_DRSUAPI \
-               RPC_NDR_LSA RPC_NDR_EPMAPPER RPC_NDR_DFS RPC_NDR_SPOOLSS \
+               RPC_NDR_LSA RPC_NDR_EPMAPPER RPC_NDR_DFS RPC_NDR_FRSAPI RPC_NDR_SPOOLSS \
                RPC_NDR_SRVSVC RPC_NDR_WKSSVC RPC_NDR_ROT RPC_NDR_DSSETUP \
                RPC_NDR_REMACT RPC_NDR_OXIDRESOLVER WB_HELPER LIBSAMBA-NET \
                LIBCLI_AUTH POPT_CREDENTIALS TORTURE_LDAP TORTURE_UTIL TORTURE_RAP \
diff --git a/source4/torture/rpc/frsapi.c b/source4/torture/rpc/frsapi.c
new file mode 100644 (file)
index 0000000..d65d551
--- /dev/null
@@ -0,0 +1,121 @@
+/*
+   Unix SMB/CIFS implementation.
+   test suite for rpc frsapi operations
+
+   Copyright (C) Guenther Deschner 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/torture.h"
+#include "torture/rpc/rpc.h"
+#include "librpc/gen_ndr/ndr_frsapi_c.h"
+#include "torture/util.h"
+
+static bool test_GetDsPollingIntervalW(struct torture_context *tctx,
+                                      struct dcerpc_pipe *p,
+                                      uint32_t *CurrentInterval,
+                                      uint32_t *DsPollingLongInterval,
+                                      uint32_t *DsPollingShortInterval)
+{
+       struct frsapi_GetDsPollingIntervalW r;
+
+       ZERO_STRUCT(r);
+
+       r.out.CurrentInterval = CurrentInterval;
+       r.out.DsPollingLongInterval = DsPollingLongInterval;
+       r.out.DsPollingShortInterval = DsPollingShortInterval;
+
+       torture_assert_ntstatus_ok(tctx,
+               dcerpc_frsapi_GetDsPollingIntervalW(p, tctx, &r),
+               "GetDsPollingIntervalW failed");
+
+       torture_assert_werr_ok(tctx, r.out.result,
+                              "GetDsPollingIntervalW failed");
+
+       return true;
+}
+
+static bool test_SetDsPollingIntervalW(struct torture_context *tctx,
+                                      struct dcerpc_pipe *p,
+                                      uint32_t CurrentInterval,
+                                      uint32_t DsPollingLongInterval,
+                                      uint32_t DsPollingShortInterval)
+{
+       struct frsapi_SetDsPollingIntervalW r;
+
+       ZERO_STRUCT(r);
+
+       r.in.CurrentInterval = CurrentInterval;
+       r.in.DsPollingLongInterval = DsPollingLongInterval;
+       r.in.DsPollingShortInterval = DsPollingShortInterval;
+
+       torture_assert_ntstatus_ok(tctx,
+               dcerpc_frsapi_SetDsPollingIntervalW(p, tctx, &r),
+               "SetDsPollingIntervalW failed");
+
+       torture_assert_werr_ok(tctx, r.out.result,
+                              "SetDsPollingIntervalW failed");
+
+       return true;
+}
+
+static bool test_DsPollingIntervalW(struct torture_context *tctx,
+                                   struct dcerpc_pipe *p)
+{
+       uint32_t i1, i2, i3;
+       uint32_t k1, k2, k3;
+
+       if (!test_GetDsPollingIntervalW(tctx, p, &i1, &i2, &i3)) {
+               return false;
+       }
+
+       if (!test_SetDsPollingIntervalW(tctx, p, i1, i2, i3)) {
+               return false;
+       }
+
+       k1 = i1;
+       k2 = k3 = 0;
+
+       if (!test_SetDsPollingIntervalW(tctx, p, k1, k2, k3)) {
+               return false;
+       }
+
+       if (!test_GetDsPollingIntervalW(tctx, p, &k1, &k2, &k3)) {
+               return false;
+       }
+
+       if ((i1 != k1) || (i2 != k2) || (i3 != k3)) {
+               return false;
+       }
+
+       return true;
+}
+
+struct torture_suite *torture_rpc_frsapi(TALLOC_CTX *mem_ctx)
+{
+       struct torture_rpc_tcase *tcase;
+       struct torture_suite *suite = torture_suite_create(mem_ctx, "FRSAPI");
+       struct torture_test *test;
+
+       tcase = torture_suite_add_rpc_iface_tcase(suite, "frsapi",
+                                                 &ndr_table_frsapi);
+
+       test = torture_rpc_tcase_add_test(tcase, "DsPollingIntervalW",
+                                         test_DsPollingIntervalW);
+
+       return suite;
+}
index 6891783a8241501968cda1f4bbcb6d49a173c15a..19511108b5ac04754ba0378fc206e3690d39a783 100644 (file)
@@ -381,6 +381,7 @@ NTSTATUS torture_rpc_init(void)
        torture_suite_add_suite(suite, torture_rpc_lsa_secrets(suite));
        torture_suite_add_suite(suite, torture_rpc_echo(suite));
        torture_suite_add_simple_test(suite, "DFS", torture_rpc_dfs);
+       torture_suite_add_suite(suite, torture_rpc_frsapi(suite));
        torture_suite_add_suite(suite, torture_rpc_unixinfo(suite));
        torture_suite_add_suite(suite, torture_rpc_eventlog(suite));
        torture_suite_add_suite(suite, torture_rpc_atsvc(suite));