svn commit: r184528 - head/share/man/man9

Edward Tomasz Napierala trasz at FreeBSD.org
Sat Nov 1 12:02:06 PDT 2008


Author: trasz
Date: Sat Nov  1 19:02:05 2008
New Revision: 184528
URL: http://svn.freebsd.org/changeset/base/184528

Log:
  Remove obsolete pseudocode from VOP_ACCESS.9, replacing it with something
  closer to reality.
  
  Approved by:	rwatson (mentor)

Modified:
  head/share/man/man9/VOP_ACCESS.9

Modified: head/share/man/man9/VOP_ACCESS.9
==============================================================================
--- head/share/man/man9/VOP_ACCESS.9	Sat Nov  1 18:57:58 2008	(r184527)
+++ head/share/man/man9/VOP_ACCESS.9	Sat Nov  1 19:02:05 2008	(r184528)
@@ -94,45 +94,12 @@ vop_access(struct vnode *vp, accmode_t a
 
     /* 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


More information about the svn-src-all mailing list