summaryrefslogtreecommitdiff
path: root/source4/torture/rpc/drsuapi.c
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2006-11-17 11:19:15 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:28:20 -0500
commitce2d92c878ceb4c4f0f8948be2dc6ad7ecaf132c (patch)
tree79806102179c4d3e3d0f94bb57b70ea856b8f166 /source4/torture/rpc/drsuapi.c
parent2ddd807979684407de6d0346be037b25d2448cdb (diff)
downloadsamba-ce2d92c878ceb4c4f0f8948be2dc6ad7ecaf132c.tar.gz
r19760: Create a DC account for the drsuapi tests to work on, rather than
choosing an existing DC. Allow to skip some tests under Samba4. Andrew Bartlett (This used to be commit 705fbae325267fd0ed11f463f954f8e45802d6d5)
Diffstat (limited to 'source4/torture/rpc/drsuapi.c')
-rw-r--r--source4/torture/rpc/drsuapi.c51
1 files changed, 45 insertions, 6 deletions
diff --git a/source4/torture/rpc/drsuapi.c b/source4/torture/rpc/drsuapi.c
index ffef717489c..bcfb12de75d 100644
--- a/source4/torture/rpc/drsuapi.c
+++ b/source4/torture/rpc/drsuapi.c
@@ -27,6 +27,8 @@
#include "librpc/gen_ndr/ndr_drsuapi_c.h"
#include "torture/rpc/rpc.h"
+#define TEST_MACHINE_NAME "torturetest"
+
BOOL test_DsBind(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
struct DsPrivate *priv)
{
@@ -65,6 +67,11 @@ static BOOL test_DsGetDCInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
struct drsuapi_DsGetDomainControllerInfo r;
BOOL ret = True;
+ if (lp_parm_bool(-1, "torture", "samba4", False)) {
+ printf("skipping DsGetDCInfo test against Samba4\n");
+ return True;
+ }
+
r.in.bind_handle = &priv->bind_handle;
r.in.level = 1;
@@ -189,7 +196,7 @@ static BOOL test_DsGetDCInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
}
static BOOL test_DsWriteAccountSpn(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
- struct DsPrivate *priv)
+ struct DsPrivate *priv)
{
NTSTATUS status;
struct drsuapi_DsWriteAccountSpn r;
@@ -316,6 +323,11 @@ static BOOL test_DsReplicaGetInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
}
};
+ if (lp_parm_bool(-1, "torture", "samba4", False)) {
+ printf("skipping DsGetDCInfo test against Samba4\n");
+ return True;
+ }
+
r.in.bind_handle = &priv->bind_handle;
for (i=0; i < ARRAY_SIZE(array); i++) {
@@ -389,6 +401,11 @@ static BOOL test_DsReplicaSync(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
return True;
}
+ if (lp_parm_bool(-1, "torture", "samba4", False)) {
+ printf("skipping DsReplicaSync test against Samba4\n");
+ return True;
+ }
+
ZERO_STRUCT(null_guid);
ZERO_STRUCT(null_sid);
@@ -447,6 +464,11 @@ static BOOL test_DsReplicaUpdateRefs(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
}
};
+ if (lp_parm_bool(-1, "torture", "samba4", False)) {
+ printf("skipping DsReplicaUpdateRefs test against Samba4\n");
+ return True;
+ }
+
ZERO_STRUCT(null_guid);
ZERO_STRUCT(null_sid);
@@ -509,6 +531,11 @@ static BOOL test_DsGetNCChanges(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
}
};
+ if (lp_parm_bool(-1, "torture", "samba4", False)) {
+ printf("skipping DsGetNCChanges test against Samba4\n");
+ return True;
+ }
+
ZERO_STRUCT(null_guid);
ZERO_STRUCT(null_sid);
@@ -630,26 +657,36 @@ BOOL torture_rpc_drsuapi(struct torture_context *torture)
TALLOC_CTX *mem_ctx;
BOOL ret = True;
struct DsPrivate priv;
+ struct cli_credentials *machine_credentials;
mem_ctx = talloc_init("torture_rpc_drsuapi");
+ printf("Connected to DRAUAPI pipe\n");
+
+ ZERO_STRUCT(priv);
+
+ priv.join = torture_join_domain(TEST_MACHINE_NAME, ACB_SVRTRUST,
+ &machine_credentials);
+ if (!priv.join) {
+ talloc_free(mem_ctx);
+ printf("Failed to join as BDC\n");
+ return False;
+ }
+
status = torture_rpc_connection(mem_ctx,
&p,
&dcerpc_table_drsuapi);
if (!NT_STATUS_IS_OK(status)) {
+ torture_leave_domain(priv.join);
talloc_free(mem_ctx);
return False;
}
- printf("Connected to DRAUAPI pipe\n");
-
- ZERO_STRUCT(priv);
-
ret &= test_DsBind(p, mem_ctx, &priv);
ret &= test_DsGetDCInfo(p, mem_ctx, &priv);
- ret &= test_DsCrackNames(p, mem_ctx, &priv, priv.dcinfo.netbios_name);
+ ret &= test_DsCrackNames(p, mem_ctx, &priv, TEST_MACHINE_NAME);
ret &= test_DsWriteAccountSpn(p, mem_ctx, &priv);
@@ -665,6 +702,8 @@ BOOL torture_rpc_drsuapi(struct torture_context *torture)
talloc_free(mem_ctx);
+ torture_leave_domain(priv.join);
+
return ret;
}