mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-30 22:43:12 +03:00
nsswitch: return result when nss database is locked [BZ #27343]
Before the change nss_database_check_reload_and_get() did not populate the '*result' value when it returned success in a case of chroot detection. This caused initgroups() to use garage pointer in the following test (extracted from unbound): ``` int main() { // load some NSS modules struct passwd * pw = getpwnam("root"); chdir("/tmp"); chroot("/tmp"); chdir("/"); // access nsswitch.conf in a chroot initgroups("root", 0); } ``` Reviewed-by: DJ Delorie <dj@redhat.com>
This commit is contained in:
committed by
DJ Delorie
parent
921e6f4198
commit
c3479fb793
@ -398,8 +398,9 @@ nss_database_check_reload_and_get (struct nss_database_state *local,
|
|||||||
&& (str.st_ino != local->root_ino
|
&& (str.st_ino != local->root_ino
|
||||||
|| str.st_dev != local->root_dev)))
|
|| str.st_dev != local->root_dev)))
|
||||||
{
|
{
|
||||||
/* Change detected; disable reloading. */
|
/* Change detected; disable reloading and return current state. */
|
||||||
atomic_store_release (&local->data.reload_disabled, 1);
|
atomic_store_release (&local->data.reload_disabled, 1);
|
||||||
|
*result = local->data.services[database_index];
|
||||||
__libc_lock_unlock (local->lock);
|
__libc_lock_unlock (local->lock);
|
||||||
__nss_module_disable_loading ();
|
__nss_module_disable_loading ();
|
||||||
return true;
|
return true;
|
||||||
|
Reference in New Issue
Block a user