Date: Sun, 22 Mar 2020 04:21:10 +0000 From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 244967] pw: userdel will delete a home directory not owned by the user (if it is empty) Message-ID: <bug-244967-227-IxAYppJM6n@https.bugs.freebsd.org/bugzilla/> In-Reply-To: <bug-244967-227@https.bugs.freebsd.org/bugzilla/> References: <bug-244967-227@https.bugs.freebsd.org/bugzilla/>
next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D244967 --- Comment #2 from Eric Hanneken <eric@erichanneken.com> --- Comment on attachment 212604 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D212604 Patch to pw(8) Index: usr.sbin/pw/rm_r.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- usr.sbin/pw/rm_r.c (revision 359195) +++ usr.sbin/pw/rm_r.c (working copy) @@ -71,5 +71,8 @@ closedir(d); if (fstatat(rootfd, path, &st, AT_SYMLINK_NOFOLLOW) !=3D 0) return; - unlinkat(rootfd, path, S_ISDIR(st.st_mode) ? AT_REMOVEDIR : 0); + if (S_ISLNK(st.st_mode)) + unlinkat(rootfd, path, 0); + else if (st.st_uid =3D=3D uid) + unlinkat(rootfd, path, AT_REMOVEDIR); } --=20 You are receiving this mail because: You are the assignee for the bug.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-244967-227-IxAYppJM6n>