summaryrefslogtreecommitdiff
path: root/source4/dsdb
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2010-06-19 17:09:52 +0200
committerJelmer Vernooij <jelmer@samba.org>2010-06-19 22:46:43 +0200
commita4f60ffe4bb4e0e32d7cd62dc872b1f23435edca (patch)
treee8d23b2dbb40e1e40200cc2e928443b8746d842d /source4/dsdb
parent05b108a06b383f2172a379629b9a6bcff82c6868 (diff)
downloadsamba-a4f60ffe4bb4e0e32d7cd62dc872b1f23435edca.tar.gz
samba-a4f60ffe4bb4e0e32d7cd62dc872b1f23435edca.tar.bz2
samba-a4f60ffe4bb4e0e32d7cd62dc872b1f23435edca.zip
pydsdb: Move dsdb_set_schema_from_ldb to pydsdb.
Diffstat (limited to 'source4/dsdb')
-rw-r--r--source4/dsdb/pydsdb.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/source4/dsdb/pydsdb.c b/source4/dsdb/pydsdb.c
index ce7923ddad..8f9ed9fa77 100644
--- a/source4/dsdb/pydsdb.c
+++ b/source4/dsdb/pydsdb.c
@@ -408,6 +408,35 @@ static PyObject *py_dsdb_set_schema_from_ldif(PyObject *self, PyObject *args)
Py_RETURN_NONE;
}
+static PyObject *py_dsdb_set_schema_from_ldb(PyObject *self, PyObject *args)
+{
+ PyObject *py_ldb;
+ struct ldb_context *ldb;
+ PyObject *py_from_ldb;
+ struct ldb_context *from_ldb;
+ struct dsdb_schema *schema;
+ int ret;
+ if (!PyArg_ParseTuple(args, "OO", &py_ldb, &py_from_ldb))
+ return NULL;
+
+ PyErr_LDB_OR_RAISE(py_ldb, ldb);
+
+ PyErr_LDB_OR_RAISE(py_from_ldb, from_ldb);
+
+ schema = dsdb_get_schema(from_ldb, NULL);
+ if (!schema) {
+ PyErr_SetString(PyExc_RuntimeError, "Failed to set find a schema on 'from' ldb!\n");
+ return NULL;
+ }
+
+ ret = dsdb_reference_schema(ldb, schema, true);
+ PyErr_LDB_ERROR_IS_ERR_RAISE(py_ldb_get_exception(), ret, ldb);
+
+ Py_RETURN_NONE;
+}
+
+
+
static PyMethodDef py_dsdb_methods[] = {
{ "samdb_server_site_name", (PyCFunction)py_samdb_server_site_name,
METH_VARARGS, "Get the server site name as a string"},
@@ -446,6 +475,8 @@ static PyMethodDef py_dsdb_methods[] = {
NULL },
{ "dsdb_set_schema_from_ldif", (PyCFunction)py_dsdb_set_schema_from_ldif, METH_VARARGS,
NULL },
+ { "dsdb_set_schema_from_ldb", (PyCFunction)py_dsdb_set_schema_from_ldb, METH_VARARGS,
+ NULL },
{ NULL }
};