summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
Diffstat (limited to 'source4')
-rw-r--r--source4/dsdb/repl/replicated_objects.c62
-rw-r--r--source4/dsdb/samdb/ldb_modules/repl_meta_data.c19
-rw-r--r--source4/dsdb/samdb/samdb.h1
3 files changed, 47 insertions, 35 deletions
diff --git a/source4/dsdb/repl/replicated_objects.c b/source4/dsdb/repl/replicated_objects.c
index 1e032b4c80..aa92269c46 100644
--- a/source4/dsdb/repl/replicated_objects.c
+++ b/source4/dsdb/repl/replicated_objects.c
@@ -44,13 +44,13 @@ static WERROR dsdb_convert_object(struct ldb_context *ldb,
NTTIME whenChanged = 0;
time_t whenChanged_t;
const char *whenChanged_s;
- const char *rdn_name;
- const struct ldb_val *rdn_value;
- const struct dsdb_attribute *rdn_attr;
+ const char *rdn_name = NULL;
+ const struct ldb_val *rdn_value = NULL;
+ const struct dsdb_attribute *rdn_attr = NULL;
uint32_t rdn_attid;
- struct drsuapi_DsReplicaAttribute *name_a;
- struct drsuapi_DsReplicaMetaData *name_d;
- struct replPropertyMetaData1 *rdn_m;
+ struct drsuapi_DsReplicaAttribute *name_a = NULL;
+ struct drsuapi_DsReplicaMetaData *name_d = NULL;
+ struct replPropertyMetaData1 *rdn_m = NULL;
int ret;
if (!in->object.identifier) {
@@ -134,44 +134,36 @@ static WERROR dsdb_convert_object(struct ldb_context *ldb,
}
}
- if (!name_d) {
- return WERR_FOOBAR;
- }
+ if (rdn_m) {
+ ret = ldb_msg_add_value(msg, rdn_attr->lDAPDisplayName, rdn_value, NULL);
+ if (ret != LDB_SUCCESS) {
+ return WERR_FOOBAR;
+ }
- ret = ldb_msg_add_value(msg, rdn_attr->lDAPDisplayName, rdn_value, NULL);
- if (ret != LDB_SUCCESS) {
- return WERR_FOOBAR;
- }
+ rdn_m->attid = rdn_attid;
+ rdn_m->version = name_d->version;
+ rdn_m->orginating_time = name_d->orginating_time;
+ rdn_m->orginating_invocation_id = name_d->orginating_invocation_id;
+ rdn_m->orginating_usn = name_d->orginating_usn;
+ rdn_m->local_usn = 0;
+ md->ctr.ctr1.count++;
- nt_status = ndr_push_struct_blob(&guid_value, msg, &in->object.identifier->guid,
- (ndr_push_flags_fn_t)ndr_push_GUID);
- if (!NT_STATUS_IS_OK(nt_status)) {
- return ntstatus_to_werror(nt_status);
- }
- ret = ldb_msg_add_value(msg, "objectGUID", &guid_value, NULL);
- if (ret != LDB_SUCCESS) {
- return WERR_FOOBAR;
}
whenChanged_t = nt_time_to_unix(whenChanged);
whenChanged_s = ldb_timestring(msg, whenChanged_t);
W_ERROR_HAVE_NO_MEMORY(whenChanged_s);
- ret = ldb_msg_add_string(msg, "whenChanged", whenChanged_s);
- if (ret != LDB_SUCCESS) {
- return WERR_FOOBAR;
+
+ nt_status = ndr_push_struct_blob(&guid_value, msg, &in->object.identifier->guid,
+ (ndr_push_flags_fn_t)ndr_push_GUID);
+ if (!NT_STATUS_IS_OK(nt_status)) {
+ return ntstatus_to_werror(nt_status);
}
- rdn_m->attid = rdn_attid;
- rdn_m->version = name_d->version;
- rdn_m->orginating_time = name_d->orginating_time;
- rdn_m->orginating_invocation_id = name_d->orginating_invocation_id;
- rdn_m->orginating_usn = name_d->orginating_usn;
- rdn_m->local_usn = 0;
- md->ctr.ctr1.count++;
-
- out->msg = msg;
- out->guid_value = guid_value;
- out->meta_data = md;
+ out->msg = msg;
+ out->guid_value = guid_value;
+ out->when_changed = whenChanged_s;
+ out->meta_data = md;
return WERR_OK;
}
diff --git a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c
index ca0291affd..498cf6a94f 100644
--- a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c
+++ b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c
@@ -446,6 +446,15 @@ static int replmd_replicated_apply_add(struct replmd_replicated_request *ar)
uint64_t seq_num;
int ret;
+ /*
+ * TODO: check if the parent object exist
+ */
+
+ /*
+ * TODO: handle the conflict case where an object with the
+ * same name exist
+ */
+
msg = ar->objs->objects[ar->index_current].msg;
md = ar->objs->objects[ar->index_current].meta_data;
@@ -454,6 +463,16 @@ static int replmd_replicated_apply_add(struct replmd_replicated_request *ar)
return replmd_replicated_request_error(ar, ret);
}
+ ret = ldb_msg_add_value(msg, "objectGUID", &ar->objs->objects[ar->index_current].guid_value, NULL);
+ if (ret != LDB_SUCCESS) {
+ return replmd_replicated_request_error(ar, ret);
+ }
+
+ ret = ldb_msg_add_string(msg, "whenChanged", ar->objs->objects[ar->index_current].when_changed);
+ if (ret != LDB_SUCCESS) {
+ return replmd_replicated_request_error(ar, ret);
+ }
+
ret = samdb_msg_add_uint64(ar->module->ldb, msg, msg, "uSNCreated", seq_num);
if (ret != LDB_SUCCESS) {
return replmd_replicated_request_error(ar, ret);
diff --git a/source4/dsdb/samdb/samdb.h b/source4/dsdb/samdb/samdb.h
index 0a4804dfb3..f1b5b8616d 100644
--- a/source4/dsdb/samdb/samdb.h
+++ b/source4/dsdb/samdb/samdb.h
@@ -44,6 +44,7 @@ struct dsdb_control_replicated_object {
struct dsdb_extended_replicated_object {
struct ldb_message *msg;
struct ldb_val guid_value;
+ const char *when_changed;
struct replPropertyMetaDataBlob *meta_data;
};