[PATCH] ldb_debug: Fix for bug 13185

Stefan Metzmacher metze at samba.org
Thu Feb 22 15:47:27 UTC 2018


Hi Björn,

can you test this patch and check if it fixes the bug for you?

If that's ok, I'd propose we take that for now unless we get a
test for it shortly.

Thanks!
metze

Am 22.02.2018 um 05:16 schrieb Douglas Bagnall via samba-technical:
> On 22/02/18 16:53, Douglas Bagnall via samba-technical wrote:
>> On 22/02/18 16:06, Gary Lockyer via samba-technical wrote:
>>> +	/*
>>> +	 * Check for duplicates in unique indexes
>>>  	 */
>>>  	if (list->count > 0 &&
>>>  	    ((a != NULL
>>>  	      && (a->flags & LDB_ATTR_FLAG_UNIQUE_INDEX ||
>>> -		 (el->flags & LDB_FLAG_INTERNAL_FORCE_UNIQUE_INDEX))) ||
>>> -	     ldb_attr_cmp(el->name, LTDB_IDXDN) == 0)) {
>>> +		  (el->flags & LDB_FLAG_INTERNAL_FORCE_UNIQUE_INDEX))))) {
>>
>> This looks a bit wrong. I don't think it actually is wrong, but it
>> just looks scary having "&" mixing with other operators without tight
>> parentheses. I had to read random web pages to be sure the precedence
>> of (a & b || c) works as intended.
>>
>> I think something like this is logically the same but a bit clearer:
>>
>>  	if (list->count > 0 &&
>>             a != NULL &&
>>  	    ((a->flags & LDB_ATTR_FLAG_UNIQUE_INDEX) ||
>>              (el->flags & LDB_FLAG_INTERNAL_FORCE_UNIQUE_INDEX))) {
>>
> 
> Well, I spoke with Andrew, and it turns out he meant this:
> 
> 	if (list->count > 0 &&
> 	    ((a != NULL && (a->flags & LDB_ATTR_FLAG_UNIQUE_INDEX)) ||
> 	     (el->flags & LDB_FLAG_INTERNAL_FORCE_UNIQUE_INDEX))) {
> 
> as attached.
> 
> Douglas
> 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20180222/1021c703/signature.sig>


More information about the samba-technical mailing list