summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2011-04-05 16:47:20 +0200
committerStefan Metzmacher <metze@samba.org>2011-04-06 18:37:01 +0200
commitd622d21054e46dde53f751e43d8f3b481b4332b0 (patch)
tree99b9f09e96fded3de3a33a6cfb572193aaf4a4aa
parent3626579cc27cb03fba2100be1a2686651bd3f003 (diff)
downloadsamba-d622d21054e46dde53f751e43d8f3b481b4332b0.tar.gz
samba-d622d21054e46dde53f751e43d8f3b481b4332b0.tar.bz2
samba-d622d21054e46dde53f751e43d8f3b481b4332b0.zip
s4:dsdb/repl_meta_data: normalize the rdn attribute name based on the schema
metze
-rw-r--r--source4/dsdb/samdb/ldb_modules/repl_meta_data.c20
1 files changed, 15 insertions, 5 deletions
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;
}