pvfs_resolve: "\\" and a trailing "\" need to be reduced
authorStefan Metzmacher <metze@samba.org>
Fri, 29 Feb 2008 08:08:57 +0000 (09:08 +0100)
committerStefan Metzmacher <metze@samba.org>
Fri, 29 Feb 2008 14:17:52 +0000 (15:17 +0100)
metze

source/ntvfs/posix/pvfs_resolve.c

index c129038572208f5351577e8101f86dda7cf433d9..37b182733c1963b51a3e0327804f2884613e13b3 100644 (file)
@@ -265,8 +265,15 @@ static NTSTATUS pvfs_unix_path(struct pvfs_state *pvfs, const char *cifs_name,
                                   of a name */
                                return NT_STATUS_ILLEGAL_CHARACTER;
                        }
-                       if (p > p_start && p[1] == 0) {
-                               *p = 0;
+                       if (p > p_start && (p[1] == '\\' || p[1] == '\0')) {
+                               /* see if it is definately a "\\" or
+                                * a trailing "\". If it is then fail here,
+                                * and let the next layer up try again after
+                                * pvfs_reduce_name() if it wants to. This is
+                                * much more efficient on average than always
+                                * scanning for these separately
+                                */
+                               return NT_STATUS_OBJECT_PATH_SYNTAX_BAD;
                        } else {
                                *p = '/';
                        }