From owner-svn-src-head@FreeBSD.ORG Thu Oct 2 19:53:40 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 41D5D56B; Thu, 2 Oct 2014 19:53:40 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 27BFF946; Thu, 2 Oct 2014 19:53:40 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s92Jref8070848; Thu, 2 Oct 2014 19:53:40 GMT (envelope-from brd@FreeBSD.org) Received: (from brd@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s92Jrc7i070838; Thu, 2 Oct 2014 19:53:38 GMT (envelope-from brd@FreeBSD.org) Message-Id: <201410021953.s92Jrc7i070838@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: brd set sender to brd@FreeBSD.org using -f From: Brad Davis Date: Thu, 2 Oct 2014 19:53:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272445 - in head: etc/mtree usr.sbin/pw usr.sbin/pw/tests X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Oct 2014 19:53:40 -0000 Author: brd (doc committer) Date: Thu Oct 2 19:53:37 2014 New Revision: 272445 URL: https://svnweb.freebsd.org/changeset/base/272445 Log: - Add a test for bug 191427 where pw(8) will go into an infinite loop Reviewed by: will MFC after: 1 month Added: head/usr.sbin/pw/tests/ head/usr.sbin/pw/tests/Makefile (contents, props changed) head/usr.sbin/pw/tests/group (contents, props changed) head/usr.sbin/pw/tests/helper_functions.shin (contents, props changed) head/usr.sbin/pw/tests/master.passwd (contents, props changed) head/usr.sbin/pw/tests/pw_delete.sh (contents, props changed) Modified: head/etc/mtree/BSD.tests.dist head/usr.sbin/pw/Makefile Modified: head/etc/mtree/BSD.tests.dist ============================================================================== --- head/etc/mtree/BSD.tests.dist Thu Oct 2 19:11:18 2014 (r272444) +++ head/etc/mtree/BSD.tests.dist Thu Oct 2 19:53:37 2014 (r272445) @@ -287,6 +287,8 @@ .. newsyslog .. + pw + .. sa .. .. Modified: head/usr.sbin/pw/Makefile ============================================================================== --- head/usr.sbin/pw/Makefile Thu Oct 2 19:11:18 2014 (r272444) +++ head/usr.sbin/pw/Makefile Thu Oct 2 19:53:37 2014 (r272445) @@ -11,4 +11,10 @@ WARNS?= 2 DPADD= ${LIBCRYPT} ${LIBUTIL} LDADD= -lcrypt -lutil +.include + +.if ${MK_TESTS} != "no" +SUBDIR+= tests +.endif + .include Added: head/usr.sbin/pw/tests/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/pw/tests/Makefile Thu Oct 2 19:53:37 2014 (r272445) @@ -0,0 +1,10 @@ +# $FreeBSD$ + +TESTSDIR= ${TESTSBASE}/usr.sbin/pw + +ATF_TESTS_SH= pw_delete + +FILES= group helper_functions.shin master.passwd +FILESDIR= ${TESTSDIR} + +.include Added: head/usr.sbin/pw/tests/group ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/pw/tests/group Thu Oct 2 19:53:37 2014 (r272445) @@ -0,0 +1,3 @@ +# $FreeBSD$ +# +wheel:*:0:root Added: head/usr.sbin/pw/tests/helper_functions.shin ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/pw/tests/helper_functions.shin Thu Oct 2 19:53:37 2014 (r272445) @@ -0,0 +1,15 @@ +# $FreeBSD$ + +# Workdir to run tests in +TESTDIR=$(atf_get_srcdir) + +# Populate the files pw needs to use into $HOME/etc +populate_etc_skel() { + cp ${TESTDIR}/master.passwd ${HOME} || \ + atf_fail "Populating master.passwd in ${HOME}" + cp ${TESTDIR}/group ${HOME} || atf_fail "Populating group in ${HOME}" + + # Generate the passwd file + pwd_mkdb -p -d ${HOME} ${HOME}/master.passwd || \ + atf_fail "generate passwd from master.passwd" +} Added: head/usr.sbin/pw/tests/master.passwd ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/pw/tests/master.passwd Thu Oct 2 19:53:37 2014 (r272445) @@ -0,0 +1,4 @@ +# $FreeBSD$ +# +root:*:0:0::0:0:Charlie &:/root:/bin/csh +toor:*:0:0::0:0:Bourne-again Superuser:/root: Added: head/usr.sbin/pw/tests/pw_delete.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/pw/tests/pw_delete.sh Thu Oct 2 19:53:37 2014 (r272445) @@ -0,0 +1,24 @@ +# $FreeBSD$ + +# Import helper functions +. $(atf_get_srcdir)/helper_functions.shin + +# Test that a user can be deleted when another user is part of this +# user's default group and does not go into an infinate loop. +# PR: 191427 +atf_test_case rmuser_seperate_group cleanup +rmuser_seperate_group_head() { + atf_set "timeout" "30" +} +rmuser_seperate_group_body() { + populate_etc_skel + pw -V ${HOME} useradd test || atf_fail "Creating test user" + pw -V ${HOME} groupmod test -M 'test,root' || \ + atf_fail "Modifying the group" + pw -V ${HOME} userdel test || atf_fail "delete the user" +} + + +atf_init_test_cases() { + atf_add_test_case rmuser_seperate_group +}