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. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cifs/protocol/royalty-free_cifs_technical_reference_license_agreement.asp. 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.
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
TID Tree ID. A code for the share in question.
UID A code for the user. Need not be the user ID number, but is given by the server when the user verifies.
PID Process ID. Locking is done via PID.
MID Multiplex id. Allows for multiple outstanding requests.
See http://ubiqx.org/cifs/SMB.html section 2.4.3
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.
. A fully featured SMB server should be able to handle
Guest accounts (no passwords)
Plaintext passwords
LanManager challenge response (since broken)
NT challenge response.
NTv2 challenge response.
Kerberos challenge response.
Passwords themselves can be
Forced UPPERCASE.
Mixed case.
Unicode mixed case.
The server should be able to do
User verification
Share verification
The server should be able to either
verify itself
send the request to a Active Directory Controller for verification.
Please recall that it also has to be able to answer in two different error code schemes.
The original SMB didn't use IP for networking, but used NetBIOS. Therefore it could not be routed over the internet.
NFS is defined by an RCF. CIFS is defined by the actions of Microsoft code. CIFS does printing, SMB does not.
User verification is very different.
CIFS uses the windows permission scheme, NFS uses the UNIX one.
CIFS uses passwords, NFS verifies by IP number and trusts clients from allowed IP numbers.
CIFS exports shares and NFS exports directory subtrees.
CIFS can change at Microsoft s whim as long as they maintain backwards compatibility. NFS is more difficult to change, but is now on version 4.
CIFS is case insensitive. NFS cares about case.
CIFS uses TCP or NetBIOS. NFS uses UDP or TCP.
CIFS has locking, NFS has a locking add-on.
CIFS can compress data before sending it.