s4 dsdb: fix sign problem on PPC and x86
authorMatthieu Patou <mat@matws.net>
Thu, 14 Oct 2010 13:56:23 +0000 (17:56 +0400)
committerMatthieu Patou <mat@matws.net>
Fri, 15 Oct 2010 07:34:24 +0000 (11:34 +0400)
In LDAP we used signed intege and groups have the highest bit set (ie.
0x80000002). So it will result with values that are > 2^31 when these
value are used on some plateforms (x86 and PPC 64bits in this case) it
causes problem with strtol.

source4/dsdb/samdb/ldb_modules/samldb.c

index 400ae81114cb2b647462e4f62bd08a50ed0ccd1a..ff110b74025d5d29eda51e9e77e7654d6fc25a7c 100644 (file)
@@ -793,7 +793,7 @@ static int samldb_objectclass_trigger(struct samldb_ctx *ac)
                /* Step 1.2: Default values */
                ret = samdb_find_or_add_attribute(ldb, ac->msg,
                        "userAccountControl",
-                       talloc_asprintf(ac->msg, "%u", UF_NORMAL_ACCOUNT));
+                       talloc_asprintf(ac->msg, "%d", UF_NORMAL_ACCOUNT));
                if (ret != LDB_SUCCESS) return ret;
                ret = samdb_find_or_add_attribute(ldb, ac->msg,
                        "badPwdCount", "0");
@@ -896,7 +896,7 @@ static int samldb_objectclass_trigger(struct samldb_ctx *ac)
                /* Step 2.2: Default values */
                ret = samdb_find_or_add_attribute(ldb, ac->msg,
                        "groupType",
-                       talloc_asprintf(ac->msg, "%u", GTYPE_SECURITY_GLOBAL_GROUP));
+                       talloc_asprintf(ac->msg, "%d", GTYPE_SECURITY_GLOBAL_GROUP));
                if (ret != LDB_SUCCESS) return ret;
 
                /* Step 2.3: "groupType" -> "sAMAccountType" */