Author: metze
Date: 2005-08-23 16:22:22 +0000 (Tue, 23 Aug 2005)
New Revision: 9528

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=9528

Log:
the RPC-DSSYNC test is now able to fetch the whole tree,
including the unicodePwd, ntPwdHistory fields

metze
Modified:
   branches/SOC/SAMBA_4_0/source/torture/rpc/dssync.c


Changeset:
Modified: branches/SOC/SAMBA_4_0/source/torture/rpc/dssync.c
===================================================================
--- branches/SOC/SAMBA_4_0/source/torture/rpc/dssync.c  2005-08-23 16:19:04 UTC 
(rev 9527)
+++ branches/SOC/SAMBA_4_0/source/torture/rpc/dssync.c  2005-08-23 16:22:22 UTC 
(rev 9528)
@@ -62,6 +62,7 @@
        /* what we need to do as the new dc machine account */
        struct {
                struct cli_credentials *credentials;
+               struct DsSyncBindInfo drsuapi;
                struct drsuapi_DsGetDCInfo2 dc_info2;
                struct GUID invocation_id;
                struct GUID object_guid;
@@ -113,7 +114,7 @@
        /* ctx->new_dc ...*/
 #define TEST_MACHINE_NAME "smbtorturedssync"
        /*create machine account*/
-       ctx->new_dc.join = torture_join_domain(mem_ctx, TEST_MACHINE_NAME, 
lp_workgroup(), ACB_SVRTRUST, &new_dc_pass);  
+       ctx->new_dc.join = torture_join_domain(mem_ctx, TEST_MACHINE_NAME, 
lp_workgroup(), ACB_SVRTRUST, &new_dc_pass);
 
        ctx->new_dc.credentials = cli_credentials_init(ctx);
        
@@ -125,6 +126,23 @@
 
        ctx->new_dc.invocation_id = GUID_random();
 
+       our_bind_info                                   = 
&ctx->new_dc.drsuapi.our_bind_info;
+       our_bind_info->length                           = 28;
+       our_bind_info->info.info28.supported_extensions = 0x1ffffb7f;
+       our_bind_info->info.info28.supported_extensions |= 
DRSUAPI_SUPPORTED_EXTENSION_ADDENTRYREPLY_V3;
+       our_bind_info->info.info28.site_guid            = GUID_zero();
+       our_bind_info->info.info28.u1                   = 508;
+       our_bind_info->info.info28.repl_epoch           = 0;
+
+#ifndef DRSUAPI_DS_BIND_GUID_W2K3
+#define DRSUAPI_DS_BIND_GUID_W2K3      ( 
"6afab99c-6e26-464a-975f-f58f105218bc" )
+#endif
+       GUID_from_string(DRSUAPI_DS_BIND_GUID_W2K3, 
&ctx->new_dc.drsuapi.bind_guid);
+
+       ctx->new_dc.drsuapi.req.in.bind_guid            = 
&ctx->new_dc.drsuapi.bind_guid;
+       ctx->new_dc.drsuapi.req.in.bind_info            = our_bind_info;
+       ctx->new_dc.drsuapi.req.out.bind_handle         = 
&ctx->new_dc.drsuapi.bind_handle;
+
        /* ctx->old_dc ...*/
        
        ctx->ldb_ctx = ldb_init(mem_ctx);
