From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/7106 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: regression tests for bugs in first versions of new passwd code Date: Sat, 28 Feb 2015 21:27:29 -0500 Message-ID: <20150301022729.GA8010@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="k+w/mQv8wyuph6w0" X-Trace: ger.gmane.org 1425176868 30981 80.91.229.3 (1 Mar 2015 02:27:48 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 1 Mar 2015 02:27:48 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-7119-gllmg-musl=m.gmane.org@lists.openwall.com Sun Mar 01 03:27:48 2015 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1YRtbg-0006id-2S for gllmg-musl@m.gmane.org; Sun, 01 Mar 2015 03:27:48 +0100 Original-Received: (qmail 3633 invoked by uid 550); 1 Mar 2015 02:27:45 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 3594 invoked from network); 1 Mar 2015 02:27:41 -0000 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Original-Sender: Rich Felker Xref: news.gmane.org gmane.linux.lib.musl.general:7106 Archived-At: --k+w/mQv8wyuph6w0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Here are a couple of tests, in the libc-test framework, for bugs that affected the early versions of the new passwd code. I'd like to eventually get some more extensive functionality coverage tests, but these are a start. Rich --k+w/mQv8wyuph6w0 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="getpwnam_r-crash.c" // commit fc5a96c9c8aa186effad7520d5df6b616bbfd29d // getpwnam_r should not crash on nonexistant users when errno is 0 #include #include "test.h" int main(void) { struct passwd *pw, pwbuf; char buf[1024]; getpwnam_r("nonsensical_user", &pwbuf, buf, sizeof buf, &pw); return t_status; } --k+w/mQv8wyuph6w0 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="getpwnam_r-errno.c" // commit 0afef1aa24b784c86ae6121ca39e999824086c7c // preexisting errno should not be interpreted by passwd/group functions #include #include #include "test.h" int main(void) { int baderr = EOWNERDEAD; // arbitrary absurd error struct passwd *pw, pwbuf; char buf[1024]; errno = baderr; if (getpwnam_r("nonsensical_user", &pwbuf, buf, sizeof buf, &pw) == baderr) t_error("getpwnam_r used preexisting errno for nonexisting user\n"); return t_status; } --k+w/mQv8wyuph6w0--