Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 170581 - sys-auth/libnss-pgsql - getgrent_r group database query deadlocks if database is not available
Summary: sys-auth/libnss-pgsql - getgrent_r group database query deadlocks if database...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High major (vote)
Assignee: PgSQL Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-03-12 15:36 UTC by Claudinei Matos
Modified: 2019-11-02 16:14 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Patch to fix _nss_pgsql_setgrent endless loop when database is down. (libnss-pgsql-1.4.0-setgrent_fixed.patch,635 bytes, patch)
2007-03-12 15:47 UTC, Claudinei Matos
Details | Diff
ebuild for setgrent_fixed patch (libnss-pgsql-1.4.0.ebuild,1.62 KB, text/plain)
2007-03-12 15:48 UTC, Claudinei Matos
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Claudinei Matos 2007-03-12 15:36:19 UTC
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.
Comment 1 Claudinei Matos 2007-03-12 15:47:30 UTC
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.
Comment 2 Claudinei Matos 2007-03-12 15:48:27 UTC
Created attachment 113082 [details]
ebuild for setgrent_fixed patch
Comment 3 Larry the Git Cow gentoo-dev 2019-11-02 16:14:20 UTC
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(-)