summaryrefslogtreecommitdiff
path: root/source4/torture
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2005-03-15 14:42:09 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:11:04 -0500
commitcead12981f86f8c30daf50995d61ff3af9439898 (patch)
tree7e03ac7699a767bc9f8f991c87bb72ff6677ee06 /source4/torture
parent9743bdf86fe44babed74fc06264337ded8c43382 (diff)
downloadsamba-cead12981f86f8c30daf50995d61ff3af9439898.tar.gz
samba-cead12981f86f8c30daf50995d61ff3af9439898.tar.bz2
samba-cead12981f86f8c30daf50995d61ff3af9439898.zip
r5799: more DsGetNCChanges updates, I'm starting to understand it...
also add a really simple torture test for DsGetNCChanges metze (This used to be commit bcde67a7eff9ad82919e90fd64c02a17610c6f0e)
Diffstat (limited to 'source4/torture')
-rw-r--r--source4/torture/rpc/drsuapi.c110
1 files changed, 94 insertions, 16 deletions
diff --git a/source4/torture/rpc/drsuapi.c b/source4/torture/rpc/drsuapi.c
index a6c0f5b9c6..57382289a2 100644
--- a/source4/torture/rpc/drsuapi.c
+++ b/source4/torture/rpc/drsuapi.c
@@ -764,8 +764,9 @@ static BOOL test_DsReplicaSync(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
BOOL ret = True;
int i;
struct drsuapi_DsReplicaSync r;
- struct drsuapi_DsReplicaSyncRequest1Info info1;
-
+ struct drsuapi_DsReplicaObjectIdentifier nc;
+ struct GUID null_guid;
+ struct dom_sid null_sid;
struct {
int32_t level;
} array[] = {
@@ -779,6 +780,9 @@ static BOOL test_DsReplicaSync(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
return True;
}
+ ZERO_STRUCT(null_guid);
+ ZERO_STRUCT(null_sid);
+
r.in.bind_handle = &priv->bind_handle;
for (i=0; i < ARRAY_SIZE(array); i++) {
@@ -788,11 +792,11 @@ static BOOL test_DsReplicaSync(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
r.in.level = array[i].level;
switch(r.in.level) {
case 1:
- r.in.req.req1.info = &info1;
- r.in.req.req1.info->unknown1 = 0;
- ZERO_STRUCT(r.in.req.req1.info->guid1);
- ZERO_STRUCT(r.in.req.req1.info->byte_array);
- r.in.req.req1.info->nc_dn = priv->domain_obj_dn?priv->domain_obj_dn:"";
+ nc.guid = null_guid;
+ nc.sid = null_sid;
+ nc.dn = priv->domain_obj_dn?priv->domain_obj_dn:"";
+
+ r.in.req.req1.naming_context = &nc;
r.in.req.req1.guid1 = priv->dcinfo.ntds_guid;
r.in.req.req1.string1 = NULL;
r.in.req.req1.options = 16;
@@ -823,7 +827,9 @@ static BOOL test_DsReplicaUpdateRefs(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
BOOL ret = True;
int i;
struct drsuapi_DsReplicaUpdateRefs r;
+ struct drsuapi_DsReplicaObjectIdentifier nc;
struct GUID null_guid;
+ struct dom_sid null_sid;
struct {
int32_t level;
} array[] = {
@@ -833,6 +839,7 @@ static BOOL test_DsReplicaUpdateRefs(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
};
ZERO_STRUCT(null_guid);
+ ZERO_STRUCT(null_sid);
r.in.bind_handle = &priv->bind_handle;
@@ -843,16 +850,15 @@ static BOOL test_DsReplicaUpdateRefs(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
r.in.level = array[i].level;
switch(r.in.level) {
case 1:
- r.in.req.req1.unknown1 = 0;
- r.in.req.req1.unknown2 = 0;
- r.in.req.req1.dest_dsa_guid = null_guid;
- r.in.req.req1.options = 0;
- r.in.req.req1.sync_req_info1.unknown1 = 0;
- r.in.req.req1.sync_req_info1.guid1 = null_guid;
- ZERO_STRUCT(r.in.req.req1.sync_req_info1.byte_array);
- r.in.req.req1.sync_req_info1.nc_dn = priv->domain_obj_dn?priv->domain_obj_dn:"";
- r.in.req.req1.dest_dsa_dns_name = talloc_asprintf(mem_ctx, "__some_dest_dsa_guid_string._msdn.%s",
+ nc.guid = null_guid;
+ nc.sid = null_sid;
+ nc.dn = priv->domain_obj_dn?priv->domain_obj_dn:"";
+
+ r.in.req.req1.naming_context = &nc;
+ r.in.req.req1.dest_dsa_dns_name = talloc_asprintf(mem_ctx, "__some_dest_dsa_guid_string._msdn.%s",
priv->domain_dns_name);
+ r.in.req.req1.dest_dsa_guid = null_guid;
+ r.in.req.req1.options = 0;
break;
}
@@ -873,6 +879,76 @@ static BOOL test_DsReplicaUpdateRefs(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
return ret;
}
+static BOOL test_DsGetNCChanges(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
+ struct DsPrivate *priv)
+{
+ NTSTATUS status;
+ BOOL ret = True;
+ int i;
+ struct drsuapi_DsGetNCChanges r;
+ struct drsuapi_DsReplicaObjectIdentifier nc;
+ struct GUID null_guid;
+ struct dom_sid null_sid;
+ struct {
+ int32_t level;
+ } array[] = {
+ {
+ 5
+ },
+ {
+ 8
+ }
+ };
+
+ ZERO_STRUCT(null_guid);
+ ZERO_STRUCT(null_sid);
+
+ for (i=0; i < ARRAY_SIZE(array); i++) {
+ printf("testing DsGetNCChanges level %d\n",
+ array[i].level);
+
+ ZERO_STRUCT(r.in);
+ r.in.bind_handle = &priv->bind_handle;
+ r.in.level = array[i].level;
+
+ switch (r.in.level) {
+ case 5:
+ nc.guid = null_guid;
+ nc.sid = null_sid;
+ nc.dn = talloc_asprintf(mem_ctx, "CN=Schema,CN=Configuration,%s",
+ priv->domain_obj_dn?priv->domain_obj_dn:"");
+ nc.dn = priv->domain_obj_dn?priv->domain_obj_dn:"";
+
+ r.in.req.req5.naming_context = &nc;
+ r.in.req.req5.usn1.usn1 = 0;
+ break;
+ case 8:
+ nc.guid = null_guid;
+ nc.sid = null_sid;
+ nc.dn = priv->domain_obj_dn?priv->domain_obj_dn:"";
+
+ r.in.req.req8.naming_context = &nc;
+ r.in.req.req8.usn1.usn1 = 0;
+ break;
+ }
+
+ status = dcerpc_drsuapi_DsGetNCChanges(p, mem_ctx, &r);
+ if (!NT_STATUS_IS_OK(status)) {
+ const char *errstr = nt_errstr(status);
+ if (NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT)) {
+ errstr = dcerpc_errstr(mem_ctx, p->last_fault_code);
+ }
+ printf("dcerpc_drsuapi_DsGetNCChanges failed - %s\n", errstr);
+ ret = False;
+ } else if (!W_ERROR_IS_OK(r.out.result)) {
+ printf("DsGetNCChanges failed - %s\n", win_errstr(r.out.result));
+ ret = False;
+ }
+ }
+
+ return ret;
+}
+
static BOOL test_DsUnbind(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
struct DsPrivate *priv)
{
@@ -937,6 +1013,8 @@ BOOL torture_rpc_drsuapi(void)
ret &= test_DsReplicaUpdateRefs(p, mem_ctx, &priv);
+ ret &= test_DsGetNCChanges(p, mem_ctx, &priv);
+
ret &= test_DsUnbind(p, mem_ctx, &priv);
talloc_free(mem_ctx);