mirror of
https://github.com/sudo-project/sudo.git
synced 2025-09-02 23:35:36 +00:00
Set handle->pw before sss_to_sudoers() since sss_check_user()
uses it. Coverity CID 185651
This commit is contained in:
@@ -332,21 +332,24 @@ sudo_sss_query(struct sudo_nss *nss, struct passwd *pw)
|
|||||||
if (sss_result == NULL)
|
if (sss_result == NULL)
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
|
/* Stash a ref to the passwd struct in the handle. */
|
||||||
|
sudo_pw_addref(pw);
|
||||||
|
handle->pw = pw;
|
||||||
|
|
||||||
/* Convert to sudoers parse tree. */
|
/* Convert to sudoers parse tree. */
|
||||||
if (!sss_to_sudoers(handle, sss_result, &nss->userspecs)) {
|
if (!sss_to_sudoers(handle, sss_result, &nss->userspecs)) {
|
||||||
ret = -1;
|
ret = -1;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Stash a ref to the passwd struct in the handle. */
|
|
||||||
sudo_pw_addref(pw);
|
|
||||||
handle->pw = pw;
|
|
||||||
|
|
||||||
done:
|
done:
|
||||||
/* Cleanup */
|
/* Cleanup */
|
||||||
handle->fn_free_result(sss_result);
|
handle->fn_free_result(sss_result);
|
||||||
if (ret == -1)
|
if (ret == -1) {
|
||||||
free_userspecs(&nss->userspecs);
|
free_userspecs(&nss->userspecs);
|
||||||
|
sudo_pw_delref(handle->pw);
|
||||||
|
handle->pw = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
sudo_debug_printf(SUDO_DEBUG_DIAG, "Done with LDAP searches");
|
sudo_debug_printf(SUDO_DEBUG_DIAG, "Done with LDAP searches");
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user