[PATCH] Prepare for LMDB by improving ldb_tdb and Samba callers

Andrew Bartlett abartlet at samba.org
Wed Apr 4 00:42:49 UTC 2018


On Tue, 2018-04-03 at 20:07 -0400, jim via samba-technical wrote:
> This should be either < 5 or <= 4. A key length of 0 is not useful 
> (after subtracting 4).
> Error message should also be changed to match if test.

Thankyou.  However to be clear a key length of less than 511 is just as
pointless (outside synthetic tests), the reason for this check is just
to avoid arithmetical underflow. 

Andrew Bartlett

> On 4/3/2018 7:43 PM, Andrew Bartlett via samba-technical wrote:
> > diff --git a/lib/ldb/ldb_tdb/ldb_index.c b/lib/ldb/ldb_tdb/ldb_index.c
> > index 076db10f2dd..ccbc6443b81 100644
> > --- a/lib/ldb/ldb_tdb/ldb_index.c
> > +++ b/lib/ldb/ldb_tdb/ldb_index.c
> > @@ -848,6 +848,18 @@ static struct ldb_dn *ltdb_index_key(struct ldb_context *ldb,
> >   	unsigned indx_len = 0;
> >   	unsigned frmt_len = 0;
> >   
> > +	if (max_key_length < 4) {
> > +		ldb_asprintf_errstring(
> > +			ldb,
> > +			__location__ ": max_key_length of (%u) < 4",
> 
> 
-- 
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