patch-2.0.31 linux/fs/ext2/namei.c

Next file: linux/fs/ext2/symlink.c
Previous file: linux/fs/ext2/ioctl.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.0.30/linux/fs/ext2/namei.c linux/fs/ext2/namei.c
@@ -1015,10 +1015,15 @@
 			goto end_rename;
 	}
 	retval = -EPERM;
-	if (new_inode && (new_dir->i_mode & S_ISVTX) &&
-	    current->fsuid != new_inode->i_uid &&
-	    current->fsuid != new_dir->i_uid && !fsuser())
-		goto end_rename;
+	if (new_inode) {
+		if ((new_dir->i_mode & S_ISVTX) &&
+		    current->fsuid != new_inode->i_uid &&
+		    current->fsuid != new_dir->i_uid && !fsuser())
+			goto end_rename;
+		if (IS_APPEND(new_inode) || IS_IMMUTABLE(new_inode))
+			goto end_rename;
+	}
+	
 	if (S_ISDIR(old_inode->i_mode)) {
 		retval = -ENOTDIR;
 		if (new_inode && !S_ISDIR(new_inode->i_mode))

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov