summaryrefslogtreecommitdiff
path: root/source4/dsdb/pydsdb.c
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2010-04-04 00:42:52 +0200
committerJelmer Vernooij <jelmer@samba.org>2010-04-04 00:42:52 +0200
commit55aeb682ba157dc02d838381d1b5d9db166beaeb (patch)
tree41295c0bcbc659961de9a57f5a248b964f649fea /source4/dsdb/pydsdb.c
parent2a67eda98f88f132443bc2b81ca2686bcc1775a6 (diff)
downloadsamba-55aeb682ba157dc02d838381d1b5d9db166beaeb.tar.gz
samba-55aeb682ba157dc02d838381d1b5d9db166beaeb.tar.bz2
samba-55aeb682ba157dc02d838381d1b5d9db166beaeb.zip
s4-python: Move dsdb_convert_schema_to_openldap to dsdb.
Diffstat (limited to 'source4/dsdb/pydsdb.c')
-rw-r--r--source4/dsdb/pydsdb.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/source4/dsdb/pydsdb.c b/source4/dsdb/pydsdb.c
index b4f0b0f339..6e3e50a871 100644
--- a/source4/dsdb/pydsdb.c
+++ b/source4/dsdb/pydsdb.c
@@ -121,11 +121,41 @@ static PyObject *py_dsdb_set_opaque_integer(PyObject *self, PyObject *args)
Py_RETURN_NONE;
}
+static PyObject *py_dsdb_convert_schema_to_openldap(PyObject *self,
+ PyObject *args)
+{
+ char *target_str, *mapping;
+ PyObject *py_ldb;
+ struct ldb_context *ldb;
+ PyObject *ret;
+ char *retstr;
+
+ if (!PyArg_ParseTuple(args, "Oss", &py_ldb, &target_str, &mapping))
+ return NULL;
+
+ PyErr_LDB_OR_RAISE(py_ldb, ldb);
+
+ retstr = dsdb_convert_schema_to_openldap(ldb, target_str, mapping);
+ if (retstr == NULL) {
+ PyErr_SetString(PyExc_RuntimeError,
+ "dsdb_convert_schema_to_openldap failed");
+ return NULL;
+ }
+
+ ret = PyString_FromString(retstr);
+ talloc_free(retstr);
+ return ret;
+}
+
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"},
{ "dsdb_set_opaque_integer", (PyCFunction)py_dsdb_set_opaque_integer,
METH_VARARGS, NULL },
+ { "dsdb_convert_schema_to_openldap",
+ (PyCFunction)py_dsdb_convert_schema_to_openldap, METH_VARARGS,
+ "dsdb_convert_schema_to_openldap(ldb, target_str, mapping) -> str\n"
+ "Create an OpenLDAP schema from a schema." },
{ NULL }
};