Revert "INT32..."
authorStefan Metzmacher <metze@samba.org>
Wed, 2 Mar 2011 17:59:48 +0000 (18:59 +0100)
committerStefan Metzmacher <metze@samba.org>
Thu, 17 May 2018 08:33:07 +0000 (10:33 +0200)
This reverts commit 1751c1688f778ac2fe75d3df165b48327b2721af.

source4/dsdb/schema/schema_syntax.c

index 4b0a14c01d03feefe6f1169db5e57f1fa451b0b9..e82b350d2004de5eb0030480b60ffd542ccefc6f 100644 (file)
@@ -369,6 +369,7 @@ static WERROR dsdb_syntax_INT32_validate_ldb(const struct dsdb_syntax_ctx *ctx,
 
        for (i=0; i < in->num_values; i++) {
                long v;
+               long n;
                char buf[sizeof("-2147483648")];
                char *end = NULL;
 
@@ -387,6 +388,8 @@ static WERROR dsdb_syntax_INT32_validate_ldb(const struct dsdb_syntax_ctx *ctx,
                        return WERR_DS_INVALID_ATTRIBUTE_SYNTAX;
                }
 
+               n = v & UINT32_MAX;
+
                if (n != v) {
                        DEBUG(0,("invalid[%s] n[%ld] v[%ld]\n",
                                buf, n, v));
@@ -394,10 +397,13 @@ static WERROR dsdb_syntax_INT32_validate_ldb(const struct dsdb_syntax_ctx *ctx,
                }
 
                if ((v & INT32_MIN) && buf[0] != '-') {
-               /*
-                               * We need to accept values between '4294967295'
-                        * and '-2147483648', but store and return values
-                        * between '2147483647' and '-2147483648'.
+                       /*
+                        * if the 0x80000000 bit is set, it is a negative
+                        * value. We need to make sure the it was given
+                        * as a negativ string value.
+                        *
+                        * We need to accept '-2147483647', but reject
+                        * '2147483649', both represent 0x80000001.
                         */
                        DEBUG(0,("invalid[%s] n[%ld] v[%ld]\n",
                                buf, n, v));