Change O_BENEATH to handle relative paths same as absolute.
Do not care if path walks out of the topping directory if it returns back. Requested and reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D25886
This commit is contained in:
parent
07e7ad2b98
commit
6a9c72d901
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=366021
@ -178,11 +178,13 @@ static void
|
||||
nameicap_tracker_add(struct nameidata *ndp, struct vnode *dp)
|
||||
{
|
||||
struct nameicap_tracker *nt;
|
||||
struct componentname *cnp;
|
||||
|
||||
if ((ndp->ni_lcf & NI_LCF_CAP_DOTDOT) == 0 || dp->v_type != VDIR)
|
||||
return;
|
||||
if ((ndp->ni_lcf & (NI_LCF_BENEATH_ABS | NI_LCF_BENEATH_LATCHED)) ==
|
||||
NI_LCF_BENEATH_ABS) {
|
||||
cnp = &ndp->ni_cnd;
|
||||
if ((cnp->cn_flags & BENEATH) != 0 &&
|
||||
(ndp->ni_lcf & NI_LCF_BENEATH_LATCHED) == 0) {
|
||||
MPASS((ndp->ni_lcf & NI_LCF_LATCH) != 0);
|
||||
if (dp != ndp->ni_beneath_latch)
|
||||
return;
|
||||
@ -593,8 +595,8 @@ namei(struct nameidata *ndp)
|
||||
namei_cleanup_cnp(cnp);
|
||||
} else
|
||||
cnp->cn_flags |= HASBUF;
|
||||
if ((ndp->ni_lcf & (NI_LCF_BENEATH_ABS |
|
||||
NI_LCF_BENEATH_LATCHED)) == NI_LCF_BENEATH_ABS) {
|
||||
if ((ndp->ni_lcf & (NI_LCF_LATCH |
|
||||
NI_LCF_BENEATH_LATCHED)) == NI_LCF_LATCH) {
|
||||
NDFREE(ndp, 0);
|
||||
error = ENOTCAPABLE;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user