From ea38e9d90995e2901e4824d8d2e52e1ff358b047 Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Thu, 30 Aug 2018 07:48:16 -0600 Subject: [PATCH] For conversion to a sudoers parse tree, ldap_entry_compare() now needs to sort in ascending order, not descending. Bug #849 --- plugins/sudoers/ldap.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/plugins/sudoers/ldap.c b/plugins/sudoers/ldap.c index 03691eaff..bcf134421 100644 --- a/plugins/sudoers/ldap.c +++ b/plugins/sudoers/ldap.c @@ -1724,7 +1724,8 @@ done: } /* - * Comparison function for ldap_entry_wrapper structures, descending order. + * Comparison function for ldap_entry_wrapper structures, ascending order. + * This should match role_order_cmp() in parse_ldif.c. */ static int ldap_entry_compare(const void *a, const void *b) @@ -1733,8 +1734,8 @@ ldap_entry_compare(const void *a, const void *b) const struct ldap_entry_wrapper *bw = b; debug_decl(ldap_entry_compare, SUDOERS_DEBUG_LDAP) - debug_return_int(bw->order < aw->order ? -1 : - (bw->order > aw->order ? 1 : 0)); + debug_return_int(aw->order < bw->order ? -1 : + (aw->order > bw->order ? 1 : 0)); } /* -- 2.40.0