From 8149094eddebd9a0e8b7c123c2ed54d00164bb26 Mon Sep 17 00:00:00 2001 From: Kamen Mazdrashki Date: Fri, 9 Apr 2010 10:48:20 +0300 Subject: s4/dsdb: Set schemaInfo attribute value during provisioning After provisioning new Forest, schemaInfo should be set to a value with revision=1 and current invocation_id --- source4/scripting/python/pyglue.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'source4/scripting/python/pyglue.c') diff --git a/source4/scripting/python/pyglue.c b/source4/scripting/python/pyglue.c index f085714635..a80dedc717 100644 --- a/source4/scripting/python/pyglue.c +++ b/source4/scripting/python/pyglue.c @@ -159,6 +159,30 @@ static PyObject *py_dsdb_write_prefixes_from_schema_to_ldb(PyObject *self, PyObj Py_RETURN_NONE; } +static PyObject *py_dsdb_schema_info_reset(PyObject *self, PyObject *args) +{ + PyObject *py_ldb; + struct ldb_context *ldb; + WERROR result; + struct dsdb_schema *schema; + + if (!PyArg_ParseTuple(args, "O", &py_ldb)) + return NULL; + + PyErr_LDB_OR_RAISE(py_ldb, ldb); + + schema = dsdb_get_schema(ldb, NULL); + if (!schema) { + PyErr_SetString(PyExc_RuntimeError, "Failed to set find a schema on ldb!\n"); + return NULL; + } + + result = dsdb_schema_info_reset(ldb, schema); + PyErr_WERROR_IS_ERR_RAISE(result); + + Py_RETURN_NONE; +} + static PyObject *py_dsdb_set_schema_from_ldb(PyObject *self, PyObject *args) { PyObject *py_ldb; @@ -253,6 +277,8 @@ static PyMethodDef py_misc_methods[] = { NULL }, { "dsdb_write_prefixes_from_schema_to_ldb", (PyCFunction)py_dsdb_write_prefixes_from_schema_to_ldb, METH_VARARGS, NULL }, + { "dsdb_schema_info_reset", (PyCFunction)py_dsdb_schema_info_reset, METH_VARARGS, + "Reset schemaInfo value to default for a new Forest" }, { "dsdb_set_schema_from_ldb", (PyCFunction)py_dsdb_set_schema_from_ldb, METH_VARARGS, NULL }, { "set_debug_level", (PyCFunction)py_set_debug_level, METH_VARARGS, -- cgit