diff -u -r --new-file --exclude=CVS source/Makefile newsource/Makefile --- source/Makefile Thu Jul 24 18:50:18 1997 +++ newsource/Makefile Sun Aug 24 19:21:00 1997 @@ -40,6 +40,11 @@ # This may help with some versions of make SHELL = /bin/sh +# These are used by operating systems other than OS/2. +DELETE = rm -f +CHECKOS = $(SHELL) $(srcdir)checkos.sh $(FLAGSM) +OS2BIN = + # The following can be useful for compiling on multiple architectures # just uncommment them putting the right directory in. # srcdir=./ @@ -546,10 +551,18 @@ # LIBSM = -lsocket -lnsl -# This is for OS/2 using EMX 0.9b -# Contributed by jasonr@pec.co.nz (Jason Rumney) -# FLAGSM = -DOS2 -# LIBSM = -Zexe -lsocket +# This is for OS/2 using EMX 0.9c. +# Contributed by Jacco de Leeuw , Andreas Degert +# and Jason Rumney +# FLAGSM = -DOS2 -DUFC_CRYPT +# LIBSM = -Zexe -Zbin-files -Zcrtdll -lsocket +# CC = gcc +# CONFIGFILE = $(LIBDIR)/smb.cfg +# AWK=gawk +# SHELL = cmd.exe +# DELETE = del +# CHECKOS = +# OS2BIN = nmbd.exe nmblook.exe smbclnt.exe smbd.exe smbpass.exe smbrun.exe smbstat.exe testparm.exe testprns.exe smbclient.exe smbstatus.exe nmblookup.exe smbpasswd.exe # This is for LYNX 2.3.0 (gcc v2.6) @@ -576,8 +589,8 @@ # LIBSM = -linet -# This for Amiga using GCC and ixemul.library 43.0 or later. -# contributed by Rask Ingemann Lambertsen +# This is for Amiga using GCC and ixemul.library 43.0 or later. +# Contributed by Rask Ingemann Lambertsen # The binaries will support both AmiTCP and AS225R2 compatible # protocol stacks because of the use of ixnet.library. # Other protocol stacks will be supported automatically if @@ -587,6 +600,13 @@ # FLAGSM = -DAMIGA -Dfork=vfork -mstackextend # LIBSM = +# This is for Amiga using GCC and ixemul.library 46.0+ or so. +# contributed by Rask Ingemann Lambertsen +# The difference with the above is that it uses mmap(). To get +# Samba to actually take advantage of mmap(), put "read raw = no" +# and "read prediction = no" into smb.conf. +# FLAGSM = -DAMIGA -Dfork=vfork -mstackextend -DUSE_MMAP +# LIBSM = ###################################################################### @@ -609,7 +629,7 @@ all : CHECK $(SPROGS) $(PROGS) CHECK : - @$(SHELL) $(srcdir)checkos.sh $(FLAGSM) + @$(CHECKOS) @echo "Using CFLAGS = $(CFLAGS)" @echo "Using LIBS = $(LIBS)" @@ -626,7 +646,7 @@ SMBDOBJ = predict.o $(SMBDOBJ1) $(SMBDOBJ2) $(VTP_OBJ) NMBDOBJ1 = nmblib.o namepacket.o nameresp.o nmbsync.o nameannounce.o nameelect.o NMBDOBJ2 = namedbresp.o namedbwork.o namedbserver.o namedbsubnet.o namedbname.o -NMBDOBJ3 = nameservresp.o nameservreply.o namelogon.o namebrowse.o namework.o nameserv.o clientutil.o +NMBDOBJ3 = nameservresp.o nameservreply.o namelogon.o namebrowse.o namework.o nameserv.o clientutil.o namelanman.o NMBDOBJ = $(UTILOBJ) $(NMBDOBJ1) $(NMBDOBJ2) $(NMBDOBJ3) .SUFFIXES: .SUFFIXES: .c .o .h @@ -678,7 +698,7 @@ @$(SHELL) $(srcdir)installbin.sh $(INSTALLPERMS) $(BASEDIR) $(BINDIR) $(LIBDIR) $(VARDIR) $(PROGS) installscripts: - @$(SHELL) $(srcdir)installscripts.sh $(INSTALLPERMS) $(BINDIR) $(SCRIPTS) + @$(SHELL) $(srcdir)installscripts.sh $(INSTALLPERMS) $(BINDIR) "$(srcdir)" $(SCRIPTS) # revert to the previously installed version revert: @@ -701,13 +721,13 @@ @$(SHELL) $(srcdir)uninstallscripts.sh $(INSTALLPERMS) $(BINDIR) $(SCRIPTS) clean: - rm -f core *.o *~ $(PROGS) $(SPROGS) + $(DELETE) core *.o *~ $(PROGS) $(SPROGS) $(OS2BIN) cleandir: clean - rm -f .depend tags + $(DELETE) .depend tags proto: - @$(SHELL) $(srcdir)checkos.sh $(FLAGSM) + @$(CHECKOS) $(AWK) -f mkproto.awk *.c > proto.h realclean: clean diff -u -r --new-file --exclude=CVS source/Makefile.OS2 newsource/Makefile.OS2 --- source/Makefile.OS2 Sat May 4 07:50:44 1996 +++ newsource/Makefile.OS2 Thu Jan 1 00:00:00 1970 @@ -1,535 +0,0 @@ -########################################################################### -# Makefile for Samba SMB client/server for unix -# Copyright Andrew Tridgell 1992,1993,1994 -########################################################################### - -# The base manpages directory to put the man pages in -# Note: $(MANDIR)/man1, $(MANDIR)/man5 and $(MANDIR)/man8 must exist. -MANDIR = /usr/local/man - -# The directories to put things in. If you use multiple -# architectures or share the samba binaries across NFS then -# you will probably want to change this layout. -BASEDIR = . -BINDIR = $(BASEDIR) -LIBDIR = $(BASEDIR) -VARDIR = $(BASEDIR) - -# WARNING: If you are upgrading, make sure you put all the files -# in the right spot! The default positions have changed! - - -# The permissions to give the executables -INSTALLPERMS = 0755 - -# Add any optimisation or debugging flags here -# add -DSYSLOG for syslog support -FLAGS1 = -O -LIBS1 = - -# You will need to use a ANSI C compiler. This means under SunOS 4 you can't -# use cc, instead you will have to use gcc. -CC = gcc - -# This may help with some versions of make -# SHELL = /bin/sh - -# The following can be useful for compiling on multiple architectures -srcdir=. -VPATH=$(srcdir) - -# set these to where to find various files -# These can be overridden by command line switches (see smbd(8)) -# or in smb.conf (see smb.conf(5)) -SMBLOGFILE = $(VARDIR)/log.smb -NMBLOGFILE = $(VARDIR)/log.nmb -CONFIGFILE = $(LIBDIR)/smb.cfg -LMHOSTSFILE = $(LIBDIR)/lmhosts - -# the directory where lock files go -LOCKDIR = /tmp/samba - -# set this to the default group you want your machine to appear in -# for browsing. This can also be set in nmbd (see nmbd(8)) -# NOTE: If you set it to * then nmbd will try to find a workgroup on -# the local net -WORKGROUP = WORKGROUP - -# set this to the name of the default account, which is the one -# to use when no username or password is specified. This can be overridden -# in the runtime configuration file (see smb.conf(5)) -# NOTE: The account "nobody" may not be a good one as -# on many unixes it may not be able to print. Thus you -# might have to create a separate guest account that can print. -GUESTACCOUNT = nobody - -# where you are going to have the smbrun binary. This defaults to the -# install directory. This binary is needed for correct printing -# and magic script execution. This should be an absolute path! -# Also not that this should include the name "smbrun" on the end (the -# name of the executable) -SMBRUN = $(BINDIR)/smbrun.exe - -# This is for AFS authentication. If you use AFS then set AFS_BASE -# according to your system layout, and uncomment the other lines as well. -# AFS_BASE = /usr/afsws -# AFS_FLAGS = -DAFS_AUTH -I$(AFS_BASE)/include -# AFS_LIBDIR = $(AFS_BASE)/lib -# NOTE: You may need to add -laudit in the line below -# AFS_LIBS = -L$(AFS_LIBDIR) -L$(AFS_LIBDIR)/afs -lkauth -lprot -lubik \ -# -lauth -lrxkad -lsys -ldes -lrx -llwp -lcom_err \ -# $(AFS_LIBDIR)/afs/util.a - -# This is for DCE/DFS enablement. Uncomment this so that smbd can -# operate as an authenticated user identity to operate on files that -# live in the DCE Distributed Filesystem. -# DCE_BASE = /opt/dcelocal -# DCE_FLAGS = -I$(DCE_BASE)/include -# DCE_LIBDIR = -L$(DCE_BASE)/lib -# DCE_LIBS = - -# This is for SMB encrypted (lanman) passwords. -# you may wish to add -DREPLACE_GETPASS if your getpass() is limited -# to 8 chars -# DES_BASE=/usr/local/libdes -# DES_FLAGS= -I$(DES_BASE) -# DES_LIB= -L$(DES_BASE) -ldes -# PASSWD_FLAGS=-DSMB_PASSWD=\"$(BINDIR)/smbpasswd\" -DSMB_PASSWD_FILE=\"$(BASEDIR)/private/smbpasswd\" - -###################################### -# VTP-Support -# -# uncomment the following two lines to enable VTP-Support -#VTP_FLAGS = -DWITH_VTP -#VTP_OBJ = vt_mode.o -###################################### - - -##################################### -# WHICH OPERATING SYSTEM? -# UNCOMMENT ONE OF THE SECTIONS BELOW -# MAKE SURE ONLY *ONE* IS UNCOMMENTED -# -# The following are additional flags that may apply -# -DNETGROUP if your machine supports yp netgroups -# -DSHADOW_PWD if you are using shadow passwords -# -DGETPWANAM if you wish to use getpwanam() call -# -DPWDAUTH if you have and want to use the pwdauth() call -# -DUFC_CRYPT if you want the fast crypt routine -# -DALLOW_CHANGE_PASSWORD if you want users to be able to set their password -# remotely (only works on some systems) -# -DQUOTAS for quota support in disk_free(). This probably only works -# on some systems. -# -# NOTE: GETPWANAM & PWDAUTH are mutually exclusive, if you -# Define one, you should NOT define the other. -##################################### - -##################################### -# for the JAPANESE EXTENSION -# select filename's code set for KANJI/KANA in UNIX, -# apply the following flag -# -DKANJI=\"\" -# is select character code set for JAPAN. -# sjis: if your machine support SJIS -# euc: if your machine support EUC -# jis7: if your machine support JIS7 -# jis8: if your machine support JIS8 -# junet: if your machine support jis7 + junet rule -# hex: if your machine only support 7 bits ascii filename only -# convert to hexdecimal code preseeding ':'. -# see also README.jis -###################################### - - -# This is for SUNOS 4. Use the SUNOS5 entry for Solaris 2. -# Note that you cannot use Suns "cc" compiler -# as it's not an Ansi-C compiler. Get gcc or acc. -# Note that if you have adjunct passwords you may need the GETPWANAM -# or PWDAUTH option. There have been reports that using PWDAUTH may crash -# your pwdauthd server so GETPWANAM is preferable (and probably faster) -# contributed by Andrew.Tridgell@anu.edu.au -# FLAGSM = -DSUNOS4 -# LIBSM = - - -# Use this for Linux with shadow passwords -# contributed by Andrew.Tridgell@anu.edu.au -# add -DLINUX_BIGCRYPT is you have shadow passwords but don't have the -# right libraries and includes -# FLAGSM = -DLINUX -DSHADOW_PWD -# LIBSM = -lshadow - -# Use this for Linux without shadow passwords -# contributed by Andrew.Tridgell@anu.edu.au -# FLAGSM = -DLINUX -# LIBSM = - - -# This is for SUNOS5 (also known as Solaris 2) -# contributed by Andrew.Tridgell@anu.edu.au -# FLAGSM = -DSUNOS5 -DSHADOW_PWD -DNETGROUP -# LIBSM = -lsocket -lnsl - - -# This is for SVR4 -# Contributed by mark@scot1.ucsalf.ac.uk -# FLAGSM = -DSVR4 -DSHADOW_PWD -DALLOW_CHANGE_PASSWORD -# LIBSM = -lsocket -lnsl -lc -L/usr/ucblib -lucb - - -# This is for the Motorola 88xxx/9xx range of machines -# Contributed by RPE@monnet.com -# FLAGSM = -DSVR4 -DSHADOW_PWD -DGETTIMEOFDAY1 -# LIBSM = -lsocket -lnsl -lc -L/usr/ucblib -lucb - - -# This is for UNIXWARE -# FLAGSM = -Xa -DSVR4 -DSHADOW_PWD -# LIBSM = -lsocket -lnsl -lc -L/usr/ucblib -lucb - - -# This is for ULTRIX. Add -DULTRIX_AUTH for Ultrix enhanced security. -# contributed by iversen@dsfys1.fi.uib.no -# FLAGSM = -DULTRIX -# LIBSM = - - -# This is for OSF1 (Alpha) -# contributed by errath@balu.kfunigraz.ac.at -# NOTE: You may need -warning_unresolved if you get unresolved symbols -# FLAGSM = -DOSF1 -# LIBSM = - -# This is for OSF1 with DCE/DFS -# contributed by Jim Doyle -# FLAGSM = -DOSF1 -DDFS_AUTH -DSIGCLD_IGNORE -DNO_SIGNAL_TEST -# LIBSM = -ldce -lpthreads -lmach -lc_r - -# This is for OSF1 (Alpha) with NIS and Fast Crypt -# contributed by David Gardiner -# FLAGSM = -DOSF1 -DNETGROUP -DUFC_CRYPT -# LIBSM = - - -# This is for OSF1 (Alpha) V2.0 Enhanced Security -# contributed by Udo Linauer -# FLAGSM = -DOSF1 -DOSF1_ENH_SEC -# LIBSM = -lsecurity - - -# This is for AIX -# contributed by tomc@osi.curtin.edu.au -# FLAGSM = -DAIX -# LIBSM = - -# This is for AIX 3.2.5 with DCE/DFS -# contributed by Jim Doyle -# FLAGSM = -DAIX -DDFS_AUTH -DSIGCLD_IGNORE -DNO_SIGNAL_TEST -# LIBSM = -lc_r -ldce -lpthreads -# CC = cc_r - -# This is for BSDI -# contributed by tomh@metrics.com -# versions of BSDI prior to 2.0 may need to add -DUSE_F_FSIZE for -# disk usage stats to be correct -# FLAGSM = -DBSDI -# LIBSM = - - -# This is for NetBSD. Add -DNETBSD_1_0 if you are using 1.0 -# contributed by noses@oink.rhein.de -# FLAGSM = -DNETBSD -DSHADOW_PWD -# LIBSM = -lcrypt - - -# This is for SEQUENT. -# Contributed by fwk@ix.netcom.com (Frank Keeney) and -# rpwillia@Pentagon-EMH6.army.mil (Ray Williams) -# tested on DYNIX/ptx(R) V2.1.0 -# FLAGSM = -DSEQUENT -DSHADOW_PWD -DHAVE_TIMEZONE -# LIBSM = -lrpc -lsocket -lPW -linet -lnsl -lseq -lsec - - -# This is for HP-UX. Note that some systems don't like the -Aa switch. -# contributed by Pasi.Kaara@atk.tpo.fi -# FLAGSM = -DHPUX -Aa -D_HPUX_SOURCE -D_POSIX_SOURCE -# LIBSM = - -# This is for HP-UX with DCE/DFS -# contributed by Jim Doyle -# FLAGSM = -DHPUX -Aa -D_HPUX_SOURCE -D_POSIX_SOURCE -DDFS_AUTH -D_REENTRANT -I/usr/include/reentrant -# LIBSM = -ldce -lM -lc_r - - -# This is for SGI. -# contributed by lpc@solomon.technet.sg (Michael Chua) -# FOR SGI IRIX 4.x.x, use the following line -# FLAGSM = -DSGI -DHAVE_TIMEZONE -# LIBSM = -lsun - -# FOR SGI IRIX 5.x.x, use this line instead -# FLAGSM = -DSGI5 -DSHADOW_PWD -DHAVE_TIMEZONE -# LIBSM = - - -# This is for FreeBSD -# contributed by kuku@acds.physik.rwth-aachen.de -# NOTE: You may need to add -DBSD44 if you have password problems -# FLAGSM = -DFreeBSD -# LIBSM = -lcrypt - - -# This is for NEXTSTEP Release 2.X -# No Posix. -# contributed by brad@cac.washington.edu (Brad Greer) -# FLAGSM = -DNEXT2 -# LIBSM = - -# This is for NEXTSTEP Release 3.0 and greater (including OPENSTEP for Mach). -# contributed by brad@cac.washington.edu (Brad Greer) -# additional configuration by pmarcos@next.com (Paul Marcos) -# For compiling n-way fat executables, you should append the appropriat -arch -# flags to the FLAGSM variable. Valid flags are: -# -arch m68k -# -arch i386 -# -arch hppa -# -arch sparc -# To compile 4-way fat, you would append -# -arch m68k -arch i386 -arch hppa -arch sparc -# FLAGSM = -DNEXT3_0 -# LIBSM = - - -# NOTE: ISC is also known as "INTERACTIVE" -# This is for Sunsoft ISC SVR3V4 running in POSIX mode -# contributed by pim@cti-software.nl (Pim Zandbergen) -# FLAGSM = -posix -D_SYSV3 -DISC -DSHADOW_PWD -# LIBSM = -lsec -lcrypt -linet - -# This is for Sunsoft ISC SVR3V4 running in iBCS2 mode -# contributed by pim@cti-software.nl (Pim Zandbergen) -# FLAGSM = -D_POSIX_SOURCE -D_XOPEN_SOURCE -D_SYSV3\ -# -DISC -DSHADOW_PWD -DREPLACE_GETWD -DREPLACE_RENAME -# LIBSM = -lsec -lcrypt -linet -lcposix - - -# This is for A/UX 3.0 -# Contributed by root@dolphin.csudh.edu (Jon S. Stevens) -# FLAGSM = -DAUX -# LIBSM = - -# This is for Altos Series 386/1000 -# Contributed by cal@zls.com -# FLAGSM = -DALTOS -DHAS_RDCHK -# LIBSM = -lsocket -lxenix - - -#Note: The SCO entries require the libcrypt library. You can get it via -#anonymous ftp from ftp.sco.com:/SLS/lng225b.* or ftp.uu.net:/vendors/sco -# -# Use this for SCO with shadow passwords. Tested on "Open enterprise 3.0" -# SCO changes from Heinz Mauelshagen (mauelsha@ez.da.telekom.de) -# FLAGSM = -DSCO -DSHADOW_PWD -DNETGROUP -# LIBSM = -lyp -lrpc -lyp -lsec -lsocket -lcrypt_i -lintl - -# Use this for SCO with shadow passwords, without YP. -# Tested on "Open Enterprise Server 3.0" (John Owens john@micros.com) -# Also, use "CC = cc" above. -# FLAGSM = -DSCO -DSHADOW_PWD -# LIBSM = -lsec -lsocket -lcrypt_i - -# Use this for SCO with TCB passwords (default). -# Tested on "Open enterprise 3.0". Contributed by lance@fox.com. -# CC = cc -# FLAGSM = -DSCO -DSecureWare -# LIBSM = -lprot_s -lcrypt -lsocket -lm -lc_s - -# Use this for SCO Unix 3.2v2 (ODT 1.1) with TCB passwords (default). -# Contributed by Stephen.Rothwell@pd.necisa.oz.au -# N.B. this needs gcc -# FLAGSM = -DSCO -DSecureWare -DSCO3_2_2 -# LIBSM = -lprot -lcrypt_i -lsocket -lm -lintl - -# This is for the european distribution of SCO. -# Contributed by Urmet.Janes@gwhite.goodwin.ee -# FLAGSM = -DSCO -DSHADOW_PWD -# LIBSM = -lsec -lsocket /usr/lib/libcrypt_i.a -lintl - -# Use this for SCO OpenServer 5 with TCB passwords (default). -# contributed by Scott Michel -# CC = cc -Xc -# FLAGSM = -DSCO -DSecureWare -DEVEREST -DUSE_MMAP -# LIBSM = -lprot -lcurses -lcrypt -lsocket -lPW -lm -lx -lc_s -lc - - -# This is for intergraph. -# contributed by cjkiick@flinx.b11.ingr.com -# modified by ttj@sknsws61.sjo.statkart.no -# FLAGSM = -DCLIX -D_INGR_EXTENSIONS=1 -# LIBSM = -lbsd -lc_s - -# This is for DGUX. -# Contributed by ross@augie.insci.com (Ross Andrus) -# FLAGSM = -DDGUX -# LIBSM = - -# This is for Apollo Domain/OS sr10.3 (systype = BSD4.3) -# Added 1994-07-08 Stephen C. Steel -# additional patches by jmi@csd.cri.dk (John Mills) -# you may need the "-A ansi" switch to cc -# FLAGSM = -DAPOLLO -D_INCLUDE_BSD_SOURCE -D_INCLUDE_XOPEN_SOURCE -# LIBSM = - - -# RiscIX. -# contributed by Jim Barry and -# Charles Gay-Jones -# FLAGSM = -DRiscIX -DNOSTRDUP -# LIBSM = - - -# This is for System V with some berkely extensions (Motorola 88k R32V3.2). -# contributed by tonyb@plaza.ds.adp.com (Tony D. Birnseth) -# FLAGSM = -DM88K_R3 -# LIBSM = -lgen -lbsd -lnsl - - -# This is for DNIX. -# contributed by Peter Olsson -# NOTE: You may need an updated libc.a from your vendor as older -# versions have broken mktime calls and no initgroups() call -# NOTE2: You may need -lpasswd if you use shadow passwords -# NOTE3: Please read the file DNIX.txt in the docs directory. It -# contains important information about uid handling under DNIX, you may -# need to patch your C library. -# FLAGSM = -DDNIX -I/usr/include/bsd -# LIBSM = -ln - - -# This is for Cray, Unicos 8.0 -# contributed by velo@sesun3.epfl.ch (Martin Ouwehand) -# FLAGSM = -DCRAY -U__STDC__ -DQUOTAS -# LIBSM = - -# This is for Convex -# contributed by Victor Balashov -# and Ulrich Hahn -# FLAGSM= -DCONVEX -DSHADOW_PWD -# LIBSM= - -# This is for SMP_DC.OSx v1.1-94c079 on Pyramid S series -# contributed by jeffrey@itm.org -# FLAGSM = -DSOLARIS -DSHADOW_PWD -DBSD_COMP -# LIBSM = -lsocket -lnsl - -# This is for QNX 4.22 -# Contributed by eldo@invisa.satlink.net (Eldo Loguzzo) -# FLAGSM = -DQNX -DGUEST_SESSSETUP=1 -# LIBSM = - - -# This is for SONY NEWS, NEWS-OS 4.2.x -# contributed by sky@sm.sony.co.jp (Katushi Sato) -# FLAGSM = -DNEWS42 -DKANJI=\"sjis\" -# LIBSM = - -# This is for OS/2 using EMX 0.9b -# Contributed by jasonr@pec.co.nz (Jason Rumney) -FLAGSM = -DOS2 -LIBSM = -Zexe -Zbin-files -lsocket - - -###################################################################### -# DON'T EDIT BELOW THIS LINE -###################################################################### - -CFLAGS1 = $(FLAGS1) -DSMBLOGFILE=\"$(SMBLOGFILE)\" -DNMBLOGFILE=\"$(NMBLOGFILE)\" -CFLAGS2 = -DCONFIGFILE=\"$(CONFIGFILE)\" -DLMHOSTSFILE=\"$(LMHOSTSFILE)\" -CFLAGS3 = -DLOCKDIR=\"$(LOCKDIR)\" -DSMBRUN=\"$(SMBRUN)\" -CFLAGS4 = -DWORKGROUP=\"$(WORKGROUP)\" -DGUEST_ACCOUNT=\"$(GUESTACCOUNT)\" -CFLAGS5 = $(CFLAGS1) $(CFLAGS2) $(CFLAGS3) $(CFLAGS4) $(FLAGSM) $(AFS_FLAGS) -CFLAGS = $(CFLAGS5) $(DCE_FLAGS) $(DES_FLAGS) $(PASSWD_FLAGS) $(VTP_FLAGS) -LIBS = $(LIBS1) $(LIBSM) $(DCE_LIBS) $(DES_LIB) - -PROGS1 = smbd smbclnt nmbd testparm testprns smbrun smbstat smbpass -PROGS = $(PROGS1) nmblook -SCRIPTS = smbtar addtosmbpass - -all : $(PROGS) - -#CHECK : -# @$(SHELL) $(srcdir)/checkos.sh $(FLAGSM) -# @echo "Using CFLAGS = $(CFLAGS)" -# @echo "Using LIBS = $(LIBS)" - -INCLUDES1 = version.h local.h includes.h smb.h loadparm.h params.h smbpass.h -INCLUDES2 = pcap.h trans2.h reply.h -INCLUDES = $(INCLUDES1) $(INCLUDES2) - -UTILOBJ1 = util.o system.o charset.o kanji.o fault.o smbencrypt.o charcnv.o -UTILOBJ = $(UTILOBJ1) md4.o loadparm.o params.o pcap.o username.o -PARAMOBJ = $(UTILOBJ) ufc.o smbpass.o access.o -SMBDOBJ1 = $(PARAMOBJ) trans2.o message.o dir.o printing.o locking.o -SMBDOBJ2 = ipc.o reply.o mangle.o chgpasswd.o password.o -SMBDOBJ = $(SMBDOBJ1) $(SMBDOBJ2) $(VTP_OBJ) - -.SUFFIXES: -.SUFFIXES: .c .o .h - -.c.o: $(INCLUDES) - @echo Compiling $*.c - @$(CC) $(CFLAGS) -c $(srcdir)/$*.c - -smbd: server.o $(SMBDOBJ) - @echo Linking smbd - @$(CC) $(CFLAGS) -o smbd server.o $(SMBDOBJ) $(LIBS) $(AFS_LIBS) - -smbrun: smbrun.o - @echo Linking smbrun - @$(CC) $(CFLAGS) -o smbrun smbrun.o $(LIBS) - -nmblook: nmblookup.o nmblib.o $(UTILOBJ) - @echo Linking nmblookup - @$(CC) $(CFLAGS) -o nmblook nmblookup.o nmblib.o $(UTILOBJ) $(LIBS) - -nmbd: nameserv.o nmblib.o nmbsync.o $(PARAMOBJ) - @echo Linking nmbd - @$(CC) $(CFLAGS) -o nmbd nameserv.o nmblib.o nmbsync.o $(PARAMOBJ) $(LIBS) - -smbclnt: client.o clitar.o getsmbpass.o $(UTILOBJ) - @echo Linking smbclient - @$(CC) $(CFLAGS) -o smbclnt client.o clitar.o getsmbpass.o $(UTILOBJ) $(LIBS) - -smbstat: status.o $(PARAMOBJ) - @echo Linking smbstatus - @$(CC) $(CFLAGS) -o smbstat status.o $(PARAMOBJ) $(LIBS) - -testparm: testparm.o $(PARAMOBJ) - @echo Linking testparm - @$(CC) $(CFLAGS) -o testparm testparm.o $(PARAMOBJ) $(LIBS) - -testprns: testprns.o $(PARAMOBJ) - @echo Linking testprns - @$(CC) $(CFLAGS) -o testprns testprns.o $(PARAMOBJ) $(LIBS) - -smbpass: smbpasswd.o getsmbpass.o $(PARAMOBJ) - @echo Linking smbpasswd - @$(CC) $(CFLAGS) -o smbpass smbpasswd.o getsmbpass.o $(PARAMOBJ) $(LIBS) - -install: installbin installman - -installbin: all - @$(SHELL) $(srcdir)/installbin.sh $(INSTALLPERMS) $(BASEDIR) $(BINDIR) $(LIBDIR) $(VARDIR) $(PROGS) $(SCRIPTS) - -# revert to the previously installed version -revert: - @$(SHELL) $(srcdir)/revert.sh $(BINDIR) $(PROGS) $(SCRIPTS) - -installman: - @$(SHELL) $(srcdir)/installman.sh $(MANDIR) - -clean: - rm -f core *.o *~ $(PROGS) - -realclean: clean diff -u -r --new-file --exclude=CVS source/client.c newsource/client.c --- source/client.c Thu Jul 31 18:55:08 1997 +++ newsource/client.c Sun Aug 24 20:08:32 1997 @@ -326,7 +326,24 @@ grp_id = SVAL(inbuf,smb_vwv0); +#ifdef AMIGA + printf("Connected. Type your message, ending it with a Control-\\\n"); +#else printf("Connected. Type your message, ending it with a Control-D\n"); +#endif + +#ifdef OS2 + /* OS/2 stdin is different, but EMX allows us to set it up in a Unix-like + * (non-default) mode. Still not perfect, but bearable. + */ + { + struct termio tio ; + + ioctl( fileno(stdin), TCGETA, &tio ) ; + tio.c_lflag &= ~IDEFAULT ; + ioctl( fileno(stdin), TCSETA, &tio ) ; + } +#endif while (!feof(stdin) && total_len < 1600) { @@ -1269,7 +1286,7 @@ } - DEBUG(2,("getting file %s of size %d bytes as %s ", + DEBUG(2,("getting file %s of size %d bytes as %s\n", CNV_LANG(finfo.name), finfo.size, lname)); @@ -1296,6 +1313,11 @@ (max_xmit - (2*smb_size + 13*SIZEOFWORD + 300)))) method = 0; + /* Attempt to detect OS/2 Peer as the server, because it can crash + on a chained readX+close. */ + if (max_xmit == 4356) + method = -1; + /* if we support readraw then use that */ if (method<0 && readbraw_supported) method = 1; @@ -1659,7 +1681,11 @@ strcpy(rname,cur_dir); strcat(rname,"\\"); +#ifdef OS2 + sprintf(tmpname,"%s\\%d.pag",tmpdir(),(int)getpid()); +#else sprintf(tmpname,"%s/smbmore.%d",tmpdir(),(int)getpid()); +#endif strcpy(lname,tmpname); if (!next_token(NULL,rname+strlen(rname),NULL)) { @@ -1955,7 +1981,7 @@ if (finfo->size < 0) finfo->size = file_size(lname); - DEBUG(1,("putting file %s of size %d bytes as %s ",lname,finfo->size,CNV_LANG(rname))); + DEBUG(1,("putting file %s of size %d bytes as %s\n",lname,finfo->size,CNV_LANG(rname))); if (!maxwrite) maxwrite = writebraw_supported?MAX(max_xmit,BUFFER_SIZE):(max_xmit-200); @@ -2133,11 +2159,23 @@ pstring tmpname; FILE *f; +#ifdef OS2 + pstring d; + int len; + + len = strlen(GetWd(d)); + sprintf(tmpname,"%s/%d.ls",tmpdir(),(int)getpid()); + if (recurse) + sprintf(cmd,"dir /b /s %s > %s",p,tmpname); + else + sprintf(cmd,"dir /b /a:-d %s > %s",p,tmpname); +#else sprintf(tmpname,"%s/ls.smb.%d",tmpdir(),(int)getpid()); if (recurse) sprintf(cmd,"find . -name \"%s\" -print > %s",p,tmpname); else - sprintf(cmd,"/bin/ls %s > %s",p,tmpname); + sprintf(cmd,"/bin/ls -d -1 %s > %s",p,tmpname); +#endif system(cmd); f = fopen(tmpname,"r"); @@ -2146,9 +2184,22 @@ while (!feof(f)) { pstring quest; +#ifdef OS2 + pstring dirline; + + if (fscanf(f,"%s",dirline) != 1) break; + /* Convert the absolute paths of the dir /b /s to + relative paths, to simulate a Unix 'find': + strip off 'current-dir' characters (ugly hack!). */ + if (recurse) + strncpy(lname,dirline+len+1,strlen(dirline)-len+1); + else + strcpy(lname, dirline); +#else if (fscanf(f,"%s",lname) != 1) break; trim_string(lname,"./",NULL); +#endif again1: @@ -3356,7 +3407,15 @@ memcpy(p,pword,passlen); p += SVAL(outbuf,smb_vwv7); strcpy(p,username);p = skip_string(p,1); strcpy(p,workgroup);p = skip_string(p,1); +#ifdef AMIGA + strcpy(p,"Amiga");p = skip_string(p,1); +#else +#ifdef OS2 + strcpy(p,"OS/2");p = skip_string(p,1); +#else strcpy(p,"Unix");p = skip_string(p,1); +#endif +#endif strcpy(p,"Samba");p = skip_string(p,1); set_message(outbuf,13,PTR_DIFF(p,smb_buf(outbuf)),False); } @@ -3765,7 +3824,7 @@ case STYPE_PRINTQ: strcpy(typestr,"Printer"); break; case STYPE_DEVICE: - strcpy(typestr,"Device"); break; + strcpy(typestr,"Comm"); break; case STYPE_IPC: strcpy(typestr,"IPC"); break; } @@ -4397,8 +4456,8 @@ DEBUG(0,("\nVersion %s\n",VERSION)); DEBUG(0,("\t-p port listen on the specified port\n")); DEBUG(0,("\t-d debuglevel set the debuglevel\n")); - DEBUG(0,("\t-l log basename. Basename for log/debug files\n")); - DEBUG(0,("\t-n netbios name. Use this name as my netbios name\n")); + DEBUG(0,("\t-l log basename. basename for log/debug files\n")); + DEBUG(0,("\t-n netbios name. use this name as my netbios name\n")); DEBUG(0,("\t-N don't ask for a password\n")); DEBUG(0,("\t-P connect to service as a printer\n")); DEBUG(0,("\t-M host send a winpopup message to the host\n")); @@ -4412,7 +4471,7 @@ #ifdef KANJI DEBUG(0,("\t-t terminal code terminal i/o code {sjis|euc|jis7|jis8|junet|hex}\n")); #endif /* KANJI */ - DEBUG(0,("\t-TIXgbNa command line tar\n")); + DEBUG(0,("\t-TIXgbNa command line tar\n")); DEBUG(0,("\t-D directory start from directory\n")); DEBUG(0,("\n")); } @@ -4433,6 +4492,19 @@ BOOL message = False; extern char tar_type; static pstring servicesf = CONFIGFILE; + int DEBUGLEVEL_commandline = -1; + +#ifdef OS2 + /* OS/2 stdin is different, but EMX allows us to set it up in a Unix-like + * mode. However, the OS/2 stdin mode seems better for command line editing + * (backslashes do not escape), so we set it to default. + */ + struct termio tio ; + + ioctl( fileno(stdin), TCGETA, &tio ) ; + tio.c_lflag |= IDEFAULT ; + ioctl( fileno(stdin), TCSETA, &tio ) ; +#endif *query_host = 0; *base_directory = 0; @@ -4583,9 +4655,14 @@ DEBUGLEVEL = 10000; else DEBUGLEVEL = atoi(optarg); + DEBUGLEVEL_commandline = DEBUGLEVEL; break; case 'l': +#ifdef OS2 + sprintf(debugf,"%s.cln",optarg); +#else sprintf(debugf,"%s.client",optarg); +#endif break; case 'p': port = atoi(optarg); @@ -4635,6 +4712,9 @@ get_myname(*myname?NULL:myname,NULL); strupper(myname); + if (DEBUGLEVEL_commandline != -1) + DEBUGLEVEL = DEBUGLEVEL_commandline; + if (tar_type) { recurse=True; @@ -4758,6 +4838,7 @@ {"ERRnofiles",18,"A File Search command can find no more files matching the specified criteria."}, {"ERRbadshare",32,"The sharing mode specified for an Open conflicts with existing FIDs on the file."}, {"ERRlock",33,"A Lock request conflicted with an existing lock or specified an invalid mode, or an Unlock requested attempted to remove a lock held by another process."}, + {"ERRdiskfull",39,"The disk is full."}, {"ERRfilexists",80,"The file named in a Create Directory, Make New File or Link request already exists."}, {"ERRbadpipe",230,"Pipe invalid."}, {"ERRpipebusy",231,"All instances of the requested pipe are busy."}, diff -u -r --new-file --exclude=CVS source/clientutil.c newsource/clientutil.c --- source/clientutil.c Thu Jul 31 18:55:08 1997 +++ newsource/clientutil.c Sun Aug 10 18:03:38 1997 @@ -483,7 +483,15 @@ memcpy(p,pword,passlen); p += SVAL(outbuf,smb_vwv7); strcpy(p,username);p = skip_string(p,1); strcpy(p,workgroup);p = skip_string(p,1); +#ifdef AMIGA + strcpy(p,"Amiga");p = skip_string(p,1); +#else +#ifdef OS2 + strcpy(p,"OS/2");p = skip_string(p,1); +#else strcpy(p,"Unix");p = skip_string(p,1); +#endif +#endif strcpy(p,"Samba");p = skip_string(p,1); set_message(outbuf,13,PTR_DIFF(p,smb_buf(outbuf)),False); } diff -u -r --new-file --exclude=CVS source/includes.h newsource/includes.h --- source/includes.h Thu Jul 24 18:50:22 1997 +++ newsource/includes.h Thu Aug 14 23:05:10 1997 @@ -888,23 +888,38 @@ #endif #ifdef OS2 +#define INCL_DOSFILEMGR +#define INCL_DOSMISC +#include #include #include +#include #include #include #define SIGNAL_CAST (void (*)()) #define HAVE_FCNTL_LOCK 0 #define USE_WAITPID +#define USE_GETCWD +#define getcwd _getcwd2 #define NO_GET_BROADCAST #define NO_EID #define NO_SETGROUPS #define NO_INITGROUPS #define NO_CRYPT -#define NO_STATFS +#define STATFS4 #define NO_CHROOT #define NO_CHOWN +#define SYSV +#define SYSV_TERMIO +#define STDIN_NEEDS_UNIX_SETUP +#define DEFAULT_PRINTING PRINT_BSD +#define NO_PROC +#define NO_SYM_LINKS +#define HAVE_MEMMOVE +#define HAVE_BZERO #define strcasecmp stricmp #define strncasecmp strnicmp +#define chdir _chdir2 #endif @@ -949,7 +964,10 @@ #include #include #include - +#include +/* Prototype for ACrypt so that there is no need for header files + which clash with Unix definitions. */ +char *ACrypt (char *buffer, char *password, char *username); #define SIGNAL_CAST (void (*)(int)) #define USE_GETCWD #define HAVE_BZERO @@ -961,11 +979,11 @@ #define HAVE_FCNTL_LOCK 0 #define HAVE_GETTIMEOFDAY #define HAVE_PATHCONF - -#define HAVE_NO_PROC +#define NO_PROC #define NO_FORK_DEBUG #define HAVE_FORK 0 #define HAVE_VFORK 1 +#define NO_SYM_LINKS #endif /* For UnixWare 2.x's ia_uinfo routines. (tangent@cyberport.com) */ @@ -1197,14 +1215,14 @@ #if (HAVE_FCNTL_LOCK == 0) -/* since there is no locking available, system includes */ -/* for DomainOS 10.4 do not contain any of the following */ -/* #define's. So, to satisfy the compiler, add these */ -/* #define's, although they arn't really necessary. */ +/* Some systems without file locking may not contain the + following #define's. So, to satisfy the compiler, we add + these #define's, although they aren't really necessary. */ #define F_GETLK 0 #define F_SETLK 0 #define F_WRLCK 0 #define F_UNLCK 0 +#define F_SETLKW 0 #endif /* HAVE_FCNTL_LOCK == 0 */ #ifdef NOSTRCASECMP diff -u -r --new-file --exclude=CVS source/installscripts.sh newsource/installscripts.sh --- source/installscripts.sh Fri Aug 16 13:10:48 1996 +++ newsource/installscripts.sh Sun Aug 17 23:22:52 1997 @@ -4,11 +4,17 @@ INSTALLPERMS=$1 BINDIR=$2 +SRCDIR=$3 shift shift +shift echo Installing scripts in $BINDIR + +if [ -n "$SRCDIR" ]; then + cd "$SRCDIR" +fi for d in $BINDIR; do if [ ! -d $d ]; then diff -u -r --new-file --exclude=CVS source/loadparm.c newsource/loadparm.c --- source/loadparm.c Thu Jul 31 18:55:12 1997 +++ newsource/loadparm.c Sun Aug 10 12:59:26 1997 @@ -153,6 +153,7 @@ int os_level; int max_ttl; int ReadSize; + int lm_announce; int shmem_size; int shmem_hash_size; int client_code_page; @@ -466,6 +467,7 @@ {"domain master", P_BOOL, P_GLOBAL, &Globals.bDomainMaster, NULL}, {"domain logons", P_BOOL, P_GLOBAL, &Globals.bDomainLogons, NULL}, {"browse list", P_BOOL, P_GLOBAL, &Globals.bBrowseList, NULL}, + {"lm announce", P_INTEGER, P_GLOBAL, &Globals.lm_announce, NULL}, {"unix realname", P_BOOL, P_GLOBAL, &Globals.bUnixRealname, NULL}, {"NIS homedir", P_BOOL, P_GLOBAL, &Globals.bNISHomeMap, NULL}, {"time server", P_BOOL, P_GLOBAL, &Globals.bTimeServer, NULL}, @@ -636,6 +638,7 @@ Globals.os_level = 0; Globals.max_ttl = 60*60*4; /* 2 hours default */ Globals.ReadSize = 16*1024; + Globals.lm_announce = 0; Globals.shmem_size = SHMEM_SIZE; Globals.shmem_hash_size = SHMEM_HASH_SIZE; Globals.announce_as = ANNOUNCE_AS_NT; @@ -877,6 +880,7 @@ FN_GLOBAL_INTEGER(lp_maxdisksize,&Globals.maxdisksize) FN_GLOBAL_INTEGER(lp_lpqcachetime,&Globals.lpqcachetime) FN_GLOBAL_INTEGER(lp_syslog,&Globals.syslog) +FN_GLOBAL_INTEGER(lp_lm_announce,&Globals.lm_announce) FN_GLOBAL_INTEGER(lp_client_code_page,&Globals.client_code_page) FN_GLOBAL_INTEGER(lp_announce_as,&Globals.announce_as) diff -u -r --new-file --exclude=CVS source/local.h newsource/local.h --- source/local.h Fri Jul 18 20:44:46 1997 +++ newsource/local.h Sun Aug 10 12:28:28 1997 @@ -105,8 +105,12 @@ /* the default pager to use for the client "more" command. Users can override this with the PAGER environment variable */ #ifndef PAGER +#ifdef OS2 +#define PAGER "more <" +#else #define PAGER "more" #endif +#endif /* the size of the uid cache used to reduce valid user checks */ #define UID_CACHE_SIZE 4 @@ -145,7 +149,7 @@ /* shall we support browse requests via a FIFO to nmbd? */ #define ENABLE_FIFO 1 -/* keep the password server open, this uses up a aocket, but is needed +/* keep the password server open, this uses up a socket, but is needed by many apps */ #define KEEP_PASSWORD_SERVER_OPEN 1 diff -u -r --new-file --exclude=CVS source/locking.c newsource/locking.c --- source/locking.c Fri Jul 18 20:44:46 1997 +++ newsource/locking.c Thu Aug 14 23:02:22 1997 @@ -592,7 +592,11 @@ if (!*name) return(False); name += strlen(name); +#ifdef OS2 + sprintf(name,"/%08x.shr",inode); +#else sprintf(name,"/share.%u.%u",dev,inode); +#endif return(True); } @@ -635,6 +639,7 @@ } } +#if HAVE_FCNTL_LOCK /* At this point we have an open fd to the share mode file. Lock the first byte exclusively to signify a lock. */ if(fcntl_lock(fd, F_SETLKW, 0, 1, F_WRLCK) == False) @@ -644,6 +649,7 @@ close(fd); return False; } +#endif *ptok = (share_lock_token)fd; return True; @@ -657,6 +663,7 @@ int fd = (int)token; int ret = True; +#if HAVE_FCNTL_LOCK /* token is the fd of the open share mode file. */ /* Unlock the first byte. */ if(fcntl_lock(fd, F_SETLKW, 0, 1, F_UNLCK) == False) @@ -665,6 +672,7 @@ strerror(errno))); ret = False; } +#endif close((int)token); return ret; @@ -674,16 +682,21 @@ Force a share file to be deleted. ********************************************************************/ -static int delete_share_file( int cnum, char *fname ) +static int delete_share_file( int fd, int cnum, char *fname ) { unbecome_user(); +#ifdef OS2 + close(fd); +#endif if(unlink(fname) != 0) { DEBUG(0,("delete_share_file: Can't delete share file %s (%s)\n", fname, strerror(errno))); } - + else + { DEBUG(5,("delete_share_file: Deleted share file %s\n", fname)); + } if(!become_user(cnum,Connections[cnum].vuid)) { @@ -756,7 +769,7 @@ locking version (was %d, should be %d).\n",fname, IVAL(buf,0), LOCKING_VERSION)); if(buf) free(buf); - delete_share_file(cnum, fname); + delete_share_file(fd, cnum, fname); return -1; } @@ -774,7 +787,7 @@ deleting it.\n", fname)); if(buf) free(buf); - delete_share_file(cnum, fname); + delete_share_file(fd, cnum, fname); return -1; } @@ -858,7 +871,7 @@ fname)); if(buf) free(buf); - delete_share_file(cnum, fname); + delete_share_file(fd, cnum, fname); return 0; } @@ -897,7 +910,7 @@ *old_shares = 0; if(buf) free(buf); - delete_share_file(cnum, fname); + delete_share_file(fd, cnum, fname); return 0; } @@ -995,7 +1008,7 @@ { DEBUG(0,("ERROR:del_share_mode: share file %s is new (size zero), deleting it.\n", fname)); - delete_share_file(fs_p->cnum, fname); + delete_share_file(fd, fs_p->cnum, fname); return; } @@ -1019,7 +1032,7 @@ fname)); if(buf) free(buf); - delete_share_file(fs_p->cnum, fname); + delete_share_file(fd, fs_p->cnum, fname); return; } @@ -1068,7 +1081,7 @@ fname)); if(buf) free(buf); - delete_share_file(fs_p->cnum,fname); + delete_share_file(fd, fs_p->cnum,fname); return; } @@ -1163,7 +1176,7 @@ locking version (was %d, should be %d).\n",fname, IVAL(buf,0), LOCKING_VERSION)); if(buf) free(buf); - delete_share_file(fs_p->cnum, fname); + delete_share_file(fd, fs_p->cnum, fname); return False; } @@ -1176,7 +1189,7 @@ deleting it.\n", fname)); if(buf) free(buf); - delete_share_file(fs_p->cnum, fname); + delete_share_file(fd, fs_p->cnum, fname); return False; } @@ -1220,7 +1233,7 @@ { DEBUG(2,("ERROR: set_share_mode: Failed to write share file %s - \ deleting it (%s).\n",fname, strerror(errno))); - delete_share_file(fs_p->cnum, fname); + delete_share_file(fd, fs_p->cnum, fname); if(buf) free(buf); return False; diff -u -r --new-file --exclude=CVS source/message.c newsource/message.c --- source/message.c Thu May 8 16:35:38 1997 +++ newsource/message.c Tue Aug 12 22:45:14 1997 @@ -53,7 +53,16 @@ } /* put it in a temporary file */ +#ifdef AMIGA + strcpy (s, tmpdir ()); + AddPart (s, "msg.XXXXXX", 1024); +#else +#ifdef OS2 + sprintf(s,"%s\\mgXXXXXX",tmpdir()); +#else sprintf(s,"%s/msg.XXXXXX",tmpdir()); +#endif +#endif strcpy(name,(char *)mktemp(s)); fd = open(name,O_WRONLY|O_CREAT|O_TRUNC|O_EXCL,0600); diff -u -r --new-file --exclude=CVS source/namedbname.c newsource/namedbname.c --- source/namedbname.c Fri Jun 6 16:29:26 1997 +++ newsource/namedbname.c Sun Aug 10 22:23:24 1997 @@ -228,10 +228,22 @@ strcpy(fname,lp_lockdir()); trim_string(fname,NULL,"/"); +#ifdef OS2 + if (!directory_exist(fname,NULL)) + { + DEBUG(0,("Lock dir %s not found!\n",fname)); + exit(1); + } + strcat(fname,"/"); + strcpy(fnamenew,fname); + strcat(fname,WINS_LIST); + strcat(fnamenew,"wins.new"); +#else strcat(fname,"/"); strcat(fname,WINS_LIST); strcpy(fnamenew,fname); strcat(fnamenew,"."); +#endif f = fopen(fnamenew,"w"); diff -u -r --new-file --exclude=CVS source/namedbsubnet.c newsource/namedbsubnet.c --- source/namedbsubnet.c Thu Jul 31 18:55:14 1997 +++ newsource/namedbsubnet.c Sun Aug 10 17:27:30 1997 @@ -310,10 +310,22 @@ strcpy(fname,lp_lockdir()); trim_string(fname,NULL,"/"); +#ifdef OS2 + if (!directory_exist(fname,NULL)) + { + DEBUG(0,("Lock dir %s not found\n",fname)); + exit(1); + } + strcat(fname,"/"); + strcpy(fnamenew,fname); + strcat(fname,SERVER_LIST); + strcat(fnamenew,"browse.new"); /* In order to stay within 8.3. */ +#else strcat(fname,"/"); strcat(fname,SERVER_LIST); strcpy(fnamenew,fname); strcat(fnamenew,"."); +#endif f = fopen(fnamenew,"w"); diff -u -r --new-file --exclude=CVS source/namelanman.c newsource/namelanman.c --- source/namelanman.c Thu Jan 1 00:00:00 1970 +++ newsource/namelanman.c Wed Aug 13 23:31:00 1997 @@ -0,0 +1,301 @@ +/* + Unix SMB/Netbios implementation. + Version 1.9. + NBT netbios routines and daemon - version 2 + Copyright (C) Andrew Tridgell 1994-1995 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + Revision History: + + 27 mar 1997: Andreas Degert + Implementation of LAN Manager (LM) announcements. + Samba servers should now be visible to LM clients + (including OS/2 machines). + 14 apr 1997: Jacco de Leeuw + Observed OS/2 machines will be added to the browse list. + All LM routines have been moved to one file. + 5 may 1997: Jacco de Leeuw + Send LM announcements with no services when Samba is killed. + Renamed LM routines to resemble existing name scheme. + 11 aug 1997: Updated for 1.9.17 +*/ + +#include "includes.h" + +extern int ClientDGRAM; +extern pstring myname; +extern struct subnet_record *subnetlist; +extern struct in_addr wins_ip; +extern int DEBUGLEVEL; +extern pstring scope; +extern BOOL updatedlists; + +/**************************************************************************** + send a LAN Manager packet + **************************************************************************/ + +void do_announce_lm_host(int command, + char *from_name, int from_type, + struct in_addr from_ip, char *to_name, + int to_type, struct in_addr to_ip, + time_t announce_interval, char *server_name, + int server_type, char *server_comment) +{ + pstring outbuf; + char *p = outbuf; + + bzero(outbuf,sizeof(outbuf)); + + SSVAL(p,0,command); /* frame type */ + SIVAL(p,2,server_type); /* services offered by this server */ + CVAL(p,6) = lp_major_announce_version(); + CVAL(p,7) = lp_minor_announce_version(); + SSVAL(p,8,announce_interval); /* announcement cycle in seconds */ + p += 10; + strcpy(p,server_name); + strupper(p); + p = skip_string(p,1); + strcpy(p,server_comment); + p = skip_string(p,1); + + debug_browse_data(outbuf, PTR_DIFF(p,outbuf)); + + /* send the announcement */ + send_mailslot_reply(False,LANMAN_MAILSLOT,ClientDGRAM,outbuf, + PTR_DIFF(p,outbuf), + from_name, to_name, + from_type, to_type, + to_ip, from_ip); +} + + +/**************************************************************************** + announce on all subnets that Samba is no longer a LAN Manager server + **************************************************************************/ + +void announce_my_lm_servers_removed(void) +{ + char *work = lp_workgroup(); + int announce_interval = lp_lm_announce(); + struct subnet_record *d; + int server_type; + pstring comment; + + if (announce_interval <=0) return; + + StrnCpy(comment, lp_serverstring(), 43); + + if (myname[0] == '\0') return; + + server_type = 0; /* Going down. There are 'no services'. */ + + for (d = subnetlist; d; d = d->next) + { + if (ip_equal(d->bcast_ip, wins_ip)) continue; + announce_lm_server(d,work,myname,comment, + announce_interval,server_type); + } +} + + +/**************************************************************************** + send a LAN Manager host announcement packet + **************************************************************************/ + +void announce_lm_server(struct subnet_record *d, char *work, + char *name, char *comment, time_t ttl, int server_type) +{ + + do_announce_lm_host(ANN_HostAnnouncement, + name, 0x00, + d->myip, work, + 0x00, d->bcast_ip, + ttl, name, + server_type, comment); +} + + +/**************************************************************************** + announce a LAN Manager server entry on all subnets + **************************************************************************/ + +void announce_lm_host(time_t t) +{ + static time_t lastannounce_time = 0; + char *work = lp_workgroup(); + int announce_interval = lp_lm_announce(); + struct subnet_record *d; + int server_type; + pstring comment; + + if (announce_interval <=0) return; + + StrnCpy(comment, lp_serverstring(), 43); + + if (myname[0] == '\0') return; + + if (lastannounce_time && (t - lastannounce_time) < announce_interval) + return; + + lastannounce_time = t; + server_type = SV_TYPE_WORKSTATION|SV_TYPE_SERVER|SV_TYPE_TIME_SOURCE; + + for (d = subnetlist; d; d = d->next) + { + if (ip_equal(d->bcast_ip, wins_ip)) continue; + announce_lm_server(d,work,myname,comment, + announce_interval,server_type); + } +} + + + /******************************************************************* + process a LAN Manager announcement frame + ******************************************************************/ +static void process_lm_announce(struct packet_struct *p,uint16 command,char *buf) +{ + struct dgram_packet *dgram = &p->packet.dgram; + struct in_addr ip = dgram->header.source_ip; + struct subnet_record *d = find_subnet(ip); + + int ttl = SVAL(buf,8); /* time-to-live for this announcement */ + char *name = buf+10; + int osmajor=CVAL(buf,6); /* major version of node software */ + int osminor=CVAL(buf,7); /* minor version of node software */ + uint32 server_type = IVAL(buf,2); /* services offered by this server */ + char *s = buf+10; + pstring comment; + static int logwarnings=0; + + struct work_record *work; + char *work_name; + char *serv_name = dgram->source_name.name; + BOOL add = False; + + s = skip_string(s,1); + StrnCpy(comment, s, 43); + + DEBUG(4,("LM Announcement(%d) from %s",command,name)); + DEBUG(4,(" on %s ttl=%d OS=(%d,%d) type=%08x comment=%s\n", + namestr(&dgram->dest_name),ttl,osmajor,osminor, + server_type,comment)); + + if (((osmajor > 38) && (osmajor < 36)) || (osminor !=0)) + { + DEBUG(4,("LM Announcement frame discarded: didn't originate from" \ + " OS/2 Warp 4 or Connect\n")); + /* Could have been from a Windows machine (with LM Announce=Yes), + or a Samba server. Then don't disrupt the current browse list. */ + return; + } + + if (!strequal(dgram->dest_name.scope,scope )) return; + + if ((logwarnings < 5) && (lp_lm_announce() <= 0)) + { + logwarnings++; + DEBUG(1, ("OS/2 client(s) detected! " \ + "Please increase the\n'lm announce' " \ + "parameter (see smb.conf.5)...\n")); + } + + /* we need some way of finding out about new workgroups + that appear to be sending packets to us. The name_type checks make + sure we don't add host names as workgroups */ + if (command == ANN_HostAnnouncement && + (dgram->dest_name.name_type == 0x1d || + dgram->dest_name.name_type == 0x1e)) + add = True; + + work_name = dgram->dest_name.name; + if (!(work = find_workgroupstruct(d, work_name,add))) + return; + + DEBUG(4, ("workgroup %s on %s\n", work->work_group, serv_name)); + + ttl = GET_TTL(ttl); + + /* add them to our browse list, and update the browse.dat file */ + add_server_entry(d,work,name,server_type|SV_TYPE_LOCAL_LIST_ONLY,ttl,comment,True); + updatedlists = True; +} + + +/******************************************************************* + process a LAN Manager announcement request +*******************************************************************/ + +static void process_lm_announce_request(struct packet_struct *p,char *buf) +{ + pstring comment; + uint32 server_type; + int announce_interval = lp_lm_announce(); + + + if (announce_interval <= 0) + { + DEBUG(3,("ignoring LM announcement request from %s\n",buf+2)); + /* The server is configured to not send LM announcements */ + return; + } + + DEBUG(3,("responding to LM announcement request from %s\n",buf+2)); + + server_type = SV_TYPE_WORKSTATION|SV_TYPE_SERVER|SV_TYPE_TIME_SOURCE; + + StrnCpy(comment, lp_serverstring(), 43); + + do_announce_lm_host(ANN_HostAnnouncement, + myname, 0x00, + *iface_ip(p->ip), lp_workgroup(), + 0x00, p->ip, + announce_interval, myname, + server_type, comment); +} + + +/**************************************************************************** + process a LAN Manager browse frame + **************************************************************************/ + +void process_lanman_packet(struct packet_struct *p,char *buf,int len) +{ + int code = SVAL(buf,0); + switch( code ) + { + case ANN_HostAnnouncement: + { + debug_browse_data(buf, len); + process_lm_announce(p, ANN_HostAnnouncement, buf); + break; + } + + case ANN_AnnouncementRequest: + { + debug_browse_data(buf, len); + process_lm_announce_request(p, buf); + break; + } + + default: + { + struct dgram_packet *dgram = &p->packet.dgram; + DEBUG(4,("unknown LM browse packet %d from %s %s to %s\n", + code, namestr(&dgram->source_name), + inet_ntoa(p->ip), namestr(&dgram->dest_name))); + } + } +} diff -u -r --new-file --exclude=CVS source/namepacket.c newsource/namepacket.c --- source/namepacket.c Fri Jun 6 16:29:26 1997 +++ newsource/namepacket.c Sun Aug 10 17:37:46 1997 @@ -42,7 +42,7 @@ /*************************************************************************** - updates the unique transaction identifier + displays an ASCII/hex dump of the packet **************************************************************************/ void debug_browse_data(char *outbuf, int len) { @@ -65,7 +65,7 @@ for (j = 0; j < 16; j++) { if (i+j >= len) break; - DEBUG(4, (" %02x", outbuf[i+j])); + DEBUG(4, (" %02x", (unsigned char)outbuf[i+j])); } DEBUG(4, ("\n")); @@ -384,6 +384,12 @@ process_logon_packet(p,buf2,len); return; } + + /* datagram packet received for the LAN Manager (OS/2) mailslot */ + if (strequal(smb_buf(buf),LANMAN_MAILSLOT)) { + process_lanman_packet(p,buf2,len); + return; + } } /**************************************************************************** @@ -627,7 +633,7 @@ p.timestamp = time(NULL); p.packet_type = DGRAM_PACKET; - DEBUG(4,("send mailslot %s from %s %s", mailslot, + DEBUG(4,("send mailslot %s from %s %s ", mailslot, inet_ntoa(src_ip),namestr(&dgram->source_name))); DEBUG(4,("to %s %s\n", inet_ntoa(dest_ip),namestr(&dgram->dest_name))); diff -u -r --new-file --exclude=CVS source/nameserv.h newsource/nameserv.h --- source/nameserv.h Thu Jul 31 18:55:16 1997 +++ newsource/nameserv.h Sun Aug 10 11:15:32 1997 @@ -82,6 +82,7 @@ /* mail slots */ #define BROWSE_MAILSLOT "\\MAILSLOT\\BROWSE" #define NET_LOGON_MAILSLOT "\\MAILSLOT\\NET\\NETLOGON" +#define LANMAN_MAILSLOT "\\MAILSLOT\\LANMAN" enum name_source {STATUS_QUERY, LMHOSTS, REGISTER, SELF, DNS, DNSFAIL}; enum node_type {B_NODE=0, P_NODE=1, M_NODE=2, NBDD_NODE=3}; diff -u -r --new-file --exclude=CVS source/nmbd.c newsource/nmbd.c --- source/nmbd.c Thu Jul 31 18:55:18 1997 +++ newsource/nmbd.c Sun Aug 10 17:50:58 1997 @@ -57,6 +57,9 @@ ****************************************************************************/ static int sig_term() { +#ifdef OS2 + BlockSignals(True,SIGINT); +#endif BlockSignals(True,SIGTERM); DEBUG(0,("Got SIGTERM: going down...\n")); @@ -71,6 +74,8 @@ /* XXXX don't care if we never receive a response back... yet */ announce_my_servers_removed(); + announce_my_lm_servers_removed(); + /* XXXX other things: if we are a master browser, force an election? */ exit(0); @@ -123,7 +128,11 @@ pstring dname; strcpy(dname,debugf); if ((p=strrchr(dname,'/'))) *p=0; +#ifdef OS2 + strcat(dname,"/corefile"); +#else strcat(dname,"/corefiles"); +#endif mkdir(dname,0700); sys_chown(dname,getuid(),getgid()); chmod(dname,0700); @@ -310,6 +319,7 @@ announce_host(t); announce_master(t); announce_remote(t); + announce_lm_host(t); query_refresh_names(t); @@ -450,7 +460,7 @@ printf("\t-d debuglevel set the debuglevel\n"); printf("\t-l log basename. Basename for log/debug files\n"); printf("\t-n netbiosname. the netbios name to advertise for this host\n"); - printf("\t-H hosts file load a netbios hosts file\n"); + printf("\t-H hosts file load a netbios hosts file\n"); printf("\n"); } @@ -492,6 +502,9 @@ signal(SIGHUP ,SIGNAL_CAST sig_hup); signal(SIGTERM,SIGNAL_CAST sig_term); +#ifdef OS2 + signal(SIGINT,SIGNAL_CAST sig_term); +#endif while ((opt = getopt(argc, argv, "s:T:I:C:bAi:B:N:Rn:l:d:Dp:hSH:G:f:")) != EOF) { diff -u -r --new-file --exclude=CVS source/params.c newsource/params.c --- source/params.c Thu May 8 16:35:40 1997 +++ newsource/params.c Sun Aug 10 17:51:16 1997 @@ -319,7 +319,7 @@ } if (!bRetval) - DEBUG(0,("pm_process retuned false\n")); + DEBUG(0,("pm_process returned false\n")); return (bRetval); } diff -u -r --new-file --exclude=CVS source/password.c newsource/password.c --- source/password.c Mon Jul 28 19:06:28 1997 +++ newsource/password.c Tue Aug 12 22:50:12 1997 @@ -707,6 +707,26 @@ } #endif +#ifdef AMIGA +/**************************************************************************** +Do password checking in a MultiUser 2 and INET225 compatible way. +****************************************************************************/ +static int amiga_crypt(char *passwd, char *user, char *salt, char *crypted) +{ + char acrypt_buffer[12]; + + if (strcmp((char *) crypt(passwd, salt), this_crypted) == 0) + return (True); + else + { + if (ACrypt(passwd, user, acrypt_buffer) == 0UL) + return (False); + else + return (strcmp(acrypt_buffer, crypted) == 0); + } +} +#endif + /**************************************************************************** apply a function to upper/lower case combinations @@ -802,6 +822,10 @@ #ifdef LINUX_BIGCRYPT return(linux_bigcrypt(password,this_salt,this_crypted)); +#endif + +#ifdef AMIGA + return (amiga_crypt(password, this_user, this_salt, this_crypted)); #endif #ifdef NO_CRYPT diff -u -r --new-file --exclude=CVS source/printing.c newsource/printing.c --- source/printing.c Thu May 8 16:35:40 1997 +++ newsource/printing.c Tue Aug 12 22:51:32 1997 @@ -81,7 +81,11 @@ if (iOffset==0 || syscmd[iOffset-1] != '/') { StrnCpy(filename,Connections[cnum].connectpath,sizeof(filename)-1); trim_string(filename,"","/"); +#ifdef OS2 + strcat(filename,"\\"); +#else strcat(filename,"/"); +#endif strcat(filename,filename1); } else @@ -945,7 +949,17 @@ standard_sub(cnum,syscmd); +#ifdef AMIGA + strcpy (outfile, tmpdir ()); + AddPart (outfile, "lpq.", 128); + sprintf (outfile+strlen (outfile), "%08x", str_checksum (syscmd)); +#else +#ifdef OS2 + sprintf(outfile,"%s\\%08x.lpq",tmpdir(),str_checksum(syscmd)); +#else sprintf(outfile,"%s/lpq.%08x",tmpdir(),str_checksum(syscmd)); +#endif +#endif if (!lpq_cache_reset[snum] && cachetime && !stat(outfile,&sbuf)) { diff -u -r --new-file --exclude=CVS source/proto.h newsource/proto.h --- source/proto.h Thu Jul 31 18:55:20 1997 +++ newsource/proto.h Thu Aug 14 07:48:58 1997 @@ -51,6 +51,7 @@ /*The following definitions come from clitar.c */ +int strslashcmp(char *s1, char *s2); int padit(char *buf, int bufsize, int padsize); void cmd_block(void); void cmd_tarmode(void); @@ -146,6 +147,7 @@ char *lp_interfaces(void); char *lp_socket_address(void); char *lp_nis_home_map_name(void); +char *lp_announce_version(void); char *lp_netbios_aliases(void); BOOL lp_dns_proxy(void); BOOL lp_wins_support(void); @@ -188,7 +190,9 @@ int lp_maxdisksize(void); int lp_lpqcachetime(void); int lp_syslog(void); +int lp_lm_announce(void); int lp_client_code_page(void); +int lp_announce_as(void); char *lp_preexec(int ); char *lp_postexec(int ); char *lp_rootpreexec(int ); @@ -268,10 +272,10 @@ int lp_numservices(void); void lp_dump(void); int lp_servicenumber(char *pszServiceName); +char *volume_label(int snum); int lp_default_server_announce(void); int lp_major_announce_version(void); int lp_minor_announce_version(void); -char *volume_label(int snum); /*The following definitions come from locking.c */ @@ -448,6 +452,20 @@ void process_election(struct packet_struct *p,char *buf); BOOL check_elections(void); +/*The following definitions come from namelanman.c */ + +void do_announce_lm_host(int command, + char *from_name, int from_type, + struct in_addr from_ip, char *to_name, + int to_type, struct in_addr to_ip, + time_t announce_interval, char *server_name, + int server_type, char *server_comment); +void announce_my_lm_servers_removed(void); +void announce_lm_server(struct subnet_record *d, char *work, + char *name, char *comment, time_t ttl, int server_type); +void announce_lm_host(time_t t); +void process_lanman_packet(struct packet_struct *p,char *buf,int len); + /*The following definitions come from namelogon.c */ void process_logon_packet(struct packet_struct *p,char *buf,int len); @@ -733,9 +751,6 @@ /*The following definitions come from shmem.c */ -smb_shm_offset_t smb_shm_alloc(int size); -smb_shm_offset_t smb_shm_addr2offset(void *addr); -smb_shm_offset_t smb_shm_get_userdef_off(void); BOOL smb_shm_create_hash_table( unsigned int size ); BOOL smb_shm_open( char *file_name, int size); BOOL smb_shm_close( void ); @@ -794,9 +809,11 @@ int sys_utime(char *fname,struct utimbuf *times); int sys_rename(char *from, char *to); int sys_chmod(char *fname,int mode); -int sys_chown(char *fname,int uid,int gid); +int sys_chown(const char *fname,int uid,int gid); int sys_chroot(char *dname); struct hostent *sys_gethostbyname(char *name); +int sys_statfs(char *path, struct statfs *fs, size_t size, int x); +void fix_stat(char *name, struct stat *sbuf); /*The following definitions come from testparm.c */ @@ -872,7 +889,7 @@ char *attrib_string(int mode); int StrCaseCmp(const char *s, const char *t); int StrnCaseCmp(const char *s, const char *t, int n); -BOOL strequal(const char *s1,const char *s2); +BOOL strequal(const char *s1, const char *s2); BOOL strnequal(const char *s1,const char *s2,int n); BOOL strcsequal(char *s1,char *s2); void strlower(char *s); diff -u -r --new-file --exclude=CVS source/reply.c newsource/reply.c --- source/reply.c Thu Jul 24 18:50:32 1997 +++ newsource/reply.c Sun Aug 10 18:27:26 1997 @@ -483,7 +483,15 @@ char *p; set_message(outbuf,3,3,True); p = smb_buf(outbuf); +#ifdef AMIGA + strcpy(p,"Amiga"); p = skip_string(p,1); +#else +#ifdef OS2 + strcpy(p,"OS/2"); p = skip_string(p,1); +#else strcpy(p,"Unix"); p = skip_string(p,1); +#endif +#endif strcpy(p,"Samba "); strcat(p,VERSION); p = skip_string(p,1); strcpy(p,myworkgroup); p = skip_string(p,1); set_message(outbuf,3,PTR_DIFF(p,smb_buf(outbuf)),False); @@ -1988,11 +1996,11 @@ mtime = make_unix_date3(inbuf+smb_vwv1); + close_file(fnum); + /* try and set the date */ set_filetime(Files[fnum].name,mtime); - close_file(fnum); - /* We have a cached error */ if(eclass || err) return(ERROR(eclass,err)); @@ -2036,10 +2044,10 @@ nwritten = write_file(fnum,data,numtowrite); - set_filetime(Files[fnum].name,mtime); - close_file(fnum); + set_filetime(Files[fnum].name,mtime); + DEBUG(3,("%s writeclose fnum=%d cnum=%d num=%d wrote=%d (numopen=%d)\n", timestring(),fnum,cnum,numtowrite,nwritten, Connections[cnum].num_files_open)); @@ -2215,6 +2223,7 @@ p = s; while (*p) { + /* Wouldn't this be something for issafe(*p)? */ if (!(isalnum(*p) || strchr("._-",*p))) *p = 'X'; p++; @@ -2222,7 +2231,12 @@ if (strlen(s) > 10) s[10] = 0; +#ifdef OS2 + if (strlen(s) > 2) s[2] = 0; + sprintf(fname,"%sXXXXXX",s); +#else sprintf(fname,"%s.XXXXXX",s); +#endif } fnum = find_free_file(); diff -u -r --new-file --exclude=CVS source/server.c newsource/server.c --- source/server.c Mon Jul 28 19:06:30 1997 +++ newsource/server.c Tue Aug 26 21:30:22 1997 @@ -467,7 +467,12 @@ { char *s; fstring name2; +#ifdef OS2 + /* Stay within 8.3: The remote machine name has got to go. */ + sprintf(name2,"XXXXXX"); +#else sprintf(name2,"%.6s.XXXXXX",remote_machine); +#endif /* sanitise the name */ for (s=name2 ; *s ; s++) if (!issafe(*s)) *s = '_'; @@ -649,7 +654,11 @@ pstring syscmd; pstring outfile; +#ifdef OS2 + sprintf(outfile,"%s\\%d.dfr",tmpdir(),(int)getpid()); +#else sprintf(outfile,"%s/dfree.smb.%d",tmpdir(),(int)getpid()); +#endif sprintf(syscmd,"%s %s",df_command,path); standard_sub_basic(syscmd); @@ -700,7 +709,11 @@ return(1); #else #ifdef STATFS4 +#ifdef OS2 + if (sys_statfs(path,&fs,sizeof(fs),0) != 0) +#else if (statfs(path,&fs,sizeof(fs),0) != 0) +#endif #else #ifdef USE_STATVFS if (statvfs(path, &fs)) @@ -749,7 +762,7 @@ *bsize = 512; #endif -/* handle rediculous bsize values - some OSes are broken */ +/* handle ridiculous bsize values - some OSes are broken */ if ((*bsize) < 512 || (*bsize)>0xFFFF) *bsize = 1024; disk_norm(bsize,dfree,dsize); @@ -818,6 +831,7 @@ ret = reduce_name(name,Connections[cnum].connectpath,lp_widelinks(SNUM(cnum))); +#ifndef NO_SYM_LINKS /* Check if we are allowing users to follow symlinks */ /* Patch from David Clerc University of Geneva */ @@ -832,6 +846,7 @@ ret=0; } } +#endif if (!ret) DEBUG(5,("check_name on %s failed\n",name)); @@ -1434,6 +1449,9 @@ return True; if (stat(fname,&sbuf) == -1) return(True); +#ifdef OS2 + fix_stat(fname,&sbuf); +#endif lock_share_entry(cnum, (uint32)sbuf.st_dev, (uint32)sbuf.st_ino, &token); num_share_modes = get_share_modes(cnum, token, @@ -1515,7 +1533,7 @@ if (strstr(fname,".+,;=[].")) { unix_ERR_class = ERRDOS; - unix_ERR_code = ERROR_EAS_NOT_SUPPORTED; + unix_ERR_code = ERRcannotopen; return; } @@ -1579,6 +1597,9 @@ if (file_existed) { +#ifdef OS2 + fix_stat(fname,&sbuf); +#endif dev = (uint32)sbuf.st_dev; inode = (uint32)sbuf.st_ino; lock_share_entry(cnum, dev, inode, &token); @@ -2556,7 +2577,11 @@ } if (lp_status(SNUM(cnum))) +#ifdef OS2 + claim_connection(cnum,"STATUS",MAXSTATUS,first_connection); +#else claim_connection(cnum,"STATUS.",MAXSTATUS,first_connection); +#endif first_connection = False; } /* IS_IPC */ @@ -2581,7 +2606,11 @@ yield_connection(cnum, lp_servicename(SNUM(cnum)), lp_max_connections(SNUM(cnum))); +#ifdef OS2 + if (lp_status(SNUM(cnum))) yield_connection(cnum,"STATUS",MAXSTATUS); +#else if (lp_status(SNUM(cnum))) yield_connection(cnum,"STATUS.",MAXSTATUS); +#endif } return(-1); } @@ -2956,19 +2985,20 @@ * Modified to recognize the architecture of the remote machine better. * * This appears to be the matrix of which protocol is used by which - * MS product. - Protocol WfWg Win95 WinNT OS/2 - PC NETWORK PROGRAM 1.0 1 1 1 1 - XENIX CORE 2 2 - MICROSOFT NETWORKS 3.0 2 2 - DOS LM1.2X002 3 3 - MICROSOFT NETWORKS 1.03 3 - DOS LANMAN2.1 4 4 - LANMAN1.0 4 3 - Windows for Workgroups 3.1a 5 5 5 - LM1.2X002 6 4 - LANMAN2.1 7 5 - NT LM 0.12 6 8 + * MS or IBM product. + MSCl/ + Protocol WfWg Win95 WinNT OS/2 DosLM + PC NETWORK PROGRAM 1.0 1 1 1 1 1 + XENIX CORE 2 2 2 + MICROSOFT NETWORKS 3.0 2 2 3 + DOS LM1.2X002 3 3 4 + MICROSOFT NETWORKS 1.03 3 5 + DOS LANMAN2.1 4 4 6 + LANMAN1.0 4 3 + Windows for Workgroups 3.1a 5 5 5 + LM1.2X002 6 4 + LANMAN2.1 7 5 + NT LM 0.12 6 8 * * tim@fsg.com 09/29/95 */ @@ -3049,7 +3079,7 @@ strcpy(remote_arch,"Samba"); break; case ARCH_WFWG: - strcpy(remote_arch,"WfWg"); + strcpy(remote_arch,"MSClient or WfWg"); break; case ARCH_WIN95: strcpy(remote_arch,"Win95"); @@ -3058,7 +3088,7 @@ strcpy(remote_arch,"WinNT"); break; case ARCH_OS2: - strcpy(remote_arch,"OS2"); + strcpy(remote_arch,"OS/2"); break; default: strcpy(remote_arch,"UNKNOWN"); @@ -3103,7 +3133,7 @@ } SSVAL(outbuf,smb_vwv0,choice); - DEBUG(5,("%s negprot index=%d\n",timestring(),choice)); + DEBUG(5,("%s negprot index=%d remote_arch=%s\n",timestring(),choice,remote_arch)); return(outsize); } @@ -3148,7 +3178,11 @@ lp_max_connections(SNUM(cnum))); if (lp_status(SNUM(cnum))) +#ifdef OS2 + yield_connection(cnum,"STATUS",MAXSTATUS); +#else yield_connection(cnum,"STATUS.",MAXSTATUS); +#endif close_open_files(cnum); dptr_closecnum(cnum); @@ -3382,7 +3416,11 @@ pstring dname; strcpy(dname,debugf); if ((p=strrchr(dname,'/'))) *p=0; +#ifdef OS2 + strcat(dname,"/corefile"); +#else strcat(dname,"/corefiles"); +#endif mkdir(dname,0700); sys_chown(dname,getuid(),getgid()); chmod(dname,0700); @@ -4144,7 +4182,7 @@ charset_initialise(); - /* make absolutely sure we run as root - to handle cases whre people + /* make absolutely sure we run as root - to handle cases where people are crazy enough to have it setuid */ #ifdef USE_SETRES setresuid(0,0,0); @@ -4157,6 +4195,9 @@ fault_setup(exit_server); signal(SIGTERM , SIGNAL_CAST dflt_sig); +#ifdef OS2 + signal(SIGINT , SIGNAL_CAST dflt_sig); +#endif /* we want total control over the permissions on created files, so set our umask to 0 */ @@ -4326,6 +4367,10 @@ DEBUG(2,("%s changed root to %s\n",timestring(),lp_rootdir())); } +#ifdef OS2 + DosError(0L); /* Suppress error window. If this is left out and a drive letter + turns out to be invalid, OS/2 wants human intervention. */ +#endif process(); close_sockets(); diff -u -r --new-file --exclude=CVS source/smb.h newsource/smb.h --- source/smb.h Thu Jul 31 18:55:22 1997 +++ newsource/smb.h Sun Aug 10 12:29:48 1997 @@ -58,7 +58,9 @@ #define BITSETW(ptr,bit) ((SVAL(ptr,0) & (1<<(bit)))!=0) #define PTR_DIFF(p1,p2) ((ptrdiff_t)(((char *)(p1)) - (char *)(p2))) +#ifndef OS2 typedef int BOOL; +#endif /* offset in shared memory */ typedef int smb_shm_offset_t; @@ -175,13 +177,14 @@ #define ERRbadshare 32 /* Share mode on file conflict with open mode */ #define ERRlock 33 /* Lock request conflicts with existing lock */ #define ERRfilexists 80 /* File in operation already exists */ +#define ERRcannotopen 110 /* Cannot open the file specified */ #define ERRbadpipe 230 /* Named pipe invalid */ #define ERRpipebusy 231 /* All instances of pipe are busy */ #define ERRpipeclosing 232 /* named pipe close in progress */ #define ERRnotconnected 233 /* No process on other end of named pipe */ #define ERRmoredata 234 /* More data to be returned */ #define ERROR_EAS_DIDNT_FIT 275 /* Extended attributes didn't fit */ -#define ERROR_EAS_NOT_SUPPORTED 282 /* Extended attributes not suppored */ +#define ERROR_EAS_NOT_SUPPORTED 282 /* Extended attributes not supported */ #define ERRunknownlevel 124 #define ERRunknownipc 2142 diff -u -r --new-file --exclude=CVS source/smbpass.c newsource/smbpass.c --- source/smbpass.c Fri Jul 18 20:44:52 1997 +++ newsource/smbpass.c Mon Aug 11 11:19:46 1997 @@ -33,6 +33,7 @@ int do_pw_lock(int fd, int waitsecs, int type) { +#if HAVE_FCNTL_LOCK struct flock lock; int ret; @@ -56,6 +57,9 @@ return -1; } return ret; +#else + return(0); +#endif } int pw_file_lock(char *name, int type, int secs) diff -u -r --new-file --exclude=CVS source/status.c newsource/status.c --- source/status.c Fri Jul 18 20:44:52 1997 +++ newsource/status.c Sun Aug 17 14:18:00 1997 @@ -100,8 +100,8 @@ if (IVAL(buf,0) != LOCKING_VERSION) { printf("%s: ERROR: read_share_file: share file %s has incorrect \ -locking version (was %d, should be %d).\n",fname, - progname, IVAL(buf,0), LOCKING_VERSION); +locking version (was %d, should be %d).\n",progname, + fname, IVAL(buf,0), LOCKING_VERSION); if(buf) free(buf); return 0; @@ -183,7 +183,7 @@ Ucrit_addUsername(optarg); /* added by OH */ break; default: - fprintf(stderr, "Usage: %s [-d] [-p] [-s configfile] [-u username]\n", *argv); /* changed by OH */ + fprintf(stderr, "Usage: %s [-b] [-d] [-p] [-s configfile] [-u username]\n", *argv); /* changed by OH */ return (-1); } } @@ -203,7 +203,11 @@ strcpy(fname,lp_lockdir()); standard_sub_basic(fname); trim_string(fname,"","/"); +#ifdef OS2 + strcat(fname,"/STATUS.LCK"); +#else strcat(fname,"/STATUS..LCK"); +#endif f = fopen(fname,"r"); if (!f) { @@ -223,13 +227,13 @@ if (brief) { - printf("PID Username Machine Time logged in\n"); - printf("-------------------------------------------------------------------\n"); + printf("PID Username Machine Time logged in\n"); + printf("------------------------------------------------------------------------\n"); } else { - printf("Service uid gid pid machine\n"); - printf("----------------------------------------------\n"); + printf("Service uid gid pid machine\n"); + printf("---------------------------------------------------\n"); } } @@ -276,7 +280,7 @@ add a sort at some time */ } else - printf("%-10.10s %-8s %-8s %5d %-8s (%s) %s", + printf("%-10.10s %-8s %-8s %10d %-8s (%s) %s", crec.name,uidtoname(crec.uid),gidtoname(crec.gid),crec.pid, crec.machine,crec.addr, asctime(LocalTime(&crec.start))); @@ -292,7 +296,7 @@ ptr=srecs; while (ptr!=NULL) { - printf("%-8d%-10.10s%-30.30s%s",ptr->pid,uidtoname(ptr->uid),ptr->machine,asctime(LocalTime(&(ptr->start)))); + printf("%-13d%-10.10s%-30.30s%s",ptr->pid,uidtoname(ptr->uid),ptr->machine,asctime(LocalTime(&(ptr->start)))); ptr=ptr->next; } printf("\n"); @@ -364,7 +368,12 @@ pstring lname; uint32 dev,inode; +#ifdef OS2 + dev=0; + if (sscanf(s,"%08x.shr",&inode)!=1) continue; +#else if (sscanf(s,"share.%u.%u",&dev,&inode)!=2) continue; +#endif strcpy(lname,lp_lockdir()); trim_string(lname,NULL,"/"); @@ -378,6 +387,7 @@ continue; } +#if HAVE_FCNTL_LOCK /* Lock the share mode file while we read it. */ if(fcntl_lock(fd, F_SETLKW, 0, 1, F_WRLCK) == False) { @@ -385,6 +395,7 @@ close(fd); continue; } +#endif if(( buf = read_share_file( fd, lname, argv[0] )) == NULL) { @@ -411,12 +422,12 @@ if (firstopen) { firstopen=False; printf("Locked files:\n"); - printf("Pid DenyMode R/W Name\n"); - printf("------------------------------\n"); + printf("Pid DenyMode R/W Name\n"); + printf("-----------------------------------\n"); } - printf("%-5d ",pid); + printf("%-10d ",pid); switch ((mode>>4)&0xF) { case DENY_NONE: printf("DENY_NONE "); break; diff -u -r --new-file --exclude=CVS source/system.c newsource/system.c --- source/system.c Wed Jul 2 00:19:00 1997 +++ newsource/system.c Mon Aug 11 14:18:38 1997 @@ -101,6 +101,13 @@ selrtn = select(255,SELECT_CAST fds,NULL,NULL,tval?&t2:NULL); } while (selrtn<0 && errno == EINTR); +#ifdef OS2 + if ( selrtn == 0 ) { + /* EMX select() does not reset fds [Jason Rumney] */ + FD_ZERO( fds ) ; + } +#endif + return(selrtn); } #endif @@ -289,7 +296,7 @@ /* Try to preserve ownership. For non-root it might fail, but that's ok. But root probably wants to know, e.g. if NFS disallows it. */ - if (chown (dest, source_stats.st_uid, source_stats.st_gid) + if (sys_chown(dest, source_stats.st_uid, source_stats.st_gid) && (errno != EPERM)) { return 1; @@ -334,7 +341,7 @@ /******************************************************************* chown isn't used much but OS/2 doesn't have it ********************************************************************/ -int sys_chown(char *fname,int uid,int gid) +int sys_chown(const char *fname,int uid,int gid) { #ifdef NO_CHOWN DEBUG(1,("Warning - chown(%s,%d,%d) not done\n",fname,uid,gid)); @@ -344,7 +351,7 @@ } /******************************************************************* -os/2 also doesn't have chroot +OS/2 also doesn't have chroot ********************************************************************/ int sys_chroot(char *dname) { @@ -391,4 +398,65 @@ sprintf(query, "%s%s", name, domain); return(gethostbyname(query)); } + +/******************************************************************* +create a wrapper for statfs() out of this by moving the rest of the +statfs() stuff from server.c to here? +********************************************************************/ +int sys_statfs(char *path, struct statfs *fs, size_t size, int x) +{ +#ifdef OS2 +int ret; +char driveletter; +pstring abspath; +APIRET rc; +FSALLOCATE fsinfo; + +/* Incomplete implementation of statfs() for OS/2 */ + + ret=_abspath(abspath, path, 1024); + if (ret==-1) + return(-1); + driveletter=_tolower(abspath[0]); + if ((driveletter < 'a') || (driveletter > 'z')) + return(-1); + + rc = DosQueryFSInfo((ULONG)(driveletter-'a'+1),FSIL_ALLOC,&fsinfo,sizeof(FSALLOCATE)); + if (rc != 0) return(-1); + + memset(fs, 0, size); + fs->f_bfree=(long)fsinfo.cUnitAvail; + fs->f_bsize=(long)(fsinfo.cbSector * fsinfo.cSectorUnit); + fs->f_blocks=(long)fsinfo.cUnit; +#endif + return(0); +} + +#ifdef OS2 +/***************************************************************************** + 'Fix' for stat() and fstat() for OS/2 because EMX returns a different value + for st_ino on each call. Workaround: use checksum of filename instead. +*****************************************************************************/ +void fix_stat(char *name, struct stat *sbuf) +{ + +int res = 0; +int c; +int i=0; +pstring tmpname; +char *s; + + strcpy(tmpname, name); + strupr(tmpname); /* OS/2's filesystems are case insensitive. */ + s=tmpname; + while (*s) { /* Now checksum the filename. */ + c = *s; + res ^= (c << (i % 15)) ^ (c >> (15-(i%15))); + s++; i++; + } + sbuf->st_dev=0; + sbuf->st_ino=(ino_t)res; /* Use the checksum as a fake inode number */ + return; +} +#endif diff -u -r --new-file --exclude=CVS source/trans2.c newsource/trans2.c --- source/trans2.c Thu Jul 24 18:50:36 1997 +++ newsource/trans2.c Wed Aug 27 23:58:48 1997 @@ -1055,15 +1055,9 @@ pdata = *ppdata = Realloc(*ppdata, data_size); if (total_data > 0 && IVAL(pdata,0) == total_data) { - /* uggh, EAs for OS2 */ + /* Extended attributes for OS/2 not supported */ DEBUG(4,("Rejecting EA request with total_data=%d\n",total_data)); -#if 0 - SSVAL(params,0,ERROR_EAS_NOT_SUPPORTED); - send_trans2_replies(outbuf, bufsize, params, 2, *ppdata, 0); - return(-1); -#else return(ERROR(ERRDOS,ERROR_EAS_NOT_SUPPORTED)); -#endif } bzero(pdata,data_size); @@ -1079,7 +1073,7 @@ SIVAL(pdata,l1_cbFile,size); SIVAL(pdata,l1_cbFileAlloc,ROUNDUP(size,1024)); SSVAL(pdata,l1_attrFile,mode); - SIVAL(pdata,l1_attrFile+2,4); /* this is what OS2 does */ + SIVAL(pdata,l1_attrFile+2,4); /* this is what OS/2 does */ break; case SMB_INFO_QUERY_EAS_FROM_LIST: @@ -1098,7 +1092,7 @@ break; case 6: - return(ERROR(ERRDOS,ERRbadfunc)); /* os/2 needs this */ + return(ERROR(ERRDOS,ERRbadfunc)); /* OS/2 needs this */ case SMB_QUERY_FILE_BASIC_INFO: data_size = 36; /* w95 returns 40 bytes not 36 - why ?. */ @@ -1255,13 +1249,9 @@ mode = dos_mode(cnum,fname,&st); if (total_data > 0 && IVAL(pdata,0) == total_data) { - /* uggh, EAs for OS2 */ + /* Extended attributes for OS/2 not supported */ DEBUG(4,("Rejecting EA request with total_data=%d\n",total_data)); - SSVAL(params,0,ERROR_EAS_NOT_SUPPORTED); - - send_trans2_replies(outbuf, bufsize, params, 2, *ppdata, 0); - - return(-1); + return(ERROR(ERRDOS,ERROR_EAS_NOT_SUPPORTED)); } switch (info_level) diff -u -r --new-file --exclude=CVS source/uid.c newsource/uid.c --- source/uid.c Fri Jul 18 20:44:56 1997 +++ newsource/uid.c Tue Aug 12 23:20:24 1997 @@ -395,25 +395,12 @@ int uid = current_user.uid; int gid = current_user.gid; -#if USE_SYSTEM +#ifdef OS2 int ret; pstring syscmd; - char *path = lp_smbrun(); - - /* in the old method we use system() to execute smbrun which then - executes the command (using system() again!). This involves lots - of shell launches and is very slow. It also suffers from a - potential security hole */ - if (!file_exist(path,NULL)) - { - DEBUG(0,("SMBRUN ERROR: Can't find %s. Installation problem?\n",path)); - return(1); - } - - sprintf(syscmd,"%s %d %d \"(%s 2>&1) > %s\"", - path,uid,gid,cmd, - outfile?outfile:"/dev/null"); + strcpy(syscmd, cmd); + sprintf(syscmd,"%s >%s 2>&1",cmd,outfile?outfile:"NUL"); DEBUG(5,("smbrun - running %s ",syscmd)); ret = system(syscmd); DEBUG(5,("gave %d\n",ret)); @@ -439,10 +426,14 @@ /* point our stdout at the file we want output to go into */ if (outfile && !setup_stdout_file(outfile,shared)) { +#ifdef AMIGA + _exit(80); +#else exit(80); +#endif } - /* now completely lose our privilages. This is a fairly paranoid + /* now completely lose our privileges. This is a fairly paranoid way of doing it, but it does work on all systems that I know of */ #ifdef USE_SETRES setresgid(0,0,0); @@ -461,7 +452,12 @@ if (getuid() != uid || geteuid() != uid || getgid() != gid || getegid() != gid) { /* we failed to lose our privilages - do not execute the command */ - exit(81); /* we can't print stuff at this stage, instead use exit codes +#ifdef AMIGA + _exit(81); +#else + exit(81); +#endif + /* we can't print stuff at this stage, instead use exit codes for debugging */ } @@ -472,7 +468,11 @@ execl("/bin/sh","sh","-c",cmd,NULL); /* not reached */ +#ifdef AMIGA + _exit(82); +#else exit(82); +#endif #endif return 1; } diff -u -r --new-file --exclude=CVS source/util.c newsource/util.c --- source/util.c Thu Jul 31 18:55:24 1997 +++ newsource/util.c Tue Aug 12 23:30:00 1997 @@ -278,10 +278,21 @@ char *tmpdir(void) { char *p; +#ifdef OS2 + if ((p = getenv("TMP"))) { + return p; + } + return "\\"; +#else if ((p = getenv("TMPDIR"))) { return p; } +#ifdef AMIGA + return "T:"; +#else return "/tmp"; +#endif +#endif } @@ -1279,7 +1290,12 @@ BOOL valid; } ino_list[MAX_GETWDCACHE]; +#ifdef OS2 +BOOL use_getwd_cache=False; +#else +/* But smb.conf.5 says Default getwd cache = No! */ BOOL use_getwd_cache=True; +#endif /******************************************************************* return the absolute current directory path @@ -2552,6 +2568,7 @@ { pstring ans; printf("%s",p); + fflush(stdout); if (!fgets(ans,sizeof(ans)-1,stdin)) return(False); @@ -3324,6 +3341,7 @@ sprintf(s,"/proc/%d",pid); return(directory_exist(s,NULL)); #else +#ifndef NO_PROC { static BOOL tested=False; static BOOL ok=False; @@ -3340,7 +3358,21 @@ } /* CGH 8/16/96 - added ESRCH test */ +#else +#ifndef OS2 return(pid == getpid() || kill(pid,0) == 0 || errno != ESRCH); +#else + { + pstring syscmd; + if (pid == getpid() || kill(pid,0) == 0 || errno != ESRCH) + return(True); + /* kill(pid,0) in EMX only works for direct child processes. + This hack is slow, but only used by SMBSTAT.EXE. */ + sprintf(syscmd,"existpid.cmd %x", pid); + return(system(syscmd)); + } +#endif +#endif #endif }