Samba/2


Welcome to the webpage dedicated to Samba/2, the OS/2 port of Samba.

Please note: in the following I use the notation Samba/2 wherever I specifically mean the OS/2 version of Samba. Where I just write Samba, I mean any port of Samba, including the OS/2 version. Also, please note that the Samba/2 specific information below overrides the documentation for Samba in general (except where I'm wrong! :-).

New!14-jan-1998: patch for the v1.9.18 series still needs some more work, especially on cleaning up lock files and timestamps.

18-aug-1997: OS/2 patch to get Samba 1.9.17alpha5 compiled under OS/2 (no binaries yet),

20-jul-1997: OS/2 patch to get Samba 1.9.16p11 compiled under OS/2.

This port is largely based on Jason Rumney's work. Since he's now doing other things, I've started working on some issues which were still open. Samba/2 could not have been possible without the work of Eberhard Mattes, the author of EMX. EMX allows you to port Unix applications to OS/2 with relatively little effort. Which is quite a feat, IMHO... Many GNU programs have been ported with EMX. EMX itself uses GNU software extensively: GCC, GAS, GDB, etc. etc.

Samba now!

Back to the "Using Samba with DOS or OS/2" homepage

Back to Jacco's homepage


Index

  1. What is Samba?
  2. Features
  3. Installation
  4. Using Samba/2
  5. Hints and tips on using Samba/2
  6. Known bugs/limitations
  7. Compiling Samba/2
  8. Hint and tips on compiling Samba/2
  9. Using Warp 4 and Warp Connect together with Samba/2
  10. Porting issues
  11. Todo
  12. Author


What is Samba?

This is version 1.9 of Samba, the free SMB client and server for Unix and other operating systems, including now also OS/2. Samba is maintained by the Samba Team, who support the original author and principal maintainer, Andrew Tridgell. See also the Samba homepage, http://www.samba.org

SMB is the protocol by which a lot of PC-related machines share files and printers and other informatiuon such as lists of available files and printers. Operating systems that support this natively include Windows NT, Warp 4, Warp Connect, Linux and add on packages that achieve the same thing are available for DOS, Windows, OS/2 (Microsoft LAN Manager Client), VMS, Unix of all kinds, MVS, and more. There is no reason why Apple Macs and indeed any Web browser should not be able to speak this protocol, and current development (in which the Samba team is heavily involved) is aimed at exactly that. Alternatives to SMB include Netware, NFS, Appletalk, Banyan Vines, Decnet etc; many of these have advantages but none are both public specifications and widely implemented in desktop machines by default.

The Common Internet Filesystem is what the new SMB initiative is called. For details watch http://www.samba.org/cifs/. Microsoft has submitted CIFS to the Internet Task Force. It could well be that Samba/2 is the first OS/2 network software conforming to this standard.

Back to top


Features

Here is a very short list of what Samba includes, and what it does. And all this is free and comes with full source code. But here's what it doesn't do: So, compared with Warp 4 and Connect, Samba/2 isn't as user friendly. But what are its main advantages? I have already had reports about unsuspected uses of Samba/2. For instance, someone is using it as a WINS server and someone else is using it as a server for a CD-"carrousel" because other networking software seems to change the CD when it is not needed. Another application would be using SMBCLNT.EXE for retrieving a whole bunch of files without losing their long file names.

For a much better overview of Samba have a look at the Samba website. By the way, did you know that Microsoft even mentions Samba/2 on their website? :-)

Back to top


Installation

If you are only interested in using Samba/2, and not (re)compiling, adding new features, etc. then read on. If you do have too much time on your hands :-), read the section "Compiling Samba/2" instead.

Shopping list for using Samba/2:

This new version of Samba/2 should work fine from a FAT partition. I haven't tested all options though, so if you encounter a problem with long filenames (see log.smb and log.nmd for error messages, among others) please mail me.

