1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-10 01:18:15 +03:00

s4-torture: add clusapi torture test.

Guenther

Signed-off-by: Günther Deschner <gd@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
This commit is contained in:
Günther Deschner 2015-02-26 23:03:36 +01:00
parent f675c2b2a2
commit 89a036f359
4 changed files with 115 additions and 2 deletions

View File

@ -85,6 +85,7 @@
^samba4.rpc.ntsvcs # Not provided by Samba 4
^samba4.rpc.dfs # Not provided by Samba 4
^samba4.rpc.fsrvp # fsrvp server support not yet provided
^samba4.rpc.clusapi # clusapi server support not yet provided
^samba4.*.base.samba3.* # Samba3-specific test
^samba4.*.raw.samba3.* # Samba3-specific test
^samba4.rpc..*samba3.* # Samba3-specific test

View File

@ -0,0 +1,111 @@
/*
Unix SMB/CIFS implementation.
test suite for clusapi rpc operations
Copyright (C) Günther Deschner 2015
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 3 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, see <http://www.gnu.org/licenses/>.
*/
#include "includes.h"
#include "librpc/gen_ndr/ndr_clusapi_c.h"
#include "torture/rpc/torture_rpc.h"
#include "param/param.h"
static bool test_OpenCluster_int(struct torture_context *tctx,
struct dcerpc_pipe *p,
struct policy_handle *Cluster)
{
struct dcerpc_binding_handle *b = p->binding_handle;
struct clusapi_OpenCluster r;
uint32_t Status;
r.out.Status = &Status;
r.out.Cluster = Cluster;
torture_assert_ntstatus_ok(tctx,
dcerpc_clusapi_OpenCluster_r(b, tctx, &r),
"OpenCluster failed");
torture_assert_werr_ok(tctx,
W_ERROR(*r.out.Status),
"OpenCluster failed");
return true;
}
static bool test_CloseCluster_int(struct torture_context *tctx,
struct dcerpc_pipe *p,
struct policy_handle *Cluster)
{
struct dcerpc_binding_handle *b = p->binding_handle;
struct clusapi_CloseCluster r;
r.in.Cluster = Cluster;
r.out.Cluster = Cluster;
torture_assert_ntstatus_ok(tctx,
dcerpc_clusapi_CloseCluster_r(b, tctx, &r),
"CloseCluster failed");
torture_assert_werr_ok(tctx,
W_ERROR(r.out.result),
"CloseCluster failed");
torture_assert(tctx,
ndr_policy_handle_empty(Cluster),
"policy_handle non empty after CloseCluster");
return true;
}
static bool test_OpenCluster(struct torture_context *tctx,
struct dcerpc_pipe *p)
{
struct policy_handle Cluster;
if (!test_OpenCluster_int(tctx, p, &Cluster)) {
return false;
}
test_CloseCluster_int(tctx, p, &Cluster);
return true;
}
static bool test_CloseCluster(struct torture_context *tctx,
struct dcerpc_pipe *p)
{
struct policy_handle Cluster;
if (!test_OpenCluster_int(tctx, p, &Cluster)) {
return false;
}
return test_CloseCluster_int(tctx, p, &Cluster);
}
struct torture_suite *torture_rpc_clusapi(TALLOC_CTX *mem_ctx)
{
struct torture_rpc_tcase *tcase;
struct torture_suite *suite = torture_suite_create(mem_ctx, "clusapi");
tcase = torture_suite_add_rpc_iface_tcase(suite, "clusapi",
&ndr_table_clusapi);
torture_rpc_tcase_add_test(tcase, "OpenCluster",
test_OpenCluster);
torture_rpc_tcase_add_test(tcase, "CloseCluster",
test_CloseCluster);
return suite;
}

View File

@ -544,6 +544,7 @@ NTSTATUS torture_rpc_init(void)
torture_suite_add_suite(suite, torture_rpc_backupkey(suite));
#endif
torture_suite_add_suite(suite, torture_rpc_fsrvp(suite));
torture_suite_add_suite(suite, torture_rpc_clusapi(suite));
suite->description = talloc_strdup(suite, "DCE/RPC protocol and interface tests");

