summaryrefslogtreecommitdiff
path: root/source4/dsdb/repl
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2009-09-11 18:01:27 +1000
committerAndrew Tridgell <tridge@samba.org>2009-09-11 18:02:04 +1000
commit741fe9d6a1833f358c32f91c5d7583c1c713110f (patch)
treec9d87d2787bd8645a9aa93f623fdad216bb30783 /source4/dsdb/repl
parent5b20af988c319f389e29db0a47d552c5f68aed58 (diff)
downloadsamba-741fe9d6a1833f358c32f91c5d7583c1c713110f.tar.gz
samba-741fe9d6a1833f358c32f91c5d7583c1c713110f.tar.bz2
samba-741fe9d6a1833f358c32f91c5d7583c1c713110f.zip
s4-repl: don't add the RDN if it is already there
Diffstat (limited to 'source4/dsdb/repl')
-rw-r--r--source4/dsdb/repl/replicated_objects.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/source4/dsdb/repl/replicated_objects.c b/source4/dsdb/repl/replicated_objects.c
index ecf2856eb5..fb6d4c18ec 100644
--- a/source4/dsdb/repl/replicated_objects.c
+++ b/source4/dsdb/repl/replicated_objects.c
@@ -150,9 +150,25 @@ static WERROR dsdb_convert_object_ex(struct ldb_context *ldb,
}
if (rdn_m) {
- ret = ldb_msg_add_value(msg, rdn_attr->lDAPDisplayName, rdn_value, NULL);
- if (ret != LDB_SUCCESS) {
- return WERR_FOOBAR;
+ struct ldb_message_element *el;
+ el = ldb_msg_find_element(msg, rdn_attr->lDAPDisplayName);
+ if (!el) {
+ ret = ldb_msg_add_value(msg, rdn_attr->lDAPDisplayName, rdn_value, NULL);
+ if (ret != LDB_SUCCESS) {
+ return WERR_FOOBAR;
+ }
+ } else {
+ if (el->num_values != 1) {
+ DEBUG(0,(__location__ ": Unexpected num_values=%u\n",
+ el->num_values));
+ return WERR_FOOBAR;
+ }
+ if (!ldb_val_equal_exact(&el->values[0], rdn_value)) {
+ DEBUG(0,(__location__ ": RDN value changed? '%*.*s' '%*.*s'\n",
+ (int)el->values[0].length, (int)el->values[0].length, el->values[0].data,
+ (int)rdn_value->length, (int)rdn_value->length, rdn_value->data));
+ return WERR_FOOBAR;
+ }
}
rdn_m->attid = rdn_attid;