diff options
author | Matthias Dieter Wallnöfer <mdw@samba.org> | 2010-11-06 17:49:18 +0100 |
---|---|---|
committer | Matthias Dieter Wallnöfer <mdw@samba.org> | 2010-11-08 10:39:05 +0000 |
commit | ef4861d9263d1a17396c58abc7ad0c5837a1b52c (patch) | |
tree | a9207da3fb005b4f62864ee357ba47fc169f3a59 /source4 | |
parent | 7bdbfc96037640dbd352e9ddab9c5e1ded9502fa (diff) | |
download | samba-ef4861d9263d1a17396c58abc7ad0c5837a1b52c.tar.gz samba-ef4861d9263d1a17396c58abc7ad0c5837a1b52c.tar.bz2 samba-ef4861d9263d1a17396c58abc7ad0c5837a1b52c.zip |
ldb:pyldb.c - "py_ldb_contains" - return only "0" not found, "1" found, "-1" error
Diffstat (limited to 'source4')
-rw-r--r-- | source4/lib/ldb/pyldb.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/source4/lib/ldb/pyldb.c b/source4/lib/ldb/pyldb.c index 2f87b8cdc3..40d7204c35 100644 --- a/source4/lib/ldb/pyldb.c +++ b/source4/lib/ldb/pyldb.c @@ -1425,13 +1425,14 @@ static int py_ldb_contains(PyLdbObject *self, PyObject *obj) struct ldb_context *ldb_ctx = PyLdb_AsLdbContext(self); struct ldb_dn *dn; struct ldb_result *result; + unsigned int count; int ret; - int count; if (!PyObject_AsDn(ldb_ctx, obj, ldb_ctx, &dn)) return -1; - ret = ldb_search(ldb_ctx, ldb_ctx, &result, dn, LDB_SCOPE_BASE, NULL, NULL); + ret = ldb_search(ldb_ctx, ldb_ctx, &result, dn, LDB_SCOPE_BASE, NULL, + NULL); if (ret != LDB_SUCCESS) { PyErr_SetLdbError(PyExc_LdbError, ret, ldb_ctx); return -1; @@ -1441,7 +1442,13 @@ static int py_ldb_contains(PyLdbObject *self, PyObject *obj) talloc_free(result); - return count; + if (count == 1) { + return 1; + } else if (count == 0) { + return 0; + } + + return -1; } static PySequenceMethods py_ldb_seq = { |