From: Douglas Bagnall Date: Tue, 24 Oct 2017 23:31:08 +0000 (+1300) Subject: replmd: use check_parsed_dn_duplicates() more widely X-Git-Tag: tevent-0.9.34~97 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0f0acb00ea853480565a592343ede99c140e7077;p=thirdparty%2Fsamba.git replmd: use check_parsed_dn_duplicates() more widely replmd_add_fix_la() was already making the same check; here we move it a bit earlier. Signed-off-by: Douglas Bagnall Reviewed-by: Andrew Bartlett --- diff --git a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c index 364219462e1..c443102d98c 100644 --- a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c +++ b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c @@ -938,6 +938,10 @@ static int get_parsed_dns(struct ldb_module *module, TALLOC_CTX *mem_ctx, struct ldb_message_element *el, struct parsed_dn **pdn, const char *ldap_oid, struct ldb_request *parent); +static int check_parsed_dn_duplicates(struct ldb_module *module, + struct ldb_message_element *el, + struct parsed_dn *pdn); + /* fix up linked attributes in replmd_add. This involves setting up the right meta-data in extended DN @@ -979,6 +983,12 @@ static int replmd_add_fix_la(struct ldb_module *module, TALLOC_CTX *mem_ctx, return ret; } + ret = check_parsed_dn_duplicates(module, el, pdn); + if (ret != LDB_SUCCESS) { + talloc_free(tmp_ctx); + return ret; + } + new_values = talloc_array(tmp_ctx, struct ldb_val, el->num_values); if (new_values == NULL) { ldb_module_oom(module); @@ -988,17 +998,6 @@ static int replmd_add_fix_la(struct ldb_module *module, TALLOC_CTX *mem_ctx, for (i = 0; i < el->num_values; i++) { struct parsed_dn *p = &pdn[i]; - if (i > 0 && parsed_dn_compare(p, &pdn[i - 1]) == 0) { - ldb_asprintf_errstring(ldb, - "Linked attribute %s has " - "multiple identical values", el->name); - talloc_free(tmp_ctx); - if (ldb_attr_cmp(el->name, "member") == 0) { - return LDB_ERR_ENTRY_ALREADY_EXISTS; - } else { - return LDB_ERR_ATTRIBUTE_OR_VALUE_EXISTS; - } - } ret = replmd_build_la_val(el->values, p->v, p->dsdb_dn, &ac->our_invocation_id, ac->seq_num, now);