Revert "s4:dsdb/schema_syntax: fix dsdb_syntax_INT32/64_validate_ldb() with large... master4-tstream
authorStefan Metzmacher <metze@samba.org>
Wed, 2 Mar 2011 17:59:58 +0000 (18:59 +0100)
committerStefan Metzmacher <metze@samba.org>
Thu, 17 May 2018 08:33:11 +0000 (10:33 +0200)
This reverts commit 991d237d492dbc983ff221ae5130e6bd95a5f92a.

source4/dsdb/schema/schema_syntax.c

index 6f8d3c1d44998d62326f878c2fd534f887a325a0..b434b6b0a5f71eec690bc638dc64ac358e5cec81 100644 (file)
@@ -369,7 +369,6 @@ 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;
 
@@ -388,24 +387,6 @@ 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) {
-                       return WERR_DS_INVALID_ATTRIBUTE_SYNTAX;
-               }
-
-               if ((v & INT32_MIN) && buf[0] != '-') {
-                       /*
-                        * 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.
-                        */
-                       return WERR_DS_INVALID_ATTRIBUTE_SYNTAX;
-               }
-
                if (attr->rangeLower) {
                        if ((int32_t)v < (int32_t)*attr->rangeLower) {
                                return WERR_DS_INVALID_ATTRIBUTE_SYNTAX;
@@ -513,7 +494,6 @@ static WERROR dsdb_syntax_INT64_validate_ldb(const struct dsdb_syntax_ctx *ctx,
 
        for (i=0; i < in->num_values; i++) {
                long long v;
-               long long n;
                char buf[sizeof("-9223372036854775808")];
                char *end = NULL;
 
@@ -532,26 +512,6 @@ static WERROR dsdb_syntax_INT64_validate_ldb(const struct dsdb_syntax_ctx *ctx,
                        return WERR_DS_INVALID_ATTRIBUTE_SYNTAX;
                }
 
-               n = v & UINT64_MAX;
-
-               if (n != v) {
-                       return WERR_DS_INVALID_ATTRIBUTE_SYNTAX;
-               }
-
-               if ((v & INT64_MIN) && buf[0] != '-') {
-                       /*
-                        * if the 0x8000000000000000 bit is set,
-                        * it is a negative value. We need to
-                        * make sure the it was given as a negative
-                        * string value.
-                        *
-                        * We need to accept '-9223372036854775807',
-                        * but reject '9223372036854775809',
-                        * both represent 0x8000000000000001.
-                        */
-                       return WERR_DS_INVALID_ATTRIBUTE_SYNTAX;
-               }
-
                if (attr->rangeLower) {
                        if ((int64_t)v < (int64_t)*attr->rangeLower) {
                                return WERR_DS_INVALID_ATTRIBUTE_SYNTAX;