Author: metze
Date: 2007-01-12 16:02:10 +0000 (Fri, 12 Jan 2007)
New Revision: 20709

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

Log:
pass a repsFromTo1 struct down as it contains all needed info for the source dsa
and the highwater mark vector

metze
Modified:
   branches/SAMBA_4_0/source/dsdb/repl/replicated_objects.c
   branches/SAMBA_4_0/source/dsdb/samdb/ldb_modules/repl_meta_data.c
   branches/SAMBA_4_0/source/dsdb/samdb/samdb.h
   branches/SAMBA_4_0/source/torture/libnet/libnet_BecomeDC.c


Changeset:
Modified: branches/SAMBA_4_0/source/dsdb/repl/replicated_objects.c
===================================================================
--- branches/SAMBA_4_0/source/dsdb/repl/replicated_objects.c    2007-01-12 
14:26:08 UTC (rev 20708)
+++ branches/SAMBA_4_0/source/dsdb/repl/replicated_objects.c    2007-01-12 
16:02:10 UTC (rev 20709)
@@ -183,8 +183,7 @@
                                               const struct 
drsuapi_DsReplicaObjectListItemEx *first_object,
                                               uint32_t linked_attributes_count,
                                               const struct 
drsuapi_DsReplicaLinkedAttribute *linked_attributes,
-                                              const struct GUID 
*source_dsa_invocation_id,
-                                              const struct 
drsuapi_DsReplicaHighWaterMark *new_highwatermark,
+                                              const struct repsFromTo1 
*source_dsa,
                                               const struct 
drsuapi_DsReplicaCursor2CtrEx *uptodateness_vector,
                                               TALLOC_CTX *mem_ctx,
                                               struct 
dsdb_extended_replicated_objects **_out)
@@ -205,9 +204,8 @@
        out->partition_dn = ldb_dn_new(out, ldb, partition_dn);
        W_ERROR_HAVE_NO_MEMORY(out->partition_dn);
 
-       out->source_dsa_invocation_id   = source_dsa_invocation_id;
-       out->new_highwatermark          = new_highwatermark;
-       out->uptodateness_vector        = uptodateness_vector;
+       out->source_dsa         = source_dsa;
+       out->uptodateness_vector= uptodateness_vector;
 
        out->num_objects        = object_count;
        out->objects            = talloc_array(out,

Modified: branches/SAMBA_4_0/source/dsdb/samdb/ldb_modules/repl_meta_data.c
===================================================================
--- branches/SAMBA_4_0/source/dsdb/samdb/ldb_modules/repl_meta_data.c   
2007-01-12 14:26:08 UTC (rev 20708)
+++ branches/SAMBA_4_0/source/dsdb/samdb/ldb_modules/repl_meta_data.c   
2007-01-12 16:02:10 UTC (rev 20709)
@@ -677,6 +677,9 @@
                return replmd_replicated_request_error(ar, ret);
        }
 
