s4-drs: another two unsigned comparison bugs
authorAndrew Tridgell <tridge@samba.org>
Sat, 19 Dec 2009 23:26:06 +0000 (10:26 +1100)
committerAndrew Tridgell <tridge@samba.org>
Mon, 21 Dec 2009 12:41:07 +0000 (23:41 +1100)
source4/dsdb/samdb/ldb_modules/repl_meta_data.c

index 3ae165c6dabe34e520d444229f66eef2d093e74b..3d31cc3f49dfed915aaa95f66d687dcad7299c0c 100644 (file)
@@ -336,7 +336,7 @@ static int replmd_replPropertyMetaData1_attid_sort(const struct replPropertyMeta
                return -1;
        }
 
-       return m1->attid - m2->attid;
+       return m1->attid > m2->attid ? 1 : -1;
 }
 
 static int replmd_replPropertyMetaDataCtr1_sort(struct replPropertyMetaDataCtr1 *ctr1,
@@ -390,8 +390,10 @@ static int replmd_ldb_message_element_attid_sort(const struct ldb_message_elemen
        if (!a1 || !a2) {
                return strcasecmp(e1->name, e2->name);
        }
-
-       return a1->attributeID_id - a2->attributeID_id;
+       if (a1->attributeID_id == a2->attributeID_id) {
+               return 0;
+       }
+       return a1->attributeID_id > a2->attributeID_id ? 1 : -1;
 }
 
 static void replmd_ldb_message_sort(struct ldb_message *msg,