Silence clang analyzer warning on glibc systems where the first
argument to qsort() is marked as non-NULL. Also change some counters from into to unsigned int and two flags from int to bool.
This commit is contained in:
@@ -198,10 +198,10 @@ struct ldap_entry_wrapper {
|
|||||||
struct ldap_result {
|
struct ldap_result {
|
||||||
struct ldap_search_list searches;
|
struct ldap_search_list searches;
|
||||||
struct ldap_entry_wrapper *entries;
|
struct ldap_entry_wrapper *entries;
|
||||||
int allocated_entries;
|
unsigned int allocated_entries;
|
||||||
int nentries;
|
unsigned int nentries;
|
||||||
int user_matches;
|
bool user_matches;
|
||||||
int host_matches;
|
bool host_matches;
|
||||||
};
|
};
|
||||||
#define ALLOCATION_INCREMENT 100
|
#define ALLOCATION_INCREMENT 100
|
||||||
|
|
||||||
@@ -2435,7 +2435,7 @@ sudo_ldap_display_privs(struct sudo_nss *nss, struct passwd *pw,
|
|||||||
LDAP *ld;
|
LDAP *ld;
|
||||||
struct ldap_result *lres;
|
struct ldap_result *lres;
|
||||||
LDAPMessage *entry;
|
LDAPMessage *entry;
|
||||||
int i, count = 0;
|
unsigned int i, count = 0;
|
||||||
debug_decl(sudo_ldap_display_privs, SUDOERS_DEBUG_LDAP)
|
debug_decl(sudo_ldap_display_privs, SUDOERS_DEBUG_LDAP)
|
||||||
|
|
||||||
if (handle == NULL || handle->ld == NULL)
|
if (handle == NULL || handle->ld == NULL)
|
||||||
@@ -2468,7 +2468,7 @@ sudo_ldap_display_cmnd(struct sudo_nss *nss, struct passwd *pw)
|
|||||||
struct ldap_result *lres;
|
struct ldap_result *lres;
|
||||||
LDAPMessage *entry;
|
LDAPMessage *entry;
|
||||||
bool found = false;
|
bool found = false;
|
||||||
int i;
|
unsigned int i;
|
||||||
debug_decl(sudo_ldap_display_cmnd, SUDOERS_DEBUG_LDAP)
|
debug_decl(sudo_ldap_display_cmnd, SUDOERS_DEBUG_LDAP)
|
||||||
|
|
||||||
if (handle == NULL || handle->ld == NULL)
|
if (handle == NULL || handle->ld == NULL)
|
||||||
@@ -3100,7 +3100,8 @@ sudo_ldap_lookup(struct sudo_nss *nss, int ret, int pwflag)
|
|||||||
struct sudo_ldap_handle *handle = nss->handle;
|
struct sudo_ldap_handle *handle = nss->handle;
|
||||||
LDAP *ld;
|
LDAP *ld;
|
||||||
LDAPMessage *entry;
|
LDAPMessage *entry;
|
||||||
int i, rc, setenv_implied;
|
int rc, setenv_implied;
|
||||||
|
unsigned int i;
|
||||||
struct ldap_result *lres = NULL;
|
struct ldap_result *lres = NULL;
|
||||||
debug_decl(sudo_ldap_lookup, SUDOERS_DEBUG_LDAP)
|
debug_decl(sudo_ldap_lookup, SUDOERS_DEBUG_LDAP)
|
||||||
|
|
||||||
@@ -3201,8 +3202,8 @@ sudo_ldap_lookup(struct sudo_nss *nss, int ret, int pwflag)
|
|||||||
|
|
||||||
done:
|
done:
|
||||||
DPRINTF1("done with LDAP searches");
|
DPRINTF1("done with LDAP searches");
|
||||||
DPRINTF1("user_matches=%d", lres->user_matches);
|
DPRINTF1("user_matches=%s", lres->user_matches ? "true" : "false");
|
||||||
DPRINTF1("host_matches=%d", lres->host_matches);
|
DPRINTF1("host_matches=%s", lres->host_matches ? "true" : "false");
|
||||||
|
|
||||||
if (!ISSET(ret, VALIDATE_SUCCESS)) {
|
if (!ISSET(ret, VALIDATE_SUCCESS)) {
|
||||||
/* No matching entries. */
|
/* No matching entries. */
|
||||||
@@ -3424,9 +3425,11 @@ sudo_ldap_result_get(struct sudo_nss *nss, struct passwd *pw)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Sort the entries by the sudoOrder attribute. */
|
/* Sort the entries by the sudoOrder attribute. */
|
||||||
DPRINTF1("sorting remaining %d entries", lres->nentries);
|
if (lres->nentries != 0) {
|
||||||
qsort(lres->entries, lres->nentries, sizeof(lres->entries[0]),
|
DPRINTF1("sorting remaining %d entries", lres->nentries);
|
||||||
ldap_entry_compare);
|
qsort(lres->entries, lres->nentries, sizeof(lres->entries[0]),
|
||||||
|
ldap_entry_compare);
|
||||||
|
}
|
||||||
|
|
||||||
/* Store everything in the sudo_nss handle. */
|
/* Store everything in the sudo_nss handle. */
|
||||||
/* XXX - store pw and take a reference to it. */
|
/* XXX - store pw and take a reference to it. */
|
||||||
|
Reference in New Issue
Block a user