nsswitch: return result when nss database is locked [BZ #27343]
commitc3479fb7939898ec22c655c383454d6e8b982a67
authorSergei Trofimovich <slyfox@gentoo.org>
Fri, 5 Feb 2021 07:32:18 +0000 (5 07:32 +0000)
committerDJ Delorie <dj@redhat.com>
Fri, 5 Feb 2021 18:07:10 +0000 (5 13:07 -0500)
tree7f5a514f3602b691721804e8281304e085b7510d
parent921e6f419867ae0ec15b6b5182f194a8229e7941
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>
nss/nss_database.c