summaryrefslogtreecommitdiff
path: root/source4/dsdb/pydsdb.c
diff options
context:
space:
mode:
authorMatthias Dieter Wallnöfer <mdw@samba.org>2012-04-11 16:06:03 +0200
committerAndrew Tridgell <tridge@samba.org>2012-04-18 07:48:05 +0200
commita2a9c334c10b259d070a984a61656ae76a95a643 (patch)
tree9f780939907329c961149fb89b0d64103bc940b0 /source4/dsdb/pydsdb.c
parent27bcf7a0b6ab3a4c74129e3952c1bf14b8017b86 (diff)
downloadsamba-a2a9c334c10b259d070a984a61656ae76a95a643.tar.gz
samba-a2a9c334c10b259d070a984a61656ae76a95a643.tar.bz2
samba-a2a9c334c10b259d070a984a61656ae76a95a643.zip
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 <tridge@samba.org>
Diffstat (limited to 'source4/dsdb/pydsdb.c')
-rw-r--r--source4/dsdb/pydsdb.c14
1 files changed, 14 insertions, 0 deletions
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
*/