summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2009-06-27 22:28:47 +0200
committerVolker Lendecke <vl@samba.org>2009-06-27 22:30:14 +0200
commit53b9a24ce38acc79d8086b502f0e8ff048ef67bc (patch)
tree5061275058d0a73e4e7d1d0a2c62d193792d04f8 /source3/lib
parent79c299f96fe1780c0ca09d2ed429a2640ec56744 (diff)
downloadsamba-53b9a24ce38acc79d8086b502f0e8ff048ef67bc.tar.gz
samba-53b9a24ce38acc79d8086b502f0e8ff048ef67bc.tar.bz2
samba-53b9a24ce38acc79d8086b502f0e8ff048ef67bc.zip
tldap: Don't fire off more than one read_ldap request during searches
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/tldap.c32
1 files changed, 22 insertions, 10 deletions
diff --git a/source3/lib/tldap.c b/source3/lib/tldap.c
index 376e03f80c..0f9e67869c 100644
--- a/source3/lib/tldap.c
+++ b/source3/lib/tldap.c
@@ -591,20 +591,32 @@ static void tldap_msg_received(struct tevent_req *subreq)
ev = state->ev;
talloc_set_destructor(req, NULL);
- tldap_msg_destructor(req);
+ tldap_msg_unset_pending(req);
+ num_pending = talloc_array_length(ld->pending);
+
tevent_req_done(req);
done:
- if (talloc_array_length(ld->pending) > 0) {
- state = tevent_req_data(ld->pending[0],
- struct tldap_msg_state);
- subreq = read_ldap_send(ld->pending, state->ev, ld->fd);
- if (subreq == NULL) {
- status = TLDAP_NO_MEMORY;
- goto fail;
- }
- tevent_req_set_callback(subreq, tldap_msg_received, ld);
+ if (num_pending == 0) {
+ return;
+ }
+ if (talloc_array_length(ld->pending) > num_pending) {
+ /*
+ * The callback functions called from tevent_req_done() above
+ * have put something on the pending queue. We don't have to
+ * trigger the read_ldap_send(), tldap_msg_set_pending() has
+ * done it for us already.
+ */
+ return;
+ }
+
+ state = tevent_req_data(ld->pending[0], struct tldap_msg_state);
+ subreq = read_ldap_send(ld->pending, state->ev, ld->fd);
+ if (subreq == NULL) {
+ status = TLDAP_NO_MEMORY;
+ goto fail;
}
+ tevent_req_set_callback(subreq, tldap_msg_received, ld);
return;
fail: