r4172: commit a DsReplicaSync() torture test
authorStefan Metzmacher <metze@samba.org>
Mon, 13 Dec 2004 10:29:44 +0000 (10:29 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:07:22 +0000 (13:07 -0500)
this not make much sense as we don't send the correct nc_name
but it shows that doesn't get a NDR_FAULT anymore,
we just need handle the conformant strings in pidl

metze
(This used to be commit be449f628faf85a163852d18bc724984d3afefd2)

source4/torture/rpc/drsuapi.c

index e5b7e2ca0c6ee701a8b23b1ca64b758074aa3c82..0b1377c7401f58dc7bdb62f50f9c6f8ce5e0bc74 100644 (file)
@@ -755,6 +755,65 @@ static BOOL test_DsReplicaGetInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
        return ret;
 }
 
+static BOOL test_DsReplicaSync(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, 
+                       struct DsPrivate *priv)
+{
+       NTSTATUS status;
+       BOOL ret = True;
+       int i;
+       struct drsuapi_DsReplicaSync r;
+       struct drsuapi_DsReplicaSyncRequest1Info info1;
+
+       struct {
+               int32 level;
+       } array[] = {
+               {       
+                       1
+               }
+       };
+
+       r.in.bind_handle        = &priv->bind_handle;
+
+       for (i=0; i < ARRAY_SIZE(array); i++) {
+               printf("testing DsReplicaGetInfo level %d\n",
+                       array[i].level);
+
+               r.in.level = array[i].level;
+               switch(r.in.level) {
+               case 1: {
+                       uint16_t string[] = { 0x0064, 0x0063, 0x003d, 0x0073, 0x0039, 0x0000};
+                       ZERO_STRUCT(r.in.req.req1);
+                       r.in.req.req1.info                      = &info1;
+                       r.in.req.req1.info->unknown1            = 32;
+                       r.in.req.req1.info->unknown2            = 120;
+                       ZERO_STRUCT(r.in.req.req1.info->guid1);
+                       ZERO_ARRAY(r.in.req.req1.info->unknown3);
+                       r.in.req.req1.info->length              = ARRAY_SIZE(string)-1;
+                       r.in.req.req1.info->nc_dn               = string;/*priv->domain_obj_dn*/;
+                       r.in.req.req1.guid1                     = priv->dcinfo.ntds_guid;
+                       r.in.req.req1.string1                   = NULL;
+                       r.in.req.req1.unknown1                  = 16;
+                       break;
+               }
+               }
+
+               status = dcerpc_drsuapi_DsReplicaSync(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_DsReplicaSync failed - %s\n", errstr);
+                       ret = False;
+               } else if (!W_ERROR_IS_OK(r.out.result)) {
+                       printf("DsReplicaSync 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)
 {
@@ -825,6 +884,10 @@ BOOL torture_rpc_drsuapi(void)
                ret = False;
        }
 
+       if (!test_DsReplicaSync(p, mem_ctx, &priv)) {
+               ret = False;
+       }
+
        if (!test_DsUnbind(p, mem_ctx, &priv)) {
                ret = False;
        }