From a2a9c334c10b259d070a984a61656ae76a95a643 Mon Sep 17 00:00:00 2001 From: Matthias Dieter Wallnöfer Date: Wed, 11 Apr 2012 16:06:03 +0200 Subject: s4:dsdb/pydsdb.c - call the "objectClass" normalisation code from Python This allows the dbchecker to fix ordering/inconsistency problems with the mentioned attribute. Signed-off-by: Andrew Tridgell --- source4/dsdb/pydsdb.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'source4/dsdb/pydsdb.c') diff --git a/source4/dsdb/pydsdb.c b/source4/dsdb/pydsdb.c index 762a03de3f..d3486a41ec 100644 --- a/source4/dsdb/pydsdb.c +++ b/source4/dsdb/pydsdb.c @@ -569,6 +569,7 @@ static PyObject *py_dsdb_DsReplicaAttribute(PyObject *self, PyObject *args) PyObject *item = PyList_GetItem(el_list, i); if (!PyString_Check(item)) { PyErr_Format(PyExc_TypeError, "ldif_elements should be strings"); + talloc_free(tmp_ctx); return NULL; } el->values[i].data = (uint8_t *)PyString_AsString(item); @@ -663,12 +664,25 @@ static PyObject *py_dsdb_normalise_attributes(PyObject *self, PyObject *args) PyObject *item = PyList_GetItem(el_list, i); if (!PyString_Check(item)) { PyErr_Format(PyExc_TypeError, "ldif_elements should be strings"); + talloc_free(tmp_ctx); return NULL; } el->values[i].data = (uint8_t *)PyString_AsString(item); el->values[i].length = PyString_Size(item); } + /* Normalise "objectClass" attribute if needed */ + if (ldb_attr_cmp(a->lDAPDisplayName, "objectClass") == 0) { + int iret; + iret = dsdb_sort_objectClass_attr(ldb, schema, tmp_ctx, el, + tmp_ctx, el); + if (iret != LDB_SUCCESS) { + PyErr_SetString(PyExc_RuntimeError, ldb_errstring(ldb)); + talloc_free(tmp_ctx); + return NULL; + } + } + /* first run ldb_to_drsuapi, then convert back again. This has * the effect of normalising the attributes */ -- cgit