s3: Differentiate between posix files with colons and actual streams
authorTim Prouty <tprouty@samba.org>
Sat, 3 Jan 2009 01:35:04 +0000 (17:35 -0800)
committerTim Prouty <tprouty@samba.org>
Mon, 12 Jan 2009 06:13:37 +0000 (22:13 -0800)
commit9872dbf439e94ffd56019f789145c4b5eb3e606c
treeb5de67773f14260296b3f71f379f07879f2a8e27
parenta1e428914b9bc468d99775607781ff15169defa4
s3: Differentiate between posix files with colons and actual streams

It is possible for a posix file created locally or over nfs to have a
":" in the name.  Since ":" is a reserved character in windows,
filenames containing a colon must be mangled in a directory listing.
Right now files containing colons will not even be displayed in
directory listings if streams modules are in use.  During the
directory listing the file will be detected as a stream because of the
colon, but the streams module will fail to find the stream since it
doesn't exist.  This fix adds a step to is_ntfs_stream_name that stats
the filename to differentiate between actual streams and files
containing colons.

While this is an improvement, it isn't perfect. Consider the case
where there is a file on disk called "a.txt:s1" and also a file called
"a.txt" that has a stream called "s1".  This patch will always
preference "a.txt:s1" over a.txt's s1 stream.

The real issue is that at the vfs level, the vfs modules have no way
to tell between a demangled name with a colon and an actual stream.  A
more invasive, but better, long-term fix would be to add all paths
that come over the wire into a struct containing metadata about the
path.  This metadata could include a flag to indicate whether the path
came over the wire with a colon ":" (guaranteeing that the client is
requesting a stream). Passing this struct down to the lower levels,
including all path-based vfs calls, would allow the above case to be
handled correctly in all cases.
source3/smbd/nttrans.c