summaryrefslogtreecommitdiff
path: root/source4/libnet/libnet_vampire.c
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2009-11-09 21:26:02 +1100
committerAndrew Bartlett <abartlet@samba.org>2009-11-12 16:34:10 +1100
commitdf7546ac16db6e802f8c8ef7bac6f01acc9233b2 (patch)
tree6f3d65861d90b964c920d36e066b55d2ecd8ef17 /source4/libnet/libnet_vampire.c
parentd6563801d1783a8cb1b9740878d0a07d40085f32 (diff)
downloadsamba-df7546ac16db6e802f8c8ef7bac6f01acc9233b2.tar.gz
samba-df7546ac16db6e802f8c8ef7bac6f01acc9233b2.tar.bz2
samba-df7546ac16db6e802f8c8ef7bac6f01acc9233b2.zip
s4:dsdb/repl Split the 'convert' or 'commit' stages in the DRS import
This will allow us in future to do tests on the LDB values we generate from the DRS replication. Andrew Bartlett
Diffstat (limited to 'source4/libnet/libnet_vampire.c')
-rw-r--r--source4/libnet/libnet_vampire.c63
1 files changed, 38 insertions, 25 deletions
diff --git a/source4/libnet/libnet_vampire.c b/source4/libnet/libnet_vampire.c
index f7131c1d02..2f30826cce 100644
--- a/source4/libnet/libnet_vampire.c
+++ b/source4/libnet/libnet_vampire.c
@@ -280,7 +280,6 @@ static NTSTATUS vampire_apply_schema(struct vampire_state *s,
if (!W_ERROR_IS_OK(status)) {
return werror_to_ntstatus(status);
}
-
DLIST_ADD_END(s->self_made_schema->classes, sc, struct dsdb_class *);
}
}
@@ -291,20 +290,21 @@ static NTSTATUS vampire_apply_schema(struct vampire_state *s,
return NT_STATUS_FOOBAR;
}
/* we don't want to access the self made schema anymore */
+ s->schema = s->self_made_schema;
s->self_made_schema = NULL;
- s->schema = dsdb_get_schema(s->ldb);
- status = dsdb_extended_replicated_objects_commit(s->ldb,
- c->partition->nc.dn,
- mapping_ctr,
- object_count,
- first_object,
- linked_attributes_count,
- linked_attributes,
- s_dsa,
- uptodateness_vector,
- c->gensec_skey,
- s, &objs, &seq_num);
+ /* Now convert the schema elements again, using the schema we just imported */
+ status = dsdb_extended_replicated_objects_convert(s->ldb,
+ c->partition->nc.dn,
+ mapping_ctr,
+ object_count,
+ first_object,
+ linked_attributes_count,
+ linked_attributes,
+ s_dsa,
+ uptodateness_vector,
+ c->gensec_skey,
+ s, &objs);
if (!W_ERROR_IS_OK(status)) {
DEBUG(0,("Failed to commit objects: %s\n", win_errstr(status)));
return werror_to_ntstatus(status);
@@ -321,6 +321,12 @@ static NTSTATUS vampire_apply_schema(struct vampire_state *s,
}
}
+ status = dsdb_extended_replicated_objects_commit(s->ldb, objs, &seq_num);
+ if (!W_ERROR_IS_OK(status)) {
+ DEBUG(0,("Failed to commit objects: %s\n", win_errstr(status)));
+ return werror_to_ntstatus(status);
+ }
+
msg = ldb_msg_new(objs);
NT_STATUS_HAVE_NO_MEMORY(msg);
msg->dn = objs->partition_dn;
@@ -535,19 +541,19 @@ static NTSTATUS vampire_store_chunk(void *private_data,
}
- status = dsdb_extended_replicated_objects_commit(s->ldb,
- c->partition->nc.dn,
- mapping_ctr,
- object_count,
- first_object,
- linked_attributes_count,
- linked_attributes,
- s_dsa,
- uptodateness_vector,
- c->gensec_skey,
- s, &objs, &seq_num);
+ status = dsdb_extended_replicated_objects_convert(s->ldb,
+ c->partition->nc.dn,
+ mapping_ctr,
+ object_count,
+ first_object,
+ linked_attributes_count,
+ linked_attributes,
+ s_dsa,
+ uptodateness_vector,
+ c->gensec_skey,
+ s, &objs);
if (!W_ERROR_IS_OK(status)) {
- DEBUG(0,("Failed to commit objects: %s\n", win_errstr(status)));
+ DEBUG(0,("Failed to convert objects: %s\n", win_errstr(status)));
return werror_to_ntstatus(status);
}
@@ -561,6 +567,13 @@ static NTSTATUS vampire_store_chunk(void *private_data,
NDR_PRINT_DEBUG(replPropertyMetaDataBlob, objs->objects[i].meta_data);
}
}
+ status = dsdb_extended_replicated_objects_commit(s->ldb,
+ objs, &seq_num);
+ if (!W_ERROR_IS_OK(status)) {
+ DEBUG(0,("Failed to commit objects: %s\n", win_errstr(status)));
+ return werror_to_ntstatus(status);
+ }
+
talloc_free(s_dsa);
talloc_free(objs);