* [PATCH] inode_change_ok() grpid bug?
@ 2001-02-07 20:19 Jay Miller
0 siblings, 0 replies; only message in thread
From: Jay Miller @ 2001-02-07 20:19 UTC (permalink / raw)
To: linux-kernel
I think I found a reælly minor problem..
* 'chmod g+s foo' when I am not in foo's group does nothing. (no error)
* 'chmod g-s foo' when I am not in foo's group turns off the GID bit.
This seems like inconsistent/wrong behavior. It apparently stems from the
fact that if there is a group mismatch between the current process and the
inode, inode_change_ok() and inode_setattr() just turn S_ISGID off, as they
have no way of knowing the original state of the bit.
My lame suggestions (to 2.4.1) are below - I apologize if this is old news
or in fact correct behavior.
--
Jay Miller
diff -urN linux/fs/attr.c linux-j/fs/attr.c
--- linux/fs/attr.c Mon Oct 16 14:00:53 2000
+++ linux-j/fs/attr.c Wed Feb 7 13:10:06 2001
@@ -43,7 +43,7 @@
/* Also check the setgid bit! */
if (!in_group_p((ia_valid & ATTR_GID) ? attr->ia_gid :
inode->i_gid) && !capable(CAP_FSETID))
- attr->ia_mode &= ~S_ISGID;
+ goto error;
}
/* Check for setting the inode time. */
@@ -73,11 +73,8 @@
inode->i_mtime = attr->ia_mtime;
if (ia_valid & ATTR_CTIME)
inode->i_ctime = attr->ia_ctime;
- if (ia_valid & ATTR_MODE) {
+ if (ia_valid & ATTR_MODE)
inode->i_mode = attr->ia_mode;
- if (!in_group_p(inode->i_gid) && !capable(CAP_FSETID))
- inode->i_mode &= ~S_ISGID;
- }
mark_inode_dirty(inode);
}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2001-02-07 20:19 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-02-07 20:19 [PATCH] inode_change_ok() grpid bug? Jay Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.