Actually this bug was first submitted at bugs.debian.org but since the fix was not applied on the latest version of libnss-pgsql (1.4.0) by they developers I'm opening this bug here 'cause it can be useful for someone. The problem happens when the database is down and you try to make some group lookup. Instead of return no groups the function enter in a endless loop. Making the group calls functions looks like the passwd and shadow functions solved the problem for me and now there's no loop anymore. Reproducible: Always Steps to Reproduce: 1. Setup libnss-pgsql 2. Stop PostgreSQL 3. run # id root Actual Results: Endless loop on database connection try. Expected Results: It probably should return NSS_STATUS_UNAVAIL when database is down.
Created attachment 113081 [details, diff] Patch to fix _nss_pgsql_setgrent endless loop when database is down. Small patch to fix _nss_pgsql_setgrent endless loop when database is down. The solution was just to make the group functions looks like shadown and passwd functions, returning the correct NSS_STATUS instead of a fixed NSS_STATUS_SUCCESS. Also I did added some lines to _nss_pgsql_endgrent function since without this lines the additional groups are not returned. These lines was copied from _nss_pgsql_endpwent function.
Created attachment 113082 [details] ebuild for setgrent_fixed patch
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a8e2b1b69695ff13c292b87afc76304fb36f9a9a commit a8e2b1b69695ff13c292b87afc76304fb36f9a9a Author: Aaron W. Swenson <titanofold@gentoo.org> AuthorDate: 2019-11-02 16:13:39 +0000 Commit: Aaron W. Swenson <titanofold@gentoo.org> CommitDate: 2019-11-02 16:13:46 +0000 sys-auth/libnss-pgsql: Cleanup old ebuilds/patches Remove EAPI0 based ebuilds and related patches. 1.5.0_beta includes patch from bug 170581. Closes: https://bugs.gentoo.org/170581 Closes: https://bugs.gentoo.org/697206 Package-Manager: Portage-2.3.76, Repoman-2.3.16 Signed-off-by: Aaron W. Swenson <titanofold@gentoo.org> sys-auth/libnss-pgsql/Manifest | 1 - .../files/libnss-pgsql-1.4.0-gentoo.patch | 12 ----- .../files/libnss-pgsql-1.4.0-schema.patch | 22 --------- sys-auth/libnss-pgsql/libnss-pgsql-1.4.0.ebuild | 56 ---------------------- .../libnss-pgsql/libnss-pgsql-1.5.0_beta.ebuild | 55 --------------------- 5 files changed, 146 deletions(-)