[PATCH] Fix ldb_comparison_binary for blobs of differing lengths

Andrew Bartlett abartlet at samba.org
Tue Jan 26 18:44:41 UTC 2016

On Tue, 2016-01-26 at 09:42 -0800, Jeremy Allison wrote:

> What is the current sort algorithm when applied to binary
> comparison ? Could any real applications (not the nbt tests
> only) depend on this ?

Length before content.  Shorter length sorts first.

The issue is that if you put positive integers into LDB, and don't
declare them as an INTEGER in @ATTRIBUTES then the < and > operators
still 'just work'. 

I think real applications could innocently depend on it, as this is
metze code in the WINS replication server that broke. 

I hate the idea of baking this behaviour in forever-more, but changing
the output of a valid search against valid data seems equally un

My understanding is that it breaks code like this in source4/wrepl_server/wrepl_in_call.c:

	owner_filter = wreplsrv_owner_filter(service, call, owner->owner.address);
	filter = talloc_asprintf(call,
				 (long long)owner_in->min_version, 
				 (long long)owner_in->max_version);

Andrew Bartlett

Andrew Bartlett                       http://samba.org/~abartlet/
Authentication Developer, Samba Team  http://samba.org
Samba Developer, Catalyst IT          http://catalyst.net.nz/services/samba

More information about the samba-technical mailing list