Windows File Sharing

Name: It is commonly called smb (Server message block). In 1998 it was renamed CIFS (Common Internet File System). The UNIX server program is called Samba.

History: Originally called BAF after Barry Feigenbaum. J SMB was started by Microsoft long ago. They added soft links, hard links, larger file sizes during the rename in 1998.

Documents: There are a few documents describing CIFS. You can find the Microsoft agreement you must agree to here. However, see http://www.theregister.co.uk/2002/03/19/why_microsofts_eu_concession/

Shares: A share is a named directory subtree. For example, a server might offer the subtree Windows/Program Files/GCC/doc as the share documents . The client would then request to mount documents . This level of indirection means that servers can move things without affecting the clients. It also adds a bit of complexity.

Names: A Universal Naming Convention name looks like this \\computername\sharename\subdirectoryname\filename.txt

The \\ distinguishes between a normal filename and a remote filename.

The Protocol

Basics

Clients ask questions, and servers only send in response to questions. Opportunistic locks are the main counterexample.

All packets are sent in little endian order, which is the way Intel CPUs work and the opposite of network byte order.

Multiple messages can be merged into the same packet if wanted for performance reasons.

Each server reply contains an error code. There are two error code formats. The NT format is just a bunch of 32 bit error numbers. The older OS/2 format has 2 bits of level and 16 bits of errorcode . The levels are success, information, warning, and error.

Each request and reply contains the fields

Packet Format

See http://ubiqx.org/cifs/SMB.html section 2.4.3

The Exchange of Packets

An SMB client starts the conversation by sending a NEGOTIATE PROTOCOL REQUEST packet to the server. It asks to negotiate various functions (long file names, unicode, etc.) with the server. The reply indicates which features are allowed and a TID for that tree. See http://ubiqx.org/cifs/SMB.html section 2.5.2 and the reply at 2.6.3.1

Then the SMB client sends a SESSION SETUP, offering a username. Very likely a challenge/response happens next

Then the SMB client sends a TREE CONNECT requesting to mount a share.

Then the file request dialog can take place. A list of available commands can be found at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cifs/protocol/royalty-free_cifs_technical_reference_license_agreement.asp.

When a client wants to it can send an OPLOCK request. When an OPLOCK is granted the client may cache reads and writes. The server can refuse or revoke an OPLOCK at any time, including in the middle of client operations. Oplocks come in READ, WRITE, and BATCH mode.

Verification

. A fully featured SMB server should be able to handle

Passwords themselves can be

The server should be able to do

The server should be able to either

Please recall that it also has to be able to answer in two different error code schemes.

Differences between SMB and NFS: