twisted/ldaptor — pull request #32 by cwaldbieser (2014-12-09 21:55:53+00:00)
Title: ProxyBase bugfix

While experimenting with the proxbase.py LDAP proxy I submitted, I discovered that there was an issue with the order in which the responses from an LDAP search were returned. Specifically, a pureldap.LDAPSearchResultDone might be written to the client prior to all the pureldap.LDAPSearchResultEntry responses. This will cause a typical LDAP client to fail, because it will believe the results to have all been received.

This was not apparent to me initially, because I only tested with results that were returned immediately from the `ProxyBase.handleProxiedResponse()` callback. When I started using deferred callbacks (pulling data from another database), this problem was apparent.

I corrected the issue and updated the test to use deferred responses. I rigged the clock so that if the results are not handled correctly, the results would be in the wrong order. I tested against the unpatched version of the proxy and the test failed. Against this updated version, the test passed.