Re: an LDAP test server maybe?

Patrick Monnerat via curl-library <[email protected]> Sun, 26 Oct 2025 22:44:08 +0100
Newsgroups gmane.comp.web.curl.library
Message-ID <[email protected]>
On 10/26/25 11:55 AM, Daniel Stenberg via curl-library wrote:
> Hello,
Hi Daniel,
>
> Some of our supported protocols are less tested than others and that 
> sometimes leads to regressions or worse.
>
> One of the least tested protocols in the curl collection is LDAP and I 
> would like to do something about this.
At the time I did some commits on openldap, I already brainstormed 
myself on LDAP testing: this did not result in some code, I'm afraid.
>
> The standard way to do protocol testing in curl, and one that works 
> really well, is to implement a really simple server of our own for the 
> purpose. It usually doesn't even have to speak the protocol well but 
> just be able to do responses according to what the test case instructs 
> it. The test case should also be able to instruct the server to 
> respond completely protocol non-compliant etc so that we can make sure 
> curl deals with those situations as well. That's typically a reason 
> why we don't want or need a full "proper" server - just a thin basic 
> engine.
As you have noted, we not only need a simple server, but one that allows 
us to inject bad/wrong replies...
>
> Any suggestions for an embryo for an LDAP test server where we can 
> start? The smaller the better. It can be done in C, but maybe using 
> Python is more convenient.

The real problem here is LDAP is a binary protocol, thus there should be 
a text-->binary conversion involved to be able to enter 
directives/config to this test server: important parsing and shaping work.

I think the best idea I had on this subject is to use scapy 
(https://scapy.net/): this a a specialized Python machine augmented with 
low level network primitives. It probably contains everything to forge 
an LDAP message from text (i.e.: Python statements) and could also be 
used in non-LDAP context.

The biggest work for us with it is certainly to learn and familiarize 
with the specialized API, then to define and write a framework using it.

Just my 2ยข,

Patrick

-- 
Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-library
Etiquette:   https://curl.se/mail/etiquette.html