summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMatthias Dieter Wallnöfer <mdw@samba.org>2010-10-25 18:10:04 +0200
committerMatthias Dieter Wallnöfer <mdw@samba.org>2010-10-25 18:58:20 +0200
commitfd7943bc80f0e96b70d4f851ea4e3f8f7689bead (patch)
treeaf86c46aca05fd30393a896208ca8124f40d6407 /lib
parent8bc2b54c7237697d8fddcec9a02d742c81c83699 (diff)
downloadsamba-fd7943bc80f0e96b70d4f851ea4e3f8f7689bead.tar.gz
samba-fd7943bc80f0e96b70d4f851ea4e3f8f7689bead.tar.bz2
samba-fd7943bc80f0e96b70d4f851ea4e3f8f7689bead.zip
ldb:gendb_* calls: support a "NULL" resultset parameter
This is useful for "samdb_search_count" where only the amount of entries matters.
Diffstat (limited to 'lib')
-rw-r--r--lib/util/util_ldb.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/util/util_ldb.c b/lib/util/util_ldb.c
index 5a23ce4652..a92824597a 100644
--- a/lib/util/util_ldb.c
+++ b/lib/util/util_ldb.c
@@ -55,22 +55,23 @@ int gendb_search_v(struct ldb_context *ldb,
expr?"%s":NULL, expr);
if (ret == LDB_SUCCESS) {
- talloc_steal(mem_ctx, res->msgs);
-
DEBUG(6,("gendb_search_v: %s %s -> %d\n",
basedn?ldb_dn_get_linearized(basedn):"NULL",
expr?expr:"NULL", res->count));
ret = res->count;
- *msgs = res->msgs;
+ if (msgs != NULL) {
+ *msgs = talloc_steal(mem_ctx, res->msgs);
+ }
talloc_free(res);
} else if (scope == LDB_SCOPE_BASE && ret == LDB_ERR_NO_SUCH_OBJECT) {
ret = 0;
- *msgs = NULL;
+ if (msgs != NULL) *msgs = NULL;
} else {
DEBUG(4,("gendb_search_v: search failed: %s\n",
ldb_errstring(ldb)));
ret = -1;
+ if (msgs != NULL) *msgs = NULL;
}
talloc_free(expr);