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