From owner-svn-src-stable-11@freebsd.org Wed Aug 30 01:15:07 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5CBACDEAB02; Wed, 30 Aug 2017 01:15:07 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 331D57CEFA; Wed, 30 Aug 2017 01:15:07 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7U1F6Yb037902; Wed, 30 Aug 2017 01:15:06 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7U1F5Dm037899; Wed, 30 Aug 2017 01:15:05 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201708300115.v7U1F5Dm037899@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 30 Aug 2017 01:15:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r323009 - in stable/11: tools/build/mk usr.sbin/pw usr.sbin/pw/tests X-SVN-Group: stable-11 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: in stable/11: tools/build/mk usr.sbin/pw usr.sbin/pw/tests X-SVN-Commit-Revision: 323009 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Aug 2017 01:15:07 -0000 Author: emaste Date: Wed Aug 30 01:15:05 2017 New Revision: 323009 URL: https://svnweb.freebsd.org/changeset/base/323009 Log: MFC r322581: remove debug files in delete-old* when WITHOUT_DEBUG_FILES Sponsored by: The FreeBSD Foundation Modified: stable/11/tools/build/mk/OptionalObsoleteFiles.inc stable/11/usr.sbin/pw/pw_user.c stable/11/usr.sbin/pw/tests/pw_useradd_test.sh Directory Properties: stable/11/ (props changed) Modified: stable/11/tools/build/mk/OptionalObsoleteFiles.inc ============================================================================== --- stable/11/tools/build/mk/OptionalObsoleteFiles.inc Wed Aug 30 00:20:43 2017 (r323008) +++ stable/11/tools/build/mk/OptionalObsoleteFiles.inc Wed Aug 30 01:15:05 2017 (r323009) @@ -1583,6 +1583,22 @@ OLD_FILES+=usr/bin/g++ OLD_FILES+=usr/libexec/cc1plus .endif +.if ${MK_DEBUG_FILES} == no +.if exists(${DESTDIR}/usr/lib/debug) +DEBUG_DIRS!=find ${DESTDIR}/usr/lib/debug -mindepth 1 \ + -type d \! -path "${DESTDIR}/usr/lib/debug/boot/*" \ + | sed -e 's,^${DESTDIR}/,,'; echo +DEBUG_FILES!=find ${DESTDIR}/usr/lib/debug \ + \! -type d \! -path "${DESTDIR}/usr/lib/debug/boot/*" \! -name "lib*.so*" \ + | sed -e 's,^${DESTDIR}/,,'; echo +DEBUG_LIBS!=find ${DESTDIR}/usr/lib/debug \! -type d -name "lib*.so*" \ + | sed -e 's,^${DESTDIR}/,,'; echo +OLD_DIRS+=${DEBUG_DIRS} +OLD_FILES+=${DEBUG_FILES} +OLD_LIBS+=${DEBUG_LIBS} +.endif +.endif + .if ${MK_DIALOG} == no OLD_FILES+=usr/bin/dialog OLD_FILES+=usr/bin/dpv Modified: stable/11/usr.sbin/pw/pw_user.c ============================================================================== --- stable/11/usr.sbin/pw/pw_user.c Wed Aug 30 00:20:43 2017 (r323008) +++ stable/11/usr.sbin/pw/pw_user.c Wed Aug 30 01:15:05 2017 (r323009) @@ -1202,7 +1202,7 @@ pw_user_add(int argc, char **argv, char *arg1) if (arg1[strspn(arg1, "0123456789")] == '\0') id = pw_checkid(arg1, UID_MAX); else - name = arg1; + name = pw_checkname(arg1, 0); } while ((ch = getopt(argc, argv, args)) != -1) { @@ -1214,7 +1214,7 @@ pw_user_add(int argc, char **argv, char *arg1) quiet = true; break; case 'n': - name = optarg; + name = pw_checkname(optarg, 0); break; case 'u': userid = optarg; Modified: stable/11/usr.sbin/pw/tests/pw_useradd_test.sh ============================================================================== --- stable/11/usr.sbin/pw/tests/pw_useradd_test.sh Wed Aug 30 00:20:43 2017 (r323008) +++ stable/11/usr.sbin/pw/tests/pw_useradd_test.sh Wed Aug 30 01:15:05 2017 (r323009) @@ -176,6 +176,43 @@ user_add_name_too_long_body() { ${PW} useradd name_very_vert_very_very_very_long } +atf_test_case user_add_name_with_spaces +user_add_name_with_spaces_body() { + populate_etc_skel + atf_check -s exit:65 -e match:"invalid character" \ + ${PW} useradd 'test user' + atf_check -s exit:1 -o empty grep "^test user:.*" $HOME/master.passwd + # Try again with -n which uses a slightly different code path. + atf_check -s exit:65 -e match:"invalid character" \ + ${PW} useradd -n 'test user' + atf_check -s exit:1 -o empty grep "^test user:.*" $HOME/master.passwd +} + +atf_test_case user_add_name_with_spaces_and_gid_specified +user_add_name_with_spaces_and_gid_specified_body() { + populate_etc_skel + gid=12345 + user_name="test user" + # pw useradd should fail because of the space in the user + # name, not because the group doesn't exist. + atf_check -s exit:65 -e match:"invalid character" \ + ${PW} useradd "${user_name}" -g ${gid} + atf_check -s exit:1 -o empty grep "^${user_name}:.*" $HOME/master.passwd + # Try again with -n which uses a slightly different code path. + atf_check -s exit:65 -e match:"invalid character" \ + ${PW} useradd -n "${user_name}" -g ${gid} + atf_check -s exit:1 -o empty grep "^${user_name}:.*" $HOME/master.passwd + # Make sure the user isn't added even if the group exists + atf_check -s exit:0 ${PW} groupadd blafasel -g ${gid} + atf_check -s exit:65 -e match:"invalid character" \ + ${PW} useradd "${user_name}" -g ${gid} + atf_check -s exit:1 -o empty grep "^${user_name}:.*" $HOME/master.passwd + # Try again with the -n option. + atf_check -s exit:65 -e match:"invalid character" \ + ${PW} useradd -n "${user_name}" -g ${gid} + atf_check -s exit:1 -o empty grep "^${user_name}:.*" $HOME/master.passwd +} + atf_test_case user_add_expiration user_add_expiration_body() { populate_etc_skel @@ -415,6 +452,8 @@ atf_init_test_cases() { atf_add_test_case user_add_password_expiration_date_month atf_add_test_case user_add_password_expiration_date_relative atf_add_test_case user_add_name_too_long + atf_add_test_case user_add_name_with_spaces + atf_add_test_case user_add_name_with_spaces_and_gid_specified atf_add_test_case user_add_expiration atf_add_test_case user_add_invalid_user_entry atf_add_test_case user_add_invalid_group_entry