[PATCH] ldb controls in error cases

simo idra at samba.org
Sun Apr 30 21:38:55 GMT 2006

Ldb controls are returned from the server only.
If the server returns a control we pass it on, if not we don't.

I think this may be a bug in ldb, I can't remember if we can ever have a
return error code and an additional control with an error code. To test
that you should try to see if you can have a general ldap code and also
a controls attached to the server reply.


Looking at the code I think we never look at the controls in case we
have a general ldap error, and ldb in general does not guarantee there
is anything meaningful in the result structure in case of an error, so
you are probably right in applying the patch.


On Sun, 2006-04-30 at 20:28 +0200, Andrew Bartlett wrote:
> I'm unclear what the rules in LDB should be.  Are controls returned on
> ldb failure or not?  (I killed the server during a TLS-induced hang to
> get this valgrind trace:)
> ==1354== Invalid read of size 4
> ==1354==    at 0x804D195: do_search (ldbsearch.c:92)
> ==1354==    by 0x804D4CF: main (ldbsearch.c:196)
> ==1354==  Address 0x1BA43A64 is 60 bytes inside a block of size 64
> free'd
> ==1354==    at 0x1B9097D1: free (vg_replace_malloc.c:152)
> ==1354==    by 0x81C9718: talloc_free (talloc.c:583)
> ==1354==    by 0x80CBE63: ildb_search_bytree (ldb_ildap.c:550)
> ==1354==    by 0x80CC574: ildb_request (ldb_ildap.c:851)
> If they are not returned in error cases, then this patch is required.
> Otherwise, we need to avoid free()ing them.
> Andrew Bartlett
Simo Sorce
Samba Team GPL Compliance Officer
email: idra at samba.org

More information about the samba-technical mailing list