Changeset View
Changeset View
Standalone View
Standalone View
head/sys/kern/vfs_lookup.c
Show First 20 Lines • Show All 236 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
static int | static int | ||||
namei_handle_root(struct nameidata *ndp, struct vnode **dpp) | namei_handle_root(struct nameidata *ndp, struct vnode **dpp) | ||||
{ | { | ||||
struct componentname *cnp; | struct componentname *cnp; | ||||
cnp = &ndp->ni_cnd; | cnp = &ndp->ni_cnd; | ||||
if ((ndp->ni_lcf & NI_LCF_STRICTRELATIVE) != 0) { | if ((ndp->ni_lcf & NI_LCF_STRICTRELATIVE) != 0 || | ||||
(cnp->cn_flags & BENEATH) != 0) { | |||||
#ifdef KTRACE | #ifdef KTRACE | ||||
if (KTRPOINT(curthread, KTR_CAPFAIL)) | if (KTRPOINT(curthread, KTR_CAPFAIL)) | ||||
ktrcapfail(CAPFAIL_LOOKUP, NULL, NULL); | ktrcapfail(CAPFAIL_LOOKUP, NULL, NULL); | ||||
#endif | #endif | ||||
return (ENOTCAPABLE); | return (ENOTCAPABLE); | ||||
} | } | ||||
while (*(cnp->cn_nameptr) == '/') { | while (*(cnp->cn_nameptr) == '/') { | ||||
cnp->cn_nameptr++; | cnp->cn_nameptr++; | ||||
▲ Show 20 Lines • Show All 175 Lines • ▼ Show 20 Lines | #endif | ||||
FILEDESC_SUNLOCK(fdp); | FILEDESC_SUNLOCK(fdp); | ||||
if (ndp->ni_startdir != NULL && !startdir_used) | if (ndp->ni_startdir != NULL && !startdir_used) | ||||
vrele(ndp->ni_startdir); | vrele(ndp->ni_startdir); | ||||
if (error != 0) { | if (error != 0) { | ||||
if (dp != NULL) | if (dp != NULL) | ||||
vrele(dp); | vrele(dp); | ||||
goto out; | goto out; | ||||
} | } | ||||
if ((ndp->ni_lcf & NI_LCF_STRICTRELATIVE) != 0 && | if (((ndp->ni_lcf & NI_LCF_STRICTRELATIVE) != 0 && | ||||
lookup_cap_dotdot != 0) | lookup_cap_dotdot != 0) || | ||||
((ndp->ni_lcf & NI_LCF_STRICTRELATIVE) == 0 && | |||||
(cnp->cn_flags & BENEATH) != 0)) | |||||
ndp->ni_lcf |= NI_LCF_CAP_DOTDOT; | ndp->ni_lcf |= NI_LCF_CAP_DOTDOT; | ||||
SDT_PROBE3(vfs, namei, lookup, entry, dp, cnp->cn_pnbuf, | SDT_PROBE3(vfs, namei, lookup, entry, dp, cnp->cn_pnbuf, | ||||
cnp->cn_flags); | cnp->cn_flags); | ||||
for (;;) { | for (;;) { | ||||
ndp->ni_startdir = dp; | ndp->ni_startdir = dp; | ||||
error = lookup(ndp); | error = lookup(ndp); | ||||
if (error != 0) | if (error != 0) | ||||
goto out; | goto out; | ||||
▲ Show 20 Lines • Show All 982 Lines • Show Last 20 Lines |