s4: Fixed the int32 datatype support
authorMatthias Dieter Wallnöfer <mwallnoefer@yahoo.de>
Mon, 17 Aug 2009 11:10:16 +0000 (13:10 +0200)
committerMatthias Dieter Wallnöfer <mwallnoefer@yahoo.de>
Mon, 17 Aug 2009 11:15:26 +0000 (13:15 +0200)
Should finally fix bug #6136 ("groupType", "sAMAccountType" ... attributes).

source4/dsdb/samdb/ldb_modules/simple_ldap_map.c
source4/lib/ldb-samba/ldif_handlers.c

index fe1de1c7d62796aaee9837033711b726b1751951..8fb639f53f10996be30407a8d1c7ad99c0cf4183 100644 (file)
@@ -147,7 +147,7 @@ static struct ldb_val objectCategory_always_dn(struct ldb_module *module, TALLOC
 static struct ldb_val normalise_to_signed32(struct ldb_module *module, TALLOC_CTX *ctx, const struct ldb_val *val)
 {
        struct ldb_val out;
-       int32_t i = (int32_t) strtol((char *)val->data, NULL, 0);
+       int32_t i = (int32_t) strtoll((char *)val->data, NULL, 0);
        out = data_blob_string_const(talloc_asprintf(ctx, "%d", i));
        return out;
 }
index 2d3d2b994d14dd3317426dd26e8724f37443f5ed..acf8af7917b420ece2ec017db3896cfb26659aa0 100644 (file)
@@ -649,7 +649,7 @@ static int ldif_canonicalise_int32(struct ldb_context *ldb, void *mem_ctx,
                        const struct ldb_val *in, struct ldb_val *out)
 {
        char *end;
-       int32_t i = (int32_t) strtol((char *)in->data, &end, 0);
+       int32_t i = (int32_t) strtoll((char *)in->data, &end, 0);
        if (*end != 0) {
                return -1;
        }
@@ -665,8 +665,8 @@ static int ldif_canonicalise_int32(struct ldb_context *ldb, void *mem_ctx,
 static int ldif_comparison_int32(struct ldb_context *ldb, void *mem_ctx,
                        const struct ldb_val *v1, const struct ldb_val *v2)
 {
-       return (int32_t) strtol((char *)v1->data, NULL, 0)
-        - (int32_t) strtol((char *)v2->data, NULL, 0);
+       return (int32_t) strtoll((char *)v1->data, NULL, 0)
+        - (int32_t) strtoll((char *)v2->data, NULL, 0);
 }
 
 static int extended_dn_write_hex(struct ldb_context *ldb, void *mem_ctx,