Samba Part 6
Now that we have jumped through the flaming NBT hoops, it's time to juggle the SMB chainsaw.
The first thing to note about Server Message Block is that SMB packets use Intel little-endian byte order, while NBT uses big-endian network byte order. No matter how you fiddle with it, if you are going to implement SMB, you are going to have to swap a few bytes.
The Server Message Block is a record structure. The first field always contains the identifying characters '0xFF' 'S' 'M' 'B', just to make it absolutely clear what you are dealing with. The second field is the command. SMB messages are made up of a command, the data associated with the command, and the context in which the command is to execute. The context information allows SMB to keep track of multiple links multiplexed within a single NetBIOS session.
Most of the SMB commands are derived directly from DOS I/O functions. They include basic stuff like OPEN, CLOSE, and DELETE, plus commands for handling print jobs and a few other oddities. Before these can be used, however, a client must gain access to a shared printer or directory (share). However, the SMB protocol has undergone a bit of evolution since it was first introduced, and this has resulted in a number of "dialects." To accommodate the various SMB dialects, there is a NEGOTIATE SMB that lets nodes discuss and agree upon an SMB dialect to use.
Documentation on SMB can be found on Microsoft's FTP servers. Just dig around in ftp://ftp.microsoft.com/developr/drg/cifs/ for a while if you are curious. Start with the older stuff and work your way forward.
Presentation Is Everything
|Figure Three: Servers available on the network.|
|Figure Four: File shares available on the Scred server.|
Now it's time to put a pretty face on all of this. On any Windows desktop, you will likely find an icon labeled "Network Neighborhood." This is the front door to the CIFS (and SMB) world. Double-click the icon and you should see something resembling Figure Three.
The icons in the window represent servers available on the network. (Your network, of course, will have different servers listed.) Double-click a server icon and you should see a list of the shares offered by that server. Figure Four contains such a list.