[PATCH] Ext2FS: SUID on Dir

From: Clifford Wolf (clifford@clifford.at)
Date: Tue Aug 28 2001 - 05:52:46 EST


Hi,

I'm not subscribed to l-k anymore since I'm not doing much kernel hacking
now - so please don't send your replies only to the list but also to me.

As you all know, on Ext2FS Partitions the SGID flag has a special function
on directories: files within that directories will be owned by the same
group that also owns the directory - which is useful for creating
directories which are shared between the members of a group.

But that only makes sense if the umask is set to give full permissions to
the group (e.g. 007 or 002). Noone would do that if there is a system-wide
'users' group - so some distributions add an extra group for every user
which lets the /etc/group file grow very fast and makes the admins life
harder ...

The following small patch adds a function to the SUID flag on directories.
If the SUID flag is set for a diectory, all new files in that directory
will get the same rights in the group-field as they have in their
user-field. So, if one sets both - SUID and SGID - on a directory, it
will also work with a umask like 022 or 077 and there is no more need for
an extra group for every user.

Also, the SUID flag will be set to all subdirectories of a SUID directory
(as it is already now with the SGID flag on directories).

--- linux/fs/ext2/ialloc.c.orig Tue Aug 28 10:59:09 2001
+++ linux/fs/ext2/ialloc.c Tue Aug 28 11:03:17 2001
@@ -427,6 +427,11 @@
                         mode |= S_ISGID;
         } else
                 inode->i_gid = current->fsgid;
+ if (dir->i_mode & S_ISUID) {
+ mode |= (mode & 0700) >> 3;
+ if (S_ISDIR(mode))
+ mode |= S_ISUID;
+ }
         inode->i_mode = mode;

         inode->i_ino = j;
--- linux/CREDITS.orig Tue Aug 28 11:03:27 2001
+++ linux/CREDITS Tue Aug 28 11:05:07 2001
@@ -3064,6 +3064,8 @@
 E: god@clifford.at
 W: http://www.clifford.at/
 D: Menuconfig/lxdialog improvement
+D: Initial Wacom Intuos USB Driver
+D: Ext2FS: SUID on directories
 S: Foehrengasse 16
 S: A-2333 Leopoldsdorf b. Wien
 S: Austria

What do you thing? Good idea? Bad idea? Why?

yours,
 - clifford

--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
Clifford Wolf ................ www.clifford.at IRC: http://opirc.nu
The ROCK Projects Workgroup .. www.rock-projects.com Tel: +43-699-10063494
The ROCK Linux Workgroup ..... www.rocklinux.org Fax: +43-2235-42788-4
The NTx Consulting Group ..... www.ntx.at email: god@clifford.at

Reality corrupted. Reboot universe? (Y/N) www.rocklinux.net

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Fri Aug 31 2001 - 21:00:28 EST