LDB: Patch for fixing counter variables

Matthias Dieter Wallnöfer mdw at samba.org
Mon Nov 9 08:28:17 MST 2009


Andrew,

I dropped the wrong part of the patch though your and Jelmer's 
suggestion. The other changes should fully compliy - I would like to 
remember: "make test" passes as without them - so nothing (additional) 
should have been broken.

I hope that you aren't that picky on those changes since then we never 
get to an end. For the future I plan also to provide some patches on 
other similar s4 code. Of course if you notice an obvious mistake (like 
this with python) please inform me. But otherwise going through each 
part I don't see very efficient.

Matthias

Andrew Bartlett wrote:
> On Fri, 2009-11-06 at 21:19 +0000, Matthias Dieter Wallnöfer wrote:
>    
>> Most of our LDB objects are stored in structures containing a dynamic
>> array and a counter. The counter variable is typically an "unsigned
>> integer". Until here it's all okay. But with the major part of the
>> counter variables (i, j...) it's not: since they're "signed". Well,
>> this doesn't give problems till we don't break the ~ 2,1 * 10^9
>> barrier - but the API is fine to go beyond: with the possible result
>> of infinite loops (since we are never able to reach the maximum).
>> Now you can argue: "this does happen very rarely" - where I'm also
>> with you. But that doesn't mean that those counters aren't buggy.
>> Since the LDB is a public library for  LDAP-like directories I would
>> be very pleased to see this fixed.
>> To achieve this I prepared a patch which changes "signed" types to
>> "unsigned" ones which fix the problem. It passes "make test" and
>> doesn't seem to give problems. The only thing I would like to ask you
>> is to review it, so I could push it soon.
>>      
> Matthias,
>
> As you may have come to expect, my first request is that you split the
> patch up.  There are parts of this that look safe, and many parts that
> need to looked at more carefully.
>
> The changes the the Python look most dubious, as you are changing the
> type of something that is then interpreted as an integer in the python.
> (so please remove all the Python changes).
>
> You also have typo fixes and changes to use LDB_SUCCESS mixed in the
> same patch.
>
> Once you do that, I'll take another look, and we can see if some of
> these can be easily merged.   Perhaps also produce the patches with more
> context?  It's hard to tell from the changed declaration what the effect
> would be (otherwise I'll have to do the review in gitk).
>
> Thanks,
>
> Andrew Bartlett
>
>    



More information about the samba-technical mailing list