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