patch-2.1.122 linux/fs/namei.c

Next file: linux/fs/proc/array.c
Previous file: linux/fs/msdos/namei.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.121/linux/fs/namei.c linux/fs/namei.c
@@ -84,6 +84,8 @@
 
 /* [16-Dec-97 Kevin Buhr] For security reasons, we change some symlink
  * semantics.  See the comments in "open_namei" and "do_link" below.
+ *
+ * [10-Sep-98 Alan Modra] Another symlink change.
  */
 
 static inline char * get_page(void)
@@ -992,20 +994,20 @@
 	struct inode *inode;
 	int error;
 
-	old_dentry = lookup_dentry(oldname, NULL, 1);
-	error = PTR_ERR(old_dentry);
-	if (IS_ERR(old_dentry))
-		goto exit;
-
 	/*
 	 * Hardlinks are often used in delicate situations.  We avoid
 	 * security-related surprises by not following symlinks on the
-	 * newname.  We *do* follow them on the oldname.  This is
-	 * the same as Digital Unix 4.0, for example.
+	 * newname.  --KAB
 	 *
-	 * Solaris 2.5.1 is similar, but for a laugh try linking from
-	 * a dangling symlink.                              --KAB
+	 * We don't follow them on the oldname either to be compatible
+	 * with linux 2.0, and to avoid hard-linking to directories
+	 * and other special files.  --ADM
 	 */
+	old_dentry = lookup_dentry(oldname, NULL, 0);
+	error = PTR_ERR(old_dentry);
+	if (IS_ERR(old_dentry))
+		goto exit;
+
 	new_dentry = lookup_dentry(newname, NULL, 0);
 	error = PTR_ERR(new_dentry);
 	if (IS_ERR(new_dentry))

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