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