summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2009-12-21 23:36:23 +1100
committerAndrew Tridgell <tridge@samba.org>2009-12-21 23:45:23 +1100
commit0c362597c0f933b3612bb17328c0a13b73d72e43 (patch)
treeae9bc6019cd080bac476a296343f61dbfeaa60a3
parentec7dc6a619d7fca83a49065c45fdbc0fa93249a0 (diff)
downloadsamba-0c362597c0f933b3612bb17328c0a13b73d72e43.tar.gz
samba-0c362597c0f933b3612bb17328c0a13b73d72e43.tar.bz2
samba-0c362597c0f933b3612bb17328c0a13b73d72e43.zip
s4-schema: fixed the sorting of schema attributes
another case of unsigned int subtracting breaking sorts. This one surfaced now as attributeID_id now can be larger than 2^31
-rw-r--r--source4/dsdb/schema/schema_set.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/source4/dsdb/schema/schema_set.c b/source4/dsdb/schema/schema_set.c
index e65e372623..f59fc32696 100644
--- a/source4/dsdb/schema/schema_set.c
+++ b/source4/dsdb/schema/schema_set.c
@@ -180,13 +180,19 @@ op_error:
return LDB_ERR_OPERATIONS_ERROR;
}
+static int uint32_cmp(uint32_t c1, uint32_t c2)
+{
+ if (c1 == c2) return 0;
+ return c1 > c2 ? 1 : -1;
+}
+
static int dsdb_compare_class_by_lDAPDisplayName(struct dsdb_class **c1, struct dsdb_class **c2)
{
return strcasecmp((*c1)->lDAPDisplayName, (*c2)->lDAPDisplayName);
}
static int dsdb_compare_class_by_governsID_id(struct dsdb_class **c1, struct dsdb_class **c2)
{
- return (*c1)->governsID_id - (*c2)->governsID_id;
+ return uint32_cmp((*c1)->governsID_id, (*c2)->governsID_id);
}
static int dsdb_compare_class_by_governsID_oid(struct dsdb_class **c1, struct dsdb_class **c2)
{
@@ -203,7 +209,7 @@ static int dsdb_compare_attribute_by_lDAPDisplayName(struct dsdb_attribute **a1,
}
static int dsdb_compare_attribute_by_attributeID_id(struct dsdb_attribute **a1, struct dsdb_attribute **a2)
{
- return (*a1)->attributeID_id - (*a2)->attributeID_id;
+ return uint32_cmp((*a1)->attributeID_id, (*a2)->attributeID_id);
}
static int dsdb_compare_attribute_by_attributeID_oid(struct dsdb_attribute **a1, struct dsdb_attribute **a2)
{
@@ -211,7 +217,7 @@ static int dsdb_compare_attribute_by_attributeID_oid(struct dsdb_attribute **a1,
}
static int dsdb_compare_attribute_by_linkID(struct dsdb_attribute **a1, struct dsdb_attribute **a2)
{
- return (*a1)->linkID - (*a2)->linkID;
+ return uint32_cmp((*a1)->linkID, (*a2)->linkID);
}
/*