summaryrefslogtreecommitdiff
path: root/source4/lib
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2008-03-11 14:20:42 +1100
committerAndrew Bartlett <abartlet@samba.org>2008-03-11 14:20:42 +1100
commit7da5ec17e666a9992cd0bd774b2360aafed8f3f3 (patch)
treed61030b5aa13e9866b57d1a91aa16c6e1369651b /source4/lib
parentdb06d932c8f43b02d4a54d0c139310a3890160d5 (diff)
downloadsamba-7da5ec17e666a9992cd0bd774b2360aafed8f3f3.tar.gz
samba-7da5ec17e666a9992cd0bd774b2360aafed8f3f3.tar.bz2
samba-7da5ec17e666a9992cd0bd774b2360aafed8f3f3.zip
Make error handling in ldb more consistant.
This change ensures we give an immidiate error if the DN won't parse. Also clean up strcmp use to be more standard. Andrew Bartlett (This used to be commit 1b15f374a89b99f3c43d9c2ce06dde9c67383e66)
Diffstat (limited to 'source4/lib')
-rw-r--r--source4/lib/ldb/ldb.i5
1 files changed, 4 insertions, 1 deletions
diff --git a/source4/lib/ldb/ldb.i b/source4/lib/ldb/ldb.i
index 0d9679d21e..bd41e1e23e 100644
--- a/source4/lib/ldb/ldb.i
+++ b/source4/lib/ldb/ldb.i
@@ -258,6 +258,9 @@ int ldb_dn_from_pyobject(TALLOC_CTX *mem_ctx, PyObject *object,
struct ldb_dn *odn;
if (ldb_ctx != NULL && PyString_Check(object)) {
*dn = ldb_dn_new(mem_ctx, ldb_ctx, PyString_AsString(object));
+ if (!*dn) {
+ return SWIG_ERROR;
+ }
return 0;
}
ret = SWIG_ConvertPtr(object, (void **)&odn, SWIGTYPE_p_ldb_dn,
@@ -566,7 +569,7 @@ PyObject *PyExc_LdbError;
$1->elements = talloc_zero_array($1, struct ldb_message_element, PyDict_Size($input));
msg_pos = dict_pos = 0;
while (PyDict_Next($input, &dict_pos, &key, &value)) {
- if (!strcmp(PyString_AsString(key), "dn")) {
+ if (strcmp(PyString_AsString(key), "dn") == 0) {
/* using argp0 (magic SWIG value) here is a hack */
if (ldb_dn_from_pyobject($1, value, argp1, &$1->dn) != 0) {
SWIG_exception(SWIG_TypeError, "unable to import dn object");