summaryrefslogtreecommitdiff
path: root/source4/torture
diff options
context:
space:
mode:
authorKamen Mazdrashki <kamen.mazdrashki@postpath.com>2009-08-28 15:42:48 +0300
committerAndrew Bartlett <abartlet@samba.org>2009-09-08 22:44:48 +1000
commit5e3759d122aac95fd3a99898e37f64d76e4eeee8 (patch)
treed13bbdc4b6a42d8388dca0663d21e3a351bf2666 /source4/torture
parent0ed467ac0c2b8854445662650b3066aa1be236f5 (diff)
downloadsamba-5e3759d122aac95fd3a99898e37f64d76e4eeee8.tar.gz
samba-5e3759d122aac95fd3a99898e37f64d76e4eeee8.tar.bz2
samba-5e3759d122aac95fd3a99898e37f64d76e4eeee8.zip
tort: Implement 'setup' and 'teardown' for DRSUAPI test cases.
Diffstat (limited to 'source4/torture')
-rw-r--r--source4/torture/rpc/drsuapi.c43
-rw-r--r--source4/torture/rpc/drsuapi.h1
2 files changed, 44 insertions, 0 deletions
diff --git a/source4/torture/rpc/drsuapi.c b/source4/torture/rpc/drsuapi.c
index da6ce2b5f5..ac16dc6e63 100644
--- a/source4/torture/rpc/drsuapi.c
+++ b/source4/torture/rpc/drsuapi.c
@@ -772,7 +772,50 @@ bool torture_rpc_drsuapi(struct torture_context *torture)
return ret;
}
+bool torture_rpc_drsuapi_tcase_setup(struct torture_context *tctx, void **data)
+{
+ NTSTATUS status;
+ struct DsPrivate *priv;
+ struct cli_credentials *machine_credentials;
+
+ *data = priv = talloc_zero(tctx, struct DsPrivate);
+ torture_assert(tctx, priv, "Not enough memory");
+
+ torture_comment(tctx, "Create DRSUAPI pipe");
+ status = torture_rpc_connection(tctx,
+ &priv->pipe,
+ &ndr_table_drsuapi);
+ torture_assert(tctx, NT_STATUS_IS_OK(status), "Unable to connect to DRSUAPI pipe");
+
+ torture_comment(tctx, "Connected to DRSUAPI pipe\n");
+ priv->join = torture_join_domain(tctx, TEST_MACHINE_NAME, ACB_SVRTRUST,
+ &machine_credentials);
+ torture_assert(tctx, priv->join, "Failed to join as BDC");
+
+ if (!test_DsBind(priv->pipe, tctx, priv)) {
+ /* clean up */
+ torture_rpc_drsuapi_tcase_teardown(tctx, priv);
+ torture_fail(tctx, "Failed execute test_DsBind()");
+ }
+
+ return true;
+}
+
+bool torture_rpc_drsuapi_tcase_teardown(struct torture_context *tctx, void *data)
+{
+ struct DsPrivate *priv = (struct DsPrivate *)data;
+
+ if (priv->join) {
+ torture_leave_domain(tctx, priv->join);
+ }
+
+ talloc_free(priv);
+
+ return true;
+}
+
+/*
bool torture_rpc_drsuapi_cracknames(struct torture_context *torture)
{
NTSTATUS status;
diff --git a/source4/torture/rpc/drsuapi.h b/source4/torture/rpc/drsuapi.h
index 98438cc9b7..e9a7dd5ad1 100644
--- a/source4/torture/rpc/drsuapi.h
+++ b/source4/torture/rpc/drsuapi.h
@@ -24,6 +24,7 @@
#include "librpc/gen_ndr/drsuapi.h"
struct DsPrivate {
+ struct dcerpc_pipe *pipe;
struct policy_handle bind_handle;
struct GUID bind_guid;
const char *domain_obj_dn;