Evan Jeffrey
ejeffrey@eliot82.wustl.edu
--- include/linux/ext2_fs.h.orig Wed Dec 18 15:59:50 1996
+++ include/linux/ext2_fs.h Wed Dec 18 00:26:59 1996
@@ -297,4 +297,5 @@
#define EXT2_MOUNT_ERRORS_PANIC 0x0040 /* Panic on errors */
#define EXT2_MOUNT_MINIX_DF 0x0080 /* Mimics the Minix statfs */
+#define EXT2_MOUNT_SAFE_HLINK 0x0100 /* Only owner or root can create hard links */
#define clear_opt(o, opt) o &= ~EXT2_MOUNT_##opt
--- fs/ext2/namei.c.orig Wed Dec 18 15:58:48 1996
+++ fs/ext2/namei.c Wed Dec 18 15:43:21 1996
@@ -866,4 +866,9 @@
return -EPERM;
}
+ if (test_opt(oldinode->i_sb, SAFE_HLINK) && current->euid && current->euid != oldinode->i_uid) {
+ iput (oldinode);
+ iput (dir);
+ return -EPERM;
+ }
if (oldinode->i_nlink >= EXT2_LINK_MAX) {
iput (oldinode);
--- fs/ext2/super.c.orig Wed Dec 18 15:59:19 1996
+++ fs/ext2/super.c Wed Dec 18 00:56:07 1996
@@ -265,4 +265,6 @@
|| !strcmp (this_char, "usrquota"))
/* Don't do anything ;-) */ ;
+ else if (!strcmp (this_char, "safehlink"))
+ set_opt (*mount_options, SAFE_HLINK);
else {
printk ("EXT2-fs: Unrecognized mount option %s\n", this_char);