Author: abartlet Date: 2006-09-13 04:03:58 +0000 (Wed, 13 Sep 2006) New Revision: 18441
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=18441 Log: Allow searching for the high bit in these bitfields, when the client asks for them as large integers, rather than a negative integer. Due to an OpenLDAP bug, this only works reliably against OpenLDAP CVS as of today. (but mostly works in older versions, depending on a thread-specific value fo errno in the server). Andrew Bartlett Modified: branches/SAMBA_4_0/source/dsdb/samdb/ldb_modules/entryUUID.c Changeset: Modified: branches/SAMBA_4_0/source/dsdb/samdb/ldb_modules/entryUUID.c =================================================================== --- branches/SAMBA_4_0/source/dsdb/samdb/ldb_modules/entryUUID.c 2006-09-13 03:56:31 UTC (rev 18440) +++ branches/SAMBA_4_0/source/dsdb/samdb/ldb_modules/entryUUID.c 2006-09-13 04:03:58 UTC (rev 18441) @@ -171,7 +171,22 @@ } +static struct ldb_val normalise_to_signed32(struct ldb_module *module, TALLOC_CTX *ctx, const struct ldb_val *val) +{ + long long int signed_ll = strtoll(val->data, NULL, 10); + if (signed_ll >= 0x80000000LL) { + union { + int32_t signed_int; + uint32_t unsigned_int; + } u = { + .unsigned_int = strtoul(val->data, NULL, 10) + }; + struct ldb_val out = data_blob_string_const(talloc_asprintf(ctx, "%d", u.signed_int)); + return out; + } + return val_copy(module, ctx, val); +} const struct ldb_map_attribute entryUUID_attributes[] = { @@ -258,6 +273,28 @@ } }, { + .local_name = "groupType", + .type = MAP_CONVERT, + .u = { + .convert = { + .remote_name = "groupType", + .convert_local = normalise_to_signed32, + .convert_remote = val_copy, + }, + } + }, + { + .local_name = "samAccountType", + .type = MAP_CONVERT, + .u = { + .convert = { + .remote_name = "samAccountType", + .convert_local = normalise_to_signed32, + .convert_remote = val_copy, + }, + } + }, + { .local_name = "*", .type = MAP_KEEP, },