+       /*
+        * first create the new replUpToDateVector
+        */
        ouv_value = ldb_msg_find_ldb_val(ar->sub.search_msg, 
"replUpToDateVector");
        if (ouv_value) {
                nt_status = ndr_pull_struct_blob(ouv_value, ar->sub.mem_ctx, 
&ouv,
@@ -743,7 +746,7 @@
         */
        found = false;
        for (j=0; j < ni; j++) {
-               if (!GUID_equal(ar->objs->source_dsa_invocation_id,
+               if (!GUID_equal(&ar->objs->source_dsa->source_dsa_invocation_id,
                                
&nuv.ctr.ctr2.cursors[j].source_dsa_invocation_id)) {
                        continue;
                }
@@ -757,7 +760,7 @@
                 * and use the tmp_highest_usn because this is what we have 
just applied
                 * to our ldb
                 */
-               nuv.ctr.ctr2.cursors[j].highest_usn             = 
ar->objs->new_highwatermark->tmp_highest_usn;
+               nuv.ctr.ctr2.cursors[j].highest_usn             = 
ar->objs->source_dsa->highwatermark.tmp_highest_usn;
                nuv.ctr.ctr2.cursors[j].last_sync_success       = now;
                break;
        }
@@ -769,8 +772,8 @@
                 * and use the tmp_highest_usn because this is what we have 
just applied
                 * to our ldb
                 */
-               nuv.ctr.ctr2.cursors[ni].source_dsa_invocation_id= 
*ar->objs->source_dsa_invocation_id;
-               nuv.ctr.ctr2.cursors[ni].highest_usn            = 
ar->objs->new_highwatermark->tmp_highest_usn;
+               nuv.ctr.ctr2.cursors[ni].source_dsa_invocation_id= 
ar->objs->source_dsa->source_dsa_invocation_id;
+               nuv.ctr.ctr2.cursors[ni].highest_usn            = 
ar->objs->source_dsa->highwatermark.tmp_highest_usn;
                nuv.ctr.ctr2.cursors[ni].last_sync_success      = now;
                ni++;
        }

Modified: branches/SAMBA_4_0/source/dsdb/samdb/samdb.h
===================================================================
--- branches/SAMBA_4_0/source/dsdb/samdb/samdb.h        2007-01-12 14:26:08 UTC 
(rev 20708)
+++ branches/SAMBA_4_0/source/dsdb/samdb/samdb.h        2007-01-12 16:02:10 UTC 
(rev 20709)
@@ -50,8 +50,7 @@
 struct dsdb_extended_replicated_objects {
        struct ldb_dn *partition_dn;
 
-       const struct GUID *source_dsa_invocation_id;
-       const struct drsuapi_DsReplicaHighWaterMark *new_highwatermark;
+       const struct repsFromTo1 *source_dsa;
        const struct drsuapi_DsReplicaCursor2CtrEx *uptodateness_vector;
 
        uint32_t num_objects;

Modified: branches/SAMBA_4_0/source/torture/libnet/libnet_BecomeDC.c
===================================================================
--- branches/SAMBA_4_0/source/torture/libnet/libnet_BecomeDC.c  2007-01-12 
14:26:08 UTC (rev 20708)
+++ branches/SAMBA_4_0/source/torture/libnet/libnet_BecomeDC.c  2007-01-12 
16:02:10 UTC (rev 20709)
@@ -259,39 +259,57 @@
        struct drsuapi_DsReplicaObjectListItemEx *cur;
        uint32_t linked_attributes_count;
        struct drsuapi_DsReplicaLinkedAttribute *linked_attributes;
-       const struct GUID *source_dsa_invocation_id;
-       const struct drsuapi_DsReplicaHighWaterMark *new_highwatermark;
        const struct drsuapi_DsReplicaCursor2CtrEx *uptodateness_vector;
        struct dsdb_extended_replicated_objects *objs;
+       struct repsFromTo1 *s_dsa;
+       char *tmp_dns_name;
        uint32_t i;
 
+       s_dsa                   = talloc_zero(s, struct repsFromTo1);
+       NT_STATUS_HAVE_NO_MEMORY(s_dsa);
+       s_dsa->other_info       = talloc(s_dsa, struct repsFromTo1OtherInfo);
+       NT_STATUS_HAVE_NO_MEMORY(s_dsa->other_info);
+
        switch (c->ctr_level) {
        case 1:
-               mapping_ctr             = &c->ctr1->mapping_ctr;
-               total_object_count      = c->ctr1->total_object_count;
-               object_count            = s->schema_part.object_count;
-               first_object            = s->schema_part.first_object;
-               linked_attributes_count = 0;
-               linked_attributes       = NULL;
-               source_dsa_invocation_id= &c->ctr1->source_dsa_invocation_id;
-               new_highwatermark       = &c->ctr1->new_highwatermark;
-               uptodateness_vector     = NULL; /* TODO: map it */
+               mapping_ctr                     = &c->ctr1->mapping_ctr;
+               total_object_count              = c->ctr1->total_object_count;
+               object_count                    = s->schema_part.object_count;
+               first_object                    = s->schema_part.first_object;
+               linked_attributes_count         = 0;
+               linked_attributes               = NULL;
+               s_dsa->highwatermark            = c->ctr1->new_highwatermark;
+               s_dsa->source_dsa_obj_guid      = c->ctr1->source_dsa_guid;
+               s_dsa->source_dsa_invocation_id = 
c->ctr1->source_dsa_invocation_id;
+               uptodateness_vector             = NULL; /* TODO: map it */
                break;
        case 6:
-               mapping_ctr             = &c->ctr6->mapping_ctr;
-               total_object_count      = c->ctr6->total_object_count;
-               object_count            = s->schema_part.object_count;
-               first_object            = s->schema_part.first_object;
-               linked_attributes_count = 0; /* TODO: ! */
-               linked_attributes       = NULL; /* TODO: ! */;
-               source_dsa_invocation_id= &c->ctr6->source_dsa_invocation_id;
-               new_highwatermark       = &c->ctr6->new_highwatermark;
-               uptodateness_vector     = c->ctr6->uptodateness_vector;
+               mapping_ctr                     = &c->ctr6->mapping_ctr;
+               total_object_count              = c->ctr6->total_object_count;
+               object_count                    = s->schema_part.object_count;
+               first_object                    = s->schema_part.first_object;
+               linked_attributes_count         = 0; /* TODO: ! */
+               linked_attributes               = NULL; /* TODO: ! */;
+               s_dsa->highwatermark            = c->ctr6->new_highwatermark;
+               s_dsa->source_dsa_obj_guid      = c->ctr6->source_dsa_guid;
+               s_dsa->source_dsa_invocation_id = 
c->ctr6->source_dsa_invocation_id;
+               uptodateness_vector             = c->ctr6->uptodateness_vector;
                break;
        default:
                return NT_STATUS_INVALID_PARAMETER;
        }
 
+       s_dsa->replica_flags            = DRSUAPI_DS_REPLICA_NEIGHBOUR_WRITEABLE
+                                       | 
DRSUAPI_DS_REPLICA_NEIGHBOUR_SYNC_ON_STARTUP
+                                       | 
DRSUAPI_DS_REPLICA_NEIGHBOUR_DO_SCHEDULED_SYNCS;
+       memset(s_dsa->schedule, 0x11, sizeof(s_dsa->schedule));
+
+       tmp_dns_name    = GUID_string(s_dsa->other_info, 
&s_dsa->source_dsa_obj_guid);
+       NT_STATUS_HAVE_NO_MEMORY(tmp_dns_name);
+       tmp_dns_name    = talloc_asprintf_append(tmp_dns_name, "._msdcs.%s", 
c->forest->dns_name);
+       NT_STATUS_HAVE_NO_MEMORY(tmp_dns_name);
+       s_dsa->other_info->dns_name = tmp_dns_name;
+
        for (cur = first_object; cur; cur = cur->next_object) {
                bool is_attr = false;
                bool is_class = false;
@@ -368,8 +386,7 @@
                                                         first_object,
                                                         
linked_attributes_count,
                                                         linked_attributes,
-                                                        
source_dsa_invocation_id,
-                                                        new_highwatermark,
+                                                        s_dsa,
                                                         uptodateness_vector,
                                                         s, &objs);
        if (!W_ERROR_IS_OK(status)) {
@@ -388,6 +405,7 @@
                }
        }
 
+       talloc_free(s_dsa);
        talloc_free(objs);
        return NT_STATUS_OK;
 }
@@ -472,39 +490,57 @@
        struct drsuapi_DsReplicaObjectListItemEx *first_object;
        uint32_t linked_attributes_count;
        struct drsuapi_DsReplicaLinkedAttribute *linked_attributes;
-       const struct GUID *source_dsa_invocation_id;
-       const struct drsuapi_DsReplicaHighWaterMark *new_highwatermark;
        const struct drsuapi_DsReplicaCursor2CtrEx *uptodateness_vector;
        struct dsdb_extended_replicated_objects *objs;
+       struct repsFromTo1 *s_dsa;
+       char *tmp_dns_name;
        uint32_t i;
 
+       s_dsa                   = talloc_zero(s, struct repsFromTo1);
+       NT_STATUS_HAVE_NO_MEMORY(s_dsa);
+       s_dsa->other_info       = talloc(s_dsa, struct repsFromTo1OtherInfo);
+       NT_STATUS_HAVE_NO_MEMORY(s_dsa->other_info);
+
        switch (c->ctr_level) {
        case 1:
-               mapping_ctr             = &c->ctr1->mapping_ctr;
-               total_object_count      = c->ctr1->total_object_count;
-               object_count            = c->ctr1->object_count;
-               first_object            = c->ctr1->first_object;
-               linked_attributes_count = 0;
-               linked_attributes       = NULL;
-               source_dsa_invocation_id= &c->ctr1->source_dsa_invocation_id;
-               new_highwatermark       = &c->ctr1->new_highwatermark;
-               uptodateness_vector     = NULL; /* TODO: map it */
+               mapping_ctr                     = &c->ctr1->mapping_ctr;
+               total_object_count              = c->ctr1->total_object_count;
+               object_count                    = c->ctr1->object_count;
+               first_object                    = c->ctr1->first_object;
+               linked_attributes_count         = 0;
+               linked_attributes               = NULL;
+               s_dsa->highwatermark            = c->ctr1->new_highwatermark;
+               s_dsa->source_dsa_obj_guid      = c->ctr1->source_dsa_guid;
+               s_dsa->source_dsa_invocation_id = 
c->ctr1->source_dsa_invocation_id;
+               uptodateness_vector             = NULL; /* TODO: map it */
                break;
        case 6:
-               mapping_ctr             = &c->ctr6->mapping_ctr;
-               total_object_count      = c->ctr6->total_object_count;
-               object_count            = c->ctr6->object_count;
-               first_object            = c->ctr6->first_object;
-               linked_attributes_count = c->ctr6->linked_attributes_count;
-               linked_attributes       = c->ctr6->linked_attributes;
-               source_dsa_invocation_id= &c->ctr6->source_dsa_invocation_id;
-               new_highwatermark       = &c->ctr6->new_highwatermark;
-               uptodateness_vector     = c->ctr6->uptodateness_vector;
+               mapping_ctr                     = &c->ctr6->mapping_ctr;
+               total_object_count              = c->ctr6->total_object_count;
+               object_count                    = c->ctr6->object_count;
+               first_object                    = c->ctr6->first_object;
+               linked_attributes_count         = 
c->ctr6->linked_attributes_count;
+               linked_attributes               = c->ctr6->linked_attributes;
+               s_dsa->highwatermark            = c->ctr6->new_highwatermark;
+               s_dsa->source_dsa_obj_guid      = c->ctr6->source_dsa_guid;
+               s_dsa->source_dsa_invocation_id = 
c->ctr6->source_dsa_invocation_id;
+               uptodateness_vector             = c->ctr6->uptodateness_vector;
                break;
        default:
                return NT_STATUS_INVALID_PARAMETER;
        }
 
+       s_dsa->replica_flags            = DRSUAPI_DS_REPLICA_NEIGHBOUR_WRITEABLE
+                                       | 
DRSUAPI_DS_REPLICA_NEIGHBOUR_SYNC_ON_STARTUP
+                                       | 
DRSUAPI_DS_REPLICA_NEIGHBOUR_DO_SCHEDULED_SYNCS;
+       memset(s_dsa->schedule, 0x11, sizeof(s_dsa->schedule));
+
+       tmp_dns_name    = GUID_string(s_dsa->other_info, 
&s_dsa->source_dsa_obj_guid);
+       NT_STATUS_HAVE_NO_MEMORY(tmp_dns_name);
+       tmp_dns_name    = talloc_asprintf_append(tmp_dns_name, "._msdcs.%s", 
c->forest->dns_name);
+       NT_STATUS_HAVE_NO_MEMORY(tmp_dns_name);
+       s_dsa->other_info->dns_name = tmp_dns_name;
+
        if (total_object_count) {
                DEBUG(0,("Partition[%s] objects[%u/%u]\n",
                        c->partition->nc.dn, object_count, total_object_count));
@@ -521,8 +557,7 @@
                                                         first_object,
                                                         
linked_attributes_count,
                                                         linked_attributes,
-                                                        
source_dsa_invocation_id,
-                                                        new_highwatermark,
+                                                        s_dsa,
                                                         uptodateness_vector,
                                                         s, &objs);
        if (!W_ERROR_IS_OK(status)) {
@@ -540,6 +575,7 @@
                        NDR_PRINT_DEBUG(replPropertyMetaDataBlob, 
objs->objects[i].meta_data);
                }
        }
+       talloc_free(s_dsa);
        talloc_free(objs);
 
        for (i=0; i < linked_attributes_count; i++) {

Reply via email to