As you can see in the list above, you need some TCP/IP networking software since Samba uses it to run the SMB protocol over it. TCP/IP is built-in in Warp 4 and Connect. If you want to run Samba over a modem (not very likely since there aren't many Internet servers which support SMB yet; CIFS may change that), you can do with the older Warp versions. If you have an older version of OS/2 before Warp Connect, you have to use IBM TCP/IP 2.0 if you want to use Samba with a network card. An alternative to IBM TCP/IP 2.0 is FreeTCP, which costs nothing but has some other disadvantages.

How to install Samba/2:

  1. Unzip the Samba/2 binaries archive file to a directory, say C:\SAMBA.

  2. Unzip the Samba/2 support files to the same directory.

  3. Next, unzip EMXRT.ZIP. It creates the EMX tree itself, so if you want install all EMX stuff in, say, C:\EMX, goto the root of C: and do a UNZIP EMXRT.ZIP.

  4. Install the EMX runtime files per the included instructions in EMXRT.DOC:
  5. I also added the following lines to my CONFIG.SYS:
  6. SET USE_HOSTS_FIRST=1
    SET USER=jacco
    SET LOGNAME=jacco
    SET HOME=C:\USR\JACCO
    SET TZ=CET-1CED,3,-1,0,7200,10,-1,0,10800,3600
    The first line says to use the local HOSTS file first to look up the IP address of a host before consulting a Domain Name Server. In most cases this is useful if the DNS has no knowledge of a host, for instance if it isn't an official host or there is no DNS present on the network (just your own little LAN). See below for more information on working with timezones. The other lines set the default user for SMBCLNT.EXE, the user's home directory, etc. (although OS/2 is of course not a multi-user operating system).

  7. Add a line SET HOSTNAME=myPCname to your CONFIG.SYS if there isn't already one. myPCname is whatever hostname you like for your own machine.

  8. Configure a "localhost" for your machine, so you will be able to test the Samba server with the Samba client on the same machine, i.e. without a real network. Under Warp 4 and Connect (and probably TCP/IP v2.0 too), you do this by starting the "TCP/IP Configuration Notebook", clicking on the "Hostnames" tab, and checking the entry "Localhost". Under FreeTCP, you just add an IFCONFIG LO 127.0.0.1 to your LANSTART.CMD. (These two ways are actually equivalent...)

  9. Execute the following command: ECHO %ETC%

  10. This will show you to which directory the environment variable ETC has been set. In most cases this will be \TCPIP\ETC or \MPTN\ETC. Now edit the file HOSTS in that directory. You need to add an entry for your own PC to the HOSTS file if you want to run or test Samba/2 and you want to access the server from that PC itself through the loopback device. Let's assume in the following that your OS/2 PC has the following IP address: 192.168.0.2. With the HOSTS lines:
    127.0.0.1   localhost
    192.168.0.2 myPCname
    ...you can use the name localhost instead of the loopback IP address 127.0.0.1. The next line contains the IP address of your PC, plus the symbolic name you made up for it. With Warp 4 and Connect it should already be there in the file. Please note: the last line of the HOSTS and RESOLV files need to end with a Carriage Return/Line Feed, otherwise that line will not be recognized!

  11. Samba/2 needs a directory to store some temporary files, e.g. for "lock files". I mostly use the temp directory pointed to by the environment variable TMP. Check in your CONFIG.SYS that it is set to a directory. Normally, it points to a directory C:\TCPIP\TMP or so. Preferably use a directory on a filesystem that supports long filenames, such as HPFS.

  12. Finally, edit the file SMB.CFG. This is the one file that Samba is all about. You may want to postpone editting it to a later time (see "Using Samba/2"). Anyway, SMB.CFG works the same as the Unix versions of Samba, although it is called smb.conf there. I included an example in the Samba/2 support files. I won't explain all the settings there, that has been done already in the general Samba documentation. Please use full paths as much as possible in that SMB.CFG (i.e. specify the paths with drive letter and subdirectories). That's because the current dir could change to another drive during the execution of the Samba/2 server. Also, use the Unix notation with forward slashes as much as possible. So use f:/tmp/samba instead of f:\tmp\samba. With one exception: use the normal OS/2 notation with backward slashes when the path is to be used by an external (OS/2) program. For instance: the configuration options message command, preexec, postexec etc. See the Samba configuration manual for these commands that shell out to the OS/2 command line interpreter.
Back to top

Using Samba/2

  1. It's always a good idea to test the stuff without a real network first. You do this by using the loopback device. Issue the command:
  2. ping 127.0.0.1

     This should result in something like:

    [e:\tcpip\etc]ping 127.0.0.1
    PING 127.0.0.1: 56 data bytes
    64 bytes from 127.0.0.1: icmp_seq=0. time=0. ms
    64 bytes from 127.0.0.1: icmp_seq=1. time=0. ms
    64 bytes from 127.0.0.1: icmp_seq=2. time=0. ms
    ^C
    External process cancelled by a Ctrl+Break or another process
    If you don't get a similar output, recheck your loopback device. Also try pinging your real IP address (in the example above I assumed 192.168.0.2):

    ping 192.168.0.2

    Now to the last check: try pinging the hostname you gave to your machine. In the example above I used myPCname. That name, which you specified in both the HOSTS file and on the SET HOSTNAME= line in your CONFIG.SYS, is a local name for your PC. That means that only TCP/IP applications running on your own PC will be able to use it. If you want other people across the network to be able to use the same name to reach your PC, ask them to add this name plus your IP address to their HOSTS file. Or ask your network administrator to include this name on the Domain Name Server. Now to the final check, at this moment:

    ping myPCname

    If that also works, great.

  3. SMB.CFG should be in the directory SMBD.EXE is started from. The path to SMB.CFG is a compile time option, so if you are compiling from source code you can set this to an absolute path to remove this restriction.

  4. I'll give a couple of hints on how to edit SMB.CFG in the next couple of points in the list. Definitely check the path for the "lock dir". It contains information on locked files. If you don't specify a path, the standard path is used: the directory "locks" in the current directory from which you run the Samba/2 executables. Samba/2 won't work without a valid lock directory. I myself prefer a special "SAMBA" directory in the directory pointed to by the environment variable TMP (see my example SMB.CFG in SMB2_SUP.ZIP).

  5. Set the "debug level". Level 1 gives almost no (error) messages. You might want to set it to 5 or so for the first try.
  6. In the line "server string" you specify the text that Windows and OS/2 get to see when they "browse" (scan the network) your machine. Put something cool there :-)
  7. The default value for the workgroup parameter in SMB.CFG is WORKGROUP. This is also what the English versions of Windows use. Warp 4 and Connect default to IBMPEERS. If you have a network with a lot of Microsoft LAN Manager clients and no NT or LAN Manager servers, you might want to use the workgroup STANDALONE. This allows the clients to start up faster.
  8. Check the line "printcap line" if you want to use Warp's lp printer commands. I have only used printing with the standard PRINT command though, so I don't know much about it.
  9. Don't make things too difficult the first time you want to use Samba/2: create shares with public access (i.e. no password). See the example SMB.CFG in the Samba/2 support files.
  10. Start NMDB.EXE (the nameserver; it will respond to browsing requests from other clients on the network). If it returns to the command prompt immediately or after 10 seconds or so, there's something wrong. In that case, check the file LOG.NMB for any messages. If it runs OK, open a new OS/2 window and start SMBD.EXE, the Samba/2 server. It creates a logfile LOG.SMB. Both NMDB.EXE and SMBD.EXE should run until you hit Ctrl-C.
  11. From yet another OS/2 window, use the Samba client to see if you can get the shares from the Samba server listed:
  12. SMBCLNT.EXE -L myPCname
  13. Now to something even more advanced: set up a connection to a share of the Samba server and copy some files, list them on screen etc.:
  14. SMBCLNT.EXE \\myPCname\fdrive
    If you use a public share, the password you enter should not matter. Once you are in, cd and dir around as you please. It works more or less like OS/2's command line FTP client (FTP.EXE).
  15. Another thing you can try is to send a message ('WinPopUp') with:
  16. SMBCLNT.EXE -M myPCname
    Or you can print to a network printer (if you have a printer share defined in your SMB.CFG with:
    SMBCLNT.EXE \\myPCname\faxprn -P
    and then use the "print" command on the command line.
If all these tests worked: congratulations, you seem to have installed Samba/2!

Back to top


Hints and tips on using Samba/2

Back to top


Known bugs/limitations

So far, I can't really find an outright Samba/2 specific bug for which I am personally accountable (patting my own back :-). However, I haven't tested all of Samba's features since I don't really need them or don't have the big network required for serious testing. There are also some annoying things which need some more work (see "Hints and tips on using Samba/2").

Back to top


Compiling Samba/2

If you are only interested in using Samba/2, and not programming or (re)compiling it, just skip the following part and jump right to the Todo list!

Shopping list for (re)compiling Samba/2:

The procedure:

  1. Read \EMX\DOC\INSTALL.DOC on how to install the EMX development stuff. I won't reiterate what is being said there (sorry, no handholding :-). I'll give one hint though. Here's what my CONFIG.SYS looks like. Adjust the paths and driveletters to your setup. The last two lines make sure that pipes are used instead of temporary files, and that the compiler remains in memory for 5 minutes (see EMX docs). Use these two lines only if you have enough memory.
  2. LIBPATH=F:\OS2APPS\\EMX\DLL; ...etc...
    SET PATH=F:\OS2APPS\EMX\BIN; ...etc...
    SET USE_HOSTS_FIRST=1
    SET USER=jacco
    SET LOGNAME=jacco
    SET HOME=F:\XFree86\USR\JACCO
    SET EMXSHELL=E:\OS2\CMD.EXE
    SET TERMCAP=F:/OS2APPS/EMX/ETC/TERMCAP.X11
    SET TZ=CET-1CED,3,-1,0,7200,10,-1,0,10800,3600
    SET C_INCLUDE_PATH=F:/OS2APPS/EMX/INCLUDE
    SET LIBRARY_PATH=F:/OS2APPS/EMX/LIB
    SET INFOPATH=F:/OS2APPS/EMX/INFO
    SET GCCOPT=-pipe
    SET GCCLOAD=5
  3. Unzip GNU tar, GNU zip, GNU make, GNU diff, GNU patch and GNU awk to an empty directory. Throw away everything but the executables (the source code is not needed): TAR.EXE, GZIP.EXE, GNUMAKE.EXE, DIFF.EXE, PATCH.EXE, GAWK.EXE. Then move these executables to a directory in your path, for example \EMX\BIN. Also rename the GNU Patch executable PATCH.EXE to GNUPATCH.EXE, because OS/2 already comes with a program called PATCH.EXE.
  4. Unarchive the Samba source code:

  5. tar xfvz samba-1.9.16p11.tar.gz
  6. Copy the OS/2 patch to Samba's source directory samba-1.9.16p11\source, go to that directory and apply the OS/2 patch:

  7. gnupatch < os2.pat >& patch.out
    patch.out will contain the messages generated during the patch process. Check that everything "succeeded" and that nothing "failed".
  8. Unzip the Samba/2 support files to source directory.
  9. Note: I edit the C source code with EPM.EXE, and the Makefile with E.EXE. The thing to watch out for is that your editor doesn't convert tabs into spaces. This is especially bad for the Makefile because otherwise GNU make won't be able to parse it. TEDIT.EXE and older (Warp 3) versions of EPM.EXE are a very bad example of this... If you have Warp 3, you might want to download the latest version of EPM from ftp.cdrom.com.
  10. Now edit the Makefile. Search for the keyword OS/2 in the Makefile. Read the comments I wrote there. Most of the OS/2 related configuration options have been put together in one big section. Uncomment the whole section (except for the real comments in English of course!).I just like to have the stuff together in one section because it's easier to comment, uncomment and edit. Unfortunately, it also means there are some duplicate lines. If you edit one line in the Makefile (say, BASEDIR =/usr/local/samba), the line in the OS/2 section will override it. So watch out you don't make a change and then wonder why nothing happened...
  11. If you have added new function calls to the source code, do a MAKE PROTO to generate a new prototype file PROTO.H
  12. Encrypted passwords are now supported by Samba/2 but password files not (yet?). This means effectively that only SMBCLNT.EXE can use encrypted passwords and not SMBD.EXE. Anyway, for encrypted passwords you need to download libdes, the DES encryption library. I used version 4.01. Untar the file, e.g. with:

  13. tar xfvz libdes-4.01.tar.gz
    There are also some minor changes needed in the libdes Makefile. After compilation you need to rename the resulting file LIBDES.A to DES.A before OS/2+EMX will be able to use it (I don't know why). Working on this! Mail me if you want them! Uncomment the 4 DES lines in the Samba Makefile (DES_BASE, DES_FLAGS, DES_LIB and PASSWD_FLAGS). If you had installed libdes into \USR\LOCAL\LIBDES you don't have to change the path in the DES_BASE line.
  14. Now you can execute MAKE and the executables will be built.
  15. Unlike the normal Unix instructions, do not use MAKE INSTALL or MAKE INSTALLBIN etc. to install the executables to their final destination. These haven't been tested. They might work with alternative shells, such as KSH.
Back to top


Hints and tips compiling Samba/2

Back to top

Using Warp 4 and Warp Connect together with Samba/2

You can't run the Samba/2 server (SMBD.EXE and NMBD.EXE) on Warp 4 or Connect if you have installed the "NetBIOS over TCP/IP" protocol using MPTS.EXE. That's because both want to listen to the NetBIOS ports for incoming connections (137/138/139). So either: There are no problems when you use the Samba/2 client SMBCLNT.EXE in an OS/2 window to access other machines. Of course, Warp's support is much more comfortable (drive letters, etc.) so you'll probably prefer it over SMBCLNT.EXE. One exception would probably be if you want to access a Windows 95 machine and copy files with long filenames.

Back to top


Porting issues

Back to top


Todo

Back to top

Back to "Using Samba with DOS or OS/2"

Back to Jacco's homepage