return true;
}
-/* Fix the DN so that the relative attribute names are in upper case so that the DN:
- cn=Adminstrator,cn=users,dc=samba,dc=example,dc=com becomes
- CN=Adminstrator,CN=users,DC=samba,DC=example,DC=com
-*/
-static int fix_dn(struct ldb_context *ldb, struct ldb_dn *dn)
-{
- int i, ret;
- char *upper_rdn_attr;
-
- for (i=0; i < ldb_dn_get_comp_num(dn); i++) {
- /* We need the attribute name in upper case */
- upper_rdn_attr = strupper_talloc(dn,
- ldb_dn_get_component_name(dn, i));
- if (!upper_rdn_attr) {
- return ldb_oom(ldb);
- }
-
- /* And replace it with CN=foo (we need the attribute in upper case */
- ret = ldb_dn_set_component(dn, i, upper_rdn_attr,
- *ldb_dn_get_component_val(dn, i));
- talloc_free(upper_rdn_attr);
- if (ret != LDB_SUCCESS) {
- return ret;
- }
- }
- return LDB_SUCCESS;
-}
-
-
/* Inject the extended DN components, so the DN cn=Adminstrator,cn=users,dc=samba,dc=example,dc=com becomes
<GUID=541203ae-f7d6-47ef-8390-bfcf019f9583>;<SID=S-1-5-21-4177067393-1453636373-93818737-500>;cn=Adminstrator,cn=users,dc=samba,dc=example,dc=com */
}
if (p && p->normalise) {
- ret = fix_dn(ldb, ares->message->dn);
+ ret = dsdb_fix_dn_rdncase(ldb, ares->message->dn);
if (ret != LDB_SUCCESS) {
return ldb_module_done(ac->req, NULL, NULL, ret);
}
}
if (p->normalise) {
- ret = fix_dn(ldb, dn);
+ ret = dsdb_fix_dn_rdncase(ldb, dn);
if (ret != LDB_SUCCESS) {
talloc_free(dsdb_dn);
return ldb_module_done(ac->req, NULL, NULL, ret);
talloc_free(partition->ctrl->dn);
partition->ctrl->dn = talloc_steal(partition->ctrl, dn_res->msgs[0]->dn);
talloc_free(dn_res);
+ if (data->ldapBackend) {
+ ret = dsdb_fix_dn_rdncase(ldb, partition->ctrl->dn);
+ if (ret) {
+ talloc_free(mem_ctx);
+ return ret;
+ }
+ }
} else if (ret != LDB_ERR_NO_SUCH_OBJECT) {
ldb_asprintf_errstring(ldb,
"Failed to search for partition base %s in new partition at %s: %s",
return dsdb_get_last_structural_class(schema, oc_el);
}
+
+/* Fix the DN so that the relative attribute names are in upper case so that the DN:
+ cn=Adminstrator,cn=users,dc=samba,dc=example,dc=com becomes
+ CN=Adminstrator,CN=users,DC=samba,DC=example,DC=com
+*/
+int dsdb_fix_dn_rdncase(struct ldb_context *ldb, struct ldb_dn *dn)
+{
+ int i, ret;
+ char *upper_rdn_attr;
+
+ for (i=0; i < ldb_dn_get_comp_num(dn); i++) {
+ /* We need the attribute name in upper case */
+ upper_rdn_attr = strupper_talloc(dn,
+ ldb_dn_get_component_name(dn, i));
+ if (!upper_rdn_attr) {
+ return ldb_oom(ldb);
+ }
+ ret = ldb_dn_set_component(dn, i, upper_rdn_attr,
+ *ldb_dn_get_component_val(dn, i));
+ talloc_free(upper_rdn_attr);
+ if (ret != LDB_SUCCESS) {
+ return ret;
+ }
+ }
+ return LDB_SUCCESS;
+}