summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2008-03-04 13:45:31 +1100
committerAndrew Bartlett <abartlet@samba.org>2008-03-04 13:45:31 +1100
commitf042c1509032ff7c2ce87ea543e2fcda59b70532 (patch)
tree22d5c44a4e53a30a43bd7aea9e7fd727de64405d /source4
parent8a10979e6b5baaf9d4ef1703f056cdae6a81cf0e (diff)
downloadsamba-f042c1509032ff7c2ce87ea543e2fcda59b70532.tar.gz
samba-f042c1509032ff7c2ce87ea543e2fcda59b70532.tar.bz2
samba-f042c1509032ff7c2ce87ea543e2fcda59b70532.zip
Try to return sane ldb error strings
We don't just want to return just strerror(ret) when things go wrong. Andrew Bartlett (This used to be commit 7f0341dd589150ab01563957460cdcf42515cadc)
Diffstat (limited to 'source4')
-rw-r--r--source4/lib/ldb/ldb.i11
1 files changed, 10 insertions, 1 deletions
diff --git a/source4/lib/ldb/ldb.i b/source4/lib/ldb/ldb.i
index da4c52f778..0d9679d21e 100644
--- a/source4/lib/ldb/ldb.i
+++ b/source4/lib/ldb/ldb.i
@@ -42,6 +42,7 @@ typedef struct ldb_dn ldb_dn;
typedef struct ldb_ldif ldb_ldif;
typedef struct ldb_message_element ldb_msg_element;
typedef int ldb_error;
+typedef int ldb_int_error;
%}
@@ -521,6 +522,14 @@ PyObject *PyExc_LdbError;
%typemap(out,noblock=1) ldb_error {
if ($1 != LDB_SUCCESS) {
+ PyErr_SetObject(PyExc_LdbError, Py_BuildValue((char *)"(i,s)", $1, ldb_errstring(arg1)));
+ SWIG_fail;
+ }
+ $result = Py_None;
+};
+
+%typemap(out,noblock=1) ldb_int_error {
+ if ($1 != LDB_SUCCESS) {
PyErr_SetObject(PyExc_LdbError, Py_BuildValue((char *)"(i,s)", $1, ldb_strerror($1)));
SWIG_fail;
}
@@ -761,4 +770,4 @@ time_t ldb_string_to_time(const char *s);
}
%rename(register_module) ldb_register_module;
-ldb_error ldb_register_module(const struct ldb_module_ops *);
+ldb_int_error ldb_register_module(const struct ldb_module_ops *);