The comparison we make is unconventional, and makes no difference in
normal usage, where we just want to know whether two DNs are the same
or not. But with over 100 callers, it is possible that something
somewhere is attempting a sort.
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
}
- if (dn0->comp_num != dn1->comp_num) {
- return (dn1->comp_num - dn0->comp_num);
+ /*
+ * Notice that for comp_num, Samba reverses the usual order of
+ * comparison. A DN with fewer components is greater than one
+ * with more.
+ */
+ if (dn0->comp_num > dn1->comp_num) {
+ return -1;
+ } else if (dn0->comp_num < dn1->comp_num) {
+ return 1;
}
if (dn0->comp_num == 0) {