Do not return -1 on error from the display functions; the caller
expects a return value >= 0.
This commit is contained in:
@@ -1149,7 +1149,7 @@ sudo_ldap_display_defaults(struct sudo_nss *nss, struct passwd *pw,
|
|||||||
int rc, count = 0;
|
int rc, count = 0;
|
||||||
|
|
||||||
if (ld == NULL)
|
if (ld == NULL)
|
||||||
return(-1);
|
goto done;
|
||||||
|
|
||||||
for (base = ldap_conf.base; base != NULL; base = base->next) {
|
for (base = ldap_conf.base; base != NULL; base = base->next) {
|
||||||
result = NULL;
|
result = NULL;
|
||||||
@@ -1173,6 +1173,7 @@ sudo_ldap_display_defaults(struct sudo_nss *nss, struct passwd *pw,
|
|||||||
if (result)
|
if (result)
|
||||||
ldap_msgfree(result);
|
ldap_msgfree(result);
|
||||||
}
|
}
|
||||||
|
done:
|
||||||
return(count);
|
return(count);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1352,7 +1353,7 @@ sudo_ldap_display_privs(struct sudo_nss *nss, struct passwd *pw,
|
|||||||
int rc, do_netgr, count = 0;
|
int rc, do_netgr, count = 0;
|
||||||
|
|
||||||
if (ld == NULL)
|
if (ld == NULL)
|
||||||
return(-1);
|
goto done;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Okay - time to search for anything that matches this user
|
* Okay - time to search for anything that matches this user
|
||||||
@@ -1394,6 +1395,7 @@ sudo_ldap_display_privs(struct sudo_nss *nss, struct passwd *pw,
|
|||||||
}
|
}
|
||||||
efree(filt);
|
efree(filt);
|
||||||
}
|
}
|
||||||
|
done:
|
||||||
return(count);
|
return(count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -414,7 +414,7 @@ sudo_file_display_privs(struct sudo_nss *nss, struct passwd *pw,
|
|||||||
int nfound = 0;
|
int nfound = 0;
|
||||||
|
|
||||||
if (nss->handle == NULL)
|
if (nss->handle == NULL)
|
||||||
return(-1);
|
goto done;
|
||||||
|
|
||||||
tq_foreach_fwd(&userspecs, us) {
|
tq_foreach_fwd(&userspecs, us) {
|
||||||
if (userlist_matches(pw, &us->users) != ALLOW)
|
if (userlist_matches(pw, &us->users) != ALLOW)
|
||||||
@@ -425,6 +425,7 @@ sudo_file_display_privs(struct sudo_nss *nss, struct passwd *pw,
|
|||||||
else
|
else
|
||||||
nfound += sudo_file_display_priv_short(pw, us, lbuf);
|
nfound += sudo_file_display_priv_short(pw, us, lbuf);
|
||||||
}
|
}
|
||||||
|
done:
|
||||||
return(nfound);
|
return(nfound);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -440,7 +441,7 @@ sudo_file_display_defaults(struct sudo_nss *nss, struct passwd *pw,
|
|||||||
int nfound = 0;
|
int nfound = 0;
|
||||||
|
|
||||||
if (nss->handle == NULL)
|
if (nss->handle == NULL)
|
||||||
return(-1);
|
goto done;
|
||||||
|
|
||||||
if (lbuf->len == 0 || isspace((unsigned char)lbuf->buf[lbuf->len - 1]))
|
if (lbuf->len == 0 || isspace((unsigned char)lbuf->buf[lbuf->len - 1]))
|
||||||
prefix = " ";
|
prefix = " ";
|
||||||
@@ -476,7 +477,7 @@ sudo_file_display_defaults(struct sudo_nss *nss, struct passwd *pw,
|
|||||||
prefix = ", ";
|
prefix = ", ";
|
||||||
nfound++;
|
nfound++;
|
||||||
}
|
}
|
||||||
|
done:
|
||||||
return(nfound);
|
return(nfound);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -571,7 +572,7 @@ sudo_file_display_cmnd(struct sudo_nss *nss, struct passwd *pw)
|
|||||||
int host_match, runas_match, cmnd_match;
|
int host_match, runas_match, cmnd_match;
|
||||||
|
|
||||||
if (nss->handle == NULL)
|
if (nss->handle == NULL)
|
||||||
return(rval);
|
goto done;
|
||||||
|
|
||||||
match = NULL;
|
match = NULL;
|
||||||
tq_foreach_rev(&userspecs, us) {
|
tq_foreach_rev(&userspecs, us) {
|
||||||
@@ -602,6 +603,7 @@ sudo_file_display_cmnd(struct sudo_nss *nss, struct passwd *pw)
|
|||||||
safe_cmnd, user_args ? " " : "", user_args ? user_args : "");
|
safe_cmnd, user_args ? " " : "", user_args ? user_args : "");
|
||||||
rval = 0;
|
rval = 0;
|
||||||
}
|
}
|
||||||
|
done:
|
||||||
return(rval);
|
return(rval);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user