From 38160deac4d6f4a8ae22fcedcf55114bc0372f31 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 28 Dec 2009 17:19:29 +1100 Subject: s4-drs: use dsdb linked attribute parse functions This makes the code considerably more readable --- source4/dsdb/samdb/ldb_modules/repl_meta_data.c | 27 ++++--------------------- 1 file changed, 4 insertions(+), 23 deletions(-) (limited to 'source4/dsdb/samdb/ldb_modules') diff --git a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c index 3c713ec4d9..baae44a30d 100644 --- a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c +++ b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c @@ -3345,9 +3345,7 @@ static int replmd_process_linked_attribute(struct ldb_module *module, const struct dsdb_attribute *attr; struct dsdb_dn *dsdb_dn; uint64_t seq_num = 0; - struct drsuapi_DsReplicaAttribute drs; - struct drsuapi_DsAttributeValue val; - struct ldb_message_element new_el, *old_el; + struct ldb_message_element *old_el; WERROR status; time_t t = time(NULL); struct ldb_result *res; @@ -3358,10 +3356,6 @@ static int replmd_process_linked_attribute(struct ldb_module *module, bool active = (la->flags & DRSUAPI_DS_LINKED_ATTRIBUTE_FLAG_ACTIVE)?true:false; const struct GUID *our_invocation_id; - drs.value_ctr.num_values = 1; - drs.value_ctr.values = &val; - val.blob = la->value.blob; - /* linked_attributes[0]: &objs->linked_attributes[i]: struct drsuapi_DsReplicaLinkedAttribute @@ -3462,23 +3456,10 @@ linked_attributes[0]: return ret; } - status = attr->syntax->drsuapi_to_ldb(ldb, schema, attr, &drs, tmp_ctx, &new_el); + status = dsdb_dn_la_from_blob(ldb, attr, schema, tmp_ctx, la->value.blob, &dsdb_dn); if (!W_ERROR_IS_OK(status)) { - ldb_asprintf_errstring(ldb, "Failed to parsed linked attribute blob for %s on %s\n", - old_el->name, ldb_dn_get_linearized(msg->dn)); - return LDB_ERR_OPERATIONS_ERROR; - } - - if (new_el.num_values != 1) { - ldb_asprintf_errstring(ldb, "Failed to find value in linked attribute blob for %s on %s\n", - old_el->name, ldb_dn_get_linearized(msg->dn)); - return LDB_ERR_OPERATIONS_ERROR; - } - - dsdb_dn = dsdb_dn_parse(tmp_ctx, ldb, &new_el.values[0], attr->syntax->ldap_oid); - if (!dsdb_dn) { - ldb_asprintf_errstring(ldb, "Failed to parse DN in linked attribute blob for %s on %s\n", - old_el->name, ldb_dn_get_linearized(msg->dn)); + ldb_asprintf_errstring(ldb, "Failed to parsed linked attribute blob for %s on %s - %s\n", + old_el->name, ldb_dn_get_linearized(msg->dn), win_errstr(status)); return LDB_ERR_OPERATIONS_ERROR; } -- cgit