mirror of
https://github.com/samba-team/samba.git
synced 2025-01-11 05:18:09 +03:00
s4-python: Move ldb_set_utf8_casefold to pyldb-samba.
This commit is contained in:
parent
ae97613499
commit
e9c3f2ef13
@ -25,6 +25,8 @@
|
|||||||
#include "lib/ldb/pyldb.h"
|
#include "lib/ldb/pyldb.h"
|
||||||
#include "param/pyparam.h"
|
#include "param/pyparam.h"
|
||||||
#include "auth/credentials/pycredentials.h"
|
#include "auth/credentials/pycredentials.h"
|
||||||
|
#include "ldb_wrap.h"
|
||||||
|
#include "lib/ldb-samba/ldif_handlers.h"
|
||||||
|
|
||||||
static PyObject *pyldb_module;
|
static PyObject *pyldb_module;
|
||||||
staticforward PyTypeObject PySambaLdb;
|
staticforward PyTypeObject PySambaLdb;
|
||||||
@ -136,15 +138,30 @@ static PyObject *py_ldb_set_opaque_integer(PyObject *self, PyObject *args)
|
|||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static PyObject *py_ldb_set_utf8_casefold(PyObject *self, PyObject *args)
|
||||||
|
{
|
||||||
|
struct ldb_context *ldb;
|
||||||
|
|
||||||
|
ldb = PyLdb_AsLdbContext(self);
|
||||||
|
|
||||||
|
ldb_set_utf8_fns(ldb, NULL, wrap_casefold);
|
||||||
|
|
||||||
|
Py_RETURN_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
static PyMethodDef py_samba_ldb_methods[] = {
|
static PyMethodDef py_samba_ldb_methods[] = {
|
||||||
{ "set_loadparm", (PyCFunction)py_ldb_set_loadparm, METH_VARARGS,
|
{ "set_loadparm", (PyCFunction)py_ldb_set_loadparm, METH_VARARGS,
|
||||||
"ldb_set_loadparm(ldb, session_info)\n"
|
"ldb_set_loadparm(ldb, session_info)\n"
|
||||||
"Set loadparm context to use when connecting." },
|
"Set loadparm context to use when connecting." },
|
||||||
{ "ldb_set_credentials", (PyCFunction)py_ldb_set_credentials, METH_VARARGS,
|
{ "set_credentials", (PyCFunction)py_ldb_set_credentials, METH_VARARGS,
|
||||||
"ldb_set_credentials(ldb, credentials)\n"
|
"ldb_set_credentials(ldb, credentials)\n"
|
||||||
"Set credentials to use when connecting." },
|
"Set credentials to use when connecting." },
|
||||||
{ "set_opaque_integer", (PyCFunction)py_ldb_set_opaque_integer,
|
{ "set_opaque_integer", (PyCFunction)py_ldb_set_opaque_integer,
|
||||||
METH_VARARGS, NULL },
|
METH_VARARGS, NULL },
|
||||||
|
{ "set_utf8_casefold", (PyCFunction)py_ldb_set_utf8_casefold,
|
||||||
|
METH_NOARGS,
|
||||||
|
"ldb_set_utf8_casefold(ldb)\n"
|
||||||
|
"Set the right Samba casefolding function for UTF8 charset." },
|
||||||
{ NULL },
|
{ NULL },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import getopt
|
|
||||||
import optparse
|
import optparse
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
|
@ -138,21 +138,6 @@ static PyObject *py_ldb_set_session_info(PyObject *self, PyObject *args)
|
|||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *py_ldb_set_utf8_casefold(PyObject *self, PyObject *args)
|
|
||||||
{
|
|
||||||
PyObject *py_ldb;
|
|
||||||
struct ldb_context *ldb;
|
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "O", &py_ldb))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
PyErr_LDB_OR_RAISE(py_ldb, ldb);
|
|
||||||
|
|
||||||
ldb_set_utf8_fns(ldb, NULL, wrap_casefold);
|
|
||||||
|
|
||||||
Py_RETURN_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static PyObject *py_samdb_set_domain_sid(PyLdbObject *self, PyObject *args)
|
static PyObject *py_samdb_set_domain_sid(PyLdbObject *self, PyObject *args)
|
||||||
{
|
{
|
||||||
PyObject *py_ldb, *py_sid;
|
PyObject *py_ldb, *py_sid;
|
||||||
@ -506,9 +491,6 @@ static PyMethodDef py_misc_methods[] = {
|
|||||||
{ "ldb_register_samba_handlers", (PyCFunction)py_ldb_register_samba_handlers, METH_VARARGS,
|
{ "ldb_register_samba_handlers", (PyCFunction)py_ldb_register_samba_handlers, METH_VARARGS,
|
||||||
"ldb_register_samba_handlers(ldb)\n"
|
"ldb_register_samba_handlers(ldb)\n"
|
||||||
"Register Samba-specific LDB modules and schemas." },
|
"Register Samba-specific LDB modules and schemas." },
|
||||||
{ "ldb_set_utf8_casefold", (PyCFunction)py_ldb_set_utf8_casefold, METH_VARARGS,
|
|
||||||
"ldb_set_utf8_casefold(ldb)\n"
|
|
||||||
"Set the right Samba casefolding function for UTF8 charset." },
|
|
||||||
{ "dsdb_set_ntds_invocation_id", (PyCFunction)py_dsdb_set_ntds_invocation_id, METH_VARARGS,
|
{ "dsdb_set_ntds_invocation_id", (PyCFunction)py_dsdb_set_ntds_invocation_id, METH_VARARGS,
|
||||||
NULL },
|
NULL },
|
||||||
{ "dsdb_set_global_schema", (PyCFunction)py_dsdb_set_global_schema, METH_VARARGS,
|
{ "dsdb_set_global_schema", (PyCFunction)py_dsdb_set_global_schema, METH_VARARGS,
|
||||||
|
@ -44,9 +44,9 @@ else:
|
|||||||
import ldb
|
import ldb
|
||||||
import dsdb
|
import dsdb
|
||||||
import glue
|
import glue
|
||||||
from samba._ldb import Ldb
|
from samba._ldb import Ldb as _Ldb
|
||||||
|
|
||||||
class Ldb(Ldb):
|
class Ldb(_Ldb):
|
||||||
"""Simple Samba-specific LDB subclass that takes care
|
"""Simple Samba-specific LDB subclass that takes care
|
||||||
of setting up the modules dir, credentials pointers, etc.
|
of setting up the modules dir, credentials pointers, etc.
|
||||||
|
|
||||||
@ -97,7 +97,7 @@ class Ldb(Ldb):
|
|||||||
print text
|
print text
|
||||||
#self.set_debug(msg)
|
#self.set_debug(msg)
|
||||||
|
|
||||||
glue.ldb_set_utf8_casefold(self)
|
self.set_utf8_casefold()
|
||||||
|
|
||||||
# Allow admins to force non-sync ldb for all databases
|
# Allow admins to force non-sync ldb for all databases
|
||||||
if lp is not None:
|
if lp is not None:
|
||||||
@ -308,14 +308,6 @@ class Ldb(Ldb):
|
|||||||
"Get the server site name"
|
"Get the server site name"
|
||||||
return dsdb.samdb_server_site_name(self)
|
return dsdb.samdb_server_site_name(self)
|
||||||
|
|
||||||
def set_opaque_integer(self, name, value):
|
|
||||||
"""Set an integer as an opaque (a flag or other value) value on the database
|
|
||||||
|
|
||||||
:param name: The name for the opaque value
|
|
||||||
:param value: The integer value
|
|
||||||
"""
|
|
||||||
dsdb.dsdb_set_opaque_integer(self, name, value)
|
|
||||||
|
|
||||||
|
|
||||||
def substitute_var(text, values):
|
def substitute_var(text, values):
|
||||||
"""substitute strings of the form ${NAME} in str, replacing
|
"""substitute strings of the form ${NAME} in str, replacing
|
||||||
|
Loading…
Reference in New Issue
Block a user