@@ -689,11 +707,115 @@
 
 static BOOL test_FetchData(struct DsSyncTest *ctx)
 {
+       NTSTATUS status;
        BOOL ret = True;
-       /*
-       This is where we call dcerpc_drsuapi_DsGetNCChanges().
-       See test_DsGetNCChanges() in torture/rpc/drsuapi.c.
-       */
+       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);
+
+               r.in.bind_handle        = &ctx->new_dc.drsuapi.bind_handle;
+               r.in.level              = array[i].level;
+
+               switch (r.in.level) {
+               case 5:
+                       nc.guid = null_guid;
+                       nc.sid  = null_sid;
+                       nc.dn   = ctx->domain_dn;
+
+                       r.in.req.req5.destination_dsa_guid              = 
ctx->new_dc.invocation_id;
+                       r.in.req.req5.source_dsa_guid                   = 
null_guid;
+                       r.in.req.req5.naming_context                    = &nc;
+                       r.in.req.req5.highwatermark.tmp_highest_usn     = 0;
+                       r.in.req.req5.highwatermark.reserved_usn        = 0;
+                       r.in.req.req5.highwatermark.highest_usn         = 0;
+                       r.in.req.req5.uptodateness_vector               = NULL;
+                       r.in.req.req5.replica_flags                     = 0;
+                       if (lp_parm_bool(-1,"drsuapi","compression",False)) {
+                               r.in.req.req5.replica_flags             |= 
DRSUAPI_DS_REPLICA_NEIGHBOUR_COMPRESS_CHANGES;
+                       }
+                       if 
(lp_parm_bool(-1,"drsuapi","neighbour_writeable",True)) {
+                               r.in.req.req5.replica_flags             |= 
DRSUAPI_DS_REPLICA_NEIGHBOUR_WRITEABLE;
+                       }
+                       r.in.req.req5.replica_flags                     |= 
DRSUAPI_DS_REPLICA_NEIGHBOUR_SYNC_ON_STARTUP
+                                                                       | 
DRSUAPI_DS_REPLICA_NEIGHBOUR_DO_SCHEDULED_SYNCS
+                                                                       | 
DRSUAPI_DS_REPLICA_NEIGHBOUR_RETURN_OBJECT_PARENTS
+                                                                       | 
DRSUAPI_DS_REPLICA_NEIGHBOUR_NEVER_SYNCED
+                                                                       ;
+                       r.in.req.req5.unknown2                          = 133;
+                       r.in.req.req5.unknown3                          = 
1336770;
+                       r.in.req.req5.unknown4                          = 0;
+                       r.in.req.req5.h1                                = 0;
+
+                       break;
+               case 8:
+                       nc.guid = null_guid;
+                       nc.sid  = null_sid;
+                       nc.dn   = ctx->domain_dn;
+
+                       r.in.req.req8.destination_dsa_guid              = 
ctx->new_dc.invocation_id;
+                       r.in.req.req8.source_dsa_guid                   = 
null_guid;
+                       r.in.req.req8.naming_context                    = &nc;
+                       r.in.req.req8.highwatermark.tmp_highest_usn     = 0;
+                       r.in.req.req8.highwatermark.reserved_usn        = 0;
+                       r.in.req.req8.highwatermark.highest_usn         = 0;
+                       r.in.req.req8.uptodateness_vector               = NULL;
+                       r.in.req.req8.replica_flags                     = 0;
+                       if (lp_parm_bool(-1,"drsuapi","compression",False)) {
+                               r.in.req.req8.replica_flags             |= 
DRSUAPI_DS_REPLICA_NEIGHBOUR_COMPRESS_CHANGES;
+                       }
+                       if 
(lp_parm_bool(-1,"drsuapi","neighbour_writeable",True)) {
+                               r.in.req.req8.replica_flags             |= 
DRSUAPI_DS_REPLICA_NEIGHBOUR_WRITEABLE;
+                       }
+                       r.in.req.req8.replica_flags                     |= 
DRSUAPI_DS_REPLICA_NEIGHBOUR_SYNC_ON_STARTUP
+                                                                       | 
DRSUAPI_DS_REPLICA_NEIGHBOUR_DO_SCHEDULED_SYNCS
+                                                                       | 
DRSUAPI_DS_REPLICA_NEIGHBOUR_RETURN_OBJECT_PARENTS
+                                                                       | 
DRSUAPI_DS_REPLICA_NEIGHBOUR_NEVER_SYNCED
+                                                                       ;
+                       r.in.req.req8.unknown2                          = 402;
+                       r.in.req.req8.unknown3                          = 
402116;
+                       r.in.req.req8.unknown4                          = 0;
+                       r.in.req.req8.h1                                = 0;
+                       r.in.req.req8.unique_ptr1                       = 0;
+                       r.in.req.req8.unique_ptr2                       = 0;
+                       r.in.req.req8.ctr12.count                       = 0;
+                       r.in.req.req8.ctr12.array                       = NULL;
+
+                       break;
+               }
+
+               status = 
dcerpc_drsuapi_DsGetNCChanges(ctx->new_dc.drsuapi.pipe, 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(ctx, 
ctx->new_dc.drsuapi.pipe->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;
 }
 
@@ -713,6 +835,7 @@
        ret &= test_LDAPBind(ctx, ctx->admin.credentials, &ctx->admin.ldap);
        ret &= test_GetInfo(ctx);
        ret &= test_CompleteJoin(ctx, mem_ctx);
+       ret &= test_DsBind(ctx, ctx->admin.credentials, &ctx->new_dc.drsuapi);
        ret &= test_FetchData(ctx);
        test_destroy_context(ctx);
 

Reply via email to