summaryrefslogtreecommitdiff
path: root/source4/lib/ldb/ldb.i
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2007-12-22 14:28:45 -0600
committerStefan Metzmacher <metze@samba.org>2007-12-24 01:51:02 -0600
commitfb021305e4bc1175ae0d1960fbafc7eba29ef2f0 (patch)
treefd3065b1449fe0c662b52cdbfd7b1a3c7aca2997 /source4/lib/ldb/ldb.i
parentf053e385ff796914392d0eafa1e8756ff5ffdb18 (diff)
downloadsamba-fb021305e4bc1175ae0d1960fbafc7eba29ef2f0.tar.gz
samba-fb021305e4bc1175ae0d1960fbafc7eba29ef2f0.tar.bz2
samba-fb021305e4bc1175ae0d1960fbafc7eba29ef2f0.zip
r26567: Allow registering new ldb modules from python.
(This used to be commit 485db76d8476fce399a9b6cb977cf55ea35ec189)
Diffstat (limited to 'source4/lib/ldb/ldb.i')
-rw-r--r--source4/lib/ldb/ldb.i26
1 files changed, 19 insertions, 7 deletions
diff --git a/source4/lib/ldb/ldb.i b/source4/lib/ldb/ldb.i
index 15a49ec9c5..1ed1b45eaf 100644
--- a/source4/lib/ldb/ldb.i
+++ b/source4/lib/ldb/ldb.i
@@ -34,6 +34,7 @@
#include "talloc.h"
#include "ldb.h"
#include "ldb_errors.h"
+#include "ldb_private.h"
typedef struct ldb_message ldb_msg;
typedef struct ldb_context ldb;
@@ -425,16 +426,18 @@ PyObject *PyExc_LdbError;
* Wrap ldb functions
*/
+
+%typemap(out) ldb_error {
+ if ($1 != LDB_SUCCESS) {
+ PyErr_SetObject(PyExc_LdbError, Py_BuildValue("(i,s)", $1, ldb_strerror($1)));
+ SWIG_fail;
+ }
+ $result = Py_None;
+};
+
%rename(Ldb) ldb_context;
/* Top-level ldb operations */
typedef struct ldb_context {
- %typemap(out) ldb_error {
- if ($1 != LDB_SUCCESS) {
- PyErr_SetObject(PyExc_LdbError, Py_BuildValue("(i,s)", $1, ldb_strerror($1)));
- SWIG_fail;
- }
- $result = Py_None;
- };
%extend {
ldb(const char *url=NULL, unsigned int flags = 0,
const char *options[] = NULL)
@@ -572,3 +575,12 @@ static char *timestring(time_t t)
%rename(string_to_time) ldb_string_to_time;
time_t ldb_string_to_time(const char *s);
+
+%typemap(in) const struct ldb_module_ops * {
+ $1 = talloc_zero(talloc_autofree_context(), struct ldb_module_ops);
+
+ $1->name = PyObject_GetAttrString($input, "name");
+}
+
+%rename(register_module) ldb_register_module;
+ldb_error ldb_register_module(const struct ldb_module_ops *);