Fix some potential problems found by the clang static analyzer,

none serious.
This commit is contained in:
Todd C. Miller
2011-07-28 10:59:37 -04:00
parent 6365c779c0
commit 4f9a93f658
7 changed files with 55 additions and 36 deletions

View File

@@ -2059,7 +2059,7 @@ sudo_ldap_setdefs(struct sudo_nss *nss)
}
result = NULL;
rc = ldap_search_ext_s(ld, base->val, LDAP_SCOPE_SUBTREE,
filt, NULL, 0, NULL, NULL, NULL, 0, &result);
filt, NULL, 0, NULL, NULL, tvp, 0, &result);
if (rc == LDAP_SUCCESS && (entry = ldap_first_entry(ld, result))) {
DPRINTF(("found:%s", ldap_get_dn(ld, entry)), 1);
sudo_ldap_parse_options(ld, entry);
@@ -2083,7 +2083,7 @@ sudo_ldap_lookup(struct sudo_nss *nss, int ret, int pwflag)
struct sudo_ldap_handle *handle = nss->handle;
LDAP *ld;
LDAPMessage *entry;
int i, rc, setenv_implied, matched = UNSPEC;
int i, rc, setenv_implied;
struct ldap_result *lres = NULL;
if (handle == NULL || handle->ld == NULL)
@@ -2098,11 +2098,12 @@ sudo_ldap_lookup(struct sudo_nss *nss, int ret, int pwflag)
* password is required, so the order of the entries doesn't matter.
*/
if (pwflag) {
DPRINTF(("perform search for pwflag %d", pwflag), 1);
int doauth = UNSPEC;
int matched = UNSPEC;
enum def_tuple pwcheck =
(pwflag == -1) ? never : sudo_defs_table[pwflag].sd_un.tuple;
DPRINTF(("perform search for pwflag %d", pwflag), 1);
for (i = 0; i < lres->nentries; i++) {
entry = lres->entries[i].entry;
if ((pwcheck == any && doauth != FALSE) ||
@@ -2152,7 +2153,6 @@ sudo_ldap_lookup(struct sudo_nss *nss, int ret, int pwflag)
if (rc != UNSPEC) {
/* We have a match. */
DPRINTF(("Command %sallowed", rc == TRUE ? "" : "NOT "), 1);
matched = TRUE;
if (rc == TRUE) {
DPRINTF(("LDAP entry: %p", entry), 1);
/* Apply entry-specific options. */
@@ -2354,7 +2354,7 @@ sudo_ldap_result_get(struct sudo_nss *nss, struct passwd *pw)
}
result = NULL;
rc = ldap_search_ext_s(ld, base->val, LDAP_SCOPE_SUBTREE, filt,
NULL, 0, NULL, NULL, NULL, 0, &result);
NULL, 0, NULL, NULL, tvp, 0, &result);
if (rc != LDAP_SUCCESS) {
DPRINTF(("nothing found for '%s'", filt), 1);
continue;