1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* file.c (test_grpowned, rb_stat_grpowned): should honor

supplementary group IDs.  [ruby-core:09546]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11302 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2006-11-22 08:37:11 +00:00
parent c97ed5ef9a
commit 5dd8f6e20c
2 changed files with 9 additions and 4 deletions

View file

@ -8,6 +8,11 @@ Wed Nov 22 16:00:49 2006 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* ext/tk/tkutil/extconf.rb: able to be called manually
[ruby-talk:225950].
Wed Nov 15 23:22:54 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
* file.c (test_grpowned, rb_stat_grpowned): should honor
supplementary group IDs. [ruby-core:09546]
Tue Nov 7 18:35:18 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
* eval.c (formal_assign): need to pack rest arg information in

8
file.c
View file

@ -789,7 +789,7 @@ static int
group_member(GETGROUPS_T gid)
{
#ifndef _WIN32
if (getgid() == gid)
if (getgid() == gid || getegid() == gid)
return Qtrue;
# ifdef HAVE_GETGROUPS
@ -849,7 +849,7 @@ eaccess(const char *path, int mode)
if (st.st_uid == euid) /* owner */
mode <<= 6;
else if (getegid() == st.st_gid || group_member(st.st_gid))
else if (group_member(st.st_gid))
mode <<= 3;
if ((st.st_mode & mode) == mode) return 0;
@ -1330,7 +1330,7 @@ test_grpowned(VALUE obj, VALUE fname)
struct stat st;
if (rb_stat(fname, &st) < 0) return Qfalse;
if (st.st_gid == getegid()) return Qtrue;
if (group_member(st.st_gid)) return Qtrue;
#endif
return Qfalse;
}
@ -3651,7 +3651,7 @@ static VALUE
rb_stat_grpowned(VALUE obj)
{
#ifndef _WIN32
if (get_stat(obj)->st_gid == getegid()) return Qtrue;
if (group_member(get_stat(obj)->st_gid)) return Qtrue;
#endif
return Qfalse;
}