summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Dieter Wallnöfer <mwallnoefer@yahoo.de>2009-08-17 11:46:23 +0200
committerMatthias Dieter Wallnöfer <mwallnoefer@yahoo.de>2009-08-17 11:58:39 +0200
commit0a46fd630e38134a080214119e5712673687f7c0 (patch)
tree4c894a11cb79545a8fe1cfcce2e81abaf7379c56
parentfaedda0455da90aa8d5500eb2263b6ade3b72ec1 (diff)
downloadsamba-0a46fd630e38134a080214119e5712673687f7c0.tar.gz
samba-0a46fd630e38134a080214119e5712673687f7c0.tar.bz2
samba-0a46fd630e38134a080214119e5712673687f7c0.zip
s4:pyglue Add a wrapper for loading the correct UTF8 casefolder
Needed for special characters (e.g. in German "Umlaute")
-rw-r--r--source4/scripting/python/pyglue.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/source4/scripting/python/pyglue.c b/source4/scripting/python/pyglue.c
index d4db55431f..f5694e162c 100644
--- a/source4/scripting/python/pyglue.c
+++ b/source4/scripting/python/pyglue.c
@@ -1,6 +1,7 @@
/*
Unix SMB/CIFS implementation.
Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2007
+ Copyright (C) Matthias Dieter Wallnöfer 2009
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -19,6 +20,7 @@
#include "includes.h"
#include "ldb.h"
#include "ldb_errors.h"
+#include "ldb_wrap.h"
#include "param/param.h"
#include "auth/credentials/credentials.h"
#include "dsdb/samdb/samdb.h"
@@ -155,6 +157,21 @@ static PyObject *py_ldb_set_session_info(PyObject *self, PyObject *args)
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)
{
PyObject *py_ldb, *py_sid;
@@ -396,6 +413,9 @@ static PyMethodDef py_misc_methods[] = {
{ "ldb_register_samba_handlers", (PyCFunction)py_ldb_register_samba_handlers, METH_VARARGS,
"ldb_register_samba_handlers(ldb)\n"
"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,
NULL },
{ "dsdb_set_opaque_integer", (PyCFunction)py_dsdb_set_opaque_integer, METH_VARARGS,