summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2004-09-27 15:11:42 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:59:23 -0500
commit43d45f80ad7f8125542c793171af0657631566cd (patch)
tree4587b4f79f9fd6c70c1e1adbf70e779e3f528c53
parent159b8c2d386af821d265c9cfb5896c001ae8852a (diff)
downloadsamba-43d45f80ad7f8125542c793171af0657631566cd.tar.gz
samba-43d45f80ad7f8125542c793171af0657631566cd.tar.bz2
samba-43d45f80ad7f8125542c793171af0657631566cd.zip
r2693: - send a reply when no attributes there
- add some debug messages metze (This used to be commit 1de1beca66da68e5af0869629d2c50016c25e776)
-rw-r--r--source4/ldap_server/ldap_simple_ldb.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/source4/ldap_server/ldap_simple_ldb.c b/source4/ldap_server/ldap_simple_ldb.c
index c7ebd0b237..efd56c1cf9 100644
--- a/source4/ldap_server/ldap_simple_ldb.c
+++ b/source4/ldap_server/ldap_simple_ldb.c
@@ -48,19 +48,23 @@ static NTSTATUS sldb_Search(struct ldapsrv_partition *partition, struct ldapsrv_
enum ldb_scope scope = LDB_SCOPE_DEFAULT;
const char **attrs = NULL;
- DEBUG(0, ("sldb_Search: %s\n", r->filter));
+ DEBUG(10, ("sldb_Search: basedn: [%s]\n", r->basedn));
+ DEBUG(10, ("sldb_Search: filter: [%s]\n", r->filter));
samdb = samdb_connect(call);
ldb = samdb->ldb;
switch (r->scope) {
case LDAP_SEARCH_SCOPE_BASE:
+ DEBUG(10,("sldb_Search: scope: [BASE]\n"));
scope = LDB_SCOPE_BASE;
break;
case LDAP_SEARCH_SCOPE_SINGLE:
+ DEBUG(10,("sldb_Search: scope: [ONE]\n"));
scope = LDB_SCOPE_ONELEVEL;
break;
case LDAP_SEARCH_SCOPE_SUB:
+ DEBUG(10,("sldb_Search: scope: [SUB]\n"));
scope = LDB_SCOPE_SUBTREE;
break;
}
@@ -70,6 +74,7 @@ static NTSTATUS sldb_Search(struct ldapsrv_partition *partition, struct ldapsrv_
ALLOC_CHECK(attrs);
for (i=0; i < r->num_attributes; i++) {
+ DEBUG(10,("sldb_Search: attrs: [%s]\n",r->attributes[i]));
attrs[i] = r->attributes[i];
}
attrs[i] = NULL;
@@ -79,10 +84,13 @@ static NTSTATUS sldb_Search(struct ldapsrv_partition *partition, struct ldapsrv_
count = ldb_search(ldb, r->basedn, scope, r->filter, attrs, &res);
if (count > 0) {
+ DEBUG(10,("sldb_Search: results: [%d]\n",count));
result = 0;
} else if (count == 0) {
+ DEBUG(10,("sldb_Search: no results\n"));
result = 32;
} else if (count == -1) {
+ DEBUG(10,("sldb_Search: error\n"));
result = 1;
}
@@ -95,7 +103,7 @@ static NTSTATUS sldb_Search(struct ldapsrv_partition *partition, struct ldapsrv_
ent->num_attributes = 0;
ent->attributes = NULL;
if (res[i]->num_elements == 0) {
- continue;
+ goto queue_reply;
}
ent->num_attributes = res[i]->num_elements;
ent->attributes = talloc_array_p(ent_r, struct ldap_attribute, ent->num_attributes);
@@ -117,7 +125,7 @@ static NTSTATUS sldb_Search(struct ldapsrv_partition *partition, struct ldapsrv_
res[i]->elements[j].values[y].data);
}
}
-
+queue_reply:
status = ldapsrv_queue_reply(call, ent_r);
if (!NT_STATUS_IS_OK(status)) {
return status;