]> Zhao Yanbai Git Server - minix.git/commitdiff
Directory check before access check.
authorPhilip Homburg <philip@cs.vu.nl>
Wed, 8 Aug 2007 15:26:47 +0000 (15:26 +0000)
committerPhilip Homburg <philip@cs.vu.nl>
Wed, 8 Aug 2007 15:26:47 +0000 (15:26 +0000)
servers/vfs/link.c

index b61bfb217f730e90a99ab172dff2062a9564b951..0e901f4b3e8b05a292556be40bad1e6e595aff26 100644 (file)
@@ -68,6 +68,14 @@ PUBLIC int do_link()
         return EXDEV;
   }
 
+  /* Make sure that the object is a directory */
+  if ((vp_d->v_mode & I_TYPE) != I_DIRECTORY)
+  {
+       put_vnode(vp_o);
+       put_vnode(vp_d);
+       return ENOTDIR;
+  }
+
   r= forbidden(vp_d, W_BIT|X_BIT, 0 /*!use_realuid*/);
   if (r != OK)
   {