From owner-svn-src-all@freebsd.org Sun Jul 24 08:12:24 2016 Return-Path: Delivered-To: svn-src-all@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 48F30BA3A62; Sun, 24 Jul 2016 08:12:24 +0000 (UTC) (envelope-from bapt@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 196C61CB1; Sun, 24 Jul 2016 08:12:24 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6O8CNCo070621; Sun, 24 Jul 2016 08:12:23 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6O8CNr7070619; Sun, 24 Jul 2016 08:12:23 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201607240812.u6O8CNr7070619@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sun, 24 Jul 2016 08:12:23 +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: r303256 - in stable/11/usr.sbin/pw: . tests X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Jul 2016 08:12:24 -0000 Author: bapt Date: Sun Jul 24 08:12:23 2016 New Revision: 303256 URL: https://svnweb.freebsd.org/changeset/base/303256 Log: iDo not try to delete the home of the user if is is not a directory for example "/dev/null" PR: 211195 Submitted by: rday Reported by: eniorm Approved by: re (kib) Modified: stable/11/usr.sbin/pw/rm_r.c stable/11/usr.sbin/pw/tests/pw_userdel.sh Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/pw/rm_r.c ============================================================================== --- stable/11/usr.sbin/pw/rm_r.c Sun Jul 24 05:24:10 2016 (r303255) +++ stable/11/usr.sbin/pw/rm_r.c Sun Jul 24 08:12:23 2016 (r303256) @@ -50,6 +50,9 @@ rm_r(int rootfd, const char *path, uid_t path++; dirfd = openat(rootfd, path, O_DIRECTORY); + if (dirfd == -1) { + return; + } d = fdopendir(dirfd); while ((e = readdir(d)) != NULL) { Modified: stable/11/usr.sbin/pw/tests/pw_userdel.sh ============================================================================== --- stable/11/usr.sbin/pw/tests/pw_userdel.sh Sun Jul 24 05:24:10 2016 (r303255) +++ stable/11/usr.sbin/pw/tests/pw_userdel.sh Sun Jul 24 08:12:23 2016 (r303256) @@ -59,9 +59,18 @@ delete_numeric_name_body() { ${PW} userdel -n 4001 } +atf_test_case home_not_a_dir +home_not_a_dir_body() { + populate_root_etc_skel + touch ${HOME}/foo + atf_check ${RPW} useradd foo -d /foo + atf_check ${RPW} userdel foo -r +} + atf_init_test_cases() { atf_add_test_case rmuser_seperate_group atf_add_test_case user_do_not_try_to_delete_root_if_user_unknown atf_add_test_case delete_files atf_add_test_case delete_numeric_name + atf_add_test_case home_not_a_dir }