bool remove_sid)
{
int ret;
- const struct ldb_val *val;
const DATA_BLOB *guid_blob;
const DATA_BLOB *sid_blob;
ldb_msg_remove_attr(ares->message, "objectSID");
}
- val = ldb_msg_find_ldb_val(ares->message, "distinguishedName");
- if (val) {
- ldb_msg_remove_attr(ares->message, "distinguishedName");
- ret = ldb_msg_add_steal_string(ares->message, "distinguishedName",
- ldb_dn_get_extended_linearized(ares->message, ares->message->dn, type));
- if (ret != LDB_SUCCESS) {
- ldb_oom(ldb);
- return LDB_ERR_OPERATIONS_ERROR;
- }
- }
return LDB_SUCCESS;
}
break;
}
+ if (private && private->normalise) {
+ ret = fix_dn(ares->message->dn);
+ if (ret != LDB_SUCCESS) {
+ return ldb_module_done(ac->req, NULL, NULL, ret);
+ }
+ }
+
if (ac->inject) {
/* for each record returned post-process to add any derived
attributes that have been asked for */
}
}
+ if ((private && private->normalise) || ac->inject) {
+ const struct ldb_val *val = ldb_msg_find_ldb_val(ares->message, "distinguishedName");
+ if (val) {
+ ldb_msg_remove_attr(ares->message, "distinguishedName");
+ if (ac->inject) {
+ ret = ldb_msg_add_steal_string(ares->message, "distinguishedName",
+ ldb_dn_get_extended_linearized(ares->message, ares->message->dn, ac->extended_type));
+ } else {
+ ret = ldb_msg_add_string(ares->message, "distinguishedName",
+ ldb_dn_get_linearized(ares->message->dn));
+ }
+ if (ret != LDB_SUCCESS) {
+ ldb_oom(ac->module->ldb);
+ return LDB_ERR_OPERATIONS_ERROR;
+ }
+ }
+ }
+
if (private && private->dereference) {
control = ldb_reply_get_control(ares, DSDB_OPENLDAP_DEREFERENCE_CONTROL);
/* Walk the retruned elements (but only if we have a schema to interpret the list with) */
for (i = 0; ac->schema && i < msg->num_elements; i++) {
const struct dsdb_attribute *attribute;
- /* distinguishedName has been dealt with above */
- if (ldb_attr_cmp(msg->elements[i].name, "distinguishedName") == 0) {
- continue;
- }
attribute = dsdb_attribute_by_lDAPDisplayName(ac->schema, msg->elements[i].name);
if (!attribute) {
continue;
}
}
+ /* distinguishedName has been dealt with above */
+ if (ldb_attr_cmp(msg->elements[i].name, "distinguishedName") == 0) {
+ continue;
+ }
+
/* Look to see if this attributeSyntax is a DN */
if (strcmp(attribute->attributeSyntax_oid, "2.5.5.1") != 0) {
continue;