bca718
commit 5a9af6376d43b58c6545feb86002812a57956654
bca718
Author: Florian Weimer <fweimer@redhat.com>
bca718
Date:   Fri Sep 25 20:20:33 2015 +0200
bca718
bca718
    Fix inconsistent passwd compensation in nss/bug17079.c
bca718
    
bca718
    It used to be common practice to have a statically linked shell for an
bca718
    alternative root account, as in:
bca718
    
bca718
    root:x:0:0:root:/root:/bin/bash
bca718
    toor:x:0:0:root recovery account:/root:/sbin/sash
bca718
    
bca718
    This causes problems with passwd NSS tests because a UID-based lookup
bca718
    will only retrieve one of those entries.  The original version of
bca718
    nss/bug17079.c detected this, but failed to use this information later
bca718
    on.
bca718
bca718
diff --git a/nss/bug17079.c b/nss/bug17079.c
bca718
index 9846737..0249922 100644
bca718
--- a/nss/bug17079.c
bca718
+++ b/nss/bug17079.c
bca718
@@ -72,7 +72,11 @@ init_test_items (void)
bca718
       struct passwd *pwd2 = getpwuid (test_items[i].pw_uid);
bca718
       if (pwd1 == NULL || !equal (pwd1, test_items + i)
bca718
           || pwd2 == NULL || !equal (pwd2, test_items + i))
bca718
-        test_items[i].pw_name = NULL;
bca718
+        {
bca718
+          printf ("info: skipping user \"%s\", UID %ld due to inconsistency\n",
bca718
+                  test_items[i].pw_name, (long) test_items[i].pw_uid);
bca718
+          test_items[i].pw_name = NULL;
bca718
+        }
bca718
       else
bca718
         found = true;
bca718
     }
bca718
@@ -195,6 +199,10 @@ test_buffer_size (size_t buffer_size)
bca718
   for (int i = 0; i < test_count; ++i)
bca718
     for (size_t padding_size = 0; padding_size < 3; ++padding_size)
bca718
       {
bca718
+        /* Skip entries with inconsistent name/UID lookups.  */
bca718
+        if (test_items[i].pw_name == NULL)
bca718
+          continue;
bca718
+
bca718
         test_one (test_items + i, buffer_size, '\0', padding_size);
bca718
         if (padding_size > 0)
bca718
           {