00db10
commit a6033052d08027f745867e5e346852da1959226c
00db10
Author: Florian Weimer <fweimer@redhat.com>
00db10
Date:   Tue Mar 29 11:27:32 2016 +0200
00db10
00db10
    nss_db: Propagate ERANGE error if parse_line fails [BZ #19837]
00db10
    
00db10
    Reproducer (needs to run as root):
00db10
    
00db10
    perl -e \
00db10
      'print "large:x:999:" . join(",", map {"user$_"} (1 .. 135))."\n"' \
00db10
      >> /etc/group
00db10
    cd /var/db
00db10
    make
00db10
    getent -s db group
00db10
    
00db10
    After the fix, the last command should list the "large" group.
00db10
    
00db10
    The magic number 135 has been chosen so that the line is shorter than
00db10
    1024 bytes, but the pointers required to encode the member array will
00db10
    cross the threshold, triggering the bug.
00db10
00db10
Index: b/nss/nss_db/db-XXX.c
00db10
===================================================================
00db10
--- a/nss/nss_db/db-XXX.c
00db10
+++ b/nss/nss_db/db-XXX.c
00db10
@@ -284,8 +284,8 @@ CONCAT(_nss_db_get,ENTNAME_r) (struct ST
00db10
 	    }
00db10
 	  if (err < 0)
00db10
 	    {
00db10
-	      H_ERRNO_SET (HOST_NOT_FOUND);
00db10
-	      status = NSS_STATUS_NOTFOUND;
00db10
+	      H_ERRNO_SET (NETDB_INTERNAL);
00db10
+	      status = NSS_STATUS_TRYAGAIN;
00db10
 	      break;
00db10
 	    }
00db10