ldb bug fixes
Andrew Bartlett
abartlet at samba.org
Tue Nov 24 21:56:05 UTC 2015
On Mon, 2015-11-23 at 14:35 +1300, Adrian Cochrane wrote:
> It turns out that wouldn't be an easier fix because
> /lib/talloc/talloc_guide.txt specifically states:
> > talloc_realloc(context, ptr, type, 0) ==> talloc_free(ptr);
>
> However I did take your advice and incorporated it into this updated
> patch.
I think this, but with an error check on
msg->elements = talloc_array(msg, struct ldb_message_element, 0);
would be the correct solution.
LDB entries with zero attributes are vanishingly rare, but asking for
zero attributes is common, as is asking only for attributes that don't
exist. We may post-process the ldb_message to add a generated
attribute later, and we should have a zero-length array to do that on.
This also follows the principle of least supprise from the current
code, which always returned an array the same length as the database
object (ie, always non-NULL, even with num_elements == 0)
Thanks,
Andrew Bartlett
--
Andrew Bartlett
https://samba.org/~abartlet/
Authentication Developer, Samba Team https://samba.org
Samba Development and Support, Catalyst IT
https://catalyst.net.nz/services/samba
More information about the samba-technical
mailing list