From d622d21054e46dde53f751e43d8f3b481b4332b0 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 5 Apr 2011 16:47:20 +0200 Subject: s4:dsdb/repl_meta_data: normalize the rdn attribute name based on the schema metze --- source4/dsdb/samdb/ldb_modules/repl_meta_data.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'source4') diff --git a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c index 06c63a8835..0b915d897f 100644 --- a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c +++ b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c @@ -2975,11 +2975,13 @@ static struct ldb_dn *replmd_conflict_dn(TALLOC_CTX *mem_ctx, struct ldb_dn *dn, needed to ensure that renames performed as part of conflict resolution are propogated to other DCs */ -static int replmd_name_modify(struct ldb_module *module, struct ldb_request *req, struct ldb_dn *dn) +static int replmd_name_modify(struct replmd_replicated_request *ar, + struct ldb_request *req, struct ldb_dn *dn) { struct ldb_message *msg; const char *rdn_name; const struct ldb_val *rdn_val; + const struct dsdb_attribute *rdn_attr; int ret; msg = ldb_msg_new(req); @@ -2993,6 +2995,13 @@ static int replmd_name_modify(struct ldb_module *module, struct ldb_request *req goto failed; } + /* normalize the rdn attribute name */ + rdn_attr = dsdb_attribute_by_lDAPDisplayName(ar->schema, rdn_name); + if (rdn_attr == NULL) { + goto failed; + } + rdn_name = rdn_attr->lDAPDisplayName; + rdn_val = ldb_dn_get_rdn_val(dn); if (rdn_val == NULL) { goto failed; @@ -3011,10 +3020,11 @@ static int replmd_name_modify(struct ldb_module *module, struct ldb_request *req goto failed; } - ret = dsdb_module_modify(module, msg, DSDB_FLAG_OWN_MODULE, req); + ret = dsdb_module_modify(ar->module, msg, DSDB_FLAG_OWN_MODULE, req); if (ret != LDB_SUCCESS) { DEBUG(0,(__location__ ": Failed to modify rDN/name of conflict DN '%s' - %s", - ldb_dn_get_linearized(dn), ldb_errstring(ldb_module_get_ctx(module)))); + ldb_dn_get_linearized(dn), + ldb_errstring(ldb_module_get_ctx(ar->module)))); return ret; } @@ -3047,7 +3057,7 @@ static int replmd_op_name_modify_callback(struct ldb_request *req, struct ldb_re } /* perform a modify of the rDN and name of the record */ - ret = replmd_name_modify(ar->module, req, req->op.add.message->dn); + ret = replmd_name_modify(ar, req, req->op.add.message->dn); if (ret != LDB_SUCCESS) { ares->error = ret; return replmd_op_callback(req, ares); @@ -3218,7 +3228,7 @@ static int replmd_op_add_callback(struct ldb_request *req, struct ldb_reply *are * now we need to ensure that the rename is seen as an * originating update. We do that with a modify. */ - ret = replmd_name_modify(ar->module, req, new_dn); + ret = replmd_name_modify(ar, req, new_dn); if (ret != LDB_SUCCESS) { goto failed; } -- cgit