From patchwork Fri Sep 25 18:59:03 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 8857 Received: (qmail 11408 invoked by alias); 25 Sep 2015 18:59:10 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 11396 invoked by uid 89); 25 Sep 2015 18:59:09 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.7 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Subject: Re: [PATCH COMMITTED] Add test case for bug 17079 To: libc-alpha@sourceware.org References: <56014E46.9050108@redhat.com> From: Florian Weimer Message-ID: <56059977.4060403@redhat.com> Date: Fri, 25 Sep 2015 20:59:03 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: <56014E46.9050108@redhat.com> On 09/22/2015 02:49 PM, Florian Weimer wrote: > Unfortunately, the initial commit had the wrong bug number. > > I checked that the new test fails without the fix from bug 17079, and > passes on master. It runs reasonably quickly even under valgrind. Another fix, this time also tested with an inconsistent passwd file. From 5a9af6376d43b58c6545feb86002812a57956654 Mon Sep 17 00:00:00 2001 Message-Id: <5a9af6376d43b58c6545feb86002812a57956654.1443207151.git.fweimer@redhat.com> From: Florian Weimer Date: Fri, 25 Sep 2015 20:20:33 +0200 Subject: [PATCH] Fix inconsistent passwd compensation in nss/bug17079.c To: libc-alpha@sourceware.org It used to be common practice to have a statically linked shell for an alternative root account, as in: root:x:0:0:root:/root:/bin/bash toor:x:0:0:root recovery account:/root:/sbin/sash This causes problems with passwd NSS tests because a UID-based lookup will only retrieve one of those entries. The original version of nss/bug17079.c detected this, but failed to use this information later on. --- ChangeLog | 6 ++++++ nss/bug17079.c | 10 +++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index ba7aa4e..7e8156e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2015-09-25 Florian Weimer + + * nss/bug17079.c (init_test_items): Add diagnostic for + inconsistent entries. + (test_buffer_size): Skip inconsistent entries. + 2015-09-25 Joseph Myers [BZ #13304] diff --git a/nss/bug17079.c b/nss/bug17079.c index 9846737..0249922 100644 --- a/nss/bug17079.c +++ b/nss/bug17079.c @@ -72,7 +72,11 @@ init_test_items (void) struct passwd *pwd2 = getpwuid (test_items[i].pw_uid); if (pwd1 == NULL || !equal (pwd1, test_items + i) || pwd2 == NULL || !equal (pwd2, test_items + i)) - test_items[i].pw_name = NULL; + { + printf ("info: skipping user \"%s\", UID %ld due to inconsistency\n", + test_items[i].pw_name, (long) test_items[i].pw_uid); + test_items[i].pw_name = NULL; + } else found = true; } @@ -195,6 +199,10 @@ test_buffer_size (size_t buffer_size) for (int i = 0; i < test_count; ++i) for (size_t padding_size = 0; padding_size < 3; ++padding_size) { + /* Skip entries with inconsistent name/UID lookups. */ + if (test_items[i].pw_name == NULL) + continue; + test_one (test_items + i, buffer_size, '\0', padding_size); if (padding_size > 0) { -- 2.4.3