The branch, master has been updated
       via  2cf897b10aa6b0d9565333085477e348261bfb2c (commit)
      from  87737f8946527ae96cd7fd41b6157c79d7c90964 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 2cf897b10aa6b0d9565333085477e348261bfb2c
Author: Matthias Dieter Wallnöfer <mwallnoe...@yahoo.de>
Date:   Mon Aug 17 20:29:11 2009 +0200

    s4: Make the int32 problem more clear - and fix another error

-----------------------------------------------------------------------

Summary of changes:
 source4/dsdb/samdb/ldb_modules/simple_ldap_map.c |    2 ++
 source4/dsdb/schema/schema_syntax.c              |    4 +++-
 source4/lib/ldb-samba/ldif_handlers.c            |    4 ++++
 3 files changed, 9 insertions(+), 1 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source4/dsdb/samdb/ldb_modules/simple_ldap_map.c 
b/source4/dsdb/samdb/ldb_modules/simple_ldap_map.c
index 8fb639f..21b80dc 100644
--- a/source4/dsdb/samdb/ldb_modules/simple_ldap_map.c
+++ b/source4/dsdb/samdb/ldb_modules/simple_ldap_map.c
@@ -147,6 +147,8 @@ 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;
+       /* We've to use "strtoll" here to have the intended overflows.
+        * Otherwise we may get "LONG_MAX" and the conversion is wrong. */
        int32_t i = (int32_t) strtoll((char *)val->data, NULL, 0);
        out = data_blob_string_const(talloc_asprintf(ctx, "%d", i));
        return out;
diff --git a/source4/dsdb/schema/schema_syntax.c 
b/source4/dsdb/schema/schema_syntax.c
index c26b407..6159ab4 100644
--- a/source4/dsdb/schema/schema_syntax.c
+++ b/source4/dsdb/schema/schema_syntax.c
@@ -234,7 +234,9 @@ static WERROR dsdb_syntax_INT32_ldb_to_drsuapi(struct 
ldb_context *ldb,
                blobs[i] = data_blob_talloc(blobs, NULL, 4);
                W_ERROR_HAVE_NO_MEMORY(blobs[i].data);
 
-               v = strtol((const char *)in->values[i].data, NULL, 10);
+               /* We've to use "strtoll" here to have the intended overflows.
+                * Otherwise we may get "LONG_MAX" and the conversion is wrong. 
*/
+               v = strtoll((const char *)in->values[i].data, NULL, 0);
 
                SIVALS(blobs[i].data, 0, v);
        }
diff --git a/source4/lib/ldb-samba/ldif_handlers.c 
b/source4/lib/ldb-samba/ldif_handlers.c
index acf8af7..7086430 100644
--- a/source4/lib/ldb-samba/ldif_handlers.c
+++ b/source4/lib/ldb-samba/ldif_handlers.c
@@ -649,6 +649,8 @@ static int ldif_canonicalise_int32(struct ldb_context *ldb, 
void *mem_ctx,
                        const struct ldb_val *in, struct ldb_val *out)
 {
        char *end;
+       /* We've to use "strtoll" here to have the intended overflows.
+        * Otherwise we may get "LONG_MAX" and the conversion is wrong. */
        int32_t i = (int32_t) strtoll((char *)in->data, &end, 0);
        if (*end != 0) {
                return -1;
@@ -665,6 +667,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)
 {
+       /* We've to use "strtoll" here to have the intended overflows.
+        * Otherwise we may get "LONG_MAX" and the conversion is wrong. */
        return (int32_t) strtoll((char *)v1->data, NULL, 0)
         - (int32_t) strtoll((char *)v2->data, NULL, 0);
 }


-- 
Samba Shared Repository

Reply via email to