May 8, 2000
The Samba Team have been developing an implementation of an SMB server
for many years. Recently we have reached the stage where we are looking to
fill in some of the darker recesses of the implementation - implementing not
just a “good enough” emulation of the SMB protocol but instead aiming for
as close to a perfect emulation of the file sharing semantics of a NT server
as is possible within a Unix environment. The problem is in working out
exactly what those semantics are.
This paper describes three challenges along these lines and how we met
them by building tools to analyze the exact behavior of an NT server. The
tools provide a way of exactly determining the semantics of share modes,
wildcard matching and byte range locks. These three critical but complex
areas of file sharing semantics have been rather mysterious and poorly de-
scribed in the available documentation, and are thus excellent candidates
for automatic analysis.
Note that this paper only gives a high level overview of these tools and
the resulting analysis. For a complete analysis you will need to run the tools
themselves, which are freely available in the Samba CVS tree.
2 Wildcard Matching
The first area I will consider is wildcard matching. There has scarcely been a
release of Samba where we have not made some adjustment to the wildcard
matching code as we discover new and ever more esoteric features of the
wildcard matching algorithms that NT uses.
You might wonder why we bother with the fine details of these algorithm-
s. The reason is that application developers become unconsciously reliant
on the exact wildcard matching semantics of NT - their applications tend
to be tested against NT servers and often fail when a SMB server deviates
even slightly from the wildcard matching rules that NT implements. As we
want these applications to run perfectly on a Samba server we must copy
the exact semantics of NT.
Wildcard matching in the SMB protocol is quite strange indeed. A MS-