View File

@ -49,12 +49,12 @@ bld.SAMBA_SUBSYSTEM('TORTURE_NDR',
bld.SAMBA_MODULE('torture_rpc',
source='rpc/join.c rpc/lsa.c rpc/forest_trust.c rpc/lsa_lookup.c rpc/session_key.c rpc/echo.c rpc/dfs.c rpc/drsuapi.c rpc/drsuapi_cracknames.c rpc/dsgetinfo.c rpc/spoolss.c rpc/spoolss_win.c rpc/spoolss_access.c rpc/unixinfo.c rpc/samr.c rpc/samr_accessmask.c rpc/samr_priv.c rpc/wkssvc.c rpc/srvsvc.c rpc/svcctl.c rpc/atsvc.c rpc/eventlog.c rpc/epmapper.c rpc/winreg.c rpc/initshutdown.c rpc/oxidresolve.c rpc/remact.c rpc/mgmt.c rpc/scanner.c rpc/autoidl.c rpc/countcalls.c rpc/testjoin.c rpc/schannel.c rpc/netlogon.c rpc/remote_pac.c rpc/samlogon.c rpc/samsync.c rpc/dssetup.c rpc/alter_context.c rpc/bench.c rpc/samba3rpc.c rpc/rpc.c rpc/async_bind.c rpc/handles.c rpc/frsapi.c rpc/object_uuid.c rpc/ntsvcs.c rpc/browser.c rpc/bind.c rpc/fsrvp.c '+heimdal_specific['rpc'][0],
source='rpc/join.c rpc/lsa.c rpc/forest_trust.c rpc/lsa_lookup.c rpc/session_key.c rpc/echo.c rpc/dfs.c rpc/drsuapi.c rpc/drsuapi_cracknames.c rpc/dsgetinfo.c rpc/spoolss.c rpc/spoolss_win.c rpc/spoolss_access.c rpc/unixinfo.c rpc/samr.c rpc/samr_accessmask.c rpc/samr_priv.c rpc/wkssvc.c rpc/srvsvc.c rpc/svcctl.c rpc/atsvc.c rpc/eventlog.c rpc/epmapper.c rpc/winreg.c rpc/initshutdown.c rpc/oxidresolve.c rpc/remact.c rpc/mgmt.c rpc/scanner.c rpc/autoidl.c rpc/countcalls.c rpc/testjoin.c rpc/schannel.c rpc/netlogon.c rpc/remote_pac.c rpc/samlogon.c rpc/samsync.c rpc/dssetup.c rpc/alter_context.c rpc/bench.c rpc/samba3rpc.c rpc/rpc.c rpc/async_bind.c rpc/handles.c rpc/frsapi.c rpc/object_uuid.c rpc/ntsvcs.c rpc/browser.c rpc/bind.c rpc/fsrvp.c rpc/clusapi.c '+heimdal_specific['rpc'][0],
allow_warnings=True,
autoproto='rpc/proto.h',
subsystem='smbtorture',
init_function='torture_rpc_init',
deps='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 RPC_NDR_DRSUAPI 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 RPC_NDR_NTSVCS WB_HELPER samba-net LIBCLI_AUTH popt POPT_CREDENTIALS TORTURE_LDAP TORTURE_UTIL TORTURE_RAP service process_model RPC_NDR_BROWSER LIBCLI_DRSUAPI TORTURE_DFS RPC_NDR_FSRVP '+heimdal_specific['rpc'][1],
deps='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 RPC_NDR_DRSUAPI 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 RPC_NDR_NTSVCS WB_HELPER samba-net LIBCLI_AUTH popt POPT_CREDENTIALS TORTURE_LDAP TORTURE_UTIL TORTURE_RAP service process_model RPC_NDR_BROWSER LIBCLI_DRSUAPI TORTURE_DFS RPC_NDR_FSRVP RPC_NDR_CLUSAPI '+heimdal_specific['rpc'][1],
internal_module=True
)