Don't allow backslash characters in smbfs path requests.
authorSimon Schubert <corecode@dragonflybsd.org>
Tue, 13 Jun 2006 12:31:57 +0000 (12:31 +0000)
committerSimon Schubert <corecode@dragonflybsd.org>
Tue, 13 Jun 2006 12:31:57 +0000 (12:31 +0000)
Submitted-by: Ancient
Taken-from: FreeBSD SA

sys/vfs/smbfs/smbfs_vnops.c

index cd082b7..cdde82e 100644 (file)
@@ -30,7 +30,7 @@
  * SUCH DAMAGE.
  *
  * $FreeBSD: src/sys/fs/smbfs/smbfs_vnops.c,v 1.2.2.8 2003/04/04 08:57:23 tjr Exp $
- * $DragonFly: src/sys/vfs/smbfs/smbfs_vnops.c,v 1.30 2006/05/06 02:43:14 dillon Exp $
+ * $DragonFly: src/sys/vfs/smbfs/smbfs_vnops.c,v 1.31 2006/06/13 12:31:57 corecode Exp $
  */
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -976,11 +976,18 @@ smbfs_advlock(struct vop_advlock_args *ap)
 static int
 smbfs_pathcheck(struct smbmount *smp, const char *name, int nmlen, int nameiop)
 {
-       static const char *badchars = "*/\[]:<>=;?";
+       static const char *badchars = "*/:<>;?";
        static const char *badchars83 = " +|,";
        const char *cp;
        int i, error;
 
+       /*
+        * Backslash characters, being a path delimiter, are prohibited
+        * within a path component even for LOOKUP operations.
+        */
+       if (index(name, '\\') != NULL)
+               return ENOENT;
+
        if (nameiop == NAMEI_LOOKUP)
                return 0;
        error = ENOENT;