ldb bug fixes

Adrian Cochrane adrianc at catalyst.net.nz
Thu Dec 3 21:03:37 UTC 2015


It seems the patch for fixing error propagation is failing some tests. 
Please hold on that one.

I'm still happy with the patch for fixing handling of empty LDB 
messages (attached for clarity).

On Thu, Dec 3, 2015 at 2:29 PM, Adrian Cochrane 
<adrianc at catalyst.net.nz> wrote:
> 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-bug-triggered-by-having-an-empty-message-in-.patch
Type: text/x-patch
Size: 4039 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20151204/828974bc/0001-ldb-Fix-bug-triggered-by-having-an-empty-message-in-.bin>


More information about the samba-technical mailing list