/* remove any message elements that have zero values */
for (i=0; i<msg->num_elements; i++) {
struct ldb_message_element *el = &msg->elements[i];
+ const struct dsdb_attribute *sa;
if (el->num_values == 0) {
if (ldb_attr_cmp(msg->elements[i].name, "objectClass") == 0) {
i--;
continue;
}
+ sa = dsdb_attribute_by_lDAPDisplayName(ar->schema, el->name);
+ if (!sa) {
+ ldb_asprintf_errstring(ldb,
+ "replmd_apply_add: attribute '%s' on '%s' not defined in schema, "
+ "despite being in the schema during the inbound replication!",
+ el->name, ldb_dn_get_linearized(msg->dn));
+ return replmd_replicated_request_error(ar, LDB_ERR_NO_SUCH_ATTRIBUTE);
+ }
}
if (DEBUGLVL(4)) {
/* we want to replace the old values */
for (i=0; i < msg->num_elements; i++) {
- msg->elements[i].flags = LDB_FLAG_MOD_REPLACE;
- if (ldb_attr_cmp(msg->elements[i].name, "objectClass") == 0) {
- if (msg->elements[i].num_values == 0) {
+ struct ldb_message_element *el = &msg->elements[i];
+ const struct dsdb_attribute *sa;
+
+ el->flags = LDB_FLAG_MOD_REPLACE;
+
+ if (ldb_attr_cmp(el->name, "objectClass") == 0) {
+ if (el->num_values == 0) {
ldb_asprintf_errstring(ldb, __location__
": objectClass removed on %s, aborting replication\n",
ldb_dn_get_linearized(msg->dn));
return replmd_replicated_request_error(ar, LDB_ERR_OBJECT_CLASS_VIOLATION);
}
}
+
+ sa = dsdb_attribute_by_lDAPDisplayName(ar->schema, el->name);
+ if (!sa) {
+ ldb_asprintf_errstring(ldb,
+ "replmd_apply_merge: attribute '%s' on '%s' not defined in schema, "
+ "despite being in the schema during the inbound replication!",
+ el->name, ldb_dn_get_linearized(msg->dn));
+ return replmd_replicated_request_error(ar, LDB_ERR_NO_SUCH_ATTRIBUTE);
+ }
}
if (DEBUGLVL(4)) {