diff options
author | trasz <trasz@FreeBSD.org> | 2008-11-01 19:02:05 +0000 |
---|---|---|
committer | trasz <trasz@FreeBSD.org> | 2008-11-01 19:02:05 +0000 |
commit | d773e920c4b6682a7af6093fa36596cc1ea39c37 (patch) | |
tree | fc79be24974217d7a170923a48ce253ae81ec1d9 /share | |
parent | 77c74d7544fa29624c417cf036d6fa635e2f5418 (diff) | |
download | FreeBSD-src-d773e920c4b6682a7af6093fa36596cc1ea39c37.zip FreeBSD-src-d773e920c4b6682a7af6093fa36596cc1ea39c37.tar.gz |
Remove obsolete pseudocode from VOP_ACCESS.9, replacing it with something
closer to reality.
Approved by: rwatson (mentor)
Diffstat (limited to 'share')
-rw-r--r-- | share/man/man9/VOP_ACCESS.9 | 41 |
1 files changed, 4 insertions, 37 deletions
diff --git a/share/man/man9/VOP_ACCESS.9 b/share/man/man9/VOP_ACCESS.9 index 73eb2b5..e959fda 100644 --- a/share/man/man9/VOP_ACCESS.9 +++ b/share/man/man9/VOP_ACCESS.9 @@ -94,45 +94,12 @@ vop_access(struct vnode *vp, accmode_t accmode, struct ucred *cred, struct threa /* If immutable bit set, nobody gets to write it. */ if ((accmode & VWRITE) && vp has immutable bit set) - return EPERM; + return (EPERM); - /* Otherwise, user id 0 always gets access. */ - if (cred->cr_uid == 0) - return 0; + error = vaccess(vp->v_type, mode of vp, owner of vp, + group of vp, ap->a_accmode, ap->a_cred, NULL); - mask = 0; - - /* Otherwise, check the owner. */ - if (cred->cr_uid == owner of vp) { - if (accmode & VEXEC) - mask |= S_IXUSR; - if (accmode & VREAD) - mask |= S_IRUSR; - if (accmode & VWRITE) - mask |= S_IWUSR; - return (((mode of vp) & mask) == mask ? 0 : EACCES); - } - - /* Otherwise, check the groups. */ - for (i = 0, gp = cred->cr_groups; i < cred->cr_ngroups; i++, gp++) - if (group of vp == *gp) { - if (accmode & VEXEC) - mask |= S_IXGRP; - if (accmode & VREAD) - mask |= S_IRGRP; - if (accmode & VWRITE) - mask |= S_IWGRP; - return (((mode of vp) & mask) == mask ? 0 : EACCES); - } - - /* Otherwise, check everyone else. */ - if (accmode & VEXEC) - mask |= S_IXOTH; - if (accmode & VREAD) - mask |= S_IROTH; - if (accmode & VWRITE) - mask |= S_IWOTH; - return (((mode of vp) & mask) == mask ? 0 : EACCES); + return (error); } .Ed .Sh ERRORS |