s4:dsdb Don't cast an ldb_val into a const char * for schema lookups
[ira/wip.git] / source4 / dsdb / samdb / ldb_modules / objectclass.c
index 7883bccfe70e934f0df1c16c50f142cc13633912..4f013709b22234747190dcc046483f753c3f6e1b 100644 (file)
@@ -134,9 +134,10 @@ static int objectclass_sort(struct ldb_module *module,
                        ldb_oom(ldb);
                        return LDB_ERR_OPERATIONS_ERROR;
                }
                        ldb_oom(ldb);
                        return LDB_ERR_OPERATIONS_ERROR;
                }
-               current->objectclass = dsdb_class_by_lDAPDisplayName(schema, (const char *)objectclass_element->values[i].data);
+               current->objectclass = dsdb_class_by_lDAPDisplayName_ldb_val(schema, &objectclass_element->values[i]);
                if (!current->objectclass) {
                if (!current->objectclass) {
-                       ldb_asprintf_errstring(ldb, "objectclass %s is not a valid objectClass in schema", (const char *)objectclass_element->values[i].data);
+                       ldb_asprintf_errstring(ldb, "objectclass %.*s is not a valid objectClass in schema", 
+                                              (int)objectclass_element->values[i].length, (const char *)objectclass_element->values[i].data);
                        return LDB_ERR_OBJECT_CLASS_VIOLATION;
                }
 
                        return LDB_ERR_OBJECT_CLASS_VIOLATION;
                }