Makefile: - DELETE = rm -f (under Unix) DELETE = del (under OS/2) OS/2 doesn't have 'rm'. There is one included in ftp://ftp.cdrom.com/pub/os2/unix/gnufutil.zip but I figured the solution above works without having to download extra stuff. - [Rask I.L.] Makefile: There was a bug in the installscripts target. It would fail when building with separate source and build directories (which [he] always do[es]) - OS2BIN: OS/2 executables must have .EXE as an extension. But the executables created under Unix shouldn't have these extensions. We could do a: EXE = (under Unix) EXE = .exe (under OS/2) SPROGS = smbd$(EXE) nmbd$(EXE) @$(CC) $(CFLAGS) -o smbd$(EXE) server.o $(SMBDOBJ) $(LIBS) $(AFS_LIBS) etc. etc., but this would require significant changes in the Makefile. (If the Samba team doesn't mind these changes, please let me know). Instead, I decided to use EMX/GCC's -Zexe option: once an executable has been generated, .EXE will be added to its name, and an empty file will be created with the original name (so it won't disrupt the Make proces). However, a drawback of this approach is that when one does a 'make clean' the .EXE files are not deleted. Only the empty ('dummy') files are. That's why I added the $(OS2BIN) parts, it cleans up the remaining executables. It's clumsy, I know. The $(EXE) solution I described above should also work but this has the drawback that when the Samba teams decides to create new executables they would have to update the Makefile with $(EXE)'s. The (severely outdated) Makefile.OS2 shows this is not the way to go. $(OS2BIN) is preferable but has the disadvantage that when a Makefile with new executables comes out these executables will not be deleted. But IMHO, not creating new OS/2 executables is worse than not deleting old OS/2 executables... - Both OS/2 and Amiga require some special paths in the Makefile. I decided to not include these lines in the OS/2 and Amiga sections because these duplicate lines might just confuse people. Instead, I added remarks to OS2.txt and Amiga.txt respectively that one needs to change a couple of lines in the Makefile to get the thing compiled for their operating system. There are some exceptions however, namely for AWK, CC and the OS/2 config file. I changed the name of the latter to smb.cfg to stay within 8.3. That allows Samba to be run from FAT. Another reason is that I used 'smb.cfg' extensively in the instructions for the OS/2 version of Samba on my homepage. - The checkos.sh does not work under OS/2. Or better said, I didn't really feel like fixing this up, for such a trivial thing as checking whether the user has uncommented the lines for his/her operating system. I assume OS/2 programmers have enough intelligence to do this :-) The result: I define CHECKOS by default for the Unix version. People compiling the OS/2 version will have to use the other CHECKOS line. installscripts.sh: - Takes an extra argument, the directory in which the scripts can be found. This allows the scripts to be looked for in the build directory instead of in the source directory. smb.h: - BOOL is already defined as "unsigned long" (same size) in OS2EMX.H client.c: - Added printing of newlines. Under OS/2, all messages seems to be printed after eachother. Doesn't look pretty. Shouldn't hurt Unix versions either. - smbmore.%d: besides being a long filename, I had to change this because of the forward slashes. Normally, EMX translates the Unix style forward slashes in the paths to OS/2's backslashes transparently, but this doesn't work in a couple of locations in the Samba source code. E.g. when filenames/paths are being forwarded to external programs, i.e. the OS/2 shell. Then the Unix style paths do not work. Other examples are in message.c (\\mgXXXXX part) and server.c (/dfree.smb.%d). - sprintf(cmd,"/bin/ls -d -1 %s > %s",p,tmpname); If user has set 'recurse' to off and he/she does 'mput', the directories in this directory should not be mput but skipped! Without the -d -1 it will give an error (under Linux at least). - Jason Rumney used glob() under OS/2 for contructing file lists for mput. But glob() doesn't seem to support recursion (correct me if I am wrong!). I myself shell out and do a DIR /S instead. That seems to work, but it might be a bit slower. But heck, even the Unix versions shell out with find/ls! And how often do you use mput anyway? :-) - dirline: now this is a hack! fooling around with lengths of strings. I just cross my fingers and hope that it works in all cases, including peculiar filenames... - STYPE_DEVICE shows up as "Comm" with NET VIEW under both OS/2 and NT. So IMHO, there's no reason to name it "Device" under Samba. (Never seen seen a shared COM port before, guys? :-) - Added DEBUGLEVEL_commandline, a quick and dirty fix which allows one to specify a debuglevel (-d) as an argument for smbclient. AFAIK, a commandline argument should override the corresponding setting in smb.conf. The original source didn't seem to do that for (at least) the debuglevel. - ERRdiskfull: doesn't seem to be in the SMB/CIFS specs. Is it a Samba specific error code? Anyway, a description for it was missing in the source code (never had a full disk before, guys? :-) so I added one. Howeverrrr.... according to the OS/2 online manual should DOS error 39 be "Device xxx is not ready" (e.g. no COM driver installed). DOS error 112 seems more like it. loadparm.c: - Globals.lm_announce = 2; Globals.lm_interval = 60; What should the default interval for the LAN Manager announcements (=broadcasts!) be? As an OS/2 user, I would like to set it to 60 or so (this is what Warp 4 uses) so that I am not dependent on the Samba sysadmin to set the "lm announce" variable. Yes, there can be lazy sysadmins outthere! :-). The OS/2 user (as any other user) should benefit from new features (like this LM Announce), without having to be knowledgable about these thinges and without having to beg/bother sysadmins... On the other hand, in most networks LM Announcements have no purpose because there just are no OS/2 or LanMan clients. Most sysadmins prefer to avoid broadcasts, so in the end I decided to set lm_announce to 0 by default. As a compromise, I decided to print a warning in the log file (with an upper limit so it won't clutter the log) when an LM Announcement is detected on the network. Hopefully, the Samba sysadmin will notice this and is willing to help out his/her OS/2 users (after all, that's what they are being paid for!) by setting "lm announce" higher... locking: - EMX's [f]stat() seems to be broken (although Eberhard Mattes says it's a feature?). That's why I came up with fix_stat(). EMX returns a different value for st_ino on each call. In some cases, Samba uses [f]stat() to retrieve the inode number st_ino of a file/directory, e.g. to create a unique sharename for a shared file. In these cases we use this 'fix' In the other cases we just use the original [f]stat(). This is a hack. It only works because OS/2 does not support hard links. namedbname.c and namedbsubnet.c: - The added directory_exist() call for "Lock dir not found" should be useful for the other supported platforms as well. namelanman.c: - I decided to make a completely new file for all the LanManager Announcements related routines. The advantage is that if a new version comes out and this patch hasn't been integrated in the main distribution yet, it is much easier to make a new patch for just the LM part. - namelanman.c is more or less based on the name*.* stuff of Mar 1997. This stuff has changed considerably since then, and namelanman.c hasn't kept up with it. May need some work. - remove_lm_servers(): server_type=0 Strangely enough, on shutdown, Warp 4 sends a server_type 0x01 (SV_TYPE_WORKSTATION) announcement here. And its TTL is also not 0... - announce_lm_host(): Samba cannot be a domain controller or do domain logons for OS/2 (yet?), unlike LAN/WarpServer. So we don't announce it in 'server_type' as such. - process_lm_announce(): checking for scope. Dunno if this is really needed (who uses it anyway?), I just left it in. - process_lm_announce(): the part dealing with "finding out about new workgroups": again, I just left it in. namepacket.c: - Had to insert this cast for debug_browse_packet() because with some byte patterns I saw some 'misprints' (e.g. 0xfffffffe) which clearly didn't fit in. nmbd.c: - It's a bit difficult to kill other processes under OS/2 through external programs. The easiest alternative would be to press Ctrl-C or Ctrl-Break. That's why I added the SIGINT handler. reply.c: - I reversed the calling sequence of close_file() and set_filetime() because setting the filetime *after* the file has been closed is a Unix filesystem hack. Which doesn't work under OS/2, and probably not on other machines (Amiga?) either. Marcel Kuiper claims that this fixed a problem he was having under Solaris 2.4, where a transferred file got the current time/date instead of the original time/date. It happened only once in a while (race condition?). (http://lake.anu.edu.au/cgi-bin/mfs/01/digest/1997/97jun/0119.html?14#mfs) Warning: I am not sure if the fnum is still valid for set_filetime() after the file has been closed. So you may need to save the filename in a pstring before closing. On the other hand, the last line of close_file() still uses Files[fnum].name! server.c: - I suggest moving the OS dependent statfs() code from disk_free() to system.c. I already made a start with the OS/2 dependent code for statfs(). - Fixed a bug where long filenames of WPS objects got truncated to 8.3. It turned out that OS/2 does not expect error code 282 ("Extended Attributes not supported") when the remote filesystem supports long filenames but not EAs (such as Samba), but error code 110 ("cannot open file") when it tries to open a crazy file called ".+,;=[].". smbpass.c: - A few OSes don't HAVE_FCNTL_LOCK. While compiling password file support (or at least trying to) I took the liberty of adding some extra #if's. I assume they are also needed for the other OSes (Amiga and Apollo). status.c: - STATUS..LCK does not conform to 8.3. I made #ifdefs so that it results in STATUS.LCK under OS/2. However, I don't see what the point is of using the rather odd filename STATUS..LCK under Unix, so I suggest removing the #ifdefs and using STATUS.LCK under Unix as well. - Some printf() lines have been extended a little bit in order to accomodate the 32 bit width of PIDs under the Amiga. The other platforms (all of them?) use 16 bit PIDs but I didn't want to make #ifndef AMIGA's because this would make a mess out of it... system.c: - fix_stat() 'borrowed' a routine from str_checksum() for "fake" inode numbers. - I implemented an incomplete implementation of statfs() for OS/2 because EMX doesn't have it. Eberhard Mattes said he doesn't need it :-( - fix_stat(): this is a 'fix' for stat() and fstat() for OS/2 because EMX returns a different value for st_ino on each call. In some cases, Samba uses [f]stat() to retrieve the inode number st_ino of a file/directory, e.g. to create a unique sharename for a shared file. In these cases we use this 'fix'. In the other cases we just use the original [f]stat(). This is a hack. It only works because OS/2 does not support hard links. ufc.c: - When compiling under OS/2, I get a warning about ufc_doit() being defined as both static and non-static. Switching ufc_crypt() and ufc_doit() helps. Not included with the patch because it seems to work anyway. clitar.c gives a similar warning with strslashcmp(). uid.c: - Even OS/2 doesn't use the old method (smbrun with extra system() calls). As far as I am concerned, the lp_smbrun() stuff could be deleted completely. No other platform in the current Makefile uses USE_SYSTEM anymore. Perhaps one of the other oddball systems? (MVS, VMS, Stratus) util.c: - tmpdir(): first the user specified temp directory is to be tried. If there is none, try OS/2's environment variable TMP. But if this one also doesn't exist, we cannot just use "/tmp" like under the Unix because /tmp is not guaranteed to exist under OS/2. So, if the user really hasn't got a clue, punish him by dumping all files in the root... :-). - use_getwd_cache() is set by default to True but smb.conf.5 claims it must be False. The latter seems to be correct, because not every supported platform (OS/2 for instance) supports it. Thus, I suggest removing the #ifdef OS2 altogether and use False by default. Also, loadparm.c defines lp_getwdcache() but it does not seem to be used. - fflush(): OS/2 needs it because otherwise it doesn't respond to Y/N. Shouldn't hurt the other versions either, so I suggest removing the #ifdef OS2 around it. - process_exists(): kill(pid,0) in EMX only works for direct child processes (OS/2 limitation). This affects SMBSTAT.EXE for instance. So instead, PSTAT.EXE is used from a REXX script to check if the process exists. This is _much_ slower, of course, but fortunately this is only needed by the Samba utility executables, and not by SMBD.EXE. password.c, smbpasswd.c, util.c: - missing password functions: getpwent(), getpwuid(), setpwent(), endpwent() A lot of functions in the EMX libraries to do with passwd files don't actually do anything. I'm not quite sure what doesn't work because of that limitation, but it seems to me that this is why home directories and non-public directories don't actually work under OS/2. I haven't actually disabled anything. I admit that this limits the usability because it seems to me that you can only have public shares where the only protection will be 'read-only' etc. (Is this correct?). Jacco de Leeuw