From 918db36213fdd2faea7dc200de43595259b397f4 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Wed, 13 Sep 2006 04:03:58 +0000 Subject: r18441: 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 (This used to be commit 3b5354aededc619ac6656611eacd43888e74260a) --- source4/dsdb/samdb/ldb_modules/entryUUID.c | 39 +++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) (limited to 'source4/dsdb/samdb/ldb_modules') diff --git a/source4/dsdb/samdb/ldb_modules/entryUUID.c b/source4/dsdb/samdb/ldb_modules/entryUUID.c index 29e80ff003..109e9be2f9 100644 --- a/source4/dsdb/samdb/ldb_modules/entryUUID.c +++ b/source4/dsdb/samdb/ldb_modules/entryUUID.c @@ -171,7 +171,22 @@ static struct ldb_val class_from_oid(struct ldb_module *module, TALLOC_CTX *ctx, } - +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[] = { @@ -257,6 +272,28 @@ const struct ldb_map_attribute entryUUID_attributes[] = } } }, + { + .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, -- cgit