ldb bug fixes
Adrian Cochrane
adrianc at catalyst.net.nz
Thu Dec 3 01:29:05 UTC 2015
Since the symptoms of the big I fixed in more previous patch were
incorrect, here's a patch which corrects the error propagation in LDB.
On Wed, Dec 2, 2015 at 4:31 PM, Adrian Cochrane
<adrianc at catalyst.net.nz> wrote:
> Another update, realized that if I'm allocating empty arrays it's
> probably useful still to check it for null.
>
> On Thu, Nov 26, 2015 at 4:45 PM, Adrian Cochrane
> <adrianc at catalyst.net.nz> wrote:
>> Updated patch per Andrew's comments.
>>
>> On Wed, Nov 25, 2015 at 10:56 AM, Andrew Bartlett
>> <abartlet at samba.org> wrote:
>>> 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
>>>
>>>
>>>
>>>
>>>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-ldb-Fix-propagation-of-errors-through-tdb.patch
Type: text/x-patch
Size: 3575 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20151203/09bd591c/0001-ldb-Fix-propagation-of-errors-through-tdb.bin>
More information about the samba-technical
mailing list