LDB: Patch for fixing counter variables

Andrew Bartlett abartlet at samba.org
Fri Nov 6 17:37:02 MST 2009

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.


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). 


Andrew Bartlett

Andrew Bartlett                                http://samba.org/~abartlet/
Authentication Developer, Samba Team           http://samba.org
Samba Developer, Cisco Inc.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20091107/01d43777/attachment.pgp>

More information about the samba-technical mailing list