[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
-desirable.

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);
	NT_STATUS_HAVE_NO_MEMORY(owner_filter);
	filter = talloc_asprintf(call,
				 "(&%s(objectClass=winsRecord)"
				 "(|(recordState=%u)(recordState=%u))"
				 "(versionID>=%llu)(versionID<=%llu))",
				 owner_filter,
				 WREPL_STATE_ACTIVE, WREPL_STATE_TOMBSTONE,
				 (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