RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1318890 - glibc: nss_db: long group entries are skipped
Summary: glibc: nss_db: long group entries are skipped
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: glibc
Version: 7.2
Hardware: All
OS: Linux
Target Milestone: rc
: ---
Assignee: Florian Weimer
QA Contact: Sergey Kolosov
Depends On: 1321861
Blocks: 1388637 1390370
TreeView+ depends on / blocked
Reported: 2016-03-18 03:59 UTC by Frank Hirtz
Modified: 2020-02-14 17:42 UTC (History)
10 users (show)

Fixed In Version: glibc-2.17-158.el7
Doc Type: Bug Fix
Doc Text:
Cause: The nss_db Name Service Switch module fails to request larger result buffers when parsing group entries. Consequence: Group entries whose size falls into a specific range are skipped. Fix: nss_db now detects that the group list does not fit into the result buffer and requests are larger buffer. Result: Group entries in the affected size range are processed correctly.
Clone Of:
: 1321861 1388637 (view as bug list)
Last Closed: 2017-08-01 18:06:55 UTC
Target Upstream Version:

Attachments (Terms of Use)

System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1213603 0 urgent CLOSED glibc: nss_db: get*ent crashes without preceding set*ent 2021-02-22 00:41:40 UTC
Red Hat Bugzilla 1370630 0 high CLOSED glibc: nss_db: Endless loop in services database processing 2021-02-22 00:41:40 UTC
Red Hat Product Errata RHSA-2017:1916 0 normal SHIPPED_LIVE Moderate: glibc security, bug fix, and enhancement update 2017-08-01 18:05:43 UTC
Sourceware 19837 0 None None None 2019-07-23 09:05:26 UTC

Internal Links: 1213603 1370630

Description Frank Hirtz 2016-03-18 03:59:42 UTC
Description of problem:
The client discovered this when testing with RHEL7 against a sizable groups.db file. The 'getet groups' list was truncated and was missing most entries. Florian had a look and submitted the following upstream patch which was tested to resolve the issue:


nss_db: No retries for some long lines with a larger buffer
_nss_db_get*ent_r returns the wrong error code if parse_line fails.  As a result, only long lines which are large enough not to fit into the caller-provided buffer result in ERANGE with NSS_STATUS_TRYAGAIN.  If parse_line detects that there is not enough room, NSS_STATUS_NOTFOUND is returned, which stops enumeration.

Patch for later reference (I will post it to libc-alpha as well):

diff --git a/nss/nss_db/db-XXX.c b/nss/nss_db/db-XXX.c
index 03c18d7..125a5e9 100644
--- a/nss/nss_db/db-XXX.c
+++ b/nss/nss_db/db-XXX.c
@@ -288,8 +288,8 @@ CONCAT(_nss_db_get,ENTNAME_r) (struct STRUCTURE *result, char *buffer,
 	  if (err < 0)
-	      status = NSS_STATUS_NOTFOUND;
+	      status = NSS_STATUS_TRYAGAIN;

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1.Have long "group" entries (many users/group) and generate/use NSS_db in nsswitch.

2. List group with "getent group"
3. Note that the listing is truncated

I can't include the client's db file unfortunately that we were using for replication, but this patch was tested and corrected the client issue.

Comment 1 Florian Weimer 2016-03-29 09:30:16 UTC
Upstream commit:


Reproducer (needs to run as root):
    perl -e \
      'print "large:x:999:" . join(",", map {"user$_"} (1 .. 135))."\n"' \
      >> /etc/group
    cd /var/db
    getent -s db group
After the fix, the last command should list the "large" group.
The magic number 135 has been chosen so that the line is shorter than
1024 bytes, but the pointers required to encode the member array will
cross the threshold, triggering the bug.

Comment 17 errata-xmlrpc 2017-08-01 18:06:55 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.


Note You need to log in before you can comment on or make changes to this bug.