summaryrefslogtreecommitdiff
path: root/source4/scripting/python/pyglue.c
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2009-08-26 13:43:33 +1000
committerAndrew Bartlett <abartlet@samba.org>2009-08-26 13:49:10 +1000
commita1da91174b8db082c42ec7e8a6438e11e0e56e91 (patch)
treebc41b8eb1dfdd0beadb9b098456b62432b57874e /source4/scripting/python/pyglue.c
parentb9ec6bb1eb02121f43498681b99891dc17505512 (diff)
downloadsamba-a1da91174b8db082c42ec7e8a6438e11e0e56e91.tar.gz
samba-a1da91174b8db082c42ec7e8a6438e11e0e56e91.tar.bz2
samba-a1da91174b8db082c42ec7e8a6438e11e0e56e91.zip
s4:provison Add prefixes to ldb using same code a later modify will use
This allows us to test out the code that will do the modify of the prefixMap, and to provide the bindings that may assist a future upgrade script. Andrew Bartlett
Diffstat (limited to 'source4/scripting/python/pyglue.c')
-rw-r--r--source4/scripting/python/pyglue.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/source4/scripting/python/pyglue.c b/source4/scripting/python/pyglue.c
index f5694e162c..55ba5c37fc 100644
--- a/source4/scripting/python/pyglue.c
+++ b/source4/scripting/python/pyglue.c
@@ -344,6 +344,30 @@ static PyObject *py_dsdb_convert_schema_to_openldap(PyObject *self, PyObject *ar
return ret;
}
+static PyObject *py_dsdb_write_prefixes_from_schema_to_ldb(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);
+ if (!schema) {
+ PyErr_SetString(PyExc_RuntimeError, "Failed to set find a schema on ldb!\n");
+ return NULL;
+ }
+
+ result = dsdb_write_prefixes_from_schema_to_ldb(NULL, 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;
@@ -424,6 +448,8 @@ static PyMethodDef py_misc_methods[] = {
NULL },
{ "dsdb_set_schema_from_ldif", (PyCFunction)py_dsdb_set_schema_from_ldif, METH_VARARGS,
NULL },
+ { "dsdb_write_prefixes_from_schema_to_ldb", (PyCFunction)py_dsdb_write_prefixes_from_schema_to_ldb, METH_VARARGS,
+ NULL },
{ "dsdb_set_schema_from_ldb", (PyCFunction)py_dsdb_set_schema_from_ldb, METH_VARARGS,
NULL },
{ "dsdb_convert_schema_to_openldap", (PyCFunction)py_dsdb_convert_schema_to_openldap, METH_VARARGS,