svn commit: r193517 - projects/ngroups/sys/fs/unionfs
Brooks Davis
brooks at FreeBSD.org
Fri Jun 5 16:43:47 UTC 2009
Author: brooks
Date: Fri Jun 5 16:43:47 2009
New Revision: 193517
URL: http://svn.freebsd.org/changeset/base/193517
Log:
Use groupmember() instead of hand rolling our own implementation.
Modified:
projects/ngroups/sys/fs/unionfs/union_vnops.c
Modified: projects/ngroups/sys/fs/unionfs/union_vnops.c
==============================================================================
--- projects/ngroups/sys/fs/unionfs/union_vnops.c Fri Jun 5 16:16:07 2009 (r193516)
+++ projects/ngroups/sys/fs/unionfs/union_vnops.c Fri Jun 5 16:43:47 2009 (r193517)
@@ -638,7 +638,6 @@ unionfs_check_corrected_access(accmode_t
uid_t uid; /* upper side vnode's uid */
gid_t gid; /* upper side vnode's gid */
u_short vmode; /* upper side vnode's mode */
- gid_t *gp;
u_short mask;
mask = 0;
@@ -659,17 +658,14 @@ unionfs_check_corrected_access(accmode_t
/* check group */
count = 0;
- gp = cred->cr_groups;
- for (; count < cred->cr_ngroups; count++, gp++) {
- if (gid == *gp) {
- if (accmode & VEXEC)
- mask |= S_IXGRP;
- if (accmode & VREAD)
- mask |= S_IRGRP;
- if (accmode & VWRITE)
- mask |= S_IWGRP;
- return ((vmode & mask) == mask ? 0 : EACCES);
- }
+ if (groupmember(gid, cred)) {
+ if (accmode & VEXEC)
+ mask |= S_IXGRP;
+ if (accmode & VREAD)
+ mask |= S_IRGRP;
+ if (accmode & VWRITE)
+ mask |= S_IWGRP;
+ return ((vmode & mask) == mask ? 0 : EACCES);
}
/* check other */
More information about the svn-src-projects
mailing list