r18441: Allow searching for the high bit in these bitfields, when the client
authorAndrew Bartlett <abartlet@samba.org>
Wed, 13 Sep 2006 04:03:58 +0000 (04:03 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 19:18:30 +0000 (14:18 -0500)
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

index 29e80ff003470b9fd37da58bf570c5a4f9fca4c6..109e9be2f94a5c12a4db0b8fc213dc7c27fb8d64 100644 (file)
@@ -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,