mirror of
https://github.com/samba-team/samba.git
synced 2025-08-03 04:22:09 +03:00
s4-python: Move dsdb_convert_schema_to_openldap to dsdb.
This commit is contained in:
@ -121,11 +121,41 @@ static PyObject *py_dsdb_set_opaque_integer(PyObject *self, PyObject *args)
|
|||||||
Py_RETURN_NONE;
|
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[] = {
|
static PyMethodDef py_dsdb_methods[] = {
|
||||||
{ "samdb_server_site_name", (PyCFunction)py_samdb_server_site_name,
|
{ "samdb_server_site_name", (PyCFunction)py_samdb_server_site_name,
|
||||||
METH_VARARGS, "Get the server site name as a string"},
|
METH_VARARGS, "Get the server site name as a string"},
|
||||||
{ "dsdb_set_opaque_integer", (PyCFunction)py_dsdb_set_opaque_integer,
|
{ "dsdb_set_opaque_integer", (PyCFunction)py_dsdb_set_opaque_integer,
|
||||||
METH_VARARGS, NULL },
|
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 }
|
{ NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -311,29 +311,6 @@ static PyObject *py_dsdb_set_schema_from_ldif(PyObject *self, PyObject *args)
|
|||||||
Py_RETURN_NONE;
|
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) {
|
|
||||||
PyErr_SetString(PyExc_RuntimeError, "dsdb_convert_schema_to_openldap failed");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
ret = PyString_FromString(retstr);
|
|
||||||
talloc_free(retstr);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
static PyObject *py_dsdb_write_prefixes_from_schema_to_ldb(PyObject *self, PyObject *args)
|
static PyObject *py_dsdb_write_prefixes_from_schema_to_ldb(PyObject *self, PyObject *args)
|
||||||
{
|
{
|
||||||
PyObject *py_ldb;
|
PyObject *py_ldb;
|
||||||
@ -590,8 +567,6 @@ static PyMethodDef py_misc_methods[] = {
|
|||||||
NULL },
|
NULL },
|
||||||
{ "dsdb_set_schema_from_ldb", (PyCFunction)py_dsdb_set_schema_from_ldb, METH_VARARGS,
|
{ "dsdb_set_schema_from_ldb", (PyCFunction)py_dsdb_set_schema_from_ldb, METH_VARARGS,
|
||||||
NULL },
|
NULL },
|
||||||
{ "dsdb_convert_schema_to_openldap", (PyCFunction)py_dsdb_convert_schema_to_openldap, METH_VARARGS,
|
|
||||||
NULL },
|
|
||||||
{ "set_debug_level", (PyCFunction)py_set_debug_level, METH_VARARGS,
|
{ "set_debug_level", (PyCFunction)py_set_debug_level, METH_VARARGS,
|
||||||
"set debug level" },
|
"set debug level" },
|
||||||
{ "dsdb_load_partition_usn", (PyCFunction)py_dsdb_load_partition_usn, METH_VARARGS,
|
{ "dsdb_load_partition_usn", (PyCFunction)py_dsdb_load_partition_usn, METH_VARARGS,
|
||||||
|
@ -294,7 +294,7 @@ class Ldb(ldb.Ldb):
|
|||||||
glue.dsdb_write_prefixes_from_schema_to_ldb(self)
|
glue.dsdb_write_prefixes_from_schema_to_ldb(self)
|
||||||
|
|
||||||
def convert_schema_to_openldap(self, target, mapping):
|
def convert_schema_to_openldap(self, target, mapping):
|
||||||
return glue.dsdb_convert_schema_to_openldap(self, target, mapping)
|
return dsdb.dsdb_convert_schema_to_openldap(self, target, mapping)
|
||||||
|
|
||||||
def set_invocation_id(self, invocation_id):
|
def set_invocation_id(self, invocation_id):
|
||||||
"""Set the invocation id for this SamDB handle.
|
"""Set the invocation id for this SamDB handle.
|
||||||
|
Reference in New Issue
Block a user