summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/.cvsignore4
-rw-r--r--source3/Makefile.in322
-rw-r--r--source3/acconfig.h49
-rw-r--r--source3/client/client.c70
-rw-r--r--source3/client/clientutil.c10
-rw-r--r--source3/client/ntclient.c4
-rw-r--r--source3/client/smbmount.c62
-rwxr-xr-xsource3/configure4791
-rw-r--r--source3/configure.in578
-rw-r--r--source3/include/config.h.in397
-rw-r--r--source3/include/includes.h1426
-rw-r--r--source3/include/local.h6
-rw-r--r--source3/include/proto.h39
-rw-r--r--source3/include/smb.h39
-rwxr-xr-xsource3/install-sh238
-rw-r--r--source3/lib/access.c2
-rw-r--r--source3/lib/fault.c8
-rw-r--r--source3/lib/getsmbpass.c25
-rw-r--r--source3/lib/interface.c227
-rw-r--r--source3/lib/netmask.c351
-rw-r--r--source3/lib/replace.c236
-rw-r--r--source3/lib/signal.c102
-rw-r--r--source3/lib/slprintf.c4
-rw-r--r--source3/lib/system.c34
-rw-r--r--source3/lib/time.c47
-rw-r--r--source3/lib/ufc.c5
-rw-r--r--source3/lib/username.c7
-rw-r--r--source3/lib/util.c273
-rw-r--r--source3/libsmb/clientgen.c16
-rw-r--r--source3/libsmb/namequery.c2
-rw-r--r--source3/libsmb/smberr.c4
-rw-r--r--source3/locking/locking.c11
-rw-r--r--source3/locking/locking_shm.c9
-rw-r--r--source3/locking/locking_slow.c46
-rw-r--r--source3/locking/shmem.c6
-rw-r--r--source3/locking/shmem_sysv.c11
-rw-r--r--source3/nmbd/asyncdns.c10
-rw-r--r--source3/nmbd/nmbd.c16
-rw-r--r--source3/param/loadparm.c46
-rw-r--r--source3/passdb/ldap.c2
-rw-r--r--source3/passdb/nispass.c14
-rw-r--r--source3/passdb/passdb.c306
-rw-r--r--source3/passdb/smbpass.c2
-rw-r--r--source3/passdb/smbpassfile.c4
-rw-r--r--source3/printing/pcap.c3
-rwxr-xr-xsource3/script/installman.sh2
-rwxr-xr-xsource3/script/installswat.sh4
-rw-r--r--source3/smbd/chgpasswd.c58
-rw-r--r--source3/smbd/dfree.c231
-rw-r--r--source3/smbd/dir.c301
-rw-r--r--source3/smbd/ipc.c4
-rw-r--r--source3/smbd/password.c107
-rw-r--r--source3/smbd/quotas.c6
-rw-r--r--source3/smbd/server.c403
-rw-r--r--source3/smbd/smbrun.c9
-rw-r--r--source3/smbd/ssl.c6
-rw-r--r--source3/smbd/uid.c279
-rw-r--r--source3/smbd/vt_mode.c12
-rw-r--r--source3/tests/README10
-rw-r--r--source3/tests/fcntl_lock.c78
-rw-r--r--source3/tests/ftruncate.c24
-rw-r--r--source3/tests/shared_mmap.c66
-rw-r--r--source3/tests/sysv_ipc.c66
-rw-r--r--source3/tests/trapdoor.c25
-rw-r--r--source3/ubiqx/.cvsignore1
-rw-r--r--source3/utils/nmblookup.c4
-rw-r--r--source3/utils/status.c4
-rw-r--r--source3/utils/torture.c4
-rw-r--r--source3/web/.cvsignore1
69 files changed, 8356 insertions, 3213 deletions
diff --git a/source3/.cvsignore b/source3/.cvsignore
index e10b688354..53c5143160 100644
--- a/source3/.cvsignore
+++ b/source3/.cvsignore
@@ -1,4 +1,8 @@
Makefile.RPM
+config.cache
+config.h
+config.log
+config.status
cvs.log
make_printerdef
make_smbcodepage
diff --git a/source3/Makefile.in b/source3/Makefile.in
new file mode 100644
index 0000000000..4c31571dca
--- /dev/null
+++ b/source3/Makefile.in
@@ -0,0 +1,322 @@
+###########################################################################
+# Makefile.in for Samba - rewritten for autoconf support
+# Copyright Andrew Tridgell 1992-1998
+###########################################################################
+
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+INSTALL_BIN=$(exec_prefix)/bin
+INSTALL_MAN=$(prefix)/man
+
+LIBS1=@LIBS@
+CC=@CC@
+CFLAGS=@CFLAGS@
+AWK=@AWK@
+
+INSTALLCMD=@INSTALL@
+
+VPATH=@srcdir@
+srcdir=@srcdir@
+SHELL=/bin/sh
+
+.SUFFIXES:
+.SUFFIXES: .c .o
+
+BASEDIR=$(prefix)/samba
+BINDIR = $(BASEDIR)/bin
+SBINDIR = $(BASEDIR)/bin
+LIBDIR = $(BASEDIR)/lib
+VARDIR = $(BASEDIR)/var
+MANDIR = $(BASEDIR)/man
+
+# The permissions to give the executables
+INSTALLPERMS = 0755
+
+# Add any optimisation or debugging flags here
+# add -DSYSLOG for syslog support
+FLAGS1 = -O
+
+# 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.conf
+LMHOSTSFILE = $(LIBDIR)/lmhosts
+DRIVERFILE = $(LIBDIR)/printers.def
+SMB_PASSWD = $(BINDIR)/smbpasswd
+SMB_PASSWD_FILE = $(BASEDIR)/private/smbpasswd
+
+# This is where SWAT images and help files go
+SWATDIR = $(BASEDIR)/swat
+
+# the directory where lock files go
+LOCKDIR = $(VARDIR)/locks
+
+# The directory where code page definition files go
+CODEPAGEDIR = $(LIBDIR)/codepages
+# The current codepage definition list.
+CODEPAGELIST= 437 737 850 852 861 932 866 949 950 936
+
+# 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))
+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
+
+
+PASSWD_FLAGS = -DSMB_PASSWD=\"$(SMB_PASSWD)\" -DSMB_PASSWD_FILE=\"$(SMB_PASSWD_FILE)\"
+FLAGS1 = $(CFLAGS) -I. -I$(srcdir)/ubiqx -DSMBLOGFILE=\"$(SMBLOGFILE)\" -DNMBLOGFILE=\"$(NMBLOGFILE)\"
+FLAGS2 = -DCONFIGFILE=\"$(CONFIGFILE)\" -DLMHOSTSFILE=\"$(LMHOSTSFILE)\" -DWEB_ROOT=\"$(WEB_ROOT)\" $(REGEX_FLAGS)
+FLAGS3 = -DSWATDIR=\"$(SWATDIR)\" -DSBINDIR=\"$(SBINDIR)\" -DLOCKDIR=\"$(LOCKDIR)\" -DSMBRUN=\"$(SMBRUN)\" -DCODEPAGEDIR=\"$(CODEPAGEDIR)\"
+FLAGS4 = -DWORKGROUP=\"$(WORKGROUP)\" -DGUEST_ACCOUNT=\"$(GUESTACCOUNT)\" -DDRIVERFILE=\"$(DRIVERFILE)\"
+FLAGS5 = $(FLAGS1) $(FLAGS2) $(FLAGS3) $(FLAGS4) $(AFS_FLAGS) $(KRB5_FLAGS) $(KRB4_FLAGS) $(RPM_OPT_FLAGS) -DHAVE_INCLUDES_H
+
+FLAGS = $(FLAGS5) $(PAM_FLAGS) $(DCE_FLAGS) $(DES_FLAGS) $(PASSWD_FLAGS) $(VTP_FLAGS) $(NISPLUS_FLAGS) $(LDAP_FLAGS) $(SSL_CFLAGS)
+LIBS = $(LIBS1) $(LIBSM) $(PAM_LIBS) $(DCE_LIBS) $(KRB5_LIBS) $(KRB4_LIBS) $(DES_LIB) $(LDAP_LIBS) $(SSL_LIBS)
+
+SPROGS = smbd nmbd swat
+PROGS1 = smbclient testparm testprns smbrun smbstatus smbpasswd make_smbcodepage
+PROGS = $(PROGS1) nmblookup make_printerdef $(MOUNT_PROGS)
+
+SCRIPTS = smbtar addtosmbpass
+
+
+######################################################################
+# object modules
+######################################################################
+
+# modules in the ubiqx library from Chris Hertel
+UBIOBJ = ubiqx/ubi_dLinkList.o ubiqx/ubi_Cache.o ubiqx/ubi_SplayTree.o \
+ ubiqx/ubi_BinTree.o ubiqx/ubi_sLinkList.o
+
+# client specific object code in the lib/rpc directory
+RPC_CLI_OBJ = lib/rpc/client/cli_login.o lib/rpc/client/cli_netlogon.o lib/rpc/client/cli_samr.o \
+ lib/rpc/client/cli_wkssvc.o lib/rpc/client/cli_lsarpc.o lib/rpc/client/cli_pipe.o \
+ lib/rpc/client/cli_srvsvc.o lib/rpc/client/ntclienttrust.o
+
+# client code that needs to do in the server in the lib/rpc directory.
+RPC_CLIENT_SERVER_SUBSET_OBJ = lib/rpc/client/cli_pipe.o lib/rpc/client/cli_login.o \
+ lib/rpc/client/cli_netlogon.o
+
+# server specific object code in the lib/rpc directory
+RPC_SERV_OBJ = lib/rpc/server/srv_lsa.o lib/rpc/server/srv_netlog.o lib/rpc/server/srv_reg.o \
+ lib/rpc/server/srv_srvsvc.o lib/rpc/server/srv_wkssvc.o \
+ lib/rpc/server/srv_lsa_hnd.o lib/rpc/server/srv_pipe_hnd.o \
+ lib/rpc/server/srv_samr.o lib/rpc/server/srv_util.o
+
+# parse object files in the lib/rpc subdirectory
+RPC_OBJ = lib/rpc/parse/parse_lsa.o lib/rpc/parse/parse_net.o lib/rpc/parse/parse_reg.o \
+ lib/rpc/parse/parse_samr.o lib/rpc/parse/parse_wks.o lib/rpc/parse/parse_misc.o \
+ lib/rpc/parse/parse_prs.o lib/rpc/parse/parse_rpc.o lib/rpc/parse/parse_srv.o
+
+
+# password database object files
+PASSDB_OBJ = passdb.o ldap.o smbpass.o nisppass.o smbpassfile.o
+
+# general utility object files
+UTILOBJ1 = util.o system.o charset.o kanji.o fault.o smbencrypt.o smbdes.o charcnv.o genrand.o
+UTILOBJ2 = $(UTILOBJ1) md4.o loadparm.o params.o pcap.o username.o time.o membuffer.o namequery.o nmblib.o
+UTILOBJ3 = $(UTILOBJ2) signal.o netmask.o dfree.o
+UTILOBJ = $(UTILOBJ3) credentials.o interface.o replace.o print_svid.o smberr.o pidfile.o slprintf.o $(SSL_OBJ)
+
+# Client utility object files.
+CLIENTUTIL = clientgen.o nterr.o
+
+# object code for smbd
+SMBDOBJ1 = $(UTILOBJ) trans2.o nttrans.o message.o dir.o printing.o
+SMBDOBJ2 = ipc.o reply.o mangle.o chgpasswd.o password.o quotas.o uid.o
+SMBDOBJ3 = predict.o pipes.o server.o access.o
+SMBDOBJ4 = ufc.o connection.o groupname.o
+SMBDOBJ = $(SMBDOBJ1) $(SMBDOBJ2) $(SMBDOBJ3) $(SMBDOBJ4) $(UBIOBJ) $(RPC_OBJ) $(RPC_SERV_OBJ) \
+ $(RPC_CLIENT_SERVER_SUBSET_OBJ) $(VTP_OBJ) $(LOCKOBJ) $(CLIENTUTIL) $(PASSDB_OBJ)
+
+# object code needed for programs that handle the the locking files
+LOCKOBJ = locking_shm.o locking_slow.o locking.o shmem.o shmem_sysv.o
+
+# object code for nmbd
+NMBDOBJ1 = $(PASSDB_OBJ) nmbd.o nmbd_packets.o nmbd_lmhosts.o nmbd_become_dmb.o nmbd_logonnames.o
+NMBDOBJ2 = nmbd_browserdb.o nmbd_responserecordsdb.o nmbd_workgroupdb.o nmbd_serverlistdb.o
+NMBDOBJ3 = nmbd_subnetdb.o nmbd_browsesync.o nmbd_nodestatus.o nmbd_mynames.o nmbd_winsproxy.o
+NMBDOBJ4 = nmbd_sendannounce.o nmbd_processlogon.o nmbd_incomingdgrams.o
+NMBDOBJ5 = asyncdns.o nmbd_winsserver.o nmbd_incomingrequests.o nmbd_nameregister.o
+NMBDOBJ6 = nmbd_namerelease.o nmbd_namequery.o nmbd_become_lmb.o nmbd_elections.o nmbd_namelistdb.o
+
+NMBDOBJ = $(UTILOBJ) $(NMBDOBJ1) $(NMBDOBJ2) $(NMBDOBJ3) $(NMBDOBJ4) $(NMBDOBJ5) $(NMBDOBJ6) $(CLIENTUTIL) $(UBIOBJ)
+
+# object files for smbclient
+CLIENT_OBJ = client.o clientutil.o clitar.o getsmbpass.o $(UTILOBJ)
+
+# object files for smbmount
+MOUNT_OBJ = smbmount.o clientutil.o getsmbpass.o $(UTILOBJ)
+
+# object files for smbmnt
+MNT_OBJ = smbmnt.o
+
+# object files for smbumount
+UMOUNT_OBJ = smbumount.o $(UTILOBJ)
+
+# object files for smbstatus
+STATUS_OBJ = status.o $(UTILOBJ) $(LOCKOBJ)
+
+# object files for nmblookup
+LOOKUP_OBJ = nmblookup.o $(UTILOBJ)
+
+# object files for swat
+SWAT_OBJ = web/swat.o web/statuspage.o web/cgi.o web/diagnose.o web/startstop.o password.o $(PASSDB_OBJ) \
+ $(RPC_CLIENT_SERVER_SUBSET_OBJ) $(RPC_OBJ) $(UTILOBJ) $(LOCKOBJ) $(CLIENTUTIL)
+
+# object files to be auto-prototyped
+PROTOOBJ = $(UTILOBJ) $(SMBDOBJ) $(NMBDOBJ) $(LOCKOBJ) $(CLIENT_OBJ) $(STATUS_OBJ) $(SWAT_OBJ) \
+ $(CLIENTUTIL) $(PASSDB_OBJ)
+
+######################################################################
+# now the rules...
+######################################################################
+
+all : $(SPROGS) $(PROGS)
+
+.SUFFIXES:
+.SUFFIXES: .c .o .h
+
+.c.o: $(INCLUDES)
+ @echo Compiling $*.c
+ @$(CC) -I. -I$(srcdir) $(FLAGS) -c $< -o $@
+
+smbd: $(SMBDOBJ)
+ @echo Linking smbd
+ @$(CC) $(FLAGS) -o smbd $(SMBDOBJ) $(LIBS) $(AFS_LIBS)
+
+smbrun: smbrun.o
+ @echo Linking smbrun
+ @$(CC) $(FLAGS) -o smbrun smbrun.o $(LIBS)
+
+nmblookup: $(LOOKUP_OBJ)
+ @echo Linking nmblookup
+ @$(CC) $(FLAGS) -o nmblookup $(LOOKUP_OBJ) $(LIBS)
+
+nmbd: $(NMBDOBJ)
+ @echo Linking nmbd
+ @$(CC) $(FLAGS) -o nmbd $(NMBDOBJ) $(LIBS)
+
+smbclient: $(CLIENT_OBJ)
+ @echo Linking smbclient
+ @$(CC) $(FLAGS) -o smbclient $(CLIENT_OBJ) $(LIBS)
+
+smbmount: $(MOUNT_OBJ)
+ @echo Linking smbmount
+ @$(CC) $(FLAGS) -o smbmount $(MOUNT_OBJ) $(LIBS)
+
+smbmnt: $(MNT_OBJ)
+ @echo Linking smbmnt
+ @$(CC) $(FLAGS) -o smbmnt $(MNT_OBJ)
+
+smbumount: $(UMOUNT_OBJ)
+ @echo Linking smbumount
+ @$(CC) $(FLAGS) -o smbumount $(UMOUNT_OBJ)
+
+smbtorture: torture.o getsmbpass.o $(UTILOBJ) $(CLIENTUTIL)
+ @echo Linking smbtorture
+ @$(CC) $(FLAGS) -o smbtorture torture.o getsmbpass.o $(UTILOBJ) $(CLIENTUTIL) $(LIBS)
+
+smbstatus: $(STATUS_OBJ)
+ @echo Linking smbstatus
+ @$(CC) $(FLAGS) -o smbstatus $(STATUS_OBJ) $(LIBS)
+
+testparm: testparm.o access.o $(UTILOBJ)
+ @echo Linking testparm
+ @$(CC) $(FLAGS) -o testparm testparm.o access.o $(UTILOBJ) $(LIBS)
+
+testprns: testprns.o $(UTILOBJ)
+ @echo Linking testprns
+ @$(CC) $(FLAGS) -o testprns testprns.o $(UTILOBJ) $(LIBS)
+
+smbpasswd: smbpasswd.o getsmbpass.o $(PASSDB_OBJ) $(UTILOBJ) $(CLIENTUTIL) $(RPC_CLIENT_SERVER_SUBSET_OBJ) $(RPC_OBJ)
+ @echo Linking smbpasswd
+ @$(CC) $(FLAGS) -o smbpasswd smbpasswd.o getsmbpass.o $(PASSDB_OBJ) $(UTILOBJ) $(CLIENTUTIL) \
+ $(RPC_CLIENT_SERVER_SUBSET_OBJ) $(RPC_OBJ) $(LIBS)
+
+make_smbcodepage: make_smbcodepage.o $(UTILOBJ)
+ @echo Linking make_smbcodepage
+ @$(CC) $(FLAGS) -o make_smbcodepage make_smbcodepage.o $(UTILOBJ) $(LIBS)
+
+make_printerdef: make_printerdef.o $(UTILOBJ)
+ @echo Linking make_printerdef
+ @$(CC) $(FLAGS) -o make_printerdef make_printerdef.o $(UTILOBJ) $(LIBS)
+
+wsmbstatus: wsmbstatus.o $(UTILOBJ)
+ @echo Linking wsmbstatus
+ @$(CC) $(FLAGS) -o wsmbstatus wsmbstatus.o $(UTILOBJ) $(LIBS)
+
+swat: $(SWAT_OBJ)
+ @echo Linking swat
+ @$(CC) $(FLAGS) -o swat $(SWAT_OBJ) $(LIBS)
+
+install: installbin installman installscripts installcp installswat
+
+installbin: all
+ @$(SHELL) $(srcdir)/installbin.sh $(INSTALLPERMS) $(BASEDIR) $(SBINDIR) $(LIBDIR) $(VARDIR) $(SPROGS)
+ @$(SHELL) $(srcdir)/installbin.sh $(INSTALLPERMS) $(BASEDIR) $(BINDIR) $(LIBDIR) $(VARDIR) $(PROGS)
+
+installscripts:
+ @$(SHELL) $(srcdir)/installscripts.sh $(INSTALLPERMS) $(BINDIR) $(SCRIPTS)
+
+installcp:
+ @$(SHELL) $(srcdir)/installcp.sh $(LIBDIR) $(CODEPAGEDIR) $(BINDIR) $(CODEPAGELIST)
+
+installswat:
+ @$(SHELL) $(srcdir)/installswat.sh $(SWATDIR) $(srcdir)
+
+# revert to the previously installed version
+revert:
+ @$(SHELL) $(srcdir)/revert.sh $(SBINDIR) $(SPROGS) $(SCRIPTS)
+ @$(SHELL) $(srcdir)/revert.sh $(BINDIR) $(PROGS) $(SCRIPTS)
+
+installman:
+ @$(SHELL) $(srcdir)/installman.sh $(MANDIR) $(srcdir)
+
+uninstall: uninstallman uninstallbin uninstallscripts uninstallcp
+
+uninstallman:
+ @$(SHELL) $(srcdir)/uninstallman.sh $(MANDIR) $(srcdir)
+
+uninstallbin:
+ @$(SHELL) $(srcdir)/uninstallbin.sh $(INSTALLPERMS) $(BASEDIR) $(SBINDIR) $(LIBDIR) $(VARDIR) $(SPROGS)
+ @$(SHELL) $(srcdir)/uninstallbin.sh $(INSTALLPERMS) $(BASEDIR) $(BINDIR) $(LIBDIR) $(VARDIR) $(PROGS)
+
+uninstallscripts:
+ @$(SHELL) $(srcdir)/uninstallscripts.sh $(INSTALLPERMS) $(BINDIR) $(SCRIPTS)
+
+uninstallcp:
+ @$(SHELL) $(srcdir)/uninstallcp.sh $(CODEPAGEDIR) $(CODEPAGELIST)
+
+clean:
+ @echo Cleaning up ...
+ @rm -f core *.o */*.o $(PROTOOBJ) lib/rpc/*/*.o *~ config.cache $(PROGS) $(SPROGS)
+
+cleandir: clean
+ rm -f .depend tags
+
+proto:
+ $(AWK) -f mkproto.awk `echo $(PROTOOBJ) | sed -e 's/\.o/\.c/g' | tr ' ' '\n' | sort | fgrep -v "ubiqx" | uniq` > proto.h
+
+etags:
+ etags `find . -name "*.[ch]"`
+
+ctags:
+ ctags `find . -name "*.[ch]"`
+
+realclean: clean
diff --git a/source3/acconfig.h b/source3/acconfig.h
new file mode 100644
index 0000000000..6ae9f1b73d
--- /dev/null
+++ b/source3/acconfig.h
@@ -0,0 +1,49 @@
+#undef HAVE_BROKEN_READDIR
+#undef HAVE_ERRNO_DECL
+#undef HAVE_LONGLONG
+#undef HAVE_OFF64_T
+#undef HAVE_REMSH
+#undef HAVE_UNSIGNED_CHAR
+#undef HAVE_UTIMBUF
+#undef ino_t
+#undef HAVE_CONNECT
+#undef HAVE_SHORT_INO_T
+#undef WITH_AFS
+#undef WITH_DFS
+#undef SUNOS5
+#undef SUNOS4
+#undef LINUX
+#undef AIX
+#undef IRIX
+#undef HPUX
+#undef QNX
+#undef SCO
+#undef OSF1
+#undef NEXT2
+#undef HAVE_SHARED_MMAP
+#undef HAVE_SYSV_IPC
+#undef HAVE_FCNTL_LOCK
+#undef HAVE_FTRUNCATE_EXTEND
+#undef HAVE_TRAPDOOR_UID
+#undef HAVE_ROOT
+#undef HAVE_UNION_SEMUN
+#undef HAVE_NETMASK_IFCONF
+#undef HAVE_GETTIMEOFDAY_TZ
+#undef HAVE_SOCK_SIN_LEN
+#undef STAT_READ_FILSYS
+#undef STAT_STATFS2_BSIZE
+#undef STAT_STATFS2_FSIZE
+#undef STAT_STATFS2_FS_DATA
+#undef STAT_STATFS3_OSF1
+#undef STAT_STATFS4
+#undef STAT_STATVFS
+#undef HAVE_NETMASK_IFREQ
+#undef HAVE_NETMASK_AIX
+#undef HAVE_CRYPT
+#undef WITH_MMAP
+#undef WITH_SYSLOG
+#undef WITH_SSL
+#undef WITH_LDAP
+#undef WITH_NISPLUS
+#undef WITH_AUTOMOUNT
+#undef HAVE_PAM_AUTHENTICATE
diff --git a/source3/client/client.c b/source3/client/client.c
index bdfa29f86b..b72a620730 100644
--- a/source3/client/client.c
+++ b/source3/client/client.c
@@ -19,9 +19,7 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#ifdef SYSLOG
-#undef SYSLOG
-#endif
+#define NO_SYSLOG
#include "includes.h"
@@ -2919,14 +2917,6 @@ try and browse available connections on a host
****************************************************************************/
static BOOL browse_host(BOOL sort)
{
-#ifdef NOSTRCASECMP
-/* If strcasecmp is already defined, remove it. */
-#ifdef strcasecmp
-#undef strcasecmp
-#endif /* strcasecmp */
-#define strcasecmp StrCaseCmp
-#endif /* NOSTRCASECMP */
-
char *rparam = NULL;
char *rdata = NULL;
char *p;
@@ -3313,61 +3303,25 @@ void cmd_help(char *dum_in, char *dum_out)
/****************************************************************************
wait for keyboard activity, swallowing network packets
****************************************************************************/
-#ifdef CLIX
-static char wait_keyboard(char *buffer)
-#else
static void wait_keyboard(char *buffer)
-#endif
{
fd_set fds;
int selrtn;
struct timeval timeout;
-#ifdef CLIX
- int delay = 0;
-#endif
-
while (1)
{
extern int Client;
FD_ZERO(&fds);
FD_SET(Client,&fds);
-#ifndef CLIX
FD_SET(fileno(stdin),&fds);
-#endif
timeout.tv_sec = 20;
timeout.tv_usec = 0;
-#ifdef CLIX
- timeout.tv_sec = 0;
-#endif
selrtn = sys_select(&fds,&timeout);
-#ifndef CLIX
if (FD_ISSET(fileno(stdin),&fds))
return;
-#else
- {
- char ch;
- int readret;
-
- set_blocking(fileno(stdin), False);
- readret = read_data( fileno(stdin), &ch, 1);
- set_blocking(fileno(stdin), True);
- if (readret == -1)
- {
- if (errno != EAGAIN)
- {
- /* should crash here */
- DEBUG(1,("readchar stdin failed\n"));
- }
- }
- else if (readret != 0)
- {
- return ch;
- }
- }
-#endif
/* We deliberately use receive_smb instead of
client_receive_smb as we want to receive
@@ -3376,16 +3330,7 @@ static void wait_keyboard(char *buffer)
if (FD_ISSET(Client,&fds))
receive_smb(Client,buffer,0);
-#ifdef CLIX
- delay++;
- if (delay > 100000)
- {
- delay = 0;
- chkpath("\\",False);
- }
-#else
chkpath("\\",False);
-#endif
}
}
@@ -3460,22 +3405,11 @@ static BOOL process(char *base_directory)
DEBUG(0,("smb: %s> ", CNV_LANG(cur_dir)));
fflush(dbf);
-#ifdef CLIX
- line[0] = wait_keyboard(InBuffer);
- /* this might not be such a good idea... */
- if ( line[0] == EOF)
- break;
-#else
wait_keyboard(InBuffer);
-#endif
/* and get a response */
-#ifdef CLIX
- fgets( &line[1],999, stdin);
-#else
if (!fgets(line,1000,stdin))
break;
-#endif
/* input language code to internal one */
CNV_INPUT (line);
@@ -3588,7 +3522,7 @@ static void usage(char *pname)
interpret_coding_system(term_code);
-#ifdef USE_SSL
+#ifdef WITH_SSL
sslutil_init(0);
#endif
diff --git a/source3/client/clientutil.c b/source3/client/clientutil.c
index e63f668481..da5ea531d2 100644
--- a/source3/client/clientutil.c
+++ b/source3/client/clientutil.c
@@ -19,9 +19,7 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#ifdef SYSLOG
-#undef SYSLOG
-#endif
+#define NO_SYSLOG
#include "includes.h"
@@ -338,9 +336,9 @@ BOOL cli_send_session_request(char *inbuf,char *outbuf)
_smb_setlen(outbuf,len);
CVAL(outbuf,0) = 0x81;
-#ifdef USE_SSL
+#ifdef WITH_SSL
retry:
-#endif /* USE_SSL */
+#endif /* WITH_SSL */
send_smb(Client,outbuf);
DEBUG(5,("Sent session request\n"));
@@ -377,7 +375,7 @@ retry:
return cli_send_session_request(inbuf,outbuf);
} /* C. Hoch 9/14/95 End */
-#ifdef USE_SSL
+#ifdef WITH_SSL
if(CVAL(inbuf,0) == 0x83 && CVAL(inbuf,4) == 0x8e) { /* use ssl */
fprintf(stderr, "Making secure connection\n");
if(!sslutil_fd_is_ssl(Client)){
diff --git a/source3/client/ntclient.c b/source3/client/ntclient.c
index 92d74e1d49..cb2f6ecf1a 100644
--- a/source3/client/ntclient.c
+++ b/source3/client/ntclient.c
@@ -20,9 +20,7 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#ifdef SYSLOG
-#undef SYSLOG
-#endif
+#define NO_SYSLOG
#include "includes.h"
diff --git a/source3/client/smbmount.c b/source3/client/smbmount.c
index 505552997b..2424513d68 100644
--- a/source3/client/smbmount.c
+++ b/source3/client/smbmount.c
@@ -19,9 +19,7 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#ifdef SYSLOG
-#undef SYSLOG
-#endif
+#define NO_SYSLOG
#include <linux/version.h>
#define LVERSION(major,minor,patch) (((((major)<<8)+(minor))<<8)+(patch))
@@ -295,7 +293,7 @@ send_fs_socket(char *mount_point, char *inbuf, char *outbuf)
/*
* Wait for a signal from smbfs ...
*/
- signal(SIGUSR1, &usr1_handler);
+ CatchSignal(SIGUSR1, &usr1_handler);
pause();
DEBUG(0, ("smbmount: got signal, getting new socket\n"));
@@ -450,61 +448,25 @@ void cmd_help(char *dum_in, char *dum_out)
/****************************************************************************
wait for keyboard activity, swallowing network packets
****************************************************************************/
-#ifdef CLIX
-static char wait_keyboard(char *buffer)
-#else
static void wait_keyboard(char *buffer)
-#endif
{
fd_set fds;
int selrtn;
struct timeval timeout;
-#ifdef CLIX
- int delay = 0;
-#endif
-
while (1)
{
extern int Client;
FD_ZERO(&fds);
FD_SET(Client,&fds);
-#ifndef CLIX
FD_SET(fileno(stdin),&fds);
-#endif
timeout.tv_sec = 20;
timeout.tv_usec = 0;
-#ifdef CLIX
- timeout.tv_sec = 0;
-#endif
selrtn = sys_select(&fds,&timeout);
-#ifndef CLIX
if (FD_ISSET(fileno(stdin),&fds))
return;
-#else
- {
- char ch;
- int readret;
-
- set_blocking(fileno(stdin), False);
- readret = read_data( fileno(stdin), &ch, 1);
- set_blocking(fileno(stdin), True);
- if (readret == -1)
- {
- if (errno != EAGAIN)
- {
- /* should crash here */
- DEBUG(1,("readchar stdin failed\n"));
- }
- }
- else if (readret != 0)
- {
- return ch;
- }
- }
-#endif
/* We deliberately use receive_smb instead of
client_receive_smb as we want to receive
@@ -513,16 +475,7 @@ static void wait_keyboard(char *buffer)
if (FD_ISSET(Client,&fds))
receive_smb(Client,buffer,0);
-#ifdef CLIX
- delay++;
- if (delay > 100000)
- {
- delay = 0;
- chkpath("\\",False);
- }
-#else
chkpath("\\",False);
-#endif
}
}
@@ -595,22 +548,11 @@ static BOOL process(char *base_directory)
DEBUG(0,("smb: %s> ", CNV_LANG(cur_dir)));
fflush(dbf);
-#ifdef CLIX
- line[0] = wait_keyboard(InBuffer);
- /* this might not be such a good idea... */
- if ( line[0] == EOF)
- break;
-#else
wait_keyboard(InBuffer);
-#endif
/* and get a response */
-#ifdef CLIX
- fgets( &line[1],999, stdin);
-#else
if (!fgets(line,1000,stdin))
break;
-#endif
/* input language code to internal one */
CNV_INPUT (line);
diff --git a/source3/configure b/source3/configure
new file mode 100755
index 0000000000..ef237b77a9
--- /dev/null
+++ b/source3/configure
@@ -0,0 +1,4791 @@
+#! /bin/sh
+
+# Guess values for system-dependent variables and create Makefiles.
+# Generated automatically using autoconf version 2.12
+# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
+#
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+
+# Defaults:
+ac_help=
+ac_default_prefix=/usr/local
+# Any additions from configure.in:
+ac_help="$ac_help
+ --with-afs Include AFS support
+ --without-afs Don't include AFS support (default)"
+ac_help="$ac_help
+ --with-dfs Include DFS support
+ --without-dfs Don't include DFS support (default)"
+ac_help="$ac_help
+ --with-automount Include AUTOMOUNT support
+ --without-automount Don't include AUTOMOUNT support (default)"
+ac_help="$ac_help
+ --with-ldap Include LDAP support
+ --without-ldap Don't include LDAP support (default)"
+ac_help="$ac_help
+ --with-nisplus Include NISPLUS password database support
+ --without-nisplus Don't include NISPLUS password database support (default)"
+ac_help="$ac_help
+ --with-ssl Include SSL support
+ --without-ssl Don't include SSL support (default)"
+ac_help="$ac_help
+ --with-mmap Include experimental MMAP support
+ --without-mmap Don't include MMAP support (default)"
+ac_help="$ac_help
+ --with-syslog Include experimental SYSLOG support
+ --without-syslog Don't include SYSLOG support (default)"
+
+# Initialize some variables set by options.
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+build=NONE
+cache_file=./config.cache
+exec_prefix=NONE
+host=NONE
+no_create=
+nonopt=NONE
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+target=NONE
+verbose=
+x_includes=NONE
+x_libraries=NONE
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datadir='${prefix}/share'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+libdir='${exec_prefix}/lib'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+infodir='${prefix}/info'
+mandir='${prefix}/man'
+
+# Initialize some other variables.
+subdirs=
+MFLAGS= MAKEFLAGS=
+# Maximum number of lines to put in a shell here document.
+ac_max_here_lines=12
+
+ac_prev=
+for ac_option
+do
+
+ # If the previous option needs an argument, assign it.
+ if test -n "$ac_prev"; then
+ eval "$ac_prev=\$ac_option"
+ ac_prev=
+ continue
+ fi
+
+ case "$ac_option" in
+ -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
+ *) ac_optarg= ;;
+ esac
+
+ # Accept the important Cygnus configure options, so we can diagnose typos.
+
+ case "$ac_option" in
+
+ -bindir | --bindir | --bindi | --bind | --bin | --bi)
+ ac_prev=bindir ;;
+ -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+ bindir="$ac_optarg" ;;
+
+ -build | --build | --buil | --bui | --bu)
+ ac_prev=build ;;
+ -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+ build="$ac_optarg" ;;
+
+ -cache-file | --cache-file | --cache-fil | --cache-fi \
+ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+ ac_prev=cache_file ;;
+ -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+ cache_file="$ac_optarg" ;;
+
+ -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
+ ac_prev=datadir ;;
+ -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
+ | --da=*)
+ datadir="$ac_optarg" ;;
+
+ -disable-* | --disable-*)
+ ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
+ # Reject names that are not valid shell variable names.
+ if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
+ { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
+ fi
+ ac_feature=`echo $ac_feature| sed 's/-/_/g'`
+ eval "enable_${ac_feature}=no" ;;
+
+ -enable-* | --enable-*)
+ ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
+ # Reject names that are not valid shell variable names.
+ if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
+ { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
+ fi
+ ac_feature=`echo $ac_feature| sed 's/-/_/g'`
+ case "$ac_option" in
+ *=*) ;;
+ *) ac_optarg=yes ;;
+ esac
+ eval "enable_${ac_feature}='$ac_optarg'" ;;
+
+ -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+ | --exec | --exe | --ex)
+ ac_prev=exec_prefix ;;
+ -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+ | --exec=* | --exe=* | --ex=*)
+ exec_prefix="$ac_optarg" ;;
+
+ -gas | --gas | --ga | --g)
+ # Obsolete; use --with-gas.
+ with_gas=yes ;;
+
+ -help | --help | --hel | --he)
+ # Omit some internal or obsolete options to make the list less imposing.
+ # This message is too long to be a string in the A/UX 3.1 sh.
+ cat << EOF
+Usage: configure [options] [host]
+Options: [defaults in brackets after descriptions]
+Configuration:
+ --cache-file=FILE cache test results in FILE
+ --help print this message
+ --no-create do not create output files
+ --quiet, --silent do not print \`checking...' messages
+ --version print the version of autoconf that created configure
+Directory and file names:
+ --prefix=PREFIX install architecture-independent files in PREFIX
+ [$ac_default_prefix]
+ --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
+ [same as prefix]
+ --bindir=DIR user executables in DIR [EPREFIX/bin]
+ --sbindir=DIR system admin executables in DIR [EPREFIX/sbin]
+ --libexecdir=DIR program executables in DIR [EPREFIX/libexec]
+ --datadir=DIR read-only architecture-independent data in DIR
+ [PREFIX/share]
+ --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc]
+ --sharedstatedir=DIR modifiable architecture-independent data in DIR
+ [PREFIX/com]
+ --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var]
+ --libdir=DIR object code libraries in DIR [EPREFIX/lib]
+ --includedir=DIR C header files in DIR [PREFIX/include]
+ --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include]
+ --infodir=DIR info documentation in DIR [PREFIX/info]
+ --mandir=DIR man documentation in DIR [PREFIX/man]
+ --srcdir=DIR find the sources in DIR [configure dir or ..]
+ --program-prefix=PREFIX prepend PREFIX to installed program names
+ --program-suffix=SUFFIX append SUFFIX to installed program names
+ --program-transform-name=PROGRAM
+ run sed PROGRAM on installed program names
+EOF
+ cat << EOF
+Host type:
+ --build=BUILD configure for building on BUILD [BUILD=HOST]
+ --host=HOST configure for HOST [guessed]
+ --target=TARGET configure for TARGET [TARGET=HOST]
+Features and packages:
+ --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
+ --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
+ --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
+ --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
+ --x-includes=DIR X include files are in DIR
+ --x-libraries=DIR X library files are in DIR
+EOF
+ if test -n "$ac_help"; then
+ echo "--enable and --with options recognized:$ac_help"
+ fi
+ exit 0 ;;
+
+ -host | --host | --hos | --ho)
+ ac_prev=host ;;
+ -host=* | --host=* | --hos=* | --ho=*)
+ host="$ac_optarg" ;;
+
+ -includedir | --includedir | --includedi | --included | --include \
+ | --includ | --inclu | --incl | --inc)
+ ac_prev=includedir ;;
+ -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+ | --includ=* | --inclu=* | --incl=* | --inc=*)
+ includedir="$ac_optarg" ;;
+
+ -infodir | --infodir | --infodi | --infod | --info | --inf)
+ ac_prev=infodir ;;
+ -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+ infodir="$ac_optarg" ;;
+
+ -libdir | --libdir | --libdi | --libd)
+ ac_prev=libdir ;;
+ -libdir=* | --libdir=* | --libdi=* | --libd=*)
+ libdir="$ac_optarg" ;;
+
+ -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+ | --libexe | --libex | --libe)
+ ac_prev=libexecdir ;;
+ -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+ | --libexe=* | --libex=* | --libe=*)
+ libexecdir="$ac_optarg" ;;
+
+ -localstatedir | --localstatedir | --localstatedi | --localstated \
+ | --localstate | --localstat | --localsta | --localst \
+ | --locals | --local | --loca | --loc | --lo)
+ ac_prev=localstatedir ;;
+ -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+ | --localstate=* | --localstat=* | --localsta=* | --localst=* \
+ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
+ localstatedir="$ac_optarg" ;;
+
+ -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+ ac_prev=mandir ;;
+ -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+ mandir="$ac_optarg" ;;
+
+ -nfp | --nfp | --nf)
+ # Obsolete; use --without-fp.
+ with_fp=no ;;
+
+ -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+ | --no-cr | --no-c)
+ no_create=yes ;;
+
+ -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+ no_recursion=yes ;;
+
+ -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+ | --oldin | --oldi | --old | --ol | --o)
+ ac_prev=oldincludedir ;;
+ -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+ oldincludedir="$ac_optarg" ;;
+
+ -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+ ac_prev=prefix ;;
+ -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+ prefix="$ac_optarg" ;;
+
+ -program-prefix | --program-prefix | --program-prefi | --program-pref \
+ | --program-pre | --program-pr | --program-p)
+ ac_prev=program_prefix ;;
+ -program-prefix=* | --program-prefix=* | --program-prefi=* \
+ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+ program_prefix="$ac_optarg" ;;
+
+ -program-suffix | --program-suffix | --program-suffi | --program-suff \
+ | --program-suf | --program-su | --program-s)
+ ac_prev=program_suffix ;;
+ -program-suffix=* | --program-suffix=* | --program-suffi=* \
+ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+ program_suffix="$ac_optarg" ;;
+
+ -program-transform-name | --program-transform-name \
+ | --program-transform-nam | --program-transform-na \
+ | --program-transform-n | --program-transform- \
+ | --program-transform | --program-transfor \
+ | --program-transfo | --program-transf \
+ | --program-trans | --program-tran \
+ | --progr-tra | --program-tr | --program-t)
+ ac_prev=program_transform_name ;;
+ -program-transform-name=* | --program-transform-name=* \
+ | --program-transform-nam=* | --program-transform-na=* \
+ | --program-transform-n=* | --program-transform-=* \
+ | --program-transform=* | --program-transfor=* \
+ | --program-transfo=* | --program-transf=* \
+ | --program-trans=* | --program-tran=* \
+ | --progr-tra=* | --program-tr=* | --program-t=*)
+ program_transform_name="$ac_optarg" ;;
+
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ silent=yes ;;
+
+ -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+ ac_prev=sbindir ;;
+ -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+ | --sbi=* | --sb=*)
+ sbindir="$ac_optarg" ;;
+
+ -sharedstatedir | --sharedstatedir | --sharedstatedi \
+ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+ | --sharedst | --shareds | --shared | --share | --shar \
+ | --sha | --sh)
+ ac_prev=sharedstatedir ;;
+ -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+ | --sha=* | --sh=*)
+ sharedstatedir="$ac_optarg" ;;
+
+ -site | --site | --sit)
+ ac_prev=site ;;
+ -site=* | --site=* | --sit=*)
+ site="$ac_optarg" ;;
+
+ -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+ ac_prev=srcdir ;;
+ -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+ srcdir="$ac_optarg" ;;
+
+ -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+ | --syscon | --sysco | --sysc | --sys | --sy)
+ ac_prev=sysconfdir ;;
+ -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+ sysconfdir="$ac_optarg" ;;
+
+ -target | --target | --targe | --targ | --tar | --ta | --t)
+ ac_prev=target ;;
+ -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+ target="$ac_optarg" ;;
+
+ -v | -verbose | --verbose | --verbos | --verbo | --verb)
+ verbose=yes ;;
+
+ -version | --version | --versio | --versi | --vers)
+ echo "configure generated by autoconf version 2.12"
+ exit 0 ;;
+
+ -with-* | --with-*)
+ ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
+ # Reject names that are not valid shell variable names.
+ if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
+ { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
+ fi
+ ac_package=`echo $ac_package| sed 's/-/_/g'`
+ case "$ac_option" in
+ *=*) ;;
+ *) ac_optarg=yes ;;
+ esac
+ eval "with_${ac_package}='$ac_optarg'" ;;
+
+ -without-* | --without-*)
+ ac_package=`echo $ac_option|sed -e 's/-*without-//'`
+ # Reject names that are not valid shell variable names.
+ if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
+ { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
+ fi
+ ac_package=`echo $ac_package| sed 's/-/_/g'`
+ eval "with_${ac_package}=no" ;;
+
+ --x)
+ # Obsolete; use --with-x.
+ with_x=yes ;;
+
+ -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+ | --x-incl | --x-inc | --x-in | --x-i)
+ ac_prev=x_includes ;;
+ -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+ x_includes="$ac_optarg" ;;
+
+ -x-libraries | --x-libraries | --x-librarie | --x-librari \
+ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+ ac_prev=x_libraries ;;
+ -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+ x_libraries="$ac_optarg" ;;
+
+ -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; }
+ ;;
+
+ *)
+ if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
+ echo "configure: warning: $ac_option: invalid host type" 1>&2
+ fi
+ if test "x$nonopt" != xNONE; then
+ { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; }
+ fi
+ nonopt="$ac_option"
+ ;;
+
+ esac
+done
+
+if test -n "$ac_prev"; then
+ { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; }
+fi
+
+trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
+
+# File descriptor usage:
+# 0 standard input
+# 1 file creation
+# 2 errors and warnings
+# 3 some systems may open it to /dev/tty
+# 4 used on the Kubota Titan
+# 6 checking for... messages and results
+# 5 compiler messages saved in config.log
+if test "$silent" = yes; then
+ exec 6>/dev/null
+else
+ exec 6>&1
+fi
+exec 5>./config.log
+
+echo "\
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+" 1>&5
+
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Also quote any args containing shell metacharacters.
+ac_configure_args=
+for ac_arg
+do
+ case "$ac_arg" in
+ -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+ | --no-cr | --no-c) ;;
+ -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;;
+ *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
+ ac_configure_args="$ac_configure_args '$ac_arg'" ;;
+ *) ac_configure_args="$ac_configure_args $ac_arg" ;;
+ esac
+done
+
+# NLS nuisances.
+# Only set these to C if already set. These must not be set unconditionally
+# because not all systems understand e.g. LANG=C (notably SCO).
+# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
+# Non-C LC_CTYPE values break the ctype check.
+if test "${LANG+set}" = set; then LANG=C; export LANG; fi
+if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
+if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
+if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -rf conftest* confdefs.h
+# AIX cpp loses on an empty file, so make sure it contains at least a newline.
+echo > confdefs.h
+
+# A filename unique to this package, relative to the directory that
+# configure is in, which we can look for to find out if srcdir is correct.
+ac_unique_file=byteorder.h
+
+# Find the source files, if location was not specified.
+if test -z "$srcdir"; then
+ ac_srcdir_defaulted=yes
+ # Try the directory containing this script, then its parent.
+ ac_prog=$0
+ ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
+ test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
+ srcdir=$ac_confdir
+ if test ! -r $srcdir/$ac_unique_file; then
+ srcdir=..
+ fi
+else
+ ac_srcdir_defaulted=no
+fi
+if test ! -r $srcdir/$ac_unique_file; then
+ if test "$ac_srcdir_defaulted" = yes; then
+ { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; }
+ else
+ { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; }
+ fi
+fi
+srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
+
+# Prefer explicitly selected file to automatically selected ones.
+if test -z "$CONFIG_SITE"; then
+ if test "x$prefix" != xNONE; then
+ CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
+ else
+ CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
+ fi
+fi
+for ac_site_file in $CONFIG_SITE; do
+ if test -r "$ac_site_file"; then
+ echo "loading site script $ac_site_file"
+ . "$ac_site_file"
+ fi
+done
+
+if test -r "$cache_file"; then
+ echo "loading cache $cache_file"
+ . $cache_file
+else
+ echo "creating cache $cache_file"
+ > $cache_file
+fi
+
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
+ # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
+ if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
+ ac_n= ac_c='
+' ac_t=' '
+ else
+ ac_n=-n ac_c= ac_t=
+ fi
+else
+ ac_n= ac_c='\c' ac_t=
+fi
+
+
+
+
+# Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:551: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+ for ac_dir in $PATH; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_prog_CC="gcc"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+ echo "$ac_t""$CC" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+if test -z "$CC"; then
+ # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:580: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+ ac_prog_rejected=no
+ for ac_dir in $PATH; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
+ ac_prog_rejected=yes
+ continue
+ fi
+ ac_cv_prog_CC="cc"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+if test $ac_prog_rejected = yes; then
+ # We found a bogon in the path, so make sure we never use it.
+ set dummy $ac_cv_prog_CC
+ shift
+ if test $# -gt 0; then
+ # We chose a different compiler from the bogus one.
+ # However, it has the same basename, so the bogon will be chosen
+ # first if we set CC to just the basename; use the full file name.
+ shift
+ set dummy "$ac_dir/$ac_word" "$@"
+ shift
+ ac_cv_prog_CC="$@"
+ fi
+fi
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+ echo "$ac_t""$CC" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
+fi
+
+echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
+echo "configure:628: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
+
+cat > conftest.$ac_ext <<EOF
+#line 638 "configure"
+#include "confdefs.h"
+main(){return(0);}
+EOF
+if { (eval echo configure:642: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+ ac_cv_prog_cc_works=yes
+ # If we can't run a trivial program, we are probably using a cross compiler.
+ if (./conftest; exit) 2>/dev/null; then
+ ac_cv_prog_cc_cross=no
+ else
+ ac_cv_prog_cc_cross=yes
+ fi
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ ac_cv_prog_cc_works=no
+fi
+rm -fr conftest*
+
+echo "$ac_t""$ac_cv_prog_cc_works" 1>&6
+if test $ac_cv_prog_cc_works = no; then
+ { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
+fi
+echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
+echo "configure:662: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
+cross_compiling=$ac_cv_prog_cc_cross
+
+echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
+echo "configure:667: checking whether we are using GNU C" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.c <<EOF
+#ifdef __GNUC__
+ yes;
+#endif
+EOF
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:676: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+ ac_cv_prog_gcc=yes
+else
+ ac_cv_prog_gcc=no
+fi
+fi
+
+echo "$ac_t""$ac_cv_prog_gcc" 1>&6
+
+if test $ac_cv_prog_gcc = yes; then
+ GCC=yes
+ ac_test_CFLAGS="${CFLAGS+set}"
+ ac_save_CFLAGS="$CFLAGS"
+ CFLAGS=
+ echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
+echo "configure:691: checking whether ${CC-cc} accepts -g" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ echo 'void f(){}' > conftest.c
+if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
+ ac_cv_prog_cc_g=yes
+else
+ ac_cv_prog_cc_g=no
+fi
+rm -f conftest*
+
+fi
+
+echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
+ if test "$ac_test_CFLAGS" = set; then
+ CFLAGS="$ac_save_CFLAGS"
+ elif test $ac_cv_prog_cc_g = yes; then
+ CFLAGS="-g -O2"
+ else
+ CFLAGS="-O2"
+ fi
+else
+ GCC=
+ test "${CFLAGS+set}" = set || CFLAGS="-g"
+fi
+
+ac_aux_dir=
+for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
+ if test -f $ac_dir/install-sh; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install-sh -c"
+ break
+ elif test -f $ac_dir/install.sh; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install.sh -c"
+ break
+ fi
+done
+if test -z "$ac_aux_dir"; then
+ { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; }
+fi
+ac_config_guess=$ac_aux_dir/config.guess
+ac_config_sub=$ac_aux_dir/config.sub
+ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
+
+# Find a good install program. We prefer a C program (faster),
+# so one script is as good as another. But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# ./install, which can be erroneously created by make from ./install.sh.
+echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
+echo "configure:748: checking for a BSD compatible install" >&5
+if test -z "$INSTALL"; then
+if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="${IFS}:"
+ for ac_dir in $PATH; do
+ # Account for people who put trailing slashes in PATH elements.
+ case "$ac_dir/" in
+ /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
+ *)
+ # OSF1 and SCO ODT 3.0 have their own names for install.
+ for ac_prog in ginstall installbsd scoinst install; do
+ if test -f $ac_dir/$ac_prog; then
+ if test $ac_prog = install &&
+ grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
+ # AIX install. It has an incompatible calling convention.
+ # OSF/1 installbsd also uses dspmsg, but is usable.
+ :
+ else
+ ac_cv_path_install="$ac_dir/$ac_prog -c"
+ break 2
+ fi
+ fi
+ done
+ ;;
+ esac
+ done
+ IFS="$ac_save_IFS"
+
+fi
+ if test "${ac_cv_path_install+set}" = set; then
+ INSTALL="$ac_cv_path_install"
+ else
+ # As a last resort, use the slow shell script. We don't cache a
+ # path for INSTALL within a source directory, because that will
+ # break other packages using the cache if that directory is
+ # removed, or if the path is relative.
+ INSTALL="$ac_install_sh"
+ fi
+fi
+echo "$ac_t""$INSTALL" 1>&6
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+
+for ac_prog in mawk gawk nawk awk
+do
+# Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:803: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_AWK'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$AWK"; then
+ ac_cv_prog_AWK="$AWK" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+ for ac_dir in $PATH; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_prog_AWK="$ac_prog"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+fi
+fi
+AWK="$ac_cv_prog_AWK"
+if test -n "$AWK"; then
+ echo "$ac_t""$AWK" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+test -n "$AWK" && break
+done
+
+
+
+# Do some error checking and defaulting for the host and target type.
+# The inputs are:
+# configure --host=HOST --target=TARGET --build=BUILD NONOPT
+#
+# The rules are:
+# 1. You are not allowed to specify --host, --target, and nonopt at the
+# same time.
+# 2. Host defaults to nonopt.
+# 3. If nonopt is not specified, then host defaults to the current host,
+# as determined by config.guess.
+# 4. Target and build default to nonopt.
+# 5. If nonopt is not specified, then target and build default to host.
+
+# The aliases save the names the user supplied, while $host etc.
+# will get canonicalized.
+case $host---$target---$nonopt in
+NONE---*---* | *---NONE---* | *---*---NONE) ;;
+*) { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } ;;
+esac
+
+
+# Make sure we can run config.sub.
+if $ac_config_sub sun4 >/dev/null 2>&1; then :
+else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
+fi
+
+echo $ac_n "checking host system type""... $ac_c" 1>&6
+echo "configure:860: checking host system type" >&5
+
+host_alias=$host
+case "$host_alias" in
+NONE)
+ case $nonopt in
+ NONE)
+ if host_alias=`$ac_config_guess`; then :
+ else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; }
+ fi ;;
+ *) host_alias=$nonopt ;;
+ esac ;;
+esac
+
+host=`$ac_config_sub $host_alias`
+host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+echo "$ac_t""$host" 1>&6
+
+echo $ac_n "checking target system type""... $ac_c" 1>&6
+echo "configure:881: checking target system type" >&5
+
+target_alias=$target
+case "$target_alias" in
+NONE)
+ case $nonopt in
+ NONE) target_alias=$host_alias ;;
+ *) target_alias=$nonopt ;;
+ esac ;;
+esac
+
+target=`$ac_config_sub $target_alias`
+target_cpu=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+target_vendor=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+echo "$ac_t""$target" 1>&6
+
+echo $ac_n "checking build system type""... $ac_c" 1>&6
+echo "configure:899: checking build system type" >&5
+
+build_alias=$build
+case "$build_alias" in
+NONE)
+ case $nonopt in
+ NONE) build_alias=$host_alias ;;
+ *) build_alias=$nonopt ;;
+ esac ;;
+esac
+
+build=`$ac_config_sub $build_alias`
+build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+echo "$ac_t""$build" 1>&6
+
+test "$host_alias" != "$target_alias" &&
+ test "$program_prefix$program_suffix$program_transform_name" = \
+ NONENONEs,x,x, &&
+ program_prefix=${target_alias}-
+
+case "$host_os" in
+ *linux*) cat >> confdefs.h <<\EOF
+#define LINUX 1
+EOF
+;;
+ *solaris*) cat >> confdefs.h <<\EOF
+#define SUNOS5 1
+EOF
+;;
+ *sunos*) cat >> confdefs.h <<\EOF
+#define SUNOS4 1
+EOF
+;;
+ *irix*) cat >> confdefs.h <<\EOF
+#define IRIX 1
+EOF
+;;
+ *aix*) cat >> confdefs.h <<\EOF
+#define AIX 1
+EOF
+;;
+ *hpux*) cat >> confdefs.h <<\EOF
+#define HPUX 1
+EOF
+;;
+ *qnx*) cat >> confdefs.h <<\EOF
+#define QNX 1
+EOF
+;;
+ *osf1*) cat >> confdefs.h <<\EOF
+#define OSF1 1
+EOF
+;;
+ *sco*) cat >> confdefs.h <<\EOF
+#define SCO 1
+EOF
+;;
+ *next2*) cat >> confdefs.h <<\EOF
+#define NEXT2 1
+EOF
+;;
+esac
+
+echo $ac_n "checking for inline""... $ac_c" 1>&6
+echo "configure:965: checking for inline" >&5
+if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_cv_c_inline=no
+for ac_kw in inline __inline__ __inline; do
+ cat > conftest.$ac_ext <<EOF
+#line 972 "configure"
+#include "confdefs.h"
+
+int main() {
+} $ac_kw foo() {
+; return 0; }
+EOF
+if { (eval echo configure:979: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv_c_inline=$ac_kw; break
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+fi
+rm -f conftest*
+done
+
+fi
+
+echo "$ac_t""$ac_cv_c_inline" 1>&6
+case "$ac_cv_c_inline" in
+ inline | yes) ;;
+ no) cat >> confdefs.h <<\EOF
+#define inline
+EOF
+ ;;
+ *) cat >> confdefs.h <<EOF
+#define inline $ac_cv_c_inline
+EOF
+ ;;
+esac
+
+echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
+echo "configure:1005: checking how to run the C preprocessor" >&5
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+ CPP=
+fi
+if test -z "$CPP"; then
+if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ # This must be in double quotes, not single quotes, because CPP may get
+ # substituted into the Makefile and "${CC-cc}" will confuse make.
+ CPP="${CC-cc} -E"
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp.
+ cat > conftest.$ac_ext <<EOF
+#line 1020 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1026: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out`
+if test -z "$ac_err"; then
+ :
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ CPP="${CC-cc} -E -traditional-cpp"
+ cat > conftest.$ac_ext <<EOF
+#line 1037 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1043: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out`
+if test -z "$ac_err"; then
+ :
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ CPP=/lib/cpp
+fi
+rm -f conftest*
+fi
+rm -f conftest*
+ ac_cv_prog_CPP="$CPP"
+fi
+ CPP="$ac_cv_prog_CPP"
+else
+ ac_cv_prog_CPP="$CPP"
+fi
+echo "$ac_t""$CPP" 1>&6
+
+echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
+echo "configure:1066: checking for ANSI C header files" >&5
+if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1071 "configure"
+#include "confdefs.h"
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1079: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ ac_cv_header_stdc=yes
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+if test $ac_cv_header_stdc = yes; then
+ # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+cat > conftest.$ac_ext <<EOF
+#line 1096 "configure"
+#include "confdefs.h"
+#include <string.h>
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "memchr" >/dev/null 2>&1; then
+ :
+else
+ rm -rf conftest*
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+cat > conftest.$ac_ext <<EOF
+#line 1114 "configure"
+#include "confdefs.h"
+#include <stdlib.h>
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "free" >/dev/null 2>&1; then
+ :
+else
+ rm -rf conftest*
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+if test "$cross_compiling" = yes; then
+ :
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1135 "configure"
+#include "confdefs.h"
+#include <ctype.h>
+#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int main () { int i; for (i = 0; i < 256; i++)
+if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
+exit (0); }
+
+EOF
+if { (eval echo configure:1146: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+then
+ :
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ ac_cv_header_stdc=no
+fi
+rm -fr conftest*
+fi
+
+fi
+fi
+
+echo "$ac_t""$ac_cv_header_stdc" 1>&6
+if test $ac_cv_header_stdc = yes; then
+ cat >> confdefs.h <<\EOF
+#define STDC_HEADERS 1
+EOF
+
+fi
+
+ac_header_dirent=no
+for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6
+echo "configure:1174: checking for $ac_hdr that defines DIR" >&5
+if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1179 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <$ac_hdr>
+int main() {
+DIR *dirp = 0;
+; return 0; }
+EOF
+if { (eval echo configure:1187: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ eval "ac_cv_header_dirent_$ac_safe=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_header_dirent_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_dirent_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+ ac_header_dirent=$ac_hdr; break
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix.
+if test $ac_header_dirent = dirent.h; then
+echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6
+echo "configure:1212: checking for opendir in -ldir" >&5
+ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-ldir $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 1220 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char opendir();
+
+int main() {
+opendir()
+; return 0; }
+EOF
+if { (eval echo configure:1231: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ LIBS="$LIBS -ldir"
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+else
+echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6
+echo "configure:1253: checking for opendir in -lx" >&5
+ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-lx $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 1261 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char opendir();
+
+int main() {
+opendir()
+; return 0; }
+EOF
+if { (eval echo configure:1272: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ LIBS="$LIBS -lx"
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+fi
+
+echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
+echo "configure:1295: checking whether time.h and sys/time.h may both be included" >&5
+if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1300 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <sys/time.h>
+#include <time.h>
+int main() {
+struct tm *tp;
+; return 0; }
+EOF
+if { (eval echo configure:1309: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv_header_time=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_cv_header_time=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_header_time" 1>&6
+if test $ac_cv_header_time = yes; then
+ cat >> confdefs.h <<\EOF
+#define TIME_WITH_SYS_TIME 1
+EOF
+
+fi
+
+echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6
+echo "configure:1330: checking for sys/wait.h that is POSIX.1 compatible" >&5
+if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1335 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <sys/wait.h>
+#ifndef WEXITSTATUS
+#define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
+#endif
+#ifndef WIFEXITED
+#define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
+#endif
+int main() {
+int s;
+wait (&s);
+s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;
+; return 0; }
+EOF
+if { (eval echo configure:1351: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv_header_sys_wait_h=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_cv_header_sys_wait_h=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_header_sys_wait_h" 1>&6
+if test $ac_cv_header_sys_wait_h = yes; then
+ cat >> confdefs.h <<\EOF
+#define HAVE_SYS_WAIT_H 1
+EOF
+
+fi
+
+for ac_hdr in sys/fcntl.h sys/select.h fcntl.h sys/time.h sys/unistd.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:1375: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1380 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1385: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=yes"
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_hdr in unistd.h utime.h grp.h sys/id.h limits.h net/if.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:1415: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1420 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1425: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=yes"
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_hdr in compat.h sys/param.h ctype.h sys/wait.h sys/ioctl.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:1455: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1460 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1465: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=yes"
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_hdr in sys/filio.h string.h stdlib.h sys/socket.h sys/mode.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:1495: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1500 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1505: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=yes"
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_hdr in sys/mount.h sys/vfs.h sys/fs/s5param.h sys/filsys.h termios.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:1535: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1540 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1545: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=yes"
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_hdr in sys/statfs.h sys/dustat.h sys/statvfs.h stdarg.h sys/sockio.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:1575: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1580 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1585: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=yes"
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_hdr in shadow.h netinet/tcp.h sys/security.h security/pam_appl.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:1615: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1620 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1625: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=yes"
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+
+echo $ac_n "checking size of int""... $ac_c" 1>&6
+echo "configure:1653: checking size of int" >&5
+if eval "test \"`echo '$''{'ac_cv_sizeof_int'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test "$cross_compiling" = yes; then
+ { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1661 "configure"
+#include "confdefs.h"
+#include <stdio.h>
+main()
+{
+ FILE *f=fopen("conftestval", "w");
+ if (!f) exit(1);
+ fprintf(f, "%d\n", sizeof(int));
+ exit(0);
+}
+EOF
+if { (eval echo configure:1672: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+then
+ ac_cv_sizeof_int=`cat conftestval`
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ ac_cv_sizeof_int=0
+fi
+rm -fr conftest*
+fi
+
+fi
+echo "$ac_t""$ac_cv_sizeof_int" 1>&6
+cat >> confdefs.h <<EOF
+#define SIZEOF_INT $ac_cv_sizeof_int
+EOF
+
+
+echo $ac_n "checking size of long""... $ac_c" 1>&6
+echo "configure:1692: checking size of long" >&5
+if eval "test \"`echo '$''{'ac_cv_sizeof_long'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test "$cross_compiling" = yes; then
+ { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1700 "configure"
+#include "confdefs.h"
+#include <stdio.h>
+main()
+{
+ FILE *f=fopen("conftestval", "w");
+ if (!f) exit(1);
+ fprintf(f, "%d\n", sizeof(long));
+ exit(0);
+}
+EOF
+if { (eval echo configure:1711: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+then
+ ac_cv_sizeof_long=`cat conftestval`
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ ac_cv_sizeof_long=0
+fi
+rm -fr conftest*
+fi
+
+fi
+echo "$ac_t""$ac_cv_sizeof_long" 1>&6
+cat >> confdefs.h <<EOF
+#define SIZEOF_LONG $ac_cv_sizeof_long
+EOF
+
+
+echo $ac_n "checking size of short""... $ac_c" 1>&6
+echo "configure:1731: checking size of short" >&5
+if eval "test \"`echo '$''{'ac_cv_sizeof_short'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test "$cross_compiling" = yes; then
+ { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1739 "configure"
+#include "confdefs.h"
+#include <stdio.h>
+main()
+{
+ FILE *f=fopen("conftestval", "w");
+ if (!f) exit(1);
+ fprintf(f, "%d\n", sizeof(short));
+ exit(0);
+}
+EOF
+if { (eval echo configure:1750: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+then
+ ac_cv_sizeof_short=`cat conftestval`
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ ac_cv_sizeof_short=0
+fi
+rm -fr conftest*
+fi
+
+fi
+echo "$ac_t""$ac_cv_sizeof_short" 1>&6
+cat >> confdefs.h <<EOF
+#define SIZEOF_SHORT $ac_cv_sizeof_short
+EOF
+
+
+
+echo $ac_n "checking for working const""... $ac_c" 1>&6
+echo "configure:1771: checking for working const" >&5
+if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1776 "configure"
+#include "confdefs.h"
+
+int main() {
+
+/* Ultrix mips cc rejects this. */
+typedef int charset[2]; const charset x;
+/* SunOS 4.1.1 cc rejects this. */
+char const *const *ccp;
+char **p;
+/* NEC SVR4.0.2 mips cc rejects this. */
+struct point {int x, y;};
+static struct point const zero = {0,0};
+/* AIX XL C 1.02.0.0 rejects this.
+ It does not let you subtract one const X* pointer from another in an arm
+ of an if-expression whose if-part is not a constant expression */
+const char *g = "string";
+ccp = &g + (g ? g-g : 0);
+/* HPUX 7.0 cc rejects these. */
+++ccp;
+p = (char**) ccp;
+ccp = (char const *const *) p;
+{ /* SCO 3.2v4 cc rejects this. */
+ char *t;
+ char const *s = 0 ? (char *) 0 : (char const *) 0;
+
+ *t++ = 0;
+}
+{ /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */
+ int x[] = {25, 17};
+ const int *foo = &x[0];
+ ++foo;
+}
+{ /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
+ typedef const int *iptr;
+ iptr p = 0;
+ ++p;
+}
+{ /* AIX XL C 1.02.0.0 rejects this saying
+ "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
+ struct s { int j; const int *ap[3]; };
+ struct s *b; b->j = 5;
+}
+{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
+ const int foo = 10;
+}
+
+; return 0; }
+EOF
+if { (eval echo configure:1825: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv_c_const=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_cv_c_const=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_c_const" 1>&6
+if test $ac_cv_c_const = no; then
+ cat >> confdefs.h <<\EOF
+#define const
+EOF
+
+fi
+
+echo $ac_n "checking for inline""... $ac_c" 1>&6
+echo "configure:1846: checking for inline" >&5
+if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_cv_c_inline=no
+for ac_kw in inline __inline__ __inline; do
+ cat > conftest.$ac_ext <<EOF
+#line 1853 "configure"
+#include "confdefs.h"
+
+int main() {
+} $ac_kw foo() {
+; return 0; }
+EOF
+if { (eval echo configure:1860: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv_c_inline=$ac_kw; break
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+fi
+rm -f conftest*
+done
+
+fi
+
+echo "$ac_t""$ac_cv_c_inline" 1>&6
+case "$ac_cv_c_inline" in
+ inline | yes) ;;
+ no) cat >> confdefs.h <<\EOF
+#define inline
+EOF
+ ;;
+ *) cat >> confdefs.h <<EOF
+#define inline $ac_cv_c_inline
+EOF
+ ;;
+esac
+
+echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6
+echo "configure:1886: checking whether byte ordering is bigendian" >&5
+if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_cv_c_bigendian=unknown
+# See if sys/param.h defines the BYTE_ORDER macro.
+cat > conftest.$ac_ext <<EOF
+#line 1893 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <sys/param.h>
+int main() {
+
+#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN
+ bogus endian macros
+#endif
+; return 0; }
+EOF
+if { (eval echo configure:1904: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ # It does; now see whether it defined to BIG_ENDIAN or not.
+cat > conftest.$ac_ext <<EOF
+#line 1908 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <sys/param.h>
+int main() {
+
+#if BYTE_ORDER != BIG_ENDIAN
+ not big endian
+#endif
+; return 0; }
+EOF
+if { (eval echo configure:1919: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv_c_bigendian=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_cv_c_bigendian=no
+fi
+rm -f conftest*
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+fi
+rm -f conftest*
+if test $ac_cv_c_bigendian = unknown; then
+if test "$cross_compiling" = yes; then
+ { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1939 "configure"
+#include "confdefs.h"
+main () {
+ /* Are we little or big endian? From Harbison&Steele. */
+ union
+ {
+ long l;
+ char c[sizeof (long)];
+ } u;
+ u.l = 1;
+ exit (u.c[sizeof (long) - 1] == 1);
+}
+EOF
+if { (eval echo configure:1952: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+then
+ ac_cv_c_bigendian=no
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ ac_cv_c_bigendian=yes
+fi
+rm -fr conftest*
+fi
+
+fi
+fi
+
+echo "$ac_t""$ac_cv_c_bigendian" 1>&6
+if test $ac_cv_c_bigendian = yes; then
+ cat >> confdefs.h <<\EOF
+#define WORDS_BIGENDIAN 1
+EOF
+
+fi
+
+echo $ac_n "checking whether char is unsigned""... $ac_c" 1>&6
+echo "configure:1976: checking whether char is unsigned" >&5
+if eval "test \"`echo '$''{'ac_cv_c_char_unsigned'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test "$GCC" = yes; then
+ # GCC predefines this symbol on systems where it applies.
+cat > conftest.$ac_ext <<EOF
+#line 1983 "configure"
+#include "confdefs.h"
+#ifdef __CHAR_UNSIGNED__
+ yes
+#endif
+
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "yes" >/dev/null 2>&1; then
+ rm -rf conftest*
+ ac_cv_c_char_unsigned=yes
+else
+ rm -rf conftest*
+ ac_cv_c_char_unsigned=no
+fi
+rm -f conftest*
+
+else
+if test "$cross_compiling" = yes; then
+ { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2005 "configure"
+#include "confdefs.h"
+/* volatile prevents gcc2 from optimizing the test away on sparcs. */
+#if !defined(__STDC__) || __STDC__ != 1
+#define volatile
+#endif
+main() {
+ volatile char c = 255; exit(c < 0);
+}
+EOF
+if { (eval echo configure:2015: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+then
+ ac_cv_c_char_unsigned=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ ac_cv_c_char_unsigned=no
+fi
+rm -fr conftest*
+fi
+
+fi
+fi
+
+echo "$ac_t""$ac_cv_c_char_unsigned" 1>&6
+if test $ac_cv_c_char_unsigned = yes && test "$GCC" != yes; then
+ cat >> confdefs.h <<\EOF
+#define __CHAR_UNSIGNED__ 1
+EOF
+
+fi
+
+
+echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
+echo "configure:2040: checking return type of signal handlers" >&5
+if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2045 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <signal.h>
+#ifdef signal
+#undef signal
+#endif
+#ifdef __cplusplus
+extern "C" void (*signal (int, void (*)(int)))(int);
+#else
+void (*signal ()) ();
+#endif
+
+int main() {
+int i;
+; return 0; }
+EOF
+if { (eval echo configure:2062: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv_type_signal=void
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_cv_type_signal=int
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_type_signal" 1>&6
+cat >> confdefs.h <<EOF
+#define RETSIGTYPE $ac_cv_type_signal
+EOF
+
+
+echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6
+echo "configure:2081: checking for uid_t in sys/types.h" >&5
+if eval "test \"`echo '$''{'ac_cv_type_uid_t'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2086 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "uid_t" >/dev/null 2>&1; then
+ rm -rf conftest*
+ ac_cv_type_uid_t=yes
+else
+ rm -rf conftest*
+ ac_cv_type_uid_t=no
+fi
+rm -f conftest*
+
+fi
+
+echo "$ac_t""$ac_cv_type_uid_t" 1>&6
+if test $ac_cv_type_uid_t = no; then
+ cat >> confdefs.h <<\EOF
+#define uid_t int
+EOF
+
+ cat >> confdefs.h <<\EOF
+#define gid_t int
+EOF
+
+fi
+
+echo $ac_n "checking for mode_t""... $ac_c" 1>&6
+echo "configure:2115: checking for mode_t" >&5
+if eval "test \"`echo '$''{'ac_cv_type_mode_t'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2120 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#if STDC_HEADERS
+#include <stdlib.h>
+#include <stddef.h>
+#endif
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "mode_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
+ rm -rf conftest*
+ ac_cv_type_mode_t=yes
+else
+ rm -rf conftest*
+ ac_cv_type_mode_t=no
+fi
+rm -f conftest*
+
+fi
+echo "$ac_t""$ac_cv_type_mode_t" 1>&6
+if test $ac_cv_type_mode_t = no; then
+ cat >> confdefs.h <<\EOF
+#define mode_t int
+EOF
+
+fi
+
+echo $ac_n "checking for off_t""... $ac_c" 1>&6
+echo "configure:2148: checking for off_t" >&5
+if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2153 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#if STDC_HEADERS
+#include <stdlib.h>
+#include <stddef.h>
+#endif
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "off_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
+ rm -rf conftest*
+ ac_cv_type_off_t=yes
+else
+ rm -rf conftest*
+ ac_cv_type_off_t=no
+fi
+rm -f conftest*
+
+fi
+echo "$ac_t""$ac_cv_type_off_t" 1>&6
+if test $ac_cv_type_off_t = no; then
+ cat >> confdefs.h <<\EOF
+#define off_t long
+EOF
+
+fi
+
+echo $ac_n "checking for size_t""... $ac_c" 1>&6
+echo "configure:2181: checking for size_t" >&5
+if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2186 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#if STDC_HEADERS
+#include <stdlib.h>
+#include <stddef.h>
+#endif
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "size_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
+ rm -rf conftest*
+ ac_cv_type_size_t=yes
+else
+ rm -rf conftest*
+ ac_cv_type_size_t=no
+fi
+rm -f conftest*
+
+fi
+echo "$ac_t""$ac_cv_type_size_t" 1>&6
+if test $ac_cv_type_size_t = no; then
+ cat >> confdefs.h <<\EOF
+#define size_t unsigned
+EOF
+
+fi
+
+echo $ac_n "checking for pid_t""... $ac_c" 1>&6
+echo "configure:2214: checking for pid_t" >&5
+if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2219 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#if STDC_HEADERS
+#include <stdlib.h>
+#include <stddef.h>
+#endif
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "pid_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
+ rm -rf conftest*
+ ac_cv_type_pid_t=yes
+else
+ rm -rf conftest*
+ ac_cv_type_pid_t=no
+fi
+rm -f conftest*
+
+fi
+echo "$ac_t""$ac_cv_type_pid_t" 1>&6
+if test $ac_cv_type_pid_t = no; then
+ cat >> confdefs.h <<\EOF
+#define pid_t int
+EOF
+
+fi
+
+echo $ac_n "checking for st_rdev in struct stat""... $ac_c" 1>&6
+echo "configure:2247: checking for st_rdev in struct stat" >&5
+if eval "test \"`echo '$''{'ac_cv_struct_st_rdev'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2252 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <sys/stat.h>
+int main() {
+struct stat s; s.st_rdev;
+; return 0; }
+EOF
+if { (eval echo configure:2260: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv_struct_st_rdev=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_cv_struct_st_rdev=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_struct_st_rdev" 1>&6
+if test $ac_cv_struct_st_rdev = yes; then
+ cat >> confdefs.h <<\EOF
+#define HAVE_ST_RDEV 1
+EOF
+
+fi
+
+echo $ac_n "checking for ino_t""... $ac_c" 1>&6
+echo "configure:2281: checking for ino_t" >&5
+if eval "test \"`echo '$''{'ac_cv_type_ino_t'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2286 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#if STDC_HEADERS
+#include <stdlib.h>
+#include <stddef.h>
+#endif
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "ino_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
+ rm -rf conftest*
+ ac_cv_type_ino_t=yes
+else
+ rm -rf conftest*
+ ac_cv_type_ino_t=no
+fi
+rm -f conftest*
+
+fi
+echo "$ac_t""$ac_cv_type_ino_t" 1>&6
+if test $ac_cv_type_ino_t = no; then
+ cat >> confdefs.h <<\EOF
+#define ino_t unsigned
+EOF
+
+fi
+
+
+echo $ac_n "checking for errno in errno.h... $ac_c"
+cat > conftest.$ac_ext <<EOF
+#line 2316 "configure"
+#include "confdefs.h"
+#include <errno.h>
+int main() {
+int i = errno
+; return 0; }
+EOF
+if { (eval echo configure:2323: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ echo yes; cat >> confdefs.h <<\EOF
+#define HAVE_ERRNO_DECL 1
+EOF
+
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ echo no
+fi
+rm -f conftest*
+
+echo $ac_n "checking for 8-bit clean memcmp""... $ac_c" 1>&6
+echo "configure:2338: checking for 8-bit clean memcmp" >&5
+if eval "test \"`echo '$''{'ac_cv_func_memcmp_clean'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test "$cross_compiling" = yes; then
+ ac_cv_func_memcmp_clean=no
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2346 "configure"
+#include "confdefs.h"
+
+main()
+{
+ char c0 = 0x40, c1 = 0x80, c2 = 0x81;
+ exit(memcmp(&c0, &c2, 1) < 0 && memcmp(&c1, &c2, 1) < 0 ? 0 : 1);
+}
+
+EOF
+if { (eval echo configure:2356: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+then
+ ac_cv_func_memcmp_clean=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ ac_cv_func_memcmp_clean=no
+fi
+rm -fr conftest*
+fi
+
+fi
+
+echo "$ac_t""$ac_cv_func_memcmp_clean" 1>&6
+test $ac_cv_func_memcmp_clean = no && LIBOBJS="$LIBOBJS memcmp.o"
+
+
+###############################################
+# test for where we get crypt() from
+if test "$ac_cv_lib_crypt_crypt" = "yes"; then
+ echo $ac_n "checking for crypt in -lcrypt""... $ac_c" 1>&6
+echo "configure:2378: checking for crypt in -lcrypt" >&5
+ac_lib_var=`echo crypt'_'crypt | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-lcrypt $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 2386 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char crypt();
+
+int main() {
+crypt()
+; return 0; }
+EOF
+if { (eval echo configure:2397: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_lib=HAVE_LIB`echo crypt | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+ LIBS="-lcrypt $LIBS"
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ cat >> confdefs.h <<\EOF
+#define HAVE_CRYPT 1
+EOF
+
+fi
+if test "$ac_cv_lib_crypt_crypt" = "no" ||
+ test "$ac_cv_lib_crypt_crypt" = ""; then
+# look for crypt
+echo $ac_n "checking for crypt""... $ac_c" 1>&6
+echo "configure:2433: checking for crypt" >&5
+if eval "test \"`echo '$''{'ac_cv_func_crypt'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2438 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char crypt(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char crypt();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_crypt) || defined (__stub___crypt)
+choke me
+#else
+crypt();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:2461: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+ rm -rf conftest*
+ eval "ac_cv_func_crypt=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_crypt=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'crypt`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ cat >> confdefs.h <<\EOF
+#define HAVE_CRYPT 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+case "$LIBS" in
+*-lcrypt*) ;;
+*) echo $ac_n "checking for crypt in -lcrypt""... $ac_c" 1>&6
+echo "configure:2484: checking for crypt in -lcrypt" >&5
+ac_lib_var=`echo crypt'_'crypt | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-lcrypt $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 2492 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char crypt();
+
+int main() {
+crypt()
+; return 0; }
+EOF
+if { (eval echo configure:2503: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_lib=HAVE_LIB`echo crypt | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+ LIBS="-lcrypt $LIBS"
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+ ;;
+esac
+if test "$ac_cv_lib_crypt_crypt" = "yes"; then
+ ac_cv_func_crypt=yes
+ cat >> confdefs.h <<\EOF
+#define HAVE_CRYPT 1
+EOF
+
+fi
+fi
+
+fi
+
+
+###############################################
+# test for where we get pam_authenticate() from
+# might need libdl for this to work
+if test "$ac_cv_header_security_pam_appl_h" = "yes"; then
+ echo $ac_n "checking for -ldl""... $ac_c" 1>&6
+echo "configure:2548: checking for -ldl" >&5
+if eval "test \"`echo '$''{'ac_cv_lib_dl'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-ldl $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 2555 "configure"
+#include "confdefs.h"
+
+int main() {
+main()
+; return 0; }
+EOF
+if { (eval echo configure:2562: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+ rm -rf conftest*
+ ac_cv_lib_dl=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_cv_lib_dl=no
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+echo "$ac_t""$ac_cv_lib_dl" 1>&6
+if test "$ac_cv_lib_dl" = yes; then
+ cat >> confdefs.h <<\EOF
+#define HAVE_LIBDL 1
+EOF
+
+ LIBS="-ldl $LIBS"
+
+fi
+
+fi
+if test "$ac_cv_lib_pam_pam_authenticate" = "yes"; then
+ echo $ac_n "checking for pam_authenticate in -lpam""... $ac_c" 1>&6
+echo "configure:2588: checking for pam_authenticate in -lpam" >&5
+ac_lib_var=`echo pam'_'pam_authenticate | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-lpam $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 2596 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char pam_authenticate();
+
+int main() {
+pam_authenticate()
+; return 0; }
+EOF
+if { (eval echo configure:2607: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_lib=HAVE_LIB`echo pam | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+ LIBS="-lpam $LIBS"
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ cat >> confdefs.h <<\EOF
+#define HAVE_PAM_AUTHENTICATE 1
+EOF
+
+fi
+if test "$ac_cv_lib_pam_pam_authenticate" = "no" ||
+ test "$ac_cv_lib_pam_pam_authenticate" = ""; then
+# look for pam_authenticate
+echo $ac_n "checking for pam_authenticate""... $ac_c" 1>&6
+echo "configure:2643: checking for pam_authenticate" >&5
+if eval "test \"`echo '$''{'ac_cv_func_pam_authenticate'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2648 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char pam_authenticate(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char pam_authenticate();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_pam_authenticate) || defined (__stub___pam_authenticate)
+choke me
+#else
+pam_authenticate();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:2671: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+ rm -rf conftest*
+ eval "ac_cv_func_pam_authenticate=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_pam_authenticate=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'pam_authenticate`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ cat >> confdefs.h <<\EOF
+#define HAVE_PAM_AUTHENTICATE 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+case "$LIBS" in
+*-lpam*) ;;
+*) echo $ac_n "checking for pam_authenticate in -lpam""... $ac_c" 1>&6
+echo "configure:2694: checking for pam_authenticate in -lpam" >&5
+ac_lib_var=`echo pam'_'pam_authenticate | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-lpam $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 2702 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char pam_authenticate();
+
+int main() {
+pam_authenticate()
+; return 0; }
+EOF
+if { (eval echo configure:2713: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_lib=HAVE_LIB`echo pam | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+ LIBS="-lpam $LIBS"
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+ ;;
+esac
+if test "$ac_cv_lib_pam_pam_authenticate" = "yes"; then
+ ac_cv_func_pam_authenticate=yes
+ cat >> confdefs.h <<\EOF
+#define HAVE_PAM_AUTHENTICATE 1
+EOF
+
+fi
+fi
+
+fi
+
+
+for ac_func in waitpid getcwd strdup strerror chown chmod chroot
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:2756: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2761 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:2784: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_func in fstat strchr utime utimes getrlimit fsync execl
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:2811: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2816 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:2839: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_func in memmove vsnprintf setsid glob strpbrk pipe crypt16 getauthuid
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:2866: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2871 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:2894: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_func in strftime sigprocmask sigblock sigaction innetgr
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:2921: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2926 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:2949: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_func in initgroups select rdchk getgrnam pathconf putprpwnam
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:2976: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2981 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:3004: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_func in setresuid setuidx setgroups mktime rename ftruncate
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:3031: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 3036 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:3059: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_func in set_auth_parameters atexit grantpt getspnam dup2
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:3086: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 3091 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:3114: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+for ac_func in bigcrypt getprpwnam setluid yp_get_default_domain
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:3141: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 3146 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:3169: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+
+echo $ac_n "checking for long long ... $ac_c"
+if test "$cross_compiling" = yes; then
+ { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
+else
+ cat > conftest.$ac_ext <<EOF
+#line 3199 "configure"
+#include "confdefs.h"
+#include <stdio.h>
+main() { long long x = 1000000; x *= x; exit(((x/1000000) == 1000000)? 0: 1); }
+EOF
+if { (eval echo configure:3204: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+then
+ echo yes;cat >> confdefs.h <<\EOF
+#define HAVE_LONGLONG 1
+EOF
+
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ echo no
+fi
+rm -fr conftest*
+fi
+
+
+echo $ac_n "checking for off64_t ... $ac_c"
+if test "$cross_compiling" = yes; then
+ { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
+else
+ cat > conftest.$ac_ext <<EOF
+#line 3225 "configure"
+#include "confdefs.h"
+#include <stdio.h>
+#include <sys/stat.h>
+main() { struct stat64 st; off64_t s; if (sizeof(off_t) == sizeof(off64_t)) exit(1); exit((lstat64("/dev/null", &st)==0)?0:1); }
+EOF
+if { (eval echo configure:3231: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+then
+ echo yes;cat >> confdefs.h <<\EOF
+#define HAVE_OFF64_T 1
+EOF
+
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ echo no
+fi
+rm -fr conftest*
+fi
+
+
+echo $ac_n "checking for union semun ... $ac_c"
+if test "$cross_compiling" = yes; then
+ { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
+else
+ cat > conftest.$ac_ext <<EOF
+#line 3252 "configure"
+#include "confdefs.h"
+
+#include <sys/types.h>
+#include <sys/ipc.h>
+#include <sys/sem.h>
+main() { union semun ss; exit(0); }
+EOF
+if { (eval echo configure:3260: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+then
+ echo yes;cat >> confdefs.h <<\EOF
+#define HAVE_UNION_SEMUN 1
+EOF
+
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ echo no
+fi
+rm -fr conftest*
+fi
+
+
+echo $ac_n "checking for unsigned char ... $ac_c"
+if test "$cross_compiling" = yes; then
+ { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
+else
+ cat > conftest.$ac_ext <<EOF
+#line 3281 "configure"
+#include "confdefs.h"
+#include <stdio.h>
+main() { char c; c=250; exit((c > 0)?0:1); }
+EOF
+if { (eval echo configure:3286: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+then
+ echo yes;cat >> confdefs.h <<\EOF
+#define HAVE_UNSIGNED_CHAR 1
+EOF
+
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ echo no
+fi
+rm -fr conftest*
+fi
+
+
+echo $ac_n "checking for sin_len in sock ... $ac_c"
+cat > conftest.$ac_ext <<EOF
+#line 3304 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <sys/socket.h>
+int main() {
+struct sockaddr_in sock; sock.sin_len = sizeof(sock);
+; return 0; }
+EOF
+if { (eval echo configure:3312: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ echo yes;cat >> confdefs.h <<\EOF
+#define HAVE_SOCK_SIN_LEN 1
+EOF
+
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ echo no
+fi
+rm -f conftest*
+
+echo $ac_n "checking if gettimeofday takes tz argument ... $ac_c"
+if test "$cross_compiling" = yes; then
+ { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
+else
+ cat > conftest.$ac_ext <<EOF
+#line 3331 "configure"
+#include "confdefs.h"
+
+#include <sys/time.h>
+#include <unistd.h>
+main() { struct timeval tv; exit(gettimeofday(&tv, NULL));}
+EOF
+if { (eval echo configure:3338: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+then
+ echo yes;cat >> confdefs.h <<\EOF
+#define HAVE_GETTIMEOFDAY_TZ 1
+EOF
+
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ echo no
+fi
+rm -fr conftest*
+fi
+
+
+
+echo $ac_n "checking for broken readdir ... $ac_c"
+if test "$cross_compiling" = yes; then
+ { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
+else
+ cat > conftest.$ac_ext <<EOF
+#line 3360 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <dirent.h>
+main() { struct dirent *di; DIR *d = opendir("."); di = readdir(d);
+if (di && di->d_name[-2] == '.' && di->d_name[-1] == 0 &&
+di->d_name[0] == 0) exit(0); exit(1);}
+EOF
+if { (eval echo configure:3368: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+then
+ echo yes - you are using the broken /usr/ucb/cc;cat >> confdefs.h <<\EOF
+#define HAVE_BROKEN_READDIR 1
+EOF
+
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ echo no
+fi
+rm -fr conftest*
+fi
+
+
+echo $ac_n "checking for utimbuf ... $ac_c"
+cat > conftest.$ac_ext <<EOF
+#line 3386 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <utime.h>
+int main() {
+struct utimbuf tbuf; tbuf.actime = 0; tbuf.modtime = 1; exit(utime("foo.c",&tbuf));
+; return 0; }
+EOF
+if { (eval echo configure:3394: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ echo yes;cat >> confdefs.h <<\EOF
+#define HAVE_UTIMBUF 1
+EOF
+
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ echo no
+fi
+rm -f conftest*
+
+echo $ac_n "checking for ftruncate extend ... $ac_c"
+if test "$cross_compiling" = yes; then
+ { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
+else
+ cat > conftest.$ac_ext <<EOF
+#line 3413 "configure"
+#include "confdefs.h"
+#include "tests/ftruncate.c"
+EOF
+if { (eval echo configure:3417: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+then
+ echo yes;cat >> confdefs.h <<\EOF
+#define HAVE_FTRUNCATE_EXTEND 1
+EOF
+
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ echo no
+fi
+rm -fr conftest*
+fi
+
+
+# The following test taken from the cvs sources
+# If we can't find connect, try looking in -lsocket, -lnsl, and -linet.
+# The Irix 5 libc.so has connect and gethostbyname, but Irix 5 also has
+# libsocket.so which has a bad implementation of gethostbyname (it
+# only looks in /etc/hosts), so we only look for -lsocket if we need
+# it.
+echo $ac_n "checking for connect""... $ac_c" 1>&6
+echo "configure:3440: checking for connect" >&5
+if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 3445 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char connect(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char connect();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_connect) || defined (__stub___connect)
+choke me
+#else
+connect();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:3468: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+ rm -rf conftest*
+ eval "ac_cv_func_connect=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_connect=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'connect`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ :
+else
+ echo "$ac_t""no" 1>&6
+case "$LIBS" in
+*-lnsl*) ;;
+*) echo $ac_n "checking for printf in -lnsl_s""... $ac_c" 1>&6
+echo "configure:3488: checking for printf in -lnsl_s" >&5
+ac_lib_var=`echo nsl_s'_'printf | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-lnsl_s $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 3496 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char printf();
+
+int main() {
+printf()
+; return 0; }
+EOF
+if { (eval echo configure:3507: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_lib=HAVE_LIB`echo nsl_s | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+ LIBS="-lnsl_s $LIBS"
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+ ;;
+esac
+case "$LIBS" in
+*-lnsl*) ;;
+*) echo $ac_n "checking for printf in -lnsl""... $ac_c" 1>&6
+echo "configure:3538: checking for printf in -lnsl" >&5
+ac_lib_var=`echo nsl'_'printf | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-lnsl $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 3546 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char printf();
+
+int main() {
+printf()
+; return 0; }
+EOF
+if { (eval echo configure:3557: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_lib=HAVE_LIB`echo nsl | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+ LIBS="-lnsl $LIBS"
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+ ;;
+esac
+case "$LIBS" in
+*-lsocket*) ;;
+*) echo $ac_n "checking for connect in -lsocket""... $ac_c" 1>&6
+echo "configure:3588: checking for connect in -lsocket" >&5
+ac_lib_var=`echo socket'_'connect | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-lsocket $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 3596 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char connect();
+
+int main() {
+connect()
+; return 0; }
+EOF
+if { (eval echo configure:3607: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_lib=HAVE_LIB`echo socket | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+ LIBS="-lsocket $LIBS"
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+ ;;
+esac
+case "$LIBS" in
+*-linet*) ;;
+*) echo $ac_n "checking for connect in -linet""... $ac_c" 1>&6
+echo "configure:3638: checking for connect in -linet" >&5
+ac_lib_var=`echo inet'_'connect | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-linet $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 3646 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char connect();
+
+int main() {
+connect()
+; return 0; }
+EOF
+if { (eval echo configure:3657: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_lib=HAVE_LIB`echo inet | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+ LIBS="-linet $LIBS"
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+ ;;
+esac
+if test "$ac_cv_lib_socket_connect" = "yes" ||
+ test "$ac_cv_lib_inet_connect" = "yes"; then
+ ac_cv_func_connect=yes
+ cat >> confdefs.h <<\EOF
+#define HAVE_CONNECT 1
+EOF
+
+fi
+fi
+
+
+
+echo $ac_n "checking for root ... $ac_c"
+if test "$cross_compiling" = yes; then
+ { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
+else
+ cat > conftest.$ac_ext <<EOF
+#line 3702 "configure"
+#include "confdefs.h"
+main() { exit(getuid() != 0); }
+EOF
+if { (eval echo configure:3706: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+then
+ echo yes;cat >> confdefs.h <<\EOF
+#define HAVE_ROOT 1
+EOF
+
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ echo WARNING: running as non-root will disable some tests;
+fi
+rm -fr conftest*
+fi
+
+
+netmask=no;
+echo $ac_n "checking for netmask ifconf ... $ac_c"
+if test "$cross_compiling" = yes; then
+ { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
+else
+ cat > conftest.$ac_ext <<EOF
+#line 3728 "configure"
+#include "confdefs.h"
+
+#define HAVE_NETMASK_IFCONF 1
+#define AUTOCONF 1
+#include "netmask.c"
+EOF
+if { (eval echo configure:3735: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+then
+ echo yes;netmask=yes;cat >> confdefs.h <<\EOF
+#define HAVE_NETMASK_IFCONF 1
+EOF
+
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ echo no
+fi
+rm -fr conftest*
+fi
+
+
+if test $netmask = no; then
+echo $ac_n "checking for netmask ifreq ... $ac_c"
+if test "$cross_compiling" = yes; then
+ { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
+else
+ cat > conftest.$ac_ext <<EOF
+#line 3757 "configure"
+#include "confdefs.h"
+
+#define HAVE_NETMASK_IFREQ 1
+#define AUTOCONF 1
+#include "netmask.c"
+EOF
+if { (eval echo configure:3764: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+then
+ echo yes;netmask=yes;cat >> confdefs.h <<\EOF
+#define HAVE_NETMASK_IFREQ 1
+EOF
+
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ echo no
+fi
+rm -fr conftest*
+fi
+
+fi
+
+if test $netmask = no; then
+echo $ac_n "checking for netmask AIX ... $ac_c"
+if test "$cross_compiling" = yes; then
+ { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
+else
+ cat > conftest.$ac_ext <<EOF
+#line 3787 "configure"
+#include "confdefs.h"
+
+#define HAVE_NETMASK_AIX 1
+#define AUTOCONF 1
+#include "netmask.c"
+EOF
+if { (eval echo configure:3794: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+then
+ echo yes;netmask=yes;cat >> confdefs.h <<\EOF
+#define HAVE_NETMASK_AIX 1
+EOF
+
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ echo no
+fi
+rm -fr conftest*
+fi
+
+fi
+
+echo $ac_n "checking for trapdoor seteuid ... $ac_c"
+if test "$cross_compiling" = yes; then
+ { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
+else
+ cat > conftest.$ac_ext <<EOF
+#line 3816 "configure"
+#include "confdefs.h"
+#include "tests/trapdoor.c"
+EOF
+if { (eval echo configure:3820: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+then
+ echo no
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ echo yes;cat >> confdefs.h <<\EOF
+#define HAVE_TRAPDOOR_UID 1
+EOF
+
+fi
+rm -fr conftest*
+fi
+
+
+echo $ac_n "checking for shared mmap ... $ac_c"
+if test "$cross_compiling" = yes; then
+ { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
+else
+ cat > conftest.$ac_ext <<EOF
+#line 3841 "configure"
+#include "confdefs.h"
+#include "tests/shared_mmap.c"
+EOF
+if { (eval echo configure:3845: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+then
+ echo yes;cat >> confdefs.h <<\EOF
+#define HAVE_SHARED_MMAP 1
+EOF
+
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ echo no
+fi
+rm -fr conftest*
+fi
+
+
+echo $ac_n "checking for fcntl locking ... $ac_c"
+if test "$cross_compiling" = yes; then
+ { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
+else
+ cat > conftest.$ac_ext <<EOF
+#line 3866 "configure"
+#include "confdefs.h"
+#include "tests/fcntl_lock.c"
+EOF
+if { (eval echo configure:3870: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+then
+ echo yes;cat >> confdefs.h <<\EOF
+#define HAVE_FCNTL_LOCK 1
+EOF
+
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ echo no
+fi
+rm -fr conftest*
+fi
+
+
+echo $ac_n "checking for sysv ipc ... $ac_c"
+if test "$cross_compiling" = yes; then
+ { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
+else
+ cat > conftest.$ac_ext <<EOF
+#line 3891 "configure"
+#include "confdefs.h"
+#include "tests/sysv_ipc.c"
+EOF
+if { (eval echo configure:3895: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+then
+ echo yes;cat >> confdefs.h <<\EOF
+#define HAVE_SYSV_IPC 1
+EOF
+
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ echo no
+fi
+rm -fr conftest*
+fi
+
+
+#################################################
+# check for the AFS filesystem
+echo $ac_n "checking whether to use AFS""... $ac_c" 1>&6
+echo "configure:3914: checking whether to use AFS" >&5
+# Check whether --with-afs or --without-afs was given.
+if test "${with_afs+set}" = set; then
+ withval="$with_afs"
+ case "$withval" in
+ yes)
+ echo "$ac_t""yes" 1>&6
+ cat >> confdefs.h <<\EOF
+#define WITH_AFS 1
+EOF
+
+ ;;
+ *)
+ echo "$ac_t""no" 1>&6
+ ;;
+ esac
+else
+ echo "$ac_t""no" 1>&6
+
+fi
+
+
+
+#################################################
+# check for the DFS auth system
+echo $ac_n "checking whether to use DFS auth""... $ac_c" 1>&6
+echo "configure:3940: checking whether to use DFS auth" >&5
+# Check whether --with-dfs or --without-dfs was given.
+if test "${with_dfs+set}" = set; then
+ withval="$with_dfs"
+ case "$withval" in
+ yes)
+ echo "$ac_t""yes" 1>&6
+ cat >> confdefs.h <<\EOF
+#define WITH_DFS 1
+EOF
+
+ ;;
+ *)
+ echo "$ac_t""no" 1>&6
+ ;;
+ esac
+else
+ echo "$ac_t""no" 1>&6
+
+fi
+
+
+#################################################
+# check for automount support
+echo $ac_n "checking whether to use AUTOMOUNT""... $ac_c" 1>&6
+echo "configure:3965: checking whether to use AUTOMOUNT" >&5
+# Check whether --with-automount or --without-automount was given.
+if test "${with_automount+set}" = set; then
+ withval="$with_automount"
+ case "$withval" in
+ yes)
+ echo "$ac_t""yes" 1>&6
+ cat >> confdefs.h <<\EOF
+#define WITH_AUTOMOUNT 1
+EOF
+
+ ;;
+ *)
+ echo "$ac_t""no" 1>&6
+ ;;
+ esac
+else
+ echo "$ac_t""no" 1>&6
+
+fi
+
+
+#################################################
+# check for a LDAP password database
+echo $ac_n "checking whether to use LDAP password database""... $ac_c" 1>&6
+echo "configure:3990: checking whether to use LDAP password database" >&5
+# Check whether --with-ldap or --without-ldap was given.
+if test "${with_ldap+set}" = set; then
+ withval="$with_ldap"
+ case "$withval" in
+ yes)
+ echo "$ac_t""yes" 1>&6
+ cat >> confdefs.h <<\EOF
+#define WITH_LDAP 1
+EOF
+
+ ;;
+ *)
+ echo "$ac_t""no" 1>&6
+ ;;
+ esac
+else
+ echo "$ac_t""no" 1>&6
+
+fi
+
+
+#################################################
+# check for a NISPLUS password database
+echo $ac_n "checking whether to use NISPLUS password database""... $ac_c" 1>&6
+echo "configure:4015: checking whether to use NISPLUS password database" >&5
+# Check whether --with-nisplus or --without-nisplus was given.
+if test "${with_nisplus+set}" = set; then
+ withval="$with_nisplus"
+ case "$withval" in
+ yes)
+ echo "$ac_t""yes" 1>&6
+ cat >> confdefs.h <<\EOF
+#define WITH_NISPLUS 1
+EOF
+
+ ;;
+ *)
+ echo "$ac_t""no" 1>&6
+ ;;
+ esac
+else
+ echo "$ac_t""no" 1>&6
+
+fi
+
+
+#################################################
+# check for the secure socket layer
+echo $ac_n "checking whether to use SSL""... $ac_c" 1>&6
+echo "configure:4040: checking whether to use SSL" >&5
+# Check whether --with-ssl or --without-ssl was given.
+if test "${with_ssl+set}" = set; then
+ withval="$with_ssl"
+ case "$withval" in
+ yes)
+ echo "$ac_t""yes" 1>&6
+ cat >> confdefs.h <<\EOF
+#define WITH_SSL 1
+EOF
+
+ ;;
+ *)
+ echo "$ac_t""no" 1>&6
+ ;;
+ esac
+else
+ echo "$ac_t""no" 1>&6
+
+fi
+
+
+#################################################
+# check for experimental mmap support
+echo $ac_n "checking whether to use MMAP""... $ac_c" 1>&6
+echo "configure:4065: checking whether to use MMAP" >&5
+# Check whether --with-mmap or --without-mmap was given.
+if test "${with_mmap+set}" = set; then
+ withval="$with_mmap"
+ case "$withval" in
+ yes)
+ echo "$ac_t""yes" 1>&6
+ cat >> confdefs.h <<\EOF
+#define WITH_MMAP 1
+EOF
+
+ ;;
+ *)
+ echo "$ac_t""no" 1>&6
+ ;;
+ esac
+else
+ echo "$ac_t""no" 1>&6
+
+fi
+
+
+#################################################
+# check for syslog logging
+echo $ac_n "checking whether to use syslog logging""... $ac_c" 1>&6
+echo "configure:4090: checking whether to use syslog logging" >&5
+# Check whether --with-syslog or --without-syslog was given.
+if test "${with_syslog+set}" = set; then
+ withval="$with_syslog"
+ case "$withval" in
+ yes)
+ echo "$ac_t""yes" 1>&6
+ cat >> confdefs.h <<\EOF
+#define WITH_SYSLOG 1
+EOF
+
+ ;;
+ *)
+ echo "$ac_t""no" 1>&6
+ ;;
+ esac
+else
+ echo "$ac_t""no" 1>&6
+
+fi
+
+
+
+#################################################
+# these tests are taken from the GNU fileutils package
+echo "checking how to get filesystem space usage" 1>&6
+echo "configure:4116: checking how to get filesystem space usage" >&5
+space=no
+
+# Perform only the link test since it seems there are no variants of the
+# statvfs function. This check is more than just AC_CHECK_FUNCS(statvfs)
+# because that got a false positive on SCO OSR5. Adding the declaration
+# of a `struct statvfs' causes this test to fail (as it should) on such
+# systems. That system is reported to work fine with STAT_STATFS4 which
+# is what it gets when this test fails.
+if test $space = no; then
+ # SVR4
+ echo $ac_n "checking statvfs function (SVR4)""... $ac_c" 1>&6
+echo "configure:4128: checking statvfs function (SVR4)" >&5
+if eval "test \"`echo '$''{'fu_cv_sys_stat_statvfs'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 4133 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <sys/statvfs.h>
+int main() {
+struct statvfs fsd; statvfs (0, &fsd);
+; return 0; }
+EOF
+if { (eval echo configure:4141: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+ rm -rf conftest*
+ fu_cv_sys_stat_statvfs=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ fu_cv_sys_stat_statvfs=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$fu_cv_sys_stat_statvfs" 1>&6
+ if test $fu_cv_sys_stat_statvfs = yes; then
+ space=yes
+ cat >> confdefs.h <<\EOF
+#define STAT_STATVFS 1
+EOF
+
+ fi
+fi
+
+if test $space = no; then
+ # DEC Alpha running OSF/1
+ echo $ac_n "checking for 3-argument statfs function (DEC OSF/1)""... $ac_c" 1>&6
+echo "configure:4166: checking for 3-argument statfs function (DEC OSF/1)" >&5
+ if eval "test \"`echo '$''{'fu_cv_sys_stat_statfs3_osf1'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test "$cross_compiling" = yes; then
+ fu_cv_sys_stat_statfs3_osf1=no
+else
+ cat > conftest.$ac_ext <<EOF
+#line 4174 "configure"
+#include "confdefs.h"
+
+#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/mount.h>
+ main ()
+ {
+ struct statfs fsd;
+ fsd.f_fsize = 0;
+ exit (statfs (".", &fsd, sizeof (struct statfs)));
+ }
+EOF
+if { (eval echo configure:4187: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+then
+ fu_cv_sys_stat_statfs3_osf1=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ fu_cv_sys_stat_statfs3_osf1=no
+fi
+rm -fr conftest*
+fi
+
+fi
+
+ echo "$ac_t""$fu_cv_sys_stat_statfs3_osf1" 1>&6
+ if test $fu_cv_sys_stat_statfs3_osf1 = yes; then
+ space=yes
+ cat >> confdefs.h <<\EOF
+#define STAT_STATFS3_OSF1 1
+EOF
+
+ fi
+fi
+
+if test $space = no; then
+# AIX
+ echo $ac_n "checking for two-argument statfs with statfs.bsize member (AIX, 4.3BSD)""... $ac_c" 1>&6
+echo "configure:4214: checking for two-argument statfs with statfs.bsize member (AIX, 4.3BSD)" >&5
+ if eval "test \"`echo '$''{'fu_cv_sys_stat_statfs2_bsize'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test "$cross_compiling" = yes; then
+ fu_cv_sys_stat_statfs2_bsize=no
+else
+ cat > conftest.$ac_ext <<EOF
+#line 4222 "configure"
+#include "confdefs.h"
+
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#ifdef HAVE_SYS_MOUNT_H
+#include <sys/mount.h>
+#endif
+#ifdef HAVE_SYS_VFS_H
+#include <sys/vfs.h>
+#endif
+ main ()
+ {
+ struct statfs fsd;
+ fsd.f_bsize = 0;
+ exit (statfs (".", &fsd));
+ }
+EOF
+if { (eval echo configure:4241: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+then
+ fu_cv_sys_stat_statfs2_bsize=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ fu_cv_sys_stat_statfs2_bsize=no
+fi
+rm -fr conftest*
+fi
+
+fi
+
+ echo "$ac_t""$fu_cv_sys_stat_statfs2_bsize" 1>&6
+ if test $fu_cv_sys_stat_statfs2_bsize = yes; then
+ space=yes
+ cat >> confdefs.h <<\EOF
+#define STAT_STATFS2_BSIZE 1
+EOF
+
+ fi
+fi
+
+if test $space = no; then
+# SVR3
+ echo $ac_n "checking for four-argument statfs (AIX-3.2.5, SVR3)""... $ac_c" 1>&6
+echo "configure:4268: checking for four-argument statfs (AIX-3.2.5, SVR3)" >&5
+ if eval "test \"`echo '$''{'fu_cv_sys_stat_statfs4'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test "$cross_compiling" = yes; then
+ fu_cv_sys_stat_statfs4=no
+else
+ cat > conftest.$ac_ext <<EOF
+#line 4276 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <sys/statfs.h>
+ main ()
+ {
+ struct statfs fsd;
+ exit (statfs (".", &fsd, sizeof fsd, 0));
+ }
+EOF
+if { (eval echo configure:4286: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+then
+ fu_cv_sys_stat_statfs4=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ fu_cv_sys_stat_statfs4=no
+fi
+rm -fr conftest*
+fi
+
+fi
+
+ echo "$ac_t""$fu_cv_sys_stat_statfs4" 1>&6
+ if test $fu_cv_sys_stat_statfs4 = yes; then
+ space=yes
+ cat >> confdefs.h <<\EOF
+#define STAT_STATFS4 1
+EOF
+
+ fi
+fi
+
+if test $space = no; then
+# 4.4BSD and NetBSD
+ echo $ac_n "checking for two-argument statfs with statfs.fsize member (4.4BSD and NetBSD)""... $ac_c" 1>&6
+echo "configure:4313: checking for two-argument statfs with statfs.fsize member (4.4BSD and NetBSD)" >&5
+ if eval "test \"`echo '$''{'fu_cv_sys_stat_statfs2_fsize'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test "$cross_compiling" = yes; then
+ fu_cv_sys_stat_statfs2_fsize=no
+else
+ cat > conftest.$ac_ext <<EOF
+#line 4321 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#ifdef HAVE_SYS_MOUNT_H
+#include <sys/mount.h>
+#endif
+ main ()
+ {
+ struct statfs fsd;
+ fsd.f_fsize = 0;
+ exit (statfs (".", &fsd));
+ }
+EOF
+if { (eval echo configure:4337: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+then
+ fu_cv_sys_stat_statfs2_fsize=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ fu_cv_sys_stat_statfs2_fsize=no
+fi
+rm -fr conftest*
+fi
+
+fi
+
+ echo "$ac_t""$fu_cv_sys_stat_statfs2_fsize" 1>&6
+ if test $fu_cv_sys_stat_statfs2_fsize = yes; then
+ space=yes
+ cat >> confdefs.h <<\EOF
+#define STAT_STATFS2_FSIZE 1
+EOF
+
+ fi
+fi
+
+if test $space = no; then
+ # Ultrix
+ echo $ac_n "checking for two-argument statfs with struct fs_data (Ultrix)""... $ac_c" 1>&6
+echo "configure:4364: checking for two-argument statfs with struct fs_data (Ultrix)" >&5
+ if eval "test \"`echo '$''{'fu_cv_sys_stat_fs_data'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test "$cross_compiling" = yes; then
+ fu_cv_sys_stat_fs_data=no
+else
+ cat > conftest.$ac_ext <<EOF
+#line 4372 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#ifdef HAVE_SYS_MOUNT_H
+#include <sys/mount.h>
+#endif
+#ifdef HAVE_SYS_FS_TYPES_H
+#include <sys/fs_types.h>
+#endif
+ main ()
+ {
+ struct fs_data fsd;
+ /* Ultrix's statfs returns 1 for success,
+ 0 for not mounted, -1 for failure. */
+ exit (statfs (".", &fsd) != 1);
+ }
+EOF
+if { (eval echo configure:4392: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+then
+ fu_cv_sys_stat_fs_data=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ fu_cv_sys_stat_fs_data=no
+fi
+rm -fr conftest*
+fi
+
+fi
+
+ echo "$ac_t""$fu_cv_sys_stat_fs_data" 1>&6
+ if test $fu_cv_sys_stat_fs_data = yes; then
+ space=yes
+ cat >> confdefs.h <<\EOF
+#define STAT_STATFS2_FS_DATA 1
+EOF
+
+ fi
+fi
+
+
+trap '' 1 2 15
+cat > confcache <<\EOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs. It is not useful on other systems.
+# If it contains results you don't want to keep, you may remove or edit it.
+#
+# By default, configure uses ./config.cache as the cache file,
+# creating it if it does not exist already. You can give configure
+# the --cache-file=FILE option to use a different cache file; that is
+# what configure does when it calls configure scripts in
+# subdirectories, so they share the cache.
+# Giving --cache-file=/dev/null disables caching, for debugging configure.
+# config.status only pays attention to the cache file if you give it the
+# --recheck option to rerun configure.
+#
+EOF
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, don't put newlines in cache variables' values.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+(set) 2>&1 |
+ case `(ac_space=' '; set) 2>&1` in
+ *ac_space=\ *)
+ # `set' does not quote correctly, so add quotes (double-quote substitution
+ # turns \\\\ into \\, and sed turns \\ into \).
+ sed -n \
+ -e "s/'/'\\\\''/g" \
+ -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p"
+ ;;
+ *)
+ # `set' quotes correctly as required by POSIX, so do not add quotes.
+ sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p'
+ ;;
+ esac >> confcache
+if cmp -s $cache_file confcache; then
+ :
+else
+ if test -w $cache_file; then
+ echo "updating cache $cache_file"
+ cat confcache > $cache_file
+ else
+ echo "not updating unwritable cache $cache_file"
+ fi
+fi
+rm -f confcache
+
+trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+# Any assignment to VPATH causes Sun make to only execute
+# the first set of double-colon rules, so remove it if not needed.
+# If there is a colon in the path, we need to keep it.
+if test "x$srcdir" = x.; then
+ ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d'
+fi
+
+trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
+
+DEFS=-DHAVE_CONFIG_H
+
+# Without the "./", some shells look in PATH for config.status.
+: ${CONFIG_STATUS=./config.status}
+
+echo creating $CONFIG_STATUS
+rm -f $CONFIG_STATUS
+cat > $CONFIG_STATUS <<EOF
+#! /bin/sh
+# Generated automatically by configure.
+# Run this file to recreate the current configuration.
+# This directory was configured as follows,
+# on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+#
+# $0 $ac_configure_args
+#
+# Compiler output produced by configure, useful for debugging
+# configure, is in ./config.log if it exists.
+
+ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
+for ac_option
+do
+ case "\$ac_option" in
+ -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+ echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
+ exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
+ -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
+ echo "$CONFIG_STATUS generated by autoconf version 2.12"
+ exit 0 ;;
+ -help | --help | --hel | --he | --h)
+ echo "\$ac_cs_usage"; exit 0 ;;
+ *) echo "\$ac_cs_usage"; exit 1 ;;
+ esac
+done
+
+ac_given_srcdir=$srcdir
+ac_given_INSTALL="$INSTALL"
+
+trap 'rm -fr `echo "Makefile tests/dummy client/dummy lib/dummy lib/rpc/dummy
+lib/rpc/client/dummy lib/rpc/include/dummy lib/rpc/parse/dummy
+lib/rpc/server/dummy lib/smb/dummy ubiqx/dummy web/dummy config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
+EOF
+cat >> $CONFIG_STATUS <<EOF
+
+# Protect against being on the right side of a sed subst in config.status.
+sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g;
+ s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
+$ac_vpsub
+$extrasub
+s%@CFLAGS@%$CFLAGS%g
+s%@CPPFLAGS@%$CPPFLAGS%g
+s%@CXXFLAGS@%$CXXFLAGS%g
+s%@DEFS@%$DEFS%g
+s%@LDFLAGS@%$LDFLAGS%g
+s%@LIBS@%$LIBS%g
+s%@exec_prefix@%$exec_prefix%g
+s%@prefix@%$prefix%g
+s%@program_transform_name@%$program_transform_name%g
+s%@bindir@%$bindir%g
+s%@sbindir@%$sbindir%g
+s%@libexecdir@%$libexecdir%g
+s%@datadir@%$datadir%g
+s%@sysconfdir@%$sysconfdir%g
+s%@sharedstatedir@%$sharedstatedir%g
+s%@localstatedir@%$localstatedir%g
+s%@libdir@%$libdir%g
+s%@includedir@%$includedir%g
+s%@oldincludedir@%$oldincludedir%g
+s%@infodir@%$infodir%g
+s%@mandir@%$mandir%g
+s%@CC@%$CC%g
+s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
+s%@INSTALL_DATA@%$INSTALL_DATA%g
+s%@SHELL@%$SHELL%g
+s%@AWK@%$AWK%g
+s%@host@%$host%g
+s%@host_alias@%$host_alias%g
+s%@host_cpu@%$host_cpu%g
+s%@host_vendor@%$host_vendor%g
+s%@host_os@%$host_os%g
+s%@target@%$target%g
+s%@target_alias@%$target_alias%g
+s%@target_cpu@%$target_cpu%g
+s%@target_vendor@%$target_vendor%g
+s%@target_os@%$target_os%g
+s%@build@%$build%g
+s%@build_alias@%$build_alias%g
+s%@build_cpu@%$build_cpu%g
+s%@build_vendor@%$build_vendor%g
+s%@build_os@%$build_os%g
+s%@CPP@%$CPP%g
+s%@LIBOBJS@%$LIBOBJS%g
+
+CEOF
+EOF
+
+cat >> $CONFIG_STATUS <<\EOF
+
+# Split the substitutions into bite-sized pieces for seds with
+# small command number limits, like on Digital OSF/1 and HP-UX.
+ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script.
+ac_file=1 # Number of current file.
+ac_beg=1 # First line for current file.
+ac_end=$ac_max_sed_cmds # Line after last line for current file.
+ac_more_lines=:
+ac_sed_cmds=""
+while $ac_more_lines; do
+ if test $ac_beg -gt 1; then
+ sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file
+ else
+ sed "${ac_end}q" conftest.subs > conftest.s$ac_file
+ fi
+ if test ! -s conftest.s$ac_file; then
+ ac_more_lines=false
+ rm -f conftest.s$ac_file
+ else
+ if test -z "$ac_sed_cmds"; then
+ ac_sed_cmds="sed -f conftest.s$ac_file"
+ else
+ ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file"
+ fi
+ ac_file=`expr $ac_file + 1`
+ ac_beg=$ac_end
+ ac_end=`expr $ac_end + $ac_max_sed_cmds`
+ fi
+done
+if test -z "$ac_sed_cmds"; then
+ ac_sed_cmds=cat
+fi
+EOF
+
+cat >> $CONFIG_STATUS <<EOF
+
+CONFIG_FILES=\${CONFIG_FILES-"Makefile tests/dummy client/dummy lib/dummy lib/rpc/dummy
+lib/rpc/client/dummy lib/rpc/include/dummy lib/rpc/parse/dummy
+lib/rpc/server/dummy lib/smb/dummy ubiqx/dummy web/dummy"}
+EOF
+cat >> $CONFIG_STATUS <<\EOF
+for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
+ # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+ case "$ac_file" in
+ *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
+ ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
+ *) ac_file_in="${ac_file}.in" ;;
+ esac
+
+ # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories.
+
+ # Remove last slash and all that follows it. Not all systems have dirname.
+ ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
+ if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
+ # The file is in a subdirectory.
+ test ! -d "$ac_dir" && mkdir "$ac_dir"
+ ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
+ # A "../" for each directory in $ac_dir_suffix.
+ ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
+ else
+ ac_dir_suffix= ac_dots=
+ fi
+
+ case "$ac_given_srcdir" in
+ .) srcdir=.
+ if test -z "$ac_dots"; then top_srcdir=.
+ else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
+ /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;;
+ *) # Relative path.
+ srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
+ top_srcdir="$ac_dots$ac_given_srcdir" ;;
+ esac
+
+ case "$ac_given_INSTALL" in
+ [/$]*) INSTALL="$ac_given_INSTALL" ;;
+ *) INSTALL="$ac_dots$ac_given_INSTALL" ;;
+ esac
+
+ echo creating "$ac_file"
+ rm -f "$ac_file"
+ configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
+ case "$ac_file" in
+ *Makefile*) ac_comsub="1i\\
+# $configure_input" ;;
+ *) ac_comsub= ;;
+ esac
+
+ ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
+ sed -e "$ac_comsub
+s%@configure_input@%$configure_input%g
+s%@srcdir@%$srcdir%g
+s%@top_srcdir@%$top_srcdir%g
+s%@INSTALL@%$INSTALL%g
+" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file
+fi; done
+rm -f conftest.s*
+
+# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where
+# NAME is the cpp macro being defined and VALUE is the value it is being given.
+#
+# ac_d sets the value in "#define NAME VALUE" lines.
+ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)'
+ac_dB='\([ ][ ]*\)[^ ]*%\1#\2'
+ac_dC='\3'
+ac_dD='%g'
+# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE".
+ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
+ac_uB='\([ ]\)%\1#\2define\3'
+ac_uC=' '
+ac_uD='\4%g'
+# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
+ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
+ac_eB='$%\1#\2define\3'
+ac_eC=' '
+ac_eD='%g'
+
+if test "${CONFIG_HEADERS+set}" != set; then
+EOF
+cat >> $CONFIG_STATUS <<EOF
+ CONFIG_HEADERS="config.h"
+EOF
+cat >> $CONFIG_STATUS <<\EOF
+fi
+for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then
+ # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+ case "$ac_file" in
+ *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
+ ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
+ *) ac_file_in="${ac_file}.in" ;;
+ esac
+
+ echo creating $ac_file
+
+ rm -f conftest.frag conftest.in conftest.out
+ ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
+ cat $ac_file_inputs > conftest.in
+
+EOF
+
+# Transform confdefs.h into a sed script conftest.vals that substitutes
+# the proper values into config.h.in to produce config.h. And first:
+# Protect against being on the right side of a sed subst in config.status.
+# Protect against being in an unquoted here document in config.status.
+rm -f conftest.vals
+cat > conftest.hdr <<\EOF
+s/[\\&%]/\\&/g
+s%[\\$`]%\\&%g
+s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp
+s%ac_d%ac_u%gp
+s%ac_u%ac_e%gp
+EOF
+sed -n -f conftest.hdr confdefs.h > conftest.vals
+rm -f conftest.hdr
+
+# This sed command replaces #undef with comments. This is necessary, for
+# example, in the case of _POSIX_SOURCE, which is predefined and required
+# on some systems where configure will not decide to define it.
+cat >> conftest.vals <<\EOF
+s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */%
+EOF
+
+# Break up conftest.vals because some shells have a limit on
+# the size of here documents, and old seds have small limits too.
+
+rm -f conftest.tail
+while :
+do
+ ac_lines=`grep -c . conftest.vals`
+ # grep -c gives empty output for an empty file on some AIX systems.
+ if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi
+ # Write a limited-size here document to conftest.frag.
+ echo ' cat > conftest.frag <<CEOF' >> $CONFIG_STATUS
+ sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS
+ echo 'CEOF
+ sed -f conftest.frag conftest.in > conftest.out
+ rm -f conftest.in
+ mv conftest.out conftest.in
+' >> $CONFIG_STATUS
+ sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail
+ rm -f conftest.vals
+ mv conftest.tail conftest.vals
+done
+rm -f conftest.vals
+
+cat >> $CONFIG_STATUS <<\EOF
+ rm -f conftest.frag conftest.h
+ echo "/* $ac_file. Generated automatically by configure. */" > conftest.h
+ cat conftest.in >> conftest.h
+ rm -f conftest.in
+ if cmp -s $ac_file conftest.h 2>/dev/null; then
+ echo "$ac_file is unchanged"
+ rm -f conftest.h
+ else
+ # Remove last slash and all that follows it. Not all systems have dirname.
+ ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
+ if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
+ # The file is in a subdirectory.
+ test ! -d "$ac_dir" && mkdir "$ac_dir"
+ fi
+ rm -f $ac_file
+ mv conftest.h $ac_file
+ fi
+fi; done
+
+EOF
+cat >> $CONFIG_STATUS <<EOF
+
+EOF
+cat >> $CONFIG_STATUS <<\EOF
+
+exit 0
+EOF
+chmod +x $CONFIG_STATUS
+rm -fr confdefs* $ac_clean_files
+test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
+
diff --git a/source3/configure.in b/source3/configure.in
new file mode 100644
index 0000000000..883085b3e1
--- /dev/null
+++ b/source3/configure.in
@@ -0,0 +1,578 @@
+dnl Process this file with autoconf to produce a configure script.
+AC_INIT(byteorder.h)
+AC_CONFIG_HEADER(config.h)
+
+dnl Checks for programs.
+AC_PROG_CC
+AC_PROG_INSTALL
+AC_SUBST(SHELL)
+AC_PROG_AWK
+
+AC_CANONICAL_SYSTEM
+case "$host_os" in
+ *linux*) AC_DEFINE(LINUX);;
+ *solaris*) AC_DEFINE(SUNOS5);;
+ *sunos*) AC_DEFINE(SUNOS4);;
+ *irix*) AC_DEFINE(IRIX);;
+ *aix*) AC_DEFINE(AIX);;
+ *hpux*) AC_DEFINE(HPUX);;
+ *qnx*) AC_DEFINE(QNX);;
+ *osf1*) AC_DEFINE(OSF1);;
+ *sco*) AC_DEFINE(SCO);;
+ *next2*) AC_DEFINE(NEXT2);;
+esac
+
+AC_INLINE
+AC_HEADER_STDC
+AC_HEADER_DIRENT
+AC_HEADER_TIME
+AC_HEADER_SYS_WAIT
+AC_CHECK_HEADERS(sys/fcntl.h sys/select.h fcntl.h sys/time.h sys/unistd.h)
+AC_CHECK_HEADERS(unistd.h utime.h grp.h sys/id.h limits.h net/if.h)
+AC_CHECK_HEADERS(compat.h sys/param.h ctype.h sys/wait.h sys/ioctl.h)
+AC_CHECK_HEADERS(sys/filio.h string.h stdlib.h sys/socket.h sys/mode.h)
+AC_CHECK_HEADERS(sys/mount.h sys/vfs.h sys/fs/s5param.h sys/filsys.h termios.h)
+AC_CHECK_HEADERS(sys/statfs.h sys/dustat.h sys/statvfs.h stdarg.h sys/sockio.h)
+AC_CHECK_HEADERS(shadow.h netinet/tcp.h sys/security.h security/pam_appl.h)
+
+AC_CHECK_SIZEOF(int)
+AC_CHECK_SIZEOF(long)
+AC_CHECK_SIZEOF(short)
+
+AC_C_CONST
+AC_C_INLINE
+AC_C_BIGENDIAN
+AC_C_CHAR_UNSIGNED
+
+AC_TYPE_SIGNAL
+AC_TYPE_UID_T
+AC_TYPE_MODE_T
+AC_TYPE_OFF_T
+AC_TYPE_SIZE_T
+AC_TYPE_PID_T
+AC_STRUCT_ST_RDEV
+AC_CHECK_TYPE(ino_t,unsigned)
+
+echo $ac_n "checking for errno in errno.h... $ac_c"
+AC_TRY_COMPILE([#include <errno.h>],[int i = errno],
+echo yes; AC_DEFINE(HAVE_ERRNO_DECL),
+echo no)
+
+AC_FUNC_MEMCMP
+
+###############################################
+# test for where we get crypt() from
+if test "$ac_cv_lib_crypt_crypt" = "yes"; then
+ AC_CHECK_LIB(crypt, crypt)
+ AC_DEFINE(HAVE_CRYPT)
+fi
+if test "$ac_cv_lib_crypt_crypt" = "no" ||
+ test "$ac_cv_lib_crypt_crypt" = ""; then
+# look for crypt
+AC_CHECK_FUNC(crypt, AC_DEFINE(HAVE_CRYPT),
+[case "$LIBS" in
+*-lcrypt*) ;;
+*) AC_CHECK_LIB(crypt, crypt) ;;
+esac
+if test "$ac_cv_lib_crypt_crypt" = "yes"; then
+ ac_cv_func_crypt=yes
+ AC_DEFINE(HAVE_CRYPT)
+fi])
+fi
+
+
+###############################################
+# test for where we get pam_authenticate() from
+# might need libdl for this to work
+if test "$ac_cv_header_security_pam_appl_h" = "yes"; then
+ AC_HAVE_LIBRARY(dl)
+fi
+if test "$ac_cv_lib_pam_pam_authenticate" = "yes"; then
+ AC_CHECK_LIB(pam, pam_authenticate)
+ AC_DEFINE(HAVE_PAM_AUTHENTICATE)
+fi
+if test "$ac_cv_lib_pam_pam_authenticate" = "no" ||
+ test "$ac_cv_lib_pam_pam_authenticate" = ""; then
+# look for pam_authenticate
+AC_CHECK_FUNC(pam_authenticate, AC_DEFINE(HAVE_PAM_AUTHENTICATE),
+[case "$LIBS" in
+*-lpam*) ;;
+*) AC_CHECK_LIB(pam, pam_authenticate) ;;
+esac
+if test "$ac_cv_lib_pam_pam_authenticate" = "yes"; then
+ ac_cv_func_pam_authenticate=yes
+ AC_DEFINE(HAVE_PAM_AUTHENTICATE)
+fi])
+fi
+
+
+AC_CHECK_FUNCS(waitpid getcwd strdup strerror chown chmod chroot)
+AC_CHECK_FUNCS(fstat strchr utime utimes getrlimit fsync execl)
+AC_CHECK_FUNCS(memmove vsnprintf setsid glob strpbrk pipe crypt16 getauthuid)
+AC_CHECK_FUNCS(strftime sigprocmask sigblock sigaction innetgr)
+AC_CHECK_FUNCS(initgroups select rdchk getgrnam pathconf putprpwnam)
+AC_CHECK_FUNCS(setresuid setuidx setgroups mktime rename ftruncate)
+AC_CHECK_FUNCS(set_auth_parameters atexit grantpt getspnam dup2)
+AC_CHECK_FUNCS(bigcrypt getprpwnam setluid yp_get_default_domain)
+
+echo $ac_n "checking for long long ... $ac_c"
+AC_TRY_RUN([#include <stdio.h>
+main() { long long x = 1000000; x *= x; exit(((x/1000000) == 1000000)? 0: 1); }],
+echo yes;AC_DEFINE(HAVE_LONGLONG),
+echo no)
+
+echo $ac_n "checking for off64_t ... $ac_c"
+AC_TRY_RUN([#include <stdio.h>
+#include <sys/stat.h>
+main() { struct stat64 st; off64_t s; if (sizeof(off_t) == sizeof(off64_t)) exit(1); exit((lstat64("/dev/null", &st)==0)?0:1); }],
+echo yes;AC_DEFINE(HAVE_OFF64_T),
+echo no)
+
+echo $ac_n "checking for union semun ... $ac_c"
+AC_TRY_RUN([
+#include <sys/types.h>
+#include <sys/ipc.h>
+#include <sys/sem.h>
+main() { union semun ss; exit(0); }],
+echo yes;AC_DEFINE(HAVE_UNION_SEMUN),
+echo no)
+
+echo $ac_n "checking for unsigned char ... $ac_c"
+AC_TRY_RUN([#include <stdio.h>
+main() { char c; c=250; exit((c > 0)?0:1); }],
+echo yes;AC_DEFINE(HAVE_UNSIGNED_CHAR),
+echo no)
+
+echo $ac_n "checking for sin_len in sock ... $ac_c"
+AC_TRY_COMPILE([#include <sys/types.h>
+#include <sys/socket.h>],
+[struct sockaddr_in sock; sock.sin_len = sizeof(sock);],
+echo yes;AC_DEFINE(HAVE_SOCK_SIN_LEN),
+echo no)
+
+echo $ac_n "checking if gettimeofday takes tz argument ... $ac_c"
+AC_TRY_RUN([
+#include <sys/time.h>
+#include <unistd.h>
+main() { struct timeval tv; exit(gettimeofday(&tv, NULL));}],
+ echo yes;AC_DEFINE(HAVE_GETTIMEOFDAY_TZ),
+ echo no)
+
+
+echo $ac_n "checking for broken readdir ... $ac_c"
+AC_TRY_RUN([#include <sys/types.h>
+#include <dirent.h>
+main() { struct dirent *di; DIR *d = opendir("."); di = readdir(d);
+if (di && di->d_name[-2] == '.' && di->d_name[-1] == 0 &&
+di->d_name[0] == 0) exit(0); exit(1);} ],
+echo yes - you are using the broken /usr/ucb/cc;AC_DEFINE(HAVE_BROKEN_READDIR),
+echo no)
+
+echo $ac_n "checking for utimbuf ... $ac_c"
+AC_TRY_COMPILE([#include <sys/types.h>
+#include <utime.h>],
+[struct utimbuf tbuf; tbuf.actime = 0; tbuf.modtime = 1; exit(utime("foo.c",&tbuf));],
+echo yes;AC_DEFINE(HAVE_UTIMBUF),
+echo no)
+
+echo $ac_n "checking for ftruncate extend ... $ac_c"
+AC_TRY_RUN([#include "tests/ftruncate.c"],
+ echo yes;AC_DEFINE(HAVE_FTRUNCATE_EXTEND),
+ echo no)
+
+# The following test taken from the cvs sources
+# If we can't find connect, try looking in -lsocket, -lnsl, and -linet.
+# The Irix 5 libc.so has connect and gethostbyname, but Irix 5 also has
+# libsocket.so which has a bad implementation of gethostbyname (it
+# only looks in /etc/hosts), so we only look for -lsocket if we need
+# it.
+AC_CHECK_FUNC(connect, :,
+[case "$LIBS" in
+*-lnsl*) ;;
+*) AC_CHECK_LIB(nsl_s, printf) ;;
+esac
+case "$LIBS" in
+*-lnsl*) ;;
+*) AC_CHECK_LIB(nsl, printf) ;;
+esac
+case "$LIBS" in
+*-lsocket*) ;;
+*) AC_CHECK_LIB(socket, connect) ;;
+esac
+case "$LIBS" in
+*-linet*) ;;
+*) AC_CHECK_LIB(inet, connect) ;;
+esac
+dnl We can't just call AC_CHECK_FUNCS(connect) here, because the value
+dnl has been cached.
+if test "$ac_cv_lib_socket_connect" = "yes" ||
+ test "$ac_cv_lib_inet_connect" = "yes"; then
+ ac_cv_func_connect=yes
+ AC_DEFINE(HAVE_CONNECT)
+fi])
+
+
+echo $ac_n "checking for root ... $ac_c"
+AC_TRY_RUN([main() { exit(getuid() != 0); }],
+ echo yes;AC_DEFINE(HAVE_ROOT),
+ echo WARNING: running as non-root will disable some tests;)
+
+netmask=no;
+echo $ac_n "checking for netmask ifconf ... $ac_c"
+AC_TRY_RUN([
+#define HAVE_NETMASK_IFCONF 1
+#define AUTOCONF 1
+#include "netmask.c"],
+ echo yes;netmask=yes;AC_DEFINE(HAVE_NETMASK_IFCONF),
+ echo no)
+
+if test $netmask = no; then
+echo $ac_n "checking for netmask ifreq ... $ac_c"
+AC_TRY_RUN([
+#define HAVE_NETMASK_IFREQ 1
+#define AUTOCONF 1
+#include "netmask.c"],
+ echo yes;netmask=yes;AC_DEFINE(HAVE_NETMASK_IFREQ),
+ echo no)
+fi
+
+if test $netmask = no; then
+echo $ac_n "checking for netmask AIX ... $ac_c"
+AC_TRY_RUN([
+#define HAVE_NETMASK_AIX 1
+#define AUTOCONF 1
+#include "netmask.c"],
+ echo yes;netmask=yes;AC_DEFINE(HAVE_NETMASK_AIX),
+ echo no)
+fi
+
+echo $ac_n "checking for trapdoor seteuid ... $ac_c"
+AC_TRY_RUN([#include "tests/trapdoor.c"],
+ echo no,
+ echo yes;AC_DEFINE(HAVE_TRAPDOOR_UID))
+
+echo $ac_n "checking for shared mmap ... $ac_c"
+AC_TRY_RUN([#include "tests/shared_mmap.c"],
+ echo yes;AC_DEFINE(HAVE_SHARED_MMAP),
+ echo no)
+
+echo $ac_n "checking for fcntl locking ... $ac_c"
+AC_TRY_RUN([#include "tests/fcntl_lock.c"],
+ echo yes;AC_DEFINE(HAVE_FCNTL_LOCK),
+ echo no)
+
+echo $ac_n "checking for sysv ipc ... $ac_c"
+AC_TRY_RUN([#include "tests/sysv_ipc.c"],
+ echo yes;AC_DEFINE(HAVE_SYSV_IPC),
+ echo no)
+
+#################################################
+# check for the AFS filesystem
+AC_MSG_CHECKING(whether to use AFS)
+AC_ARG_WITH(afs,
+[ --with-afs Include AFS support
+ --without-afs Don't include AFS support (default)],
+[ case "$withval" in
+ yes)
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(WITH_AFS)
+ ;;
+ *)
+ AC_MSG_RESULT(no)
+ ;;
+ esac ],
+ AC_MSG_RESULT(no)
+)
+
+
+#################################################
+# check for the DFS auth system
+AC_MSG_CHECKING(whether to use DFS auth)
+AC_ARG_WITH(dfs,
+[ --with-dfs Include DFS support
+ --without-dfs Don't include DFS support (default)],
+[ case "$withval" in
+ yes)
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(WITH_DFS)
+ ;;
+ *)
+ AC_MSG_RESULT(no)
+ ;;
+ esac ],
+ AC_MSG_RESULT(no)
+)
+
+#################################################
+# check for automount support
+AC_MSG_CHECKING(whether to use AUTOMOUNT)
+AC_ARG_WITH(automount,
+[ --with-automount Include AUTOMOUNT support
+ --without-automount Don't include AUTOMOUNT support (default)],
+[ case "$withval" in
+ yes)
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(WITH_AUTOMOUNT)
+ ;;
+ *)
+ AC_MSG_RESULT(no)
+ ;;
+ esac ],
+ AC_MSG_RESULT(no)
+)
+
+#################################################
+# check for a LDAP password database
+AC_MSG_CHECKING(whether to use LDAP password database)
+AC_ARG_WITH(ldap,
+[ --with-ldap Include LDAP support
+ --without-ldap Don't include LDAP support (default)],
+[ case "$withval" in
+ yes)
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(WITH_LDAP)
+ ;;
+ *)
+ AC_MSG_RESULT(no)
+ ;;
+ esac ],
+ AC_MSG_RESULT(no)
+)
+
+#################################################
+# check for a NISPLUS password database
+AC_MSG_CHECKING(whether to use NISPLUS password database)
+AC_ARG_WITH(nisplus,
+[ --with-nisplus Include NISPLUS password database support
+ --without-nisplus Don't include NISPLUS password database support (default)],
+[ case "$withval" in
+ yes)
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(WITH_NISPLUS)
+ ;;
+ *)
+ AC_MSG_RESULT(no)
+ ;;
+ esac ],
+ AC_MSG_RESULT(no)
+)
+
+#################################################
+# check for the secure socket layer
+AC_MSG_CHECKING(whether to use SSL)
+AC_ARG_WITH(ssl,
+[ --with-ssl Include SSL support
+ --without-ssl Don't include SSL support (default)],
+[ case "$withval" in
+ yes)
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(WITH_SSL)
+ ;;
+ *)
+ AC_MSG_RESULT(no)
+ ;;
+ esac ],
+ AC_MSG_RESULT(no)
+)
+
+#################################################
+# check for experimental mmap support
+AC_MSG_CHECKING(whether to use MMAP)
+AC_ARG_WITH(mmap,
+[ --with-mmap Include experimental MMAP support
+ --without-mmap Don't include MMAP support (default)],
+[ case "$withval" in
+ yes)
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(WITH_MMAP)
+ ;;
+ *)
+ AC_MSG_RESULT(no)
+ ;;
+ esac ],
+ AC_MSG_RESULT(no)
+)
+
+#################################################
+# check for syslog logging
+AC_MSG_CHECKING(whether to use syslog logging)
+AC_ARG_WITH(syslog,
+[ --with-syslog Include experimental SYSLOG support
+ --without-syslog Don't include SYSLOG support (default)],
+[ case "$withval" in
+ yes)
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(WITH_SYSLOG)
+ ;;
+ *)
+ AC_MSG_RESULT(no)
+ ;;
+ esac ],
+ AC_MSG_RESULT(no)
+)
+
+
+#################################################
+# these tests are taken from the GNU fileutils package
+AC_CHECKING(how to get filesystem space usage)
+space=no
+
+# Perform only the link test since it seems there are no variants of the
+# statvfs function. This check is more than just AC_CHECK_FUNCS(statvfs)
+# because that got a false positive on SCO OSR5. Adding the declaration
+# of a `struct statvfs' causes this test to fail (as it should) on such
+# systems. That system is reported to work fine with STAT_STATFS4 which
+# is what it gets when this test fails.
+if test $space = no; then
+ # SVR4
+ AC_CACHE_CHECK([statvfs function (SVR4)], fu_cv_sys_stat_statvfs,
+ [AC_TRY_LINK([#include <sys/types.h>
+#include <sys/statvfs.h>],
+ [struct statvfs fsd; statvfs (0, &fsd);],
+ fu_cv_sys_stat_statvfs=yes,
+ fu_cv_sys_stat_statvfs=no)])
+ if test $fu_cv_sys_stat_statvfs = yes; then
+ space=yes
+ AC_DEFINE(STAT_STATVFS)
+ fi
+fi
+
+if test $space = no; then
+ # DEC Alpha running OSF/1
+ AC_MSG_CHECKING([for 3-argument statfs function (DEC OSF/1)])
+ AC_CACHE_VAL(fu_cv_sys_stat_statfs3_osf1,
+ [AC_TRY_RUN([
+#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/mount.h>
+ main ()
+ {
+ struct statfs fsd;
+ fsd.f_fsize = 0;
+ exit (statfs (".", &fsd, sizeof (struct statfs)));
+ }],
+ fu_cv_sys_stat_statfs3_osf1=yes,
+ fu_cv_sys_stat_statfs3_osf1=no,
+ fu_cv_sys_stat_statfs3_osf1=no)])
+ AC_MSG_RESULT($fu_cv_sys_stat_statfs3_osf1)
+ if test $fu_cv_sys_stat_statfs3_osf1 = yes; then
+ space=yes
+ AC_DEFINE(STAT_STATFS3_OSF1)
+ fi
+fi
+
+if test $space = no; then
+# AIX
+ AC_MSG_CHECKING([for two-argument statfs with statfs.bsize dnl
+member (AIX, 4.3BSD)])
+ AC_CACHE_VAL(fu_cv_sys_stat_statfs2_bsize,
+ [AC_TRY_RUN([
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#ifdef HAVE_SYS_MOUNT_H
+#include <sys/mount.h>
+#endif
+#ifdef HAVE_SYS_VFS_H
+#include <sys/vfs.h>
+#endif
+ main ()
+ {
+ struct statfs fsd;
+ fsd.f_bsize = 0;
+ exit (statfs (".", &fsd));
+ }],
+ fu_cv_sys_stat_statfs2_bsize=yes,
+ fu_cv_sys_stat_statfs2_bsize=no,
+ fu_cv_sys_stat_statfs2_bsize=no)])
+ AC_MSG_RESULT($fu_cv_sys_stat_statfs2_bsize)
+ if test $fu_cv_sys_stat_statfs2_bsize = yes; then
+ space=yes
+ AC_DEFINE(STAT_STATFS2_BSIZE)
+ fi
+fi
+
+if test $space = no; then
+# SVR3
+ AC_MSG_CHECKING([for four-argument statfs (AIX-3.2.5, SVR3)])
+ AC_CACHE_VAL(fu_cv_sys_stat_statfs4,
+ [AC_TRY_RUN([#include <sys/types.h>
+#include <sys/statfs.h>
+ main ()
+ {
+ struct statfs fsd;
+ exit (statfs (".", &fsd, sizeof fsd, 0));
+ }],
+ fu_cv_sys_stat_statfs4=yes,
+ fu_cv_sys_stat_statfs4=no,
+ fu_cv_sys_stat_statfs4=no)])
+ AC_MSG_RESULT($fu_cv_sys_stat_statfs4)
+ if test $fu_cv_sys_stat_statfs4 = yes; then
+ space=yes
+ AC_DEFINE(STAT_STATFS4)
+ fi
+fi
+
+if test $space = no; then
+# 4.4BSD and NetBSD
+ AC_MSG_CHECKING([for two-argument statfs with statfs.fsize dnl
+member (4.4BSD and NetBSD)])
+ AC_CACHE_VAL(fu_cv_sys_stat_statfs2_fsize,
+ [AC_TRY_RUN([#include <sys/types.h>
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#ifdef HAVE_SYS_MOUNT_H
+#include <sys/mount.h>
+#endif
+ main ()
+ {
+ struct statfs fsd;
+ fsd.f_fsize = 0;
+ exit (statfs (".", &fsd));
+ }],
+ fu_cv_sys_stat_statfs2_fsize=yes,
+ fu_cv_sys_stat_statfs2_fsize=no,
+ fu_cv_sys_stat_statfs2_fsize=no)])
+ AC_MSG_RESULT($fu_cv_sys_stat_statfs2_fsize)
+ if test $fu_cv_sys_stat_statfs2_fsize = yes; then
+ space=yes
+ AC_DEFINE(STAT_STATFS2_FSIZE)
+ fi
+fi
+
+if test $space = no; then
+ # Ultrix
+ AC_MSG_CHECKING([for two-argument statfs with struct fs_data (Ultrix)])
+ AC_CACHE_VAL(fu_cv_sys_stat_fs_data,
+ [AC_TRY_RUN([#include <sys/types.h>
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#ifdef HAVE_SYS_MOUNT_H
+#include <sys/mount.h>
+#endif
+#ifdef HAVE_SYS_FS_TYPES_H
+#include <sys/fs_types.h>
+#endif
+ main ()
+ {
+ struct fs_data fsd;
+ /* Ultrix's statfs returns 1 for success,
+ 0 for not mounted, -1 for failure. */
+ exit (statfs (".", &fsd) != 1);
+ }],
+ fu_cv_sys_stat_fs_data=yes,
+ fu_cv_sys_stat_fs_data=no,
+ fu_cv_sys_stat_fs_data=no)])
+ AC_MSG_RESULT($fu_cv_sys_stat_fs_data)
+ if test $fu_cv_sys_stat_fs_data = yes; then
+ space=yes
+ AC_DEFINE(STAT_STATFS2_FS_DATA)
+ fi
+fi
+
+
+AC_OUTPUT(Makefile tests/dummy client/dummy lib/dummy lib/rpc/dummy
+lib/rpc/client/dummy lib/rpc/include/dummy lib/rpc/parse/dummy
+lib/rpc/server/dummy lib/smb/dummy ubiqx/dummy web/dummy)
diff --git a/source3/include/config.h.in b/source3/include/config.h.in
new file mode 100644
index 0000000000..3bc3e95e4f
--- /dev/null
+++ b/source3/include/config.h.in
@@ -0,0 +1,397 @@
+/* config.h.in. Generated automatically from configure.in by autoheader. */
+
+/* Define if on AIX 3.
+ System headers sometimes define this.
+ We just want to avoid a redefinition error message. */
+#ifndef _ALL_SOURCE
+#undef _ALL_SOURCE
+#endif
+
+/* Define if type char is unsigned and you are not using gcc. */
+#ifndef __CHAR_UNSIGNED__
+#undef __CHAR_UNSIGNED__
+#endif
+
+/* Define to empty if the keyword does not work. */
+#undef const
+
+/* Define to `int' if <sys/types.h> doesn't define. */
+#undef gid_t
+
+/* Define if your struct stat has st_rdev. */
+#undef HAVE_ST_RDEV
+
+/* Define if you have <sys/wait.h> that is POSIX.1 compatible. */
+#undef HAVE_SYS_WAIT_H
+
+/* Define as __inline if that's what the C compiler calls it. */
+#undef inline
+
+/* Define to `int' if <sys/types.h> doesn't define. */
+#undef mode_t
+
+/* Define to `long' if <sys/types.h> doesn't define. */
+#undef off_t
+
+/* Define to `int' if <sys/types.h> doesn't define. */
+#undef pid_t
+
+/* Define as the return type of signal handlers (int or void). */
+#undef RETSIGTYPE
+
+/* Define to `unsigned' if <sys/types.h> doesn't define. */
+#undef size_t
+
+/* Define if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
+/* Define if you can safely include both <sys/time.h> and <time.h>. */
+#undef TIME_WITH_SYS_TIME
+
+/* Define to `int' if <sys/types.h> doesn't define. */
+#undef uid_t
+
+/* Define if your processor stores words with the most significant
+ byte first (like Motorola and SPARC, unlike Intel and VAX). */
+#undef WORDS_BIGENDIAN
+
+#undef HAVE_BROKEN_READDIR
+#undef HAVE_ERRNO_DECL
+#undef HAVE_LONGLONG
+#undef HAVE_OFF64_T
+#undef HAVE_REMSH
+#undef HAVE_UNSIGNED_CHAR
+#undef HAVE_UTIMBUF
+#undef ino_t
+#undef HAVE_CONNECT
+#undef HAVE_SHORT_INO_T
+#undef WITH_AFS
+#undef WITH_DFS
+#undef SUNOS5
+#undef SUNOS4
+#undef LINUX
+#undef AIX
+#undef IRIX
+#undef HPUX
+#undef QNX
+#undef SCO
+#undef OSF1
+#undef NEXT2
+#undef HAVE_SHARED_MMAP
+#undef HAVE_SYSV_IPC
+#undef HAVE_FCNTL_LOCK
+#undef HAVE_FTRUNCATE_EXTEND
+#undef HAVE_TRAPDOOR_UID
+#undef HAVE_ROOT
+#undef HAVE_UNION_SEMUN
+#undef HAVE_NETMASK_IFCONF
+#undef HAVE_GETTIMEOFDAY_TZ
+#undef HAVE_SOCK_SIN_LEN
+#undef STAT_READ_FILSYS
+#undef STAT_STATFS2_BSIZE
+#undef STAT_STATFS2_FSIZE
+#undef STAT_STATFS2_FS_DATA
+#undef STAT_STATFS3_OSF1
+#undef STAT_STATFS4
+#undef STAT_STATVFS
+#undef HAVE_NETMASK_IFREQ
+#undef HAVE_NETMASK_AIX
+#undef HAVE_CRYPT
+#undef WITH_MMAP
+#undef WITH_SYSLOG
+#undef WITH_SSL
+#undef WITH_LDAP
+#undef WITH_NISPLUS
+#undef WITH_AUTOMOUNT
+#undef HAVE_PAM_AUTHENTICATE
+
+/* The number of bytes in a int. */
+#undef SIZEOF_INT
+
+/* The number of bytes in a long. */
+#undef SIZEOF_LONG
+
+/* The number of bytes in a short. */
+#undef SIZEOF_SHORT
+
+/* Define if you have the atexit function. */
+#undef HAVE_ATEXIT
+
+/* Define if you have the bigcrypt function. */
+#undef HAVE_BIGCRYPT
+
+/* Define if you have the chmod function. */
+#undef HAVE_CHMOD
+
+/* Define if you have the chown function. */
+#undef HAVE_CHOWN
+
+/* Define if you have the chroot function. */
+#undef HAVE_CHROOT
+
+/* Define if you have the crypt16 function. */
+#undef HAVE_CRYPT16
+
+/* Define if you have the dup2 function. */
+#undef HAVE_DUP2
+
+/* Define if you have the execl function. */
+#undef HAVE_EXECL
+
+/* Define if you have the fstat function. */
+#undef HAVE_FSTAT
+
+/* Define if you have the fsync function. */
+#undef HAVE_FSYNC
+
+/* Define if you have the ftruncate function. */
+#undef HAVE_FTRUNCATE
+
+/* Define if you have the getauthuid function. */
+#undef HAVE_GETAUTHUID
+
+/* Define if you have the getcwd function. */
+#undef HAVE_GETCWD
+
+/* Define if you have the getgrnam function. */
+#undef HAVE_GETGRNAM
+
+/* Define if you have the getprpwnam function. */
+#undef HAVE_GETPRPWNAM
+
+/* Define if you have the getrlimit function. */
+#undef HAVE_GETRLIMIT
+
+/* Define if you have the getspnam function. */
+#undef HAVE_GETSPNAM
+
+/* Define if you have the glob function. */
+#undef HAVE_GLOB
+
+/* Define if you have the grantpt function. */
+#undef HAVE_GRANTPT
+
+/* Define if you have the initgroups function. */
+#undef HAVE_INITGROUPS
+
+/* Define if you have the innetgr function. */
+#undef HAVE_INNETGR
+
+/* Define if you have the memmove function. */
+#undef HAVE_MEMMOVE
+
+/* Define if you have the mktime function. */
+#undef HAVE_MKTIME
+
+/* Define if you have the pathconf function. */
+#undef HAVE_PATHCONF
+
+/* Define if you have the pipe function. */
+#undef HAVE_PIPE
+
+/* Define if you have the putprpwnam function. */
+#undef HAVE_PUTPRPWNAM
+
+/* Define if you have the rdchk function. */
+#undef HAVE_RDCHK
+
+/* Define if you have the rename function. */
+#undef HAVE_RENAME
+
+/* Define if you have the select function. */
+#undef HAVE_SELECT
+
+/* Define if you have the set_auth_parameters function. */
+#undef HAVE_SET_AUTH_PARAMETERS
+
+/* Define if you have the setgroups function. */
+#undef HAVE_SETGROUPS
+
+/* Define if you have the setluid function. */
+#undef HAVE_SETLUID
+
+/* Define if you have the setresuid function. */
+#undef HAVE_SETRESUID
+
+/* Define if you have the setsid function. */
+#undef HAVE_SETSID
+
+/* Define if you have the setuidx function. */
+#undef HAVE_SETUIDX
+
+/* Define if you have the sigaction function. */
+#undef HAVE_SIGACTION
+
+/* Define if you have the sigblock function. */
+#undef HAVE_SIGBLOCK
+
+/* Define if you have the sigprocmask function. */
+#undef HAVE_SIGPROCMASK
+
+/* Define if you have the strchr function. */
+#undef HAVE_STRCHR
+
+/* Define if you have the strdup function. */
+#undef HAVE_STRDUP
+
+/* Define if you have the strerror function. */
+#undef HAVE_STRERROR
+
+/* Define if you have the strftime function. */
+#undef HAVE_STRFTIME
+
+/* Define if you have the strpbrk function. */
+#undef HAVE_STRPBRK
+
+/* Define if you have the utime function. */
+#undef HAVE_UTIME
+
+/* Define if you have the utimes function. */
+#undef HAVE_UTIMES
+
+/* Define if you have the vsnprintf function. */
+#undef HAVE_VSNPRINTF
+
+/* Define if you have the waitpid function. */
+#undef HAVE_WAITPID
+
+/* Define if you have the yp_get_default_domain function. */
+#undef HAVE_YP_GET_DEFAULT_DOMAIN
+
+/* Define if you have the <compat.h> header file. */
+#undef HAVE_COMPAT_H
+
+/* Define if you have the <ctype.h> header file. */
+#undef HAVE_CTYPE_H
+
+/* Define if you have the <dirent.h> header file. */
+#undef HAVE_DIRENT_H
+
+/* Define if you have the <fcntl.h> header file. */
+#undef HAVE_FCNTL_H
+
+/* Define if you have the <grp.h> header file. */
+#undef HAVE_GRP_H
+
+/* Define if you have the <limits.h> header file. */
+#undef HAVE_LIMITS_H
+
+/* Define if you have the <ndir.h> header file. */
+#undef HAVE_NDIR_H
+
+/* Define if you have the <net/if.h> header file. */
+#undef HAVE_NET_IF_H
+
+/* Define if you have the <netinet/tcp.h> header file. */
+#undef HAVE_NETINET_TCP_H
+
+/* Define if you have the <security/pam_appl.h> header file. */
+#undef HAVE_SECURITY_PAM_APPL_H
+
+/* Define if you have the <shadow.h> header file. */
+#undef HAVE_SHADOW_H
+
+/* Define if you have the <stdarg.h> header file. */
+#undef HAVE_STDARG_H
+
+/* Define if you have the <stdlib.h> header file. */
+#undef HAVE_STDLIB_H
+
+/* Define if you have the <string.h> header file. */
+#undef HAVE_STRING_H
+
+/* Define if you have the <sys/dir.h> header file. */
+#undef HAVE_SYS_DIR_H
+
+/* Define if you have the <sys/dustat.h> header file. */
+#undef HAVE_SYS_DUSTAT_H
+
+/* Define if you have the <sys/fcntl.h> header file. */
+#undef HAVE_SYS_FCNTL_H
+
+/* Define if you have the <sys/filio.h> header file. */
+#undef HAVE_SYS_FILIO_H
+
+/* Define if you have the <sys/filsys.h> header file. */
+#undef HAVE_SYS_FILSYS_H
+
+/* Define if you have the <sys/fs/s5param.h> header file. */
+#undef HAVE_SYS_FS_S5PARAM_H
+
+/* Define if you have the <sys/id.h> header file. */
+#undef HAVE_SYS_ID_H
+
+/* Define if you have the <sys/ioctl.h> header file. */
+#undef HAVE_SYS_IOCTL_H
+
+/* Define if you have the <sys/mode.h> header file. */
+#undef HAVE_SYS_MODE_H
+
+/* Define if you have the <sys/mount.h> header file. */
+#undef HAVE_SYS_MOUNT_H
+
+/* Define if you have the <sys/ndir.h> header file. */
+#undef HAVE_SYS_NDIR_H
+
+/* Define if you have the <sys/param.h> header file. */
+#undef HAVE_SYS_PARAM_H
+
+/* Define if you have the <sys/security.h> header file. */
+#undef HAVE_SYS_SECURITY_H
+
+/* Define if you have the <sys/select.h> header file. */
+#undef HAVE_SYS_SELECT_H
+
+/* Define if you have the <sys/socket.h> header file. */
+#undef HAVE_SYS_SOCKET_H
+
+/* Define if you have the <sys/sockio.h> header file. */
+#undef HAVE_SYS_SOCKIO_H
+
+/* Define if you have the <sys/statfs.h> header file. */
+#undef HAVE_SYS_STATFS_H
+
+/* Define if you have the <sys/statvfs.h> header file. */
+#undef HAVE_SYS_STATVFS_H
+
+/* Define if you have the <sys/time.h> header file. */
+#undef HAVE_SYS_TIME_H
+
+/* Define if you have the <sys/unistd.h> header file. */
+#undef HAVE_SYS_UNISTD_H
+
+/* Define if you have the <sys/vfs.h> header file. */
+#undef HAVE_SYS_VFS_H
+
+/* Define if you have the <sys/wait.h> header file. */
+#undef HAVE_SYS_WAIT_H
+
+/* Define if you have the <termios.h> header file. */
+#undef HAVE_TERMIOS_H
+
+/* Define if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* Define if you have the <utime.h> header file. */
+#undef HAVE_UTIME_H
+
+/* Define if you have the crypt library (-lcrypt). */
+#undef HAVE_LIBCRYPT
+
+/* Define if you have the dl library (-ldl). */
+#undef HAVE_LIBDL
+
+/* Define if you have the inet library (-linet). */
+#undef HAVE_LIBINET
+
+/* Define if you have the nsl library (-lnsl). */
+#undef HAVE_LIBNSL
+
+/* Define if you have the nsl_s library (-lnsl_s). */
+#undef HAVE_LIBNSL_S
+
+/* Define if you have the pam library (-lpam). */
+#undef HAVE_LIBPAM
+
+/* Define if you have the socket library (-lsocket). */
+#undef HAVE_LIBSOCKET
diff --git a/source3/include/includes.h b/source3/include/includes.h
index d72595b6b4..b63787fd5e 100644
--- a/source3/include/includes.h
+++ b/source3/include/includes.h
@@ -20,1221 +20,274 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-/*
- This file does all the #includes's. This makes it easier to
- port to a new unix. Hopefully a port will only have to edit the Makefile
- and add a section for the new unix below.
-*/
-
-
-/* the first OS dependent section is to setup what includes will be used.
- the main OS dependent section comes later on
-*/
-
-#ifdef ALTOS
-#define NO_UTIMEH
-#endif
-
-#ifdef MIPS
-#define POSIX_H
-#define NO_UTIMEH
-#endif
-#ifdef sun386
-#define NO_UTIMEH
-#endif
+#include "config.h"
+#include "local.h"
-#ifdef NEXT2
-#define NO_UTIMEH
+#ifdef AIX
+#define DEFAULT_PRINTING PRINT_AIX
#endif
-#ifdef NEXT3_0
-#define NO_UTIMEH
-#define NO_UNISTDH
+#ifdef HPUX
+#define DEFAULT_PRINTING PRINT_HPUX
#endif
-#ifdef APOLLO
-#define NO_UTIMEH
-#define NO_SYSMOUNTH
-#define NO_UNISTDH
+#ifdef QNX
+#define DEFAULT_PRINTING PRINT_QNX
#endif
-#ifdef AIX
-#define NO_SYSMOUNTH
+#ifdef SUNOS4
+#define REPLACE_GETPASS
+/* on SUNOS4 termios.h conflicts with sys/ioctl.h */
+#undef HAVE_TERMIOS_H
#endif
-#ifdef M88K_R3
-#define SVR3H
-#define NO_RESOURCEH
+#ifdef SUNOS5
+#define REPLACE_GETPASS
#endif
-#ifdef DNIX
-#define NO_SYSMOUNTH
-#define NO_NETIFH
-#define NO_RESOURCEH
-#define PRIME_NMBD 0
-#define NO_SETGROUPS
-#endif
+#include <sys/types.h>
-#ifdef ISC
-#define SYSSTREAMH
-#define NO_RESOURCEH
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
#endif
+#include <stdio.h>
+#include <stddef.h>
-#ifdef QNX
-#define NO_RESOURCEH
-#define NO_SYSMOUNTH
-#define USE_MMAP 1
-#ifdef __386__
- #define __i386__
-#endif
-#define SHADOW_PWD
-#define NO_GETSPNAM
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
#endif
-#ifdef NEWS42
-#define NO_UTIMEH
-#define NO_STRFTIME
-#define NO_UTIMBUF
-#define REPLACE_MKTIME
-#define NO_TM_NAME
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
#endif
-#ifdef OS2
-#define NO_SYSMOUNTH
-#define NO_NETIFH
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
#endif
-#ifdef LYNX
-#define NO_SYSMOUNTH
+#ifdef HAVE_STRING_H
+#include <string.h>
#endif
-
-#if (defined(SHADOW_PWD)||defined(OSF1_ENH_SEC)||defined(SecureWare)||defined(PWDAUTH))
-#define PASSWORD_LENGTH 16
+#ifdef HAVE_MALLOC_H
+#include <malloc.h>
#endif
-/* here is the general includes section - with some ifdefs generated
- by the previous section
-*/
-#include "local.h"
-#include <stdio.h>
-#ifdef POSIX_STDLIBH
-#include <posix/stdlib.h>
-#else
-#include <stdlib.h>
-#endif
-#include <ctype.h>
+#ifdef TIME_WITH_SYS_TIME
+#include <sys/time.h>
#include <time.h>
-#ifndef NO_UTIMEH
-#include <utime.h>
-#endif
-#include <sys/types.h>
-
-#ifdef SVR3H
-#include <sys/statfs.h>
-#include <sys/stream.h>
-#include <netinet/types.h>
-#include <netinet/ether.h>
-#include <netinet/ip_if.h>
-#endif
-
-#include <sys/socket.h>
-#ifdef AXPROC
-#include <termio.h>
-#endif
-#include <sys/ioctl.h>
-#include <stddef.h>
-#ifdef POSIX_H
-#include <posix/utime.h>
-#include <bsd/sys/time.h>
-#include <bsd/netinet/in.h>
#else
+#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
-#include <netinet/in.h>
-#endif
-#include <netdb.h>
-#include <signal.h>
-#include <errno.h>
-#include <sys/file.h>
-#include <sys/stat.h>
-#include <sys/param.h>
-#include <grp.h>
-#ifndef NO_RESOURCEH
-#include <sys/resource.h>
-#endif
-#ifndef NO_SYSMOUNTH
-#include <sys/mount.h>
-#endif
-#include <pwd.h>
-#ifdef __STDC__
-#include <stdarg.h>
#else
-#include <varargs.h>
-#endif
-#ifndef NO_UNISTDH
-#include <unistd.h>
+#include <time.h>
#endif
-#include <sys/wait.h>
-#ifdef SYSSTREAMH
-#include <sys/stream.h>
#endif
-#ifndef NO_NETIFH
-#ifdef POSIX_H
-#include <bsd/net/if.h>
+
+#ifdef HAVE_FCNTL_H
+#include <fcntl.h>
#else
-#ifdef OSF1
-#include <net/route.h>
-#include <sys/mbuf.h>
-#endif
-#include <net/if.h>
+#ifdef HAVE_SYS_FCNTL_H
+#include <sys/fcntl.h>
#endif
#endif
-#if defined(GETPWANAM)
-#include <sys/types.h>
-#include <sys/label.h>
-#include <sys/audit.h>
-#include <pwdadj.h>
-#endif
+#include <sys/stat.h>
-#if defined(SHADOW_PWD) && !defined(NETBSD) && !defined(FreeBSD) && !defined(CONVEX) && !defined(__OpenBSD__)
-#include <shadow.h>
+#ifdef HAVE_LIMITS_H
+#include <limits.h>
#endif
-#ifdef SYSLOG
-#include <syslog.h>
+#ifdef HAVE_SYS_IOCTL_H
+#include <sys/ioctl.h>
#endif
-#ifdef HAVE_REGEX_H
-#include <regex.h>
+#ifdef HAVE_SYS_FILIO_H
+#include <sys/filio.h>
#endif
+#include <signal.h>
-/***************************************************************************
-Here come some platform specific sections
-***************************************************************************/
-
-
-#ifdef LINUX
-#include <arpa/inet.h>
-#include <dirent.h>
-#include <string.h>
-#include <sys/vfs.h>
-#include <netinet/in.h>
-#ifdef GLIBC2
-#define _LINUX_C_LIB_VERSION_MAJOR 6
-#include <termios.h>
-#include <rpcsvc/ypclnt.h>
-#include <crypt.h>
-#include <netinet/tcp.h>
-#include <netinet/ip.h>
-#endif
-#ifndef QSORT_CAST
-#define QSORT_CAST (int (*)(const void *, const void *))
-#endif /* QSORT_CAST */
-#define SIGNAL_CAST (__sighandler_t)
-#define USE_GETCWD
-#define USE_SETSID
-#define HAVE_BZERO
-#define HAVE_MEMMOVE
-#define HAVE_VSNPRINTF
-#define USE_SIGPROCMASK
-#define USE_WAITPID
-#define USE_SYSV_IPC
-#if 0
-/* SETFS disabled until we can check on some bug reports */
-#if _LINUX_C_LIB_VERSION_MAJOR >= 5
-#define USE_SETFS
-#endif
-#endif
-#ifdef SHADOW_PWD
-#if _LINUX_C_LIB_VERSION_MAJOR < 5
-#ifndef crypt
-#define crypt pw_encrypt
-#endif
-#endif
-#endif
-#endif
-
-#ifdef SUNOS4
-#define SIGNAL_CAST (void (*)(int))
-#include <netinet/tcp.h>
-#include <dirent.h>
-#include <sys/acct.h>
-#include <sys/vfs.h>
-#include <string.h>
-#include <strings.h>
-#include <errno.h>
+#ifdef HAVE_SYS_WAIT_H
#include <sys/wait.h>
-#include <signal.h>
-/* #include <termios.h> */
-#ifdef sun386
-#define NO_STRFTIME
-#define NO_UTIMBUF
-#define mktime timelocal
-typedef unsigned short mode_t;
-#else
-#include <utime.h>
-#define NO_STRERROR
#endif
-#ifndef REPLACE_GETPASS
-#define REPLACE_GETPASS
-#endif
-#ifndef BSD_TERMIO
-#define BSD_TERMIO
-#endif
-#ifndef USE_SIGPROCMASK
-#define USE_SIGPROCMASK
-#endif
-#ifndef USE_WAITPID
-#define USE_WAITPID
+#ifdef HAVE_CTYPE_H
+#include <ctype.h>
#endif
-#define USE_SYSV_IPC
-/* SunOS doesn't have POSIX atexit */
-#define atexit on_exit
-#define NOSTRCASECMP
-#ifndef QSORT_CAST
-#define QSORT_CAST (int (*)(const void *, const void *))
-#endif /* QSORT_CAST */
+#ifdef HAVE_GRP_H
+#include <grp.h>
#endif
-
-
-#ifdef SUNOS5
-#include <fcntl.h>
-#include <dirent.h>
-#include <sys/acct.h>
-#include <sys/statfs.h>
-#include <sys/statvfs.h>
-#include <sys/filio.h>
-#include <sys/sockio.h>
-#include <netinet/in_systm.h>
-#include <netinet/tcp.h>
-#include <netinet/ip.h>
-#include <string.h>
-#include <arpa/inet.h>
-#include <rpcsvc/ypclnt.h>
-#include <termios.h>
-#include <sys/stropts.h>
-#if !defined(USE_LIBDES) && !defined(KRB4_AUTH)
-#include <crypt.h>
-#endif /* !USE_LIBDES && !KRB4_AUTH */
-extern int gettimeofday (struct timeval *, void *);
-extern int gethostname (char *name, int namelen);
-extern int innetgr (const char *, const char *, const char *, const char *);
-#define USE_SETVBUF
-#define SIGNAL_CAST (void (*)(int))
-#ifndef SYSV
-#define SYSV
-#endif
-#define USE_WAITPID
-#define REPLACE_STRLEN
-#define USE_STATVFS
-#define USE_GETCWD
-#define USE_SETSID
-#define USE_SYSV_IPC
-#define NO_SEMUN
-#ifndef REPLACE_GETPASS
-#define REPLACE_GETPASS
-#endif /* REPLACE_GETPASS */
-#define USE_SIGPROCMASK
-#ifndef QSORT_CAST
-#define QSORT_CAST (int (*)(const void *, const void *))
-#endif /* QSORT_CAST */
-#define USE_GRANTPT
+#ifdef HAVE_SYS_ID_H
+#include <sys/id.h>
#endif
+#include <errno.h>
-#ifdef ULTRIX
-#include <strings.h>
-#include <nfs/nfs_clnt.h>
-#include <nfs/vfs.h>
-#include <netinet/tcp.h>
-#ifdef ULTRIX_AUTH
-#include <auth.h>
-#endif
-char *getwd(char *);
-#define NOSTRDUP
-#ifdef __STDC__
-#define SIGNAL_CAST (void(*)(int))
-#endif
-#define USE_DIRECT
-#define USE_WAITPID
+#ifdef HAVE_UTIME_H
+#include <utime.h>
#endif
-#ifdef SGI4
-#include <netinet/tcp.h>
-#include <sys/statfs.h>
-#include <string.h>
-#include <signal.h>
-#ifndef SYSV
-#define SYSV
-#endif
-#define SIGNAL_CAST (void (*)())
-#define STATFS4
-#define USE_WAITPID
-#define USE_DIRECT
-#define USE_SETSID
-#define USE_SYSV_IPC
+#ifdef HAVE_SYS_SELECT_H
+#include <sys/select.h>
#endif
-#if defined(SGI5) || defined(SGI6)
-#include <arpa/inet.h>
-#include <netinet/tcp.h>
-#include <netinet/in_systm.h>
-#include <netinet/ip.h>
-#include <sys/statvfs.h>
-#include <string.h>
-#include <signal.h>
-#include <dirent.h>
-#include <termios.h>
-#define USE_WAITPID
-#define NETGROUP
-#ifndef SYSV
-#define SYSV
-#endif /* SYSV */
-#define SIGNAL_CAST (void (*)())
-#define USE_STATVFS
-#define USE_WAITPID
-#define USE_SETSID
-#define USE_SYSV_IPC
-#define USE_GRANTPT
-#ifndef QSORT_CAST
-#define QSORT_CAST (int (*)(const void *, const void *))
-#endif /* QSORT_CAST */
+#ifdef HAVE_SYS_MODE_H
+/* apparently AIX needs this for S_ISLNK */
+#ifndef S_ISLNK
+#include <sys/mode.h>
#endif
-
-
-#ifdef MIPS
-#include <bsd/net/soioctl.h>
-#include <string.h>
-#include <dirent.h>
-#include <fcntl.h>
-#include <sys/statfs.h>
-#include <sys/wait.h>
-#include <sys/termio.h>
-#define SIGNAL_CAST (void (*)())
-typedef int mode_t;
-extern struct group *getgrnam();
-extern struct passwd *getpwnam();
-#define STATFS4
-#define NO_STRERROR
-#define REPLACE_STRSTR
-#endif /* MIPS */
-
-
-
-#ifdef DGUX
-#include <string.h>
-#include <dirent.h>
-#include <sys/statfs.h>
-#include <sys/statvfs.h>
-#include <fcntl.h>
-#include <termios.h>
-#define SYSV
-#define USE_WAITPID
-#define SIGNAL_CAST (void (*)(int))
-#define STATFS4
-#define USE_GETCWD
#endif
-
-#ifdef SVR4
-#include <string.h>
-#include <sys/dir.h>
-#include <dirent.h>
-#include <sys/statfs.h>
-#include <sys/statvfs.h>
-#include <sys/vfs.h>
-#include <sys/filio.h>
-#include <fcntl.h>
-#include <sys/sockio.h>
-#include <netinet/tcp.h>
-#include <stropts.h>
-#include <termios.h>
-#define SYSV
-#define USE_WAITPID
-#define SIGNAL_CAST (void (*)(int))
-#define USE_STATVFS
-#define USE_GETCWD
-#define USE_SETSID
-#define USE_SYSV_IPC
-#define NO_SEMUN
-#define USE_GRANTPT
+#ifdef HAVE_GLOB
+#include <glob.h>
#endif
-
-#ifdef OSF1
-#include <termios.h>
-#include <strings.h>
-#include <dirent.h>
-char *getwd(char *);
-char *mktemp(char *); /* No standard include */
-#include <netinet/in.h>
-#include <arpa/inet.h> /* both for inet_ntoa */
-#define SIGNAL_CAST ( void (*) (int) )
-#define STATFS3
-#define USE_F_FSIZE
-#define USE_SETSID
-#include <netinet/tcp.h>
-#ifdef OSF1_ENH_SEC
#include <pwd.h>
-#include <sys/types.h>
-#include <sys/security.h>
-#include <prot.h>
-#include <unistd.h>
-#define PASSWORD_LENGTH 16
-#define NEED_AUTH_PARAMETERS
-#endif /* OSF1_ENH_SEC */
-#define USE_SYSV_IPC
-#define NO_SEMUN
-#endif
-
-
-#ifdef CLIX
-#include <dirent.h>
-#define SIGNAL_CAST (void (*)())
-#include <sys/fcntl.h>
-#include <sys/statfs.h>
-#include <string.h>
-#define NO_EID
-#define USE_WAITPID
-#define STATFS4
-#define NO_FSYNC
-#define USE_GETCWD
-#define USE_SETSID
-#ifndef REPLACE_GETPASS
-#define REPLACE_GETPASS
-#endif /* REPLACE_GETPASS */
-#define NO_GETRLIMIT
-#endif /* CLIX */
-
-
-
-#ifdef BSDI
-#include <string.h>
-#include <netinet/tcp.h>
-#define SIGNAL_CAST (void (*)())
-#define USE_DIRECT
-#define QSORT_CAST (int (*)(const void *, const void *))
-#endif
-
-
-#ifdef NETBSD
-#ifdef NetBSD1_3
-#include <string.h>
-#ifdef ALLOW_CHANGE_PASSWORD
-#include <termios.h>
-#endif /* ALLOW_CHANGE_PASSWORD */
-#else /* NetBSD1_3 */
-#include <strings.h>
-#endif /* NetBSD1_3 */
-#include <netinet/tcp.h>
-#include <netinet/in_systm.h>
-#include <netinet/ip.h>
-/* you may not need this */
-#define NO_GETSPNAM
-#define SIGNAL_CAST (void (*)())
-#define USE_DIRECT
-#define REPLACE_INNETGR
-#endif
-
+#include <grp.h>
-#ifdef FreeBSD
-#include <arpa/inet.h>
-#include <strings.h>
-#include <netinet/tcp.h>
-#include <netinet/in_systm.h>
-#include <netinet/ip.h>
-#include <termios.h>
-#include <fcntl.h>
-#if __FreeBSD__ >= 3
-#include <dirent.h>
+#ifdef HAVE_STDARG_H
+#include <stdarg.h>
#else
-#define USE_DIRECT
-#endif
-#define SIGNAL_CAST (void (*)(int))
-#define USE_SETVBUF
-#define USE_SETSID
-#define USE_GETCWD
-#define USE_WAITPID
-#define HAVE_MEMMOVE
-#define HAVE_BZERO
-#define HAVE_GETTIMEOFDAY
-#define HAVE_PATHCONF
-#define HAVE_GETGRNAM 1
-#define HAVE_VSNPRINTF
-#define QSORT_CAST (int (*)(const void *, const void *))
-#if !defined(O_SYNC)
-#if defined(O_FSYNC)
-#define O_SYNC O_FSYNC
-#else /* defined(O_FSYNC) */
-#define O_SYNC 0
-#endif /* defined(O_FSYNC) */
-#endif /* !defined(O_SYNC) */
-#endif /* FreeBSD */
-
-#ifdef __OpenBSD__
-#include <strings.h>
-#include <netinet/tcp.h>
-#define NO_GETSPNAM
-#define SIGNAL_CAST (void (*)())
-#define USE_DIRECT
-#define REPLACE_INNETGR
-#define HAVE_BZERO
-#define HAVE_PATHCONF
-#define HAVE_GETGRNAM 1
-#define HAVE_GETTIMEOFDAY
-#define HAVE_MEMMOVE
-#define USE_GETCWD
-#define USE_SETSID
-#endif
+#include <varargs.h>
+#endif
-#ifdef AIX
-#include <strings.h>
-#include <sys/dir.h>
-#include <sys/select.h>
-#include <dirent.h>
-#include <sys/statfs.h>
-#include <sys/vfs.h>
-#include <sys/id.h>
-#include <sys/priv.h>
-#ifdef ALLOW_CHANGE_PASSWORD
-#include <termios.h>
-#endif /* ALLOW_CHANGE_PASSWORD */
-/* According to AIX 4.1 man pages, inet_ntoa needs the following headers */
-#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
-#include <netinet/tcp.h>
-#include <locale.h>
-#include <grp.h>
-#define HAVE_GETGRNAM 1
-#define SYSV
-#define USE_WAITPID
-#define USE_SIGBLOCK
-#define SIGNAL_CAST (void (*)())
-#define DEFAULT_PRINTING PRINT_AIX
-/* we undef this because sys/param.h is broken in aix. uggh. */
-#undef MAXHOSTNAMELEN
-#endif
-
-
-#ifdef HPUX
-#include <string.h>
-#include <dirent.h>
-#include <fcntl.h>
-#include <sys/vfs.h>
-#include <sys/types.h>
-#include <sys/termios.h>
-#include <netinet/tcp.h>
-#include <arpa/inet.h> /* needed for inet_ntoa proto */
-#ifdef HPUX_10_TRUSTED
-#include <hpsecurity.h>
-#include <prot.h>
-#define NEED_AUTH_PARAMETERS
-#endif
-#define SIGNAL_CAST (void (*)(__harg))
-#ifdef HPUX10
-#include <stropts.h>
-#else /* HPUX10 */
-/* This is only needed for HPUX 9.x */
-#define SELECT_CAST (int *)
-#endif /* HPUX10 */
-#define SYSV
-#define USE_WAITPID
-#define WAIT3_CAST2 (int *)
-#define USE_GETCWD
-#define USE_SETSID
-#define USE_SETRES
-#define USE_SYSV_IPC
-#define NO_SEMUN
-#define DEFAULT_PRINTING PRINT_HPUX
-/* Ken Weiss <krweiss@ucdavis.edu> tells us that SIGCLD_IGNORE is
- not good for HPUX */
-/* #define SIGCLD_IGNORE */
-#define USE_SIGPROCMASK /* Needed to stop zombie processes on HPUX 9.x and 10.x.*/
-#endif /* HPUX */
-
-
-#ifdef SEQUENT
-#include <signal.h>
-#include <string.h>
-#include <dirent.h>
-#include <sys/types.h>
-#include <sys/statfs.h>
-#include <sys/stat.h>
-#include <sys/buf.h>
-#include <sys/socket.h>
-#include <unistd.h>
-#include <fcntl.h>
-#define SIGNAL_CAST (void (*)(int))
-#define USE_WAITPID
-#define USE_GETCWD
-#define NO_EID
-#define STATFS4
-#define USE_DIRECT
-#ifdef PTX4
-#undef USE_DIRECT
-#endif
-#endif
-
-
+#include <netdb.h>
+#include <syslog.h>
+#include <sys/file.h>
-#ifdef SEQUENT_PTX4
-#include <string.h>
-#include <sys/dir.h>
-#include <dirent.h>
-#include <sys/statfs.h>
-#include <sys/statvfs.h>
-#include <sys/vfs.h>
-#include <fcntl.h>
-#include <sys/sockio.h>
+#ifdef HAVE_NETINET_TCP_H
#include <netinet/tcp.h>
-#include <stropts.h>
-#include <termios.h>
-#define SYSV
-#define USE_WAITPID
-#define SIGNAL_CAST (void (*)(int))
-#define USE_STATVFS
-#define USE_GETCWD
-#ifndef seteuid
-#define seteuid(uid) setreuid(-1,uid)
-#endif
-#ifndef setegid
-#define setegid(gid) setregid(-1,gid)
-#endif
#endif
-
-#ifdef NEXT2
-#include <sys/types.h>
-#include <strings.h>
-#include <dirent.h>
-#include <sys/vfs.h>
-#define bzero(b,len) memset(b,0,len)
-#define mode_t int
-#define NO_UTIMBUF
-#include <libc.h>
-#define NOSTRDUP
-#define USE_DIRECT
-#define USE_WAITPID
-#endif
-
-
-#ifdef NEXT3_0
-#include <strings.h>
-#include <sys/dir.h>
-#include <sys/vfs.h>
-#define NO_UTIMBUF
-#include <libc.h>
-#define NOSTRDUP
-#define USE_DIRECT
-#define mode_t int
-#define GID_TYPE int
-#define gid_t int
-#define pid_t int
-#define SIGNAL_CAST (void (*)(int))
-#define WAIT3_CAST1 (union wait *)
-#define HAVE_GMTOFF
-#define O_NONBLOCK O_NDELAY
-#endif
-
-
-
-#ifdef APOLLO
-#include <string.h>
-#include <fcntl.h>
-#include <sys/statfs.h>
-#define NO_UTIMBUF
-#define USE_DIRECT
-#define USE_GETCWD
-#define SIGNAL_CAST (void (*)())
-#define HAVE_FCNTL_LOCK 0
-#define HAVE_GETTIMEOFDAY
-#define STATFS4
-#endif
-
-
-
-#ifdef SCO
-#include <sys/netinet/tcp.h>
-#include <sys/netinet/in_systm.h>
-#include <sys/netinet/ip.h>
-#include <dirent.h>
-#include <string.h>
+#ifdef HAVE_TERMIOS_H
#include <termios.h>
-#include <fcntl.h>
-#include <sys/statfs.h>
-#include <sys/stropts.h>
-#include <limits.h>
-#include <locale.h>
-#ifdef EVEREST
-#include <unistd.h>
-#endif /* EVEREST */
-#ifdef NETGROUP
-#include <rpcsvc/ypclnt.h>
-#endif /* NETGROUP */
-#ifdef SecureWare
-#include <sys/security.h>
-#include <sys/audit.h>
-#include <prot.h>
-#define crypt bigcrypt
-#endif /* SecureWare */
-#define SIGNAL_CAST (void (*)(int))
-#define USE_WAITPID
-#define USE_GETCWD
-#define USE_SETSID
-#ifdef SCO3_2_2
-#define setuid(u) setreuid(u,-1)
-#define seteuid(u) setreuid(-1,u)
-#else /* SCO3_2_2 */
-#ifndef EVEREST
-#define ftruncate(f,l) syscall(0x0a28,f,l)
-#define USE_IFREQ
-#define NO_INITGROUPS
-#endif /* EVEREST */
-#endif /* SCO3_2_2 */
-#define STATFS4
-#define NO_FSYNC
-#define HAVE_PATHCONF
-#define NO_GETRLIMIT
-#endif /* SCO */
-
-
-
-/* Definitions for RiscIX */
-#ifdef RiscIX
-#define SIGNAL_CAST (void (*)(int))
-#include <sys/dirent.h>
-#include <sys/acct.h>
-#include <sys/vfs.h>
-#include <string.h>
-#include <utime.h>
-#include <signal.h>
-#define HAVE_GETTIMEOFDAY
-#define NOSTRCASECMP
-#define NOSTRDUP
#endif
-
-
-#ifdef ISC
-#include <net/errno.h>
-#include <string.h>
-#include <sys/dir.h>
-#include <dirent.h>
-#include <sys/statfs.h>
-#include <fcntl.h>
-#include <sys/sioctl.h>
-#include <stropts.h>
-#include <limits.h>
-#include <netinet/tcp.h>
-#define FIONREAD FIORDCHK
-#define SYSV
-#define USE_WAITPID
-#define SIGNAL_CAST (void (*)(int))
-#define USE_GETCWD
-#define USE_SETSID
-#define USE_IFREQ
-#define NO_FTRUNCATE
-#define STATFS4
-#define NO_FSYNC
-#endif
-
-
-
-#ifdef AUX
-#include <fstab.h>
-#include <string.h>
-#include <dirent.h>
-#include <sys/vfs.h>
-#include <fcntl.h>
-#include <termios.h>
-#define SYSV
-#define USE_WAITPID
-#define SIGNAL_CAST (void (*)(int))
-char *strdup (char *);
-#define USE_GETCWD
+#if HAVE_DIRENT_H
+# include <dirent.h>
+# define NAMLEN(dirent) strlen((dirent)->d_name)
+#else
+# define dirent direct
+# define NAMLEN(dirent) (dirent)->d_namlen
+# if HAVE_SYS_NDIR_H
+# include <sys/ndir.h>
+# endif
+# if HAVE_SYS_DIR_H
+# include <sys/dir.h>
+# endif
+# if HAVE_NDIR_H
+# include <ndir.h>
+# endif
+#endif
+
+#ifdef HAVE_SHARED_MMAP
+#include <sys/mman.h>
#endif
-
-#ifdef M88K_R3
-#include <string.h>
-#include <dirent.h>
-#include <fcntl.h>
-#include <termios.h>
-#define STATFS4
-#define SYSV
-#define USE_WAITPID
-#define SIGNAL_CAST (void (*)(int))
-char *strdup (char *);
-#define USE_GETCWD
-#define NO_FSYNC
-#define NO_EID
+#ifdef HAVE_SYSV_IPC
+#include <sys/ipc.h>
+#include <sys/shm.h>
+#include <sys/sem.h>
#endif
-
-#ifdef DNIX
-#include <dirent.h>
-#include <string.h>
-#include <fcntl.h>
-#include <sys/statfs.h>
-#include <sys/stropts.h>
-#define NO_GET_BROADCAST
-#define USE_WAITPID
-#define USE_GETCWD
-#define USE_SETSID
-#define STATFS4
-#define NO_EID
-#define PF_INET AF_INET
-#define NO_STRERROR
-#define ftruncate(f,l) chsize(f,l)
-#endif /* DNIX */
-
-#ifdef CONVEX
-#include <netinet/tcp.h>
-#include <arpa/inet.h>
-#include <dirent.h>
-#include <string.h>
-#include <sys/vfs.h>
-#include <fcntl.h>
-#define DONT_REINSTALL_SIG
-#define USE_SIGBLOCK
-#define USE_WAITPID
-#define SIGNAL_CAST (_SigFunc_Ptr_t)
-#define NO_GETSPNAM
-#define HAVE_MEMMOVE
-extern char *mktemp(char *);
-extern int fsync(int);
-extern int seteuid(uid_t);
-extern int setgroups(int, int *);
-extern int initgroups(char *, int);
-extern int statfs(char *, struct statfs *);
-extern int setegid(gid_t);
-extern int getopt(int, char *const *, const char *);
-extern int chroot(char *);
-extern int gettimeofday(struct timeval *, struct timezone *);
-extern int gethostname(char *, int);
-extern char *crypt(char *, char *);
-extern char *getpass(char *);
-#endif
-
-
-#ifdef CRAY
-#define MAXPATHLEN 1024
-#include <dirent.h>
-#include <string.h>
-#include <fcntl.h>
-#include <sys/statfs.h>
-#define SIGNAL_CAST (void (*)(int))
-#define SIGCLD_IGNORE
-#define HAVE_FCNTL_LOCK 1
-#define USE_SETSID
-#define STATFS4
+#ifdef HAVE_NET_IF_H
+#include <net/if.h>
#endif
-#ifdef ALTOS
-#include <unistd.h>
-#include <string.h>
-#include <dirent.h>
-#include <sys/fcntl.h>
-#include <sys/statfs.h>
-#define const
-#define uid_t int
-#define gid_t int
-#define mode_t int
-#define ptrdiff_t int
-#define HAVE_GETGRNAM 0
-#define NO_EID
-#define NO_FSYNC
-#define NO_FTRUNCATE
-#define NO_GETRLIMIT
-#define NO_INITGROUPS
-#define NO_SELECT
-#define NO_SETGROUPS
-#define NO_STRERROR
-#define NO_STRFTIME
-#define NO_TM_NAME
-#define NO_UTIMEH
-#define NOSTRCASECMP
-#define REPLACE_MKTIME
-#define REPLACE_RENAME
-#define REPLACE_STRSTR
-#define STATFS4
-#define USE_GETCWD
-#endif
-
-#ifdef QNX
-#include <arpa/inet.h>
-#define STATFS4
-#include <sys/statfs.h>
-/* Override QNX size of 32 to be 255 */
-#define FD_SETSIZE 255
-#include <sys/select.h>
-#include <signal.h>
-#include <sys/dir.h>
-#define SIGNAL_CAST (void (*)())
-#define USE_WAITPID
-#define NO_INITGROUPS
-#define NO_SETGROUPS
-#define HAVE_TIMEZONE
-#define USE_GETCWD
-#define USE_SETSID
-#define HAVE_FCNTL_LOCK 1
-#define DEFAULT_PRINTING PRINT_QNX
+#ifdef HAVE_SYS_MOUNT_H
+#include <sys/mount.h>
#endif
-
-#ifdef NEWS42
-#include <string.h>
-#include <dirent.h>
+#ifdef HAVE_SYS_VFS_H
#include <sys/vfs.h>
-#include <sys/timeb.h>
-typedef int mode_t;
-#endif
-
-#ifdef OS2
-#include <dirent.h>
-#include <sys/statfs.h>
-#include <string.h>
-#include <limits.h>
-#define SIGNAL_CAST (void (*)())
-#define HAVE_FCNTL_LOCK 0
-#define USE_WAITPID
-#define NO_GET_BROADCAST
-#define NO_EID
-#define NO_SETGROUPS
-#define NO_INITGROUPS
-#define NO_CRYPT
-#define NO_STATFS
-#define NO_CHROOT
-#define NO_CHOWN
-#define strcasecmp stricmp
-#define strncasecmp strnicmp
-#endif
-
-
-#ifdef LYNX
-#define SIGNAL_CAST (void (*)())
-#define WAIT3_CAST1 (union wait *)
-#define STATFS4
-#include <fcntl.h>
-#include <resource.h>
-#include <stat.h>
-#include <string.h>
-#include <dirent.h>
-#include <sys/statfs.h>
-#define USE_GETCWD
-#define USE_GETSID
-#endif
-
-
-#ifdef BOS
-#define SIGNAL_CAST (void (*)(int))
-#include <string.h>
-#include <sys/dir.h>
-#include <sys/select.h>
-#include <dirent.h>
-#include <fcntl.h>
-#include <signal.h>
-#include <sys/statfs.h>
-#include <sys/bsdioctl.h>
-#endif
-
-#ifdef AMIGA
-#include <arpa/inet.h>
-#include <dirent.h>
-#include <string.h>
-#include <netinet/tcp.h>
-#include <sys/acct.h>
-#include <sys/fcntl.h>
-#include <sys/filio.h>
-#include <sys/sockio.h>
-#include <netinet/in_systm.h>
-#include <netinet/ip.h>
-#include <sys/termios.h>
-#include <limits.h>
-#include <sys/timeb.h>
-
-#define SIGNAL_CAST (void (*)(int))
-#define USE_GETCWD
-#define HAVE_BZERO
-#define HAVE_MEMMOVE
-#define USE_SIGPROCMASK
-#define USE_WAITPID
-#define USE_DIRECT
-#define USE_F_FSIZE
-#define HAVE_FCNTL_LOCK 0
-#define HAVE_GETTIMEOFDAY
-#define HAVE_PATHCONF
-
-#define HAVE_NO_PROC
-#define NO_FORK_DEBUG
-#define HAVE_FORK 0
-#define HAVE_VFORK 1
-#endif
-
-/* For UnixWare 2.x's ia_uinfo routines. (tangent@cyberport.com) */
-#ifdef IA_UINFO
-#include <iaf.h>
-#include <ia.h>
-#endif
-
-
-/*******************************************************************
-end of the platform specific sections
-********************************************************************/
-
-#if (!defined(USE_LDAP_DB) && !defined(USE_NISPLUS_DB))
-#define USE_SMBPASS_DB
-#endif
-
-#if defined(USE_MMAP) || defined(FAST_SHARE_MODES)
-#include <sys/mman.h>
#endif
-#ifdef SecureWare
-#define NEED_AUTH_PARAMETERS
+#ifdef HAVE_SYS_FS_S5PARAM_H
+#include <sys/fs/s5param.h>
#endif
-#ifdef REPLACE_GETPASS
-extern char *getsmbpass(char *);
-#define getpass(s) getsmbpass(s)
+#if defined (HAVE_SYS_FILSYS_H) && !defined (_CRAY)
+#include <sys/filsys.h>
#endif
-#ifdef REPLACE_INNETGR
-#define innetgr(group,host,user,dom) InNetGr(group,host,user,dom)
+#ifdef HAVE_SYS_STATFS_H
+# include <sys/statfs.h>
#endif
-#ifndef FD_SETSIZE
-#define FD_SETSIZE 255
+#ifdef HAVE_DUSTAT_H
+#include <sys/dustat.h>
#endif
-#ifndef __STDC__
-#define const
-#endif
-
-/* Now for some other grungy stuff */
-#if defined(NO_GETSPNAM) && !defined(QNX)
-struct spwd { /* fake shadow password structure */
- char *sp_pwdp;
-};
-#endif
-
-#ifndef HAVE_BZERO
-#ifndef bzero
-#define bzero(p,s) memset(p,0,s)
-#endif
+#ifdef HAVE_SYS_STATVFS_H
+#include <sys/statvfs.h>
#endif
-#ifndef HAVE_MEMMOVE
-#ifndef memmove
-#define memmove(d,s,n) MemMove(d,s,n)
-#endif
+#ifdef HAVE_SHADOW_H
+#include <shadow.h>
#endif
-#ifdef USE_DIRECT
-#include <sys/dir.h>
-#endif
+#ifdef HAVE_SYS_SECURITY_H
+#include <sys/security.h>
+#include <prot.h>
+#define PASSWORD_LENGTH 16
+#endif /* HAVE_SYS_SECURITY_H */
-/* some unixes have ENOTTY instead of TIOCNOTTY */
-#ifndef TIOCNOTTY
-#ifdef ENOTTY
-#define TIOCNOTTY ENOTTY
-#endif
+#ifdef HAVE_COMPAT_H
+#include <compat.h>
#endif
-#ifndef SIGHUP
-#define SIGHUP 1
+#ifndef uchar
+#define uchar unsigned char
#endif
-/* if undefined then use bsd or sysv printing */
-#ifndef DEFAULT_PRINTING
-#ifdef SYSV
-#define DEFAULT_PRINTING PRINT_SYSV
+#ifdef HAVE_UNSIGNED_CHAR
+#define schar signed char
#else
-#define DEFAULT_PRINTING PRINT_BSD
-#endif
+#define schar char
#endif
-/* This defines the name of the printcap file. It is MOST UNLIKELY that
- this will change BUT! Specifying a file with the format of a printcap
- file but containing only a subset of the printers actually in your real
- printcap file is a quick-n-dirty way to allow dynamic access to a subset
- of available printers.
-*/
-#ifndef PRINTCAP_NAME
-#ifdef AIX
-#define PRINTCAP_NAME "/etc/qconfig"
-#elif defined(SYSV)
-#define PRINTCAP_NAME "lpstat"
-#else
-#define PRINTCAP_NAME "/etc/printcap"
+#ifndef int32
+#if (SIZEOF_INT == 4)
+#define int32 int
+#elif (SIZEOF_LONG == 4)
+#define int32 long
+#elif (SIZEOF_SHORT == 4)
+#define int32 short
#endif
#endif
-
-#ifdef USE_SYSV_IPC
-#include <sys/ipc.h>
-#include <sys/sem.h>
-#include <sys/shm.h>
-#ifdef NO_SEMUN
-union semun {
- int val;
- struct semid_ds *buf;
- unsigned short *array;
-};
-#endif
-#if defined(HPUX) && defined(HPUX10)
-#ifdef SEMMSL
-#undef SEMMSL
-#endif /* SEMMSL */
-#endif /* HPUX && HPUX10 */
-#endif
-
-#ifdef AFS_AUTH
-#include <afs/stds.h>
-#include <afs/kautils.h>
-#endif
-
-#ifdef DFS_AUTH
-#include <dce/dce_error.h>
-#include <dce/sec_login.h>
+#ifndef uint32
+#define uint32 unsigned int32
#endif
-#ifdef KRB5_AUTH
-#include <krb5.h>
+#ifndef MIN
+#define MIN(a,b) ((a)<(b)?(a):(b))
#endif
-#ifdef KRB4_AUTH
-#include <krb.h>
+#ifndef MAX
+#define MAX(a,b) ((a)>(b)?(a):(b))
#endif
-#ifdef NO_UTIMBUF
-struct utimbuf {
- time_t actime;
- time_t modtime;
-};
-#endif
-
-#ifdef NO_STRERROR
-#ifndef strerror
+#ifndef HAVE_STRERROR
extern char *sys_errlist[];
#define strerror(i) sys_errlist[i]
#endif
-#endif
-#ifndef perror
-#define perror(m) printf("%s: %s\n",m,strerror(errno))
+#ifndef HAVE_STRCHR
+# define strchr index
+# define strrchr rindex
#endif
-#ifndef MAXHOSTNAMELEN
-#define MAXHOSTNAMELEN 255
+#ifndef HAVE_ERRNO_DECL
+extern int errno;
#endif
+
/* Lists, trees, caching, datbase... */
#include "ubi_sLinkList.h"
#include "ubi_dLinkList.h"
@@ -1258,157 +311,144 @@ extern char *sys_errlist[];
/***** automatically generated prototypes *****/
#include "proto.h"
+#ifdef strcpy
+#undef strcpy
+#endif /* strcpy */
+#define strcpy(dest,src) __ERROR__XX__NEVER_USE_STRCPY___;
+#ifdef strcat
+#undef strcat
+#endif /* strcat */
+#define strcat(dest,src) __ERROR__XX__NEVER_USE_STRCAT___;
-#ifndef S_IFREG
-#define S_IFREG 0100000
-#endif
+#ifdef sprintf
+#undef sprintf
+#endif /* sprintf */
+#define sprintf __ERROR__XX__NEVER_USE_SPRINTF__;
-#ifndef S_ISREG
-#define S_ISREG(x) ((S_IFREG & (x))!=0)
-#endif
+#define pstrcpy(d,s) safe_strcpy((d),(s),sizeof(pstring)-1)
+#define pstrcat(d,s) safe_strcat((d),(s),sizeof(pstring)-1)
+#define fstrcpy(d,s) safe_strcpy((d),(s),sizeof(fstring)-1)
+#define fstrcat(d,s) safe_strcat((d),(s),sizeof(fstring)-1)
-#ifndef S_ISDIR
-#define S_ISDIR(x) ((S_IFDIR & (x))!=0)
+#ifdef __COMPAR_FN_T
+#define QSORT_CAST (__compar_fn_t)
#endif
-#if !defined(S_ISLNK) && defined(S_IFLNK)
-#define S_ISLNK(x) ((S_IFLNK & (x))!=0)
+#ifndef QSORT_CAST
+#define QSORT_CAST (int (*)(const void *, const void *))
#endif
-#ifdef UFC_CRYPT
-#define crypt ufc_crypt
+/* this guess needs to be improved (tridge) */
+#if defined(HAVE_STATVFS) && !defined(SYSV)
+#define SYSV 1
#endif
-#ifdef REPLACE_STRLEN
-#define strlen(s) Strlen(s)
+#ifndef DEFAULT_PRINTING
+#ifdef SYSV
+#define DEFAULT_PRINTING PRINT_SYSV
+#else
+#define DEFAULT_PRINTING PRINT_BSD
#endif
-
-#ifdef REPLACE_STRSTR
-#define strstr(s,p) Strstr(s,p)
#endif
-#ifdef REPLACE_MKTIME
-#define mktime(t) Mktime(t)
+#ifndef SIGCLD
+#define SIGCLD SIGCHLD
#endif
-#ifndef NGROUPS_MAX
-#define NGROUPS_MAX 128
+#if (defined(HAVE_SYSV_IPC) || defined(HAVE_SHARED_MMAP))
+#define FAST_SHARE_MODES 1
#endif
-#ifndef EDQUOT
-#define EDQUOT ENOSPC
+#ifndef MAP_FILE
+#define MAP_FILE 0
#endif
-#ifndef HAVE_GETGRNAM
-#define HAVE_GETGRNAM 1
+#ifdef HAVE_SYSV_IPC
+#ifndef HAVE_UNION_SEMUN
+union semun {
+ int val;
+ struct semid_ds *buf;
+ unsigned short *array;
+};
#endif
-
-#ifndef SOL_TCP
-#define SOL_TCP 6
#endif
-/* default to using ftruncate workaround as this is safer than assuming
-it works and getting lots of bug reports */
-#ifndef FTRUNCATE_CAN_EXTEND
-#define FTRUNCATE_CAN_EXTEND 0
+#if (!defined(WITH_NISPLUS) && !defined(WITH_LDAP))
+#define USE_SMBPASS_DB 1
#endif
-/* maybe this unix doesn't separate RD and WR locks? */
-#ifndef F_RDLCK
-#define F_RDLCK F_WRLCK
+#if defined(HAVE_PUTPRPWNAM) && defined(AUTH_CLEARTEXT_SEG_CHARS)
+#define OSF1_ENH_SEC 1
#endif
-#ifndef ENOTSOCK
-#define ENOTSOCK EINVAL
+#if defined(HAVE_PAM_AUTHENTICATE) && defined(HAVE_SECURITY_PAM_APPL_H)
+#define HAVE_PAM 1
#endif
-#ifndef SIGCLD
-#define SIGCLD SIGCHLD
-#endif
+#if defined(HAVE_YP_GET_DEFAULT_DOMAIN)
+#define HAVE_NETGROUP 1
+#endif
-#ifndef MAP_FILE
-#define MAP_FILE 0
+#ifndef ALLOW_CHANGE_PASSWORD
+#if (defined(HAVE_TERMIOS_H) && defined(HAVE_DUP2) && defined(HAVE_SETSID))
+#define ALLOW_CHANGE_PASSWORD 1
+#endif
#endif
-#ifndef HAVE_FCNTL_LOCK
-#define HAVE_FCNTL_LOCK 1
+/* what is the longest significant password available on your system?
+ Knowing this speeds up password searches a lot */
+#ifndef PASSWORD_LENGTH
+#define PASSWORD_LENGTH 8
#endif
-#ifndef WAIT3_CAST2
-#define WAIT3_CAST2 (struct rusage *)
+
+#ifndef HAVE_PIPE
+#define SYNC_DNS 1
#endif
-#ifndef WAIT3_CAST1
-#define WAIT3_CAST1 (int *)
+#ifndef MAXPATHLEN
+#define MAXPATHLEN 256
#endif
-#ifndef QSORT_CAST
-#define QSORT_CAST (int (*)())
+#ifndef SEEK_SET
+#define SEEK_SET 0
#endif
#ifndef INADDR_LOOPBACK
#define INADDR_LOOPBACK 0x7f000001
-#endif /* INADDR_LOOPBACK */
-
-/* this is a rough check to see if this machine has a lstat() call.
- it is not guaranteed to work */
-#if !defined(S_ISLNK)
-#define lstat stat
#endif
-/* Not all systems declare ERRNO in errno.h... and some systems #define it! */
-#ifndef errno
-extern int errno;
-#endif
-
-
-#ifdef NO_EID
-#define geteuid() getuid()
-#define getegid() getgid()
-#define seteuid(x) setuid(x)
-#define setegid(x) setgid(x)
+#ifndef HAVE_CRYPT
+#define crypt ufc_crypt
#endif
+#if defined(HAVE_CRYPT16) && defined(HAVE_GETAUTHUID)
+#define ULTRIX_AUTH 1
+#endif
-#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. */
-#define F_GETLK 0
-#define F_SETLK 0
-#define F_WRLCK 0
-#define F_UNLCK 0
-#endif /* HAVE_FCNTL_LOCK == 0 */
-
-#ifdef NOSTRCASECMP
-#define strcasecmp(s1,s2) StrCaseCmp(s1,s2)
-#define strncasecmp(s1,s2,n) StrnCaseCmp(s1,s2,n)
+#ifndef HAVE_STRDUP
+char *strdup(const char *s);
#endif
-#ifdef strcpy
-#undef strcpy
-#endif /* strcpy */
-#define strcpy(dest,src) __ERROR__XX__NEVER_USE_STRCPY___;
+#ifndef HAVE_MEMMOVE
+void *memmove(void *dest,const void *src,int size);
+#endif
-#ifdef strcat
-#undef strcat
-#endif /* strcat */
-#define strcat(dest,src) __ERROR__XX__NEVER_USE_STRCAT___;
+#ifndef HAVE_INITGROUPS
+int initgroups(char *name,gid_t id);
+#endif
-#ifdef sprintf
-#undef sprintf
-#endif /* sprintf */
-#define sprintf __ERROR__XX__NEVER_USE_SPRINTF__;
+#ifndef HAVE_RENAME
+int rename(const char *zfrom, const char *zto);
+#endif
-#define pstrcpy(d,s) safe_strcpy((d),(s),sizeof(pstring)-1)
-#define pstrcat(d,s) safe_strcat((d),(s),sizeof(pstring)-1)
-#define fstrcpy(d,s) safe_strcpy((d),(s),sizeof(fstring)-1)
-#define fstrcat(d,s) safe_strcat((d),(s),sizeof(fstring)-1)
+#ifndef HAVE_MKTIME
+time_t mktime(struct tm *t);
+#endif
-#if MEM_MAN
-#include "mem_man/mem_man.h"
-#endif /* MEM_MAN */
+#ifndef HAVE_FTRUNCATE
+int ftruncate(int f,long l);
+#endif
#endif /* _INCLUDES_H */
diff --git a/source3/include/local.h b/source3/include/local.h
index 0a369d80e2..afe1a3b1c6 100644
--- a/source3/include/local.h
+++ b/source3/include/local.h
@@ -152,12 +152,6 @@
accessible to root */
#define DUMP_CORE 1
-/* what is the longest significant password available on your system?
- Knowing this speeds up password searches a lot */
-#ifndef PASSWORD_LENGTH
-#define PASSWORD_LENGTH 8
-#endif
-
#define SMB_ALIGNMENT 1
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 97ee483f55..523d7c9615 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -160,6 +160,10 @@ BOOL deal_with_creds(uchar sess_key[8],
DOM_CRED *sto_clnt_cred,
DOM_CRED *rcv_clnt_cred, DOM_CRED *rtn_srv_cred);
+/*The following definitions come from dfree.c */
+
+int sys_disk_free(char *path,int *bsize,int *dfree,int *dsize);
+
/*The following definitions come from dir.c */
void init_dptrs(void);
@@ -186,7 +190,7 @@ BOOL SeekDir(void *p,int pos);
int TellDir(void *p);
void DirCacheAdd( char *path, char *name, char *dname, int snum );
char *DirCacheCheck( char *path, char *name, int snum );
-void DirCacheFlush( int snum );
+void DirCacheFlush(int snum);
/*The following definitions come from fault.c */
@@ -1188,21 +1192,6 @@ BOOL name_map_mangle( char *OutName, BOOL need83, int snum );
void mdfour(unsigned char *out, unsigned char *in, int n);
-/*The following definitions come from mem_man/mem_man.c */
-
-void *smb_mem_malloc(size_t size,char *file,int line);
-char *smb_mem_strdup(char *s, char *file, int line);
-int smb_mem_free(void *ptr,char *file,int line);
-void smb_mem_write_info(void *ptr,FILE *outfile);
-char *smb_mem_query_file(void *ptr);
-int smb_mem_query_line(void *ptr);
-int smb_mem_test(void *ptr);
-void smb_mem_write_status(FILE *outfile);
-void smb_mem_write_verbose(FILE *outfile);
-void smb_mem_write_errors(FILE *outfile);
-void smb_mem_set_multiplier(int multiplier);
-void *smb_mem_resize(void *ptr,size_t newsize);
-
/*The following definitions come from membuffer.c */
void mem_init(struct mem_buf *buf, int margin);
@@ -1240,6 +1229,10 @@ BOOL getlmhostsent( FILE *fp, char *name, int *name_type, struct in_addr *ipaddr
void endlmhosts(FILE *fp);
BOOL resolve_name(char *name, struct in_addr *return_ip);
+/*The following definitions come from netmask.c */
+
+int get_netmask(struct in_addr *ipaddr, struct in_addr *nmask);
+
/*The following definitions come from nisppass.c */
struct passdb_ops *nisplus_initialize_password_db(void);
@@ -1742,10 +1735,6 @@ BOOL disk_quotas(char *path, int *bsize, int *dfree, int *dsize);
/*The following definitions come from replace.c */
-char *Strstr(char *s, char *p);
-time_t Mktime(struct tm *t);
-int InNetGr(char *group,char *host,char *user,char *dom);
-void *memcpy_wrapped(void *d,void *s,int l,char *fname,int line);
/*The following definitions come from reply.c */
@@ -1811,8 +1800,6 @@ int dos_chmod(int cnum,char *fname,int dosmode,struct stat *st);
int file_utime(int cnum, char *fname, struct utimbuf *times);
BOOL set_filetime(int cnum, char *fname, time_t mtime);
BOOL unix_convert(char *name,int cnum,pstring saved_last_component, BOOL *bad_path);
-int disk_free(char *path,int *bsize,int *dfree,int *dsize);
-int sys_disk_free(char *path,int *bsize,int *dfree,int *dsize);
BOOL check_name(char *name,int cnum);
void sync_file(int cnum, int fnum);
void close_file(int fnum, BOOL normal_close);
@@ -1859,6 +1846,12 @@ struct shmem_ops *smb_shm_open(int ronly);
struct shmem_ops *sysv_shm_open(int ronly);
+/*The following definitions come from signal.c */
+
+void BlockSignals(BOOL block,int signum);
+void CatchSignal(int signum,void (*handler)(int ));
+void CatchChild(void);
+
/*The following definitions come from slprintf.c */
int vslprintf(char *str, int n, char *format, va_list ap);
@@ -1987,7 +1980,6 @@ char *tmpdir(void);
BOOL is_a_socket(int fd);
BOOL next_token(char **ptr,char *buff,char *sep);
char **toktocliplist(int *ctok, char *sep);
-void *MemMove(void *dest,void *src,int size);
void *mem_dup( void *from, int size );
void array_promote(char *array,int elsize,int element);
void set_socket_options(int fd, char *options);
@@ -2097,7 +2089,6 @@ struct hostent *Get_Hostbyname(char *name);
BOOL process_exists(int pid);
char *uidtoname(int uid);
char *gidtoname(int gid);
-void BlockSignals(BOOL block,int signum);
void ajt_panic(void);
char *readdirname(void *p);
BOOL is_in_path(char *name, name_compare_entry *namelist);
diff --git a/source3/include/smb.h b/source3/include/smb.h
index 3b1796f76b..1c37aab7e2 100644
--- a/source3/include/smb.h
+++ b/source3/include/smb.h
@@ -57,12 +57,6 @@ typedef int BOOL;
as signed and unsigned int will work.
*/
-/* afs/stds.h defines int16 and int32 */
-#ifndef AFS_AUTH
-typedef short int16;
-typedef int int32;
-#endif
-
#ifndef uint8
typedef unsigned char uint8;
#endif
@@ -71,22 +65,17 @@ typedef unsigned char uint8;
typedef unsigned short uint16;
#endif
-#ifndef uint32
-typedef unsigned int uint32;
-#endif
-
#ifndef uchar
#define uchar unsigned char
#endif
+
#ifndef int16
#define int16 short
#endif
+
#ifndef uint16
#define uint16 unsigned short
#endif
-#ifndef uint32
-#define uint32 unsigned int
-#endif
#define SIZEOFWORD 2
@@ -94,11 +83,15 @@ typedef unsigned int uint32;
#define DEF_CREATE_MASK (0755)
#endif
+#ifndef PRINTCAP_NAME
+#define PRINTCAP_NAME "/etc/printcap"
+#endif
+
/* how long to wait for secondary SMB packets (milli-seconds) */
#define SMB_SECONDARY_WAIT (60*1000)
/* debugging code */
-#ifndef SYSLOG
+#if !defined(WITH_SYSLOG) || defined(NO_SYSLOG)
#define DEBUG(level,body) ((DEBUGLEVEL>=(level))?(Debug1 body):0)
#define DEBUGLVL(level) (DEBUGLEVEL>=(level))
#else
@@ -1149,7 +1142,7 @@ struct parm_struct
#define ERRHRD 0x03 /* Error is an hardware error. */
#define ERRCMD 0xFF /* Command was not in the "SMB" format. */
-#ifdef __STDC__
+#ifdef HAVE_STDARG_H
int Debug1(char *, ...);
int slprintf(char *str, int n, char *format, ...);
#else
@@ -1157,7 +1150,7 @@ int Debug1();
int slprintf();
#endif
-#ifdef DFS_AUTH
+#ifdef WITH_DFS
void dfs_unlogin(void);
extern int dcelogin_atmost_once;
#endif
@@ -1170,14 +1163,6 @@ void ajt_panic(void);
char *strdup(char *s);
#endif
-#ifdef REPLACE_STRLEN
-int Strlen(char *);
-#endif
-
-#ifdef REPLACE_STRSTR
-char *Strstr(char *s, char *p);
-#endif
-
#ifndef MIN
#define MIN(a,b) ((a)<(b)?(a):(b))
#endif
@@ -1190,7 +1175,7 @@ char *Strstr(char *s, char *p);
#endif
#ifndef SIGNAL_CAST
-#define SIGNAL_CAST
+#define SIGNAL_CAST (RETSIGTYPE (*)())
#endif
#ifndef SELECT_CAST
@@ -1330,10 +1315,10 @@ enum remote_arch_types {RA_UNKNOWN, RA_WFWG, RA_OS2, RA_WIN95, RA_WINNT, RA_SAMB
/* case handling */
enum case_handling {CASE_LOWER,CASE_UPPER};
-#ifdef USE_SSL
+#ifdef WITH_SSL
/* SSL version options */
enum ssl_version_enum {SMB_SSL_V2,SMB_SSL_V3,SMB_SSL_V23,SMB_SSL_TLS1};
-#endif /* USE_SSL */
+#endif /* WITH_SSL */
/* Macros to get at offsets within smb_lkrng and smb_unlkrng
structures. We cannot define these as actual structures
diff --git a/source3/install-sh b/source3/install-sh
new file mode 100755
index 0000000000..58719246f0
--- /dev/null
+++ b/source3/install-sh
@@ -0,0 +1,238 @@
+#! /bin/sh
+#
+# install - install a program, script, or datafile
+# This comes from X11R5.
+#
+# Calling this script install-sh is preferred over install.sh, to prevent
+# `make' implicit rules from creating a file called install from it
+# when there is no Makefile.
+#
+# This script is compatible with the BSD install script, but was written
+# from scratch.
+#
+
+
+# set DOITPROG to echo to test this script
+
+# Don't use :- since 4.3BSD and earlier shells don't like it.
+doit="${DOITPROG-}"
+
+
+# put in absolute paths if you don't have them in your path; or use env. vars.
+
+mvprog="${MVPROG-mv}"
+cpprog="${CPPROG-cp}"
+chmodprog="${CHMODPROG-chmod}"
+chownprog="${CHOWNPROG-chown}"
+chgrpprog="${CHGRPPROG-chgrp}"
+stripprog="${STRIPPROG-strip}"
+rmprog="${RMPROG-rm}"
+mkdirprog="${MKDIRPROG-mkdir}"
+
+transformbasename=""
+transform_arg=""
+instcmd="$mvprog"
+chmodcmd="$chmodprog 0755"
+chowncmd=""
+chgrpcmd=""
+stripcmd=""
+rmcmd="$rmprog -f"
+mvcmd="$mvprog"
+src=""
+dst=""
+dir_arg=""
+
+while [ x"$1" != x ]; do
+ case $1 in
+ -c) instcmd="$cpprog"
+ shift
+ continue;;
+
+ -d) dir_arg=true
+ shift
+ continue;;
+
+ -m) chmodcmd="$chmodprog $2"
+ shift
+ shift
+ continue;;
+
+ -o) chowncmd="$chownprog $2"
+ shift
+ shift
+ continue;;
+
+ -g) chgrpcmd="$chgrpprog $2"
+ shift
+ shift
+ continue;;
+
+ -s) stripcmd="$stripprog"
+ shift
+ continue;;
+
+ -t=*) transformarg=`echo $1 | sed 's/-t=//'`
+ shift
+ continue;;
+
+ -b=*) transformbasename=`echo $1 | sed 's/-b=//'`
+ shift
+ continue;;
+
+ *) if [ x"$src" = x ]
+ then
+ src=$1
+ else
+ # this colon is to work around a 386BSD /bin/sh bug
+ :
+ dst=$1
+ fi
+ shift
+ continue;;
+ esac
+done
+
+if [ x"$src" = x ]
+then
+ echo "install: no input file specified"
+ exit 1
+else
+ true
+fi
+
+if [ x"$dir_arg" != x ]; then
+ dst=$src
+ src=""
+
+ if [ -d $dst ]; then
+ instcmd=:
+ else
+ instcmd=mkdir
+ fi
+else
+
+# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
+# might cause directories to be created, which would be especially bad
+# if $src (and thus $dsttmp) contains '*'.
+
+ if [ -f $src -o -d $src ]
+ then
+ true
+ else
+ echo "install: $src does not exist"
+ exit 1
+ fi
+
+ if [ x"$dst" = x ]
+ then
+ echo "install: no destination specified"
+ exit 1
+ else
+ true
+ fi
+
+# If destination is a directory, append the input filename; if your system
+# does not like double slashes in filenames, you may need to add some logic
+
+ if [ -d $dst ]
+ then
+ dst="$dst"/`basename $src`
+ else
+ true
+ fi
+fi
+
+## this sed command emulates the dirname command
+dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
+
+# Make sure that the destination directory exists.
+# this part is taken from Noah Friedman's mkinstalldirs script
+
+# Skip lots of stat calls in the usual case.
+if [ ! -d "$dstdir" ]; then
+defaultIFS='
+'
+IFS="${IFS-${defaultIFS}}"
+
+oIFS="${IFS}"
+# Some sh's can't handle IFS=/ for some reason.
+IFS='%'
+set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
+IFS="${oIFS}"
+
+pathcomp=''
+
+while [ $# -ne 0 ] ; do
+ pathcomp="${pathcomp}${1}"
+ shift
+
+ if [ ! -d "${pathcomp}" ] ;
+ then
+ $mkdirprog "${pathcomp}"
+ else
+ true
+ fi
+
+ pathcomp="${pathcomp}/"
+done
+fi
+
+if [ x"$dir_arg" != x ]
+then
+ $doit $instcmd $dst &&
+
+ if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
+ if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
+ if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
+ if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
+else
+
+# If we're going to rename the final executable, determine the name now.
+
+ if [ x"$transformarg" = x ]
+ then
+ dstfile=`basename $dst`
+ else
+ dstfile=`basename $dst $transformbasename |
+ sed $transformarg`$transformbasename
+ fi
+
+# don't allow the sed command to completely eliminate the filename
+
+ if [ x"$dstfile" = x ]
+ then
+ dstfile=`basename $dst`
+ else
+ true
+ fi
+
+# Make a temp file name in the proper directory.
+
+ dsttmp=$dstdir/#inst.$$#
+
+# Move or copy the file name to the temp name
+
+ $doit $instcmd $src $dsttmp &&
+
+ trap "rm -f ${dsttmp}" 0 &&
+
+# and set any options; do chmod last to preserve setuid bits
+
+# If any of these fail, we abort the whole thing. If we want to
+# ignore errors from any of these, just make sure not to ignore
+# errors from the above "$doit $instcmd $src $dsttmp" command.
+
+ if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
+ if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
+ if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
+ if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
+
+# Now rename the file to the real destination.
+
+ $doit $rmcmd -f $dstdir/$dstfile &&
+ $doit $mvcmd $dsttmp $dstdir/$dstfile
+
+fi &&
+
+
+exit 0
diff --git a/source3/lib/access.c b/source3/lib/access.c
index fe78700edd..d5e81eb50f 100644
--- a/source3/lib/access.c
+++ b/source3/lib/access.c
@@ -203,7 +203,7 @@ static int string_match(char *tok,char *s)
&& strcasecmp(tok, s + str_len - tok_len) == 0)
return (YES);
} else if (tok[0] == '@') { /* netgroup: look it up */
-#ifdef NETGROUP
+#ifdef HAVE_NETGROUP
static char *mydomain = NULL;
char *hostname = NULL;
BOOL netgroup_ok = False;
diff --git a/source3/lib/fault.c b/source3/lib/fault.c
index f46ccbb185..e1b3c6cd9f 100644
--- a/source3/lib/fault.c
+++ b/source3/lib/fault.c
@@ -45,10 +45,10 @@ static void fault_report(int sig)
fault_setup(cont_fn);
cont_fn(NULL);
#ifdef SIGSEGV
- signal(SIGSEGV,SIGNAL_CAST SIG_DFL);
+ CatchSignal(SIGSEGV,SIGNAL_CAST SIG_DFL);
#endif
#ifdef SIGBUS
- signal(SIGBUS,SIGNAL_CAST SIG_DFL);
+ CatchSignal(SIGBUS,SIGNAL_CAST SIG_DFL);
#endif
return; /* this should cause a core dump */
}
@@ -71,10 +71,10 @@ void fault_setup(void (*fn)(void *))
cont_fn = fn;
#ifdef SIGSEGV
- signal(SIGSEGV,SIGNAL_CAST sig_fault);
+ CatchSignal(SIGSEGV,SIGNAL_CAST sig_fault);
#endif
#ifdef SIGBUS
- signal(SIGBUS,SIGNAL_CAST sig_fault);
+ CatchSignal(SIGBUS,SIGNAL_CAST sig_fault);
#endif
}
diff --git a/source3/lib/getsmbpass.c b/source3/lib/getsmbpass.c
index 68754f0848..7e544fa8d0 100644
--- a/source3/lib/getsmbpass.c
+++ b/source3/lib/getsmbpass.c
@@ -40,20 +40,19 @@ static struct termio t;
#define TCSANOW 0
#endif
- int tcgetattr(int fd, struct termio *t)
+static int tcgetattr(int fd, struct termio *t)
{
return ioctl(fd, TCGETA, t);
}
- int tcsetattr(int fd, int flags, struct termio *t)
+static int tcsetattr(int fd, int flags, struct termio *t)
{
if(flags & TCSAFLUSH)
ioctl(fd, TCFLSH, TCIOFLUSH);
return ioctl(fd, TCSETS, t);
}
-#else /* SYSV_TERMIO */
-#ifdef BSD_TERMIO
+#elif !defined(TCSAFLUSH)
/* BSD TERMIO HANDLING */
@@ -63,33 +62,25 @@ static struct sgttyb t;
#define TURN_ECHO_OFF(t) ((t).sg_flags &= ~ECHO)
#define TURN_ECHO_ON(t) ((t).sg_flags |= ECHO)
-#ifndef TCSAFLUSH
#define TCSAFLUSH 1
-#endif
-
-#ifndef TCSANOW
#define TCSANOW 0
-#endif
- int tcgetattr(int fd, struct sgttyb *t)
+static int tcgetattr(int fd, struct sgttyb *t)
{
return ioctl(fd, TIOCGETP, (char *)t);
}
- int tcsetattr(int fd, int flags, struct sgttyb *t)
+static int tcsetattr(int fd, int flags, struct sgttyb *t)
{
return ioctl(fd, TIOCSETP, (char *)t);
}
-#else /* BSD_TERMIO */
-
-/* POSIX TERMIO HANDLING */
+#else /* POSIX TERMIO HANDLING */
#define ECHO_IS_ON(t) ((t).c_lflag & ECHO)
#define TURN_ECHO_OFF(t) ((t).c_lflag &= ~ECHO)
#define TURN_ECHO_ON(t) ((t).c_lflag |= ECHO)
static struct termios t;
-#endif /* BSD_TERMIO */
#endif /* SYSV_TERMIO */
char *getsmbpass(char *prompt)
@@ -101,7 +92,7 @@ char *getsmbpass(char *prompt)
size_t nread;
/* Catch problematic signals */
- signal(SIGINT, SIGNAL_CAST SIG_IGN);
+ CatchSignal(SIGINT, SIGNAL_CAST SIG_IGN);
/* Try to write to and read from the terminal if we can.
If we can't open the terminal, use stderr and stdin. */
@@ -153,7 +144,7 @@ char *getsmbpass(char *prompt)
fclose (in);
/* Catch problematic signals */
- signal(SIGINT, SIGNAL_CAST SIG_DFL);
+ CatchSignal(SIGINT, SIGNAL_CAST SIG_DFL);
printf("\n");
return buf;
diff --git a/source3/lib/interface.c b/source3/lib/interface.c
index 8c1610e9cb..7aae803abf 100644
--- a/source3/lib/interface.c
+++ b/source3/lib/interface.c
@@ -78,200 +78,45 @@ static void get_broadcast(struct in_addr *if_ipaddr,
struct in_addr *if_bcast,
struct in_addr *if_nmask)
{
- BOOL found = False;
-#ifndef NO_GET_BROADCAST
- int sock = -1; /* AF_INET raw socket desc */
- char buff[1024];
- struct ifreq *ifr=NULL;
- int i;
-
-#if defined(EVEREST)
- int n_interfaces;
- struct ifconf ifc;
- struct ifreq *ifreqs;
-#elif defined(USE_IFREQ)
- struct ifreq ifreq;
- struct strioctl strioctl;
- struct ifconf *ifc;
-#else
- struct ifconf ifc;
-#endif
-#endif
-
- /* get a default netmask and broadcast */
- default_netmask(if_nmask, if_ipaddr);
-
-#ifndef NO_GET_BROADCAST
- /* Create a socket to the INET kernel. */
-#if USE_SOCKRAW
- if ((sock = socket(AF_INET, SOCK_RAW, PF_INET )) < 0)
-#else
- if ((sock = socket(AF_INET, SOCK_DGRAM, 0 )) < 0)
-#endif
- {
- DEBUG(0,( "Unable to open socket to get broadcast address\n"));
- return;
- }
-
- /* Get a list of the configured interfaces */
-#ifdef EVEREST
- /* This is part of SCO Openserver 5: The ioctls are no longer part
- if the lower level STREAMS interface glue. They are now real
- ioctl calls */
-
- if (ioctl(sock, SIOCGIFANUM, &n_interfaces) < 0) {
- DEBUG(0,( "SIOCGIFANUM: %s\n", strerror(errno)));
- } else {
- DEBUG(0,( "number of interfaces returned is: %d\n", n_interfaces));
-
- ifc.ifc_len = sizeof(struct ifreq) * n_interfaces;
- ifc.ifc_buf = (caddr_t) alloca(ifc.ifc_len);
-
- if (ioctl(sock, SIOCGIFCONF, &ifc) < 0)
- DEBUG(0, ( "SIOCGIFCONF: %s\n", strerror(errno)));
- else {
- ifr = ifc.ifc_req;
-
- for (i = 0; i < n_interfaces; ++i) {
- if (if_ipaddr->s_addr ==
- ((struct sockaddr_in *) &ifr[i].ifr_addr)->sin_addr.s_addr) {
- found = True;
- break;
+ uint32 nm;
+ short onbc;
+ short offbc;
+
+ /* get a default netmask and broadcast */
+ default_netmask(if_nmask, if_ipaddr);
+
+ get_netmask(if_ipaddr, if_nmask);
+
+ /* sanity check on the netmask */
+ nm = ntohl(if_nmask->s_addr);
+ onbc = 0;
+ offbc = 0;
+ while((onbc + offbc) < 32) {
+ if(nm & 0x80000000) {
+ onbc++;
+ if(offbc) {
+ /* already found an off bit, so mask
+ is wrong */
+ onbc = 34;
+ }
+ } else {
+ offbc++;
+ }
+ nm <<= 1;
+ }
+ if ((onbc < 8)||(onbc == 34)) {
+ DEBUG(0,("Impossible netmask %s - using defaults\n",
+ inet_ntoa(*if_nmask)));
+ default_netmask(if_nmask, if_ipaddr);
}
- }
- }
- }
-#elif defined(USE_IFREQ)
- ifc = (struct ifconf *)buff;
- ifc->ifc_len = BUFSIZ - sizeof(struct ifconf);
- strioctl.ic_cmd = SIOCGIFCONF;
- strioctl.ic_dp = (char *)ifc;
- strioctl.ic_len = sizeof(buff);
- if (ioctl(sock, I_STR, &strioctl) < 0) {
- DEBUG(0,( "I_STR/SIOCGIFCONF: %s\n", strerror(errno)));
- } else {
- ifr = (struct ifreq *)ifc->ifc_req;
-
- /* Loop through interfaces, looking for given IP address */
- for (i = ifc->ifc_len / sizeof(struct ifreq); --i >= 0; ifr++) {
- if (if_ipaddr->s_addr ==
- (*(struct sockaddr_in *) &ifr->ifr_addr).sin_addr.s_addr) {
- found = True;
- break;
- }
- }
- }
-#elif defined(__FreeBSD__) || defined(NETBSD) || defined(AMIGA) || defined(_AIX41) || defined(__OpenBSD__)
- ifc.ifc_len = sizeof(buff);
- ifc.ifc_buf = buff;
- if (ioctl(sock, SIOCGIFCONF, &ifc) < 0) {
- DEBUG(0,("SIOCGIFCONF: %s\n", strerror(errno)));
- } else {
- ifr = ifc.ifc_req;
- /* Loop through interfaces, looking for given IP address */
- i = ifc.ifc_len;
- while (i > 0) {
- if (if_ipaddr->s_addr ==
- (*(struct sockaddr_in *) &ifr->ifr_addr).sin_addr.s_addr) {
- found = True;
- break;
- }
- i -= ifr->ifr_addr.sa_len + IFNAMSIZ;
- ifr = (struct ifreq*) ((char*) ifr + ifr->ifr_addr.sa_len + IFNAMSIZ);
- }
- }
-#else
- ifc.ifc_len = sizeof(buff);
- ifc.ifc_buf = buff;
- if (ioctl(sock, SIOCGIFCONF, &ifc) < 0) {
- DEBUG(0,("SIOCGIFCONF: %s\n", strerror(errno)));
- } else {
- ifr = ifc.ifc_req;
-
- /* Loop through interfaces, looking for given IP address */
- for (i = ifc.ifc_len / sizeof(struct ifreq); --i >= 0; ifr++) {
-#ifdef BSDI
- if (ioctl(sock, SIOCGIFADDR, ifr) < 0) break;
-#endif
- if (if_ipaddr->s_addr ==
- (*(struct sockaddr_in *) &ifr->ifr_addr).sin_addr.s_addr) {
- found = True;
- break;
- }
- }
- }
-#endif
-
- if (!found) {
- DEBUG(0,("No interface found for address %s\n", inet_ntoa(*if_ipaddr)));
- } else {
- /* Get the netmask address from the kernel */
-#ifdef USE_IFREQ
- ifreq = *ifr;
-
- strioctl.ic_cmd = SIOCGIFNETMASK;
- strioctl.ic_dp = (char *)&ifreq;
- strioctl.ic_len = sizeof(struct ifreq);
- if (ioctl(sock, I_STR, &strioctl) < 0)
- DEBUG(0,("Failed I_STR/SIOCGIFNETMASK: %s\n", strerror(errno)));
- else
- *if_nmask = ((struct sockaddr_in *)&ifreq.ifr_addr)->sin_addr;
-#else
- if (ioctl(sock, SIOCGIFNETMASK, ifr) < 0)
- DEBUG(0,("SIOCGIFNETMASK failed\n"));
- else
- *if_nmask = ((struct sockaddr_in *)&ifr->ifr_addr)->sin_addr;
-#endif
-
- DEBUG(4,("Netmask for %s = %s\n", ifr->ifr_name,
- inet_ntoa(*if_nmask)));
- }
-
- /* Close up shop */
- (void) close(sock);
-
-#endif
-
- /* sanity check on the netmask */
- {
- uint32 nm;
- short onbc;
- short offbc;
-
- nm = ntohl(if_nmask->s_addr);
- onbc = 0;
- offbc = 0;
- while( (onbc + offbc) < 32 )
- {
- if( nm & 0x80000000 )
- {
- onbc++;
- if( offbc ) /* already found an off bit, so mask is wrong */
- {
- onbc = 34;
- }
- }
- else
- {
- offbc++;
- }
- nm <<= 1;
- }
- if ((onbc < 8)||(onbc == 34)) {
- DEBUG(0,("Impossible netmask %s - using defaults\n",inet_ntoa(*if_nmask)));
- default_netmask(if_nmask, if_ipaddr);
- }
- }
- /* derive the broadcast assuming a 1's broadcast, as this is what
- all MS operating systems do, we have to comply even if the unix
- box is setup differently */
- {
- if_bcast->s_addr = MKBCADDR(if_ipaddr->s_addr, if_nmask->s_addr);
- }
+ /* derive the broadcast assuming a 1's broadcast, as this is what
+ all MS operating systems do, we have to comply even if the unix
+ box is setup differently */
+ if_bcast->s_addr = MKBCADDR(if_ipaddr->s_addr, if_nmask->s_addr);
- DEBUG(4,("Derived broadcast address %s\n", inet_ntoa(*if_bcast)));
-} /* get_broadcast */
+ DEBUG(4,("Derived broadcast address %s\n", inet_ntoa(*if_bcast)));
+}
diff --git a/source3/lib/netmask.c b/source3/lib/netmask.c
new file mode 100644
index 0000000000..138a4413f1
--- /dev/null
+++ b/source3/lib/netmask.c
@@ -0,0 +1,351 @@
+/*
+ Unix SMB/Netbios implementation.
+ Version 1.9.
+ code to query kernel netmask
+ Copyright (C) Andrew Tridgell 1998
+
+ 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.
+*/
+
+
+/* working out the netmask for an interface is an incredibly non-portable
+ thing. We have several possible implementations below, and autoconf
+ tries each of them to see what works
+
+ Note that this file does _not_ include includes.h. That is so this code
+ can be called directly from the autoconf tests. That also means
+ this code cannot use any of the normal Samba debug stuff or defines.
+ This is standalone code.
+
+*/
+
+#ifndef AUTOCONF
+#include "config.h"
+#endif
+
+#ifdef HAVE_NETMASK_IFCONF
+
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <netdb.h>
+#include <sys/ioctl.h>
+#include <net/if.h>
+
+#ifndef SIOCGIFCONF
+#include <sys/sockio.h>
+#endif
+
+
+/****************************************************************************
+ get the netmask address for a local interface
+****************************************************************************/
+int get_netmask(struct in_addr *ipaddr, struct in_addr *nmask)
+{
+ struct ifconf ifc;
+ char buff[2048];
+ int fd, i, n;
+ struct ifreq *ifr=NULL;
+
+ if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) == -1) {
+#ifdef DEBUG
+ fprintf(stderr,"socket failed\n");
+#endif
+ return -1;
+ }
+
+ ifc.ifc_len = sizeof(buff);
+ ifc.ifc_buf = buff;
+ if (ioctl(fd, SIOCGIFCONF, &ifc) != 0) {
+#ifdef DEBUG
+ fprintf(stderr,"SIOCGIFCONF failed\n");
+#endif
+ close(fd);
+ return -1;
+ }
+
+ ifr = ifc.ifc_req;
+
+ n = ifc.ifc_len / sizeof(struct ifreq);
+
+#ifdef DEBUG
+ fprintf(stderr,"%d interfaces - looking for %s\n",
+ n, inet_ntoa(*ipaddr));
+#endif
+
+ /* Loop through interfaces, looking for given IP address */
+ for (i=n-1;i>=0;i--) {
+ if (ioctl(fd, SIOCGIFADDR, &ifr[i]) != 0) {
+#ifdef DEBUG
+ fprintf(stderr,"SIOCGIFADDR failed\n");
+#endif
+ continue;
+ }
+
+#ifdef DEBUG
+ fprintf(stderr,"interface %s\n",
+ inet_ntoa((*(struct sockaddr_in *)&ifr[i].ifr_addr).sin_addr));
+#endif
+ if (ipaddr->s_addr !=
+ (*(struct sockaddr_in *)&ifr[i].ifr_addr).sin_addr.s_addr) {
+ continue;
+ }
+
+ if (ioctl(fd, SIOCGIFNETMASK, &ifr[i]) != 0) {
+#ifdef DEBUG
+ fprintf(stderr,"SIOCGIFNETMASK failed\n");
+#endif
+ close(fd);
+ return -1;
+ }
+ close(fd);
+ (*nmask) = ((struct sockaddr_in *)&ifr[i].ifr_addr)->sin_addr;
+#ifdef DEBUG
+ fprintf(stderr,"netmask %s\n", inet_ntoa(*nmask));
+#endif
+ return 0;
+ }
+
+#ifdef DEBUG
+ fprintf(stderr,"interface not found\n");
+#endif
+
+ close(fd);
+ return -1;
+}
+
+#elif defined(HAVE_NETMASK_IFREQ)
+
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <netdb.h>
+#include <sys/ioctl.h>
+#include <net/if.h>
+
+#ifndef SIOCGIFCONF
+#include <sys/sockio.h>
+#endif
+
+#ifndef I_STR
+#include <sys/stropts.h>
+#endif
+
+
+/****************************************************************************
+this should cover most of the rest of systems
+****************************************************************************/
+ int get_netmask(struct in_addr *ipaddr, struct in_addr *nmask)
+{
+ struct ifreq ifreq;
+ struct strioctl strioctl;
+ struct ifconf *ifc;
+ char buff[2048];
+ int fd, i, n;
+ struct ifreq *ifr=NULL;
+
+ if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) == -1) {
+#ifdef DEBUG
+ fprintf(stderr,"socket failed\n");
+#endif
+ return -1;
+ }
+
+ ifc = (struct ifconf *)buff;
+ ifc->ifc_len = BUFSIZ - sizeof(struct ifconf);
+ strioctl.ic_cmd = SIOCGIFCONF;
+ strioctl.ic_dp = (char *)ifc;
+ strioctl.ic_len = sizeof(buff);
+ if (ioctl(fd, I_STR, &strioctl) < 0) {
+#ifdef DEBUG
+ fprintf(stderr,"SIOCGIFCONF failed\n");
+#endif
+ close(fd);
+ return -1;
+ }
+
+ ifr = (struct ifreq *)ifc->ifc_req;
+
+ /* Loop through interfaces, looking for given IP address */
+ n = ifc->ifc_len / sizeof(struct ifreq);
+
+ for (i = 0; i<n; i++, ifr++) {
+#ifdef DEBUG
+ fprintf(stderr,"interface %s\n",
+ inet_ntoa((*(struct sockaddr_in *)&ifr->ifr_addr).sin_addr.s_addr));
+#endif
+ if (ipaddr->s_addr ==
+ (*(struct sockaddr_in *) &ifr->ifr_addr).sin_addr.s_addr) {
+ break;
+ }
+ }
+
+#ifdef DEBUG
+ if (i == n) {
+ fprintf(stderr,"interface not found\n");
+ close(fd);
+ return -1;
+ }
+#endif
+
+ ifreq = *ifr;
+
+ strioctl.ic_cmd = SIOCGIFNETMASK;
+ strioctl.ic_dp = (char *)&ifreq;
+ strioctl.ic_len = sizeof(struct ifreq);
+ if (ioctl(fd, I_STR, &strioctl) != 0) {
+#ifdef DEBUG
+ fprintf(stderr,"Failed SIOCGIFNETMASK\n");
+#endif
+ close(fd);
+ return -1;
+ }
+
+ close(fd);
+ *nmask = ((struct sockaddr_in *)&ifreq.ifr_addr)->sin_addr;
+#ifdef DEBUG
+ fprintf(stderr,"netmask %s\n", inet_ntoa(*nmask));
+#endif
+ return 0;
+}
+
+#elif defined(HAVE_NETMASK_AIX)
+
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <netdb.h>
+#include <sys/ioctl.h>
+#include <net/if.h>
+
+#ifndef SIOCGIFCONF
+#include <sys/sockio.h>
+#endif
+
+/****************************************************************************
+this one is for AIX
+****************************************************************************/
+ int get_netmask(struct in_addr *ipaddr, struct in_addr *nmask)
+{
+ char buff[2048];
+ int fd, i, n;
+ struct ifconf ifc;
+ struct ifreq *ifr=NULL;
+
+ if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) == -1) {
+#ifdef DEBUG
+ fprintf(stderr,"socket failed\n");
+#endif
+ return -1;
+ }
+
+
+ ifc.ifc_len = sizeof(buff);
+ ifc.ifc_buf = buff;
+
+ if (ioctl(fd, SIOCGIFCONF, &ifc) != 0) {
+#ifdef DEBUG
+ fprintf(stderr,"SIOCGIFCONF failed\n");
+#endif
+ close(fd);
+ return -1;
+ }
+
+ ifr = ifc.ifc_req;
+ /* Loop through interfaces, looking for given IP address */
+ i = ifc.ifc_len;
+ while (i > 0) {
+#ifdef DEBUG
+ fprintf(stderr,"interface %s\n",
+ inet_ntoa((*(struct sockaddr_in *)&ifr->ifr_addr).sin_addr));
+#endif
+ if (ipaddr->s_addr ==
+ (*(struct sockaddr_in *) &ifr->ifr_addr).sin_addr.s_addr) {
+ break;
+ }
+ i -= ifr->ifr_addr.sa_len + IFNAMSIZ;
+ ifr = (struct ifreq*) ((char*) ifr + ifr->ifr_addr.sa_len +
+ IFNAMSIZ);
+ }
+
+
+#ifdef DEBUG
+ if (i <= 0) {
+ fprintf(stderr,"interface not found\n");
+ close(fd);
+ return -1;
+ }
+#endif
+
+ if (ioctl(fd, SIOCGIFNETMASK, ifr) != 0) {
+#ifdef DEBUG
+ fprintf(stderr,"SIOCGIFNETMASK failed\n");
+#endif
+ close(fd);
+ return -1;
+ }
+
+ close(fd);
+
+ (*nmask) = ((struct sockaddr_in *)&ifr->ifr_addr)->sin_addr;
+#ifdef DEBUG
+ fprintf(stderr,"netmask %s\n", inet_ntoa(*nmask));
+#endif
+ return 0;
+}
+
+#else /* a dummy version */
+ int get_netmask(struct in_addr *ipaddr, struct in_addr *nmask)
+{
+ return -1;
+}
+#endif
+
+
+#ifdef AUTOCONF
+/* this is the autoconf driver to test get_netmask() */
+
+ main()
+{
+ char buf[1024];
+ struct hostent *hp;
+ struct in_addr ip, nmask;
+
+ if (gethostname(buf, sizeof(buf)-1) != 0) {
+ fprintf(stderr,"gethostname failed\n");
+ exit(1);
+ }
+
+ hp = gethostbyname(buf);
+
+ if (!hp) {
+ fprintf(stderr,"gethostbyname failed\n");
+ exit(1);
+ }
+
+ memcpy((char *)&ip, (char *)hp->h_addr, hp->h_length);
+
+ if (get_netmask(&ip, &nmask) == 0) exit(0);
+
+ fprintf(stderr,"get_netmask failed\n");
+ exit(1);
+}
+#endif
diff --git a/source3/lib/replace.c b/source3/lib/replace.c
index a08d3d240e..50eac37c83 100644
--- a/source3/lib/replace.c
+++ b/source3/lib/replace.c
@@ -27,20 +27,8 @@ extern int DEBUGLEVEL;
void replace_dummy(void)
{}
-#ifdef REPLACE_STRLEN
-/****************************************************************************
-a replacement strlen() that returns int for solaris
-****************************************************************************/
- int Strlen(char *s)
-{
- int ret=0;
- if (!s) return(0);
- while (*s++) ret++;
- return(ret);
-}
-#endif
-#ifdef NO_FTRUNCATE
+#ifndef HAVE_FTRUNCATE
/*******************************************************************
ftruncate for operating systems that don't have it
********************************************************************/
@@ -57,27 +45,7 @@ ftruncate for operating systems that don't have it
#endif
-#ifdef REPLACE_STRSTR
-/****************************************************************************
-Mips version of strstr doesn't seem to work correctly.
-There is a #define in includes.h to redirect calls to this function.
-****************************************************************************/
-char *Strstr(char *s, char *p)
-{
- int len = strlen(p);
-
- while ( *s != '\0' ) {
- if ( strncmp(s, p, len) == 0 )
- return s;
- s++;
- }
-
- return NULL;
-}
-#endif /* REPLACE_STRSTR */
-
-
-#ifdef REPLACE_MKTIME
+#ifndef HAVE_MKTIME
/*******************************************************************
a mktime() replacement for those who don't have it - contributed by
C.A. Lademann <cal@zls.com>
@@ -86,7 +54,7 @@ C.A. Lademann <cal@zls.com>
#define HOUR 60*MINUTE
#define DAY 24*HOUR
#define YEAR 365*DAY
-time_t Mktime(struct tm *t)
+ time_t mktime(struct tm *t)
{
struct tm *u;
time_t epoch = 0;
@@ -126,22 +94,17 @@ time_t Mktime(struct tm *t)
t->tm_wday = u->tm_wday;
t->tm_yday = u->tm_yday;
t->tm_isdst = u->tm_isdst;
-#ifndef NO_TM_NAME
- memcpy(t->tm_name, u->tm_name, LTZNMAX);
-#endif
}
return(epoch);
}
-#endif /* REPLACE_MKTIME */
+#endif /* !HAVE_MKTIME */
-#ifdef REPLACE_RENAME
+#ifndef HAVE_RENAME
/* Rename a file. (from libiberty in GNU binutils) */
- int rename (zfrom, zto)
- const char *zfrom;
- const char *zto;
+ int rename(const char *zfrom, const char *zto)
{
if (link (zfrom, zto) < 0)
{
@@ -156,73 +119,70 @@ time_t Mktime(struct tm *t)
#endif
-#ifdef REPLACE_INNETGR
+#ifndef HAVE_INNETGR
/*
* Search for a match in a netgroup. This replaces it on broken systems.
*/
-int InNetGr(char *group,char *host,char *user,char *dom)
+ int innetgr(char *group,char *host,char *user,char *dom)
{
- char *hst, *usr, *dm;
+ char *hst, *usr, *dm;
- setnetgrent(group);
- while (getnetgrent(&hst, &usr, &dm))
- if (((host == 0) || (hst == 0) || !strcmp(host, hst)) &&
- ((user == 0) || (usr == 0) || !strcmp(user, usr)) &&
- ((dom == 0) || (dm == 0) || !strcmp(dom, dm))) {
- endnetgrent();
- return (1);
- }
- endnetgrent();
- return (0);
+ setnetgrent(group);
+ while (getnetgrent(&hst, &usr, &dm)) {
+ if (((host == 0) || (hst == 0) || !strcmp(host, hst)) &&
+ ((user == 0) || (usr == 0) || !strcmp(user, usr)) &&
+ ((dom == 0) || (dm == 0) || !strcmp(dom, dm))) {
+ endnetgrent();
+ return (1);
+ }
+ }
+ endnetgrent();
+ return (0);
}
#endif
-#ifdef NO_INITGROUPS
-#include <sys/types.h>
-#include <limits.h>
-#include <grp.h>
-
-#ifndef NULL
-#define NULL (void *)0
-#endif
-
+#ifndef HAVE_INITGROUPS
/****************************************************************************
some systems don't have an initgroups call
****************************************************************************/
int initgroups(char *name,gid_t id)
{
-#ifdef NO_SETGROUPS
- /* yikes! no SETGROUPS or INITGROUPS? how can this work? */
- return(0);
+#ifndef HAVE_SETGROUPS
+ static int done;
+ if (!done) {
+ DEBUG(1,("WARNING: running without setgroups\n"));
+ done=1;
+ }
+ /* yikes! no SETGROUPS or INITGROUPS? how can this work? */
+ return(0);
#else
- gid_t grouplst[NGROUPS_MAX];
- int i,j;
- struct group *g;
- char *gr;
-
- grouplst[0] = id;
- i = 1;
- while (i < NGROUPS_MAX &&
- ((g = (struct group *)getgrent()) != (struct group *)NULL))
- {
- if (g->gr_gid == id)
- continue;
- j = 0;
- gr = g->gr_mem[0];
- while (gr && (*gr != (char)NULL)) {
- if (strcmp(name,gr) == 0) {
- grouplst[i] = g->gr_gid;
- i++;
- gr = (char *)NULL;
- break;
+ gid_t grouplst[NGROUPS_MAX];
+ int i,j;
+ struct group *g;
+ char *gr;
+
+ grouplst[0] = id;
+ i = 1;
+ while (i < NGROUPS_MAX &&
+ ((g = (struct group *)getgrent()) != (struct group *)NULL)) {
+ if (g->gr_gid == id)
+ continue;
+ j = 0;
+ gr = g->gr_mem[0];
+ while (gr && (*gr != (char)NULL)) {
+ if (strcmp(name,gr) == 0) {
+ grouplst[i] = g->gr_gid;
+ i++;
+ gr = (char *)NULL;
+ break;
+ }
+ gr = g->gr_mem[++j];
+ }
}
- gr = g->gr_mem[++j];
- }
- }
- endgrent();
- return(setgroups(i,grouplst));
+ endgrent();
+ return(setgroups(i,grouplst));
#endif
}
#endif
@@ -232,27 +192,89 @@ int InNetGr(char *group,char *host,char *user,char *dom)
/* This is needed due to needing the nap() function but we don't want
to include the Xenix libraries since that will break other things...
BTW: system call # 0x0c28 is the same as calling nap() */
-long nap(long milliseconds) {
- return syscall(0x0c28, milliseconds);
-}
+ long nap(long milliseconds) {
+ return syscall(0x0c28, milliseconds);
+ }
#endif
-#if WRAP_MEMCPY
-#undef memcpy
+#ifndef HAVE_MEMMOVE
/*******************************************************************
-a wrapper around memcpy for diagnostic purposes
+safely copies memory, ensuring no overlap problems.
+this is only used if the machine does not have it's own memmove().
+this is not the fastest algorithm in town, but it will do for our
+needs.
********************************************************************/
-void *memcpy_wrapped(void *d,void *s,int l,char *fname,int line)
+ void *memmove(void *dest,const void *src,int size)
{
- if (l>64 && (((int)d)%4) != (((int)s)%4))
- DEBUG(4,("Misaligned memcpy(0x%X,0x%X,%d) at %s(%d)\n",d,s,l,fname,line));
-#ifdef xx_old_memcpy
- return(xx_old_memcpy(d,s,l));
-#else
- return(memcpy(d,s,l));
+ unsigned long d,s;
+ int i;
+ if (dest==src || !size) return(dest);
+
+ d = (unsigned long)dest;
+ s = (unsigned long)src;
+
+ if ((d >= (s+size)) || (s >= (d+size))) {
+ /* no overlap */
+ memcpy(dest,src,size);
+ return(dest);
+ }
+
+ if (d < s) {
+ /* we can forward copy */
+ if (s-d >= sizeof(int) &&
+ !(s%sizeof(int)) &&
+ !(d%sizeof(int)) &&
+ !(size%sizeof(int))) {
+ /* do it all as words */
+ int *idest = (int *)dest;
+ int *isrc = (int *)src;
+ size /= sizeof(int);
+ for (i=0;i<size;i++) idest[i] = isrc[i];
+ } else {
+ /* simplest */
+ char *cdest = (char *)dest;
+ char *csrc = (char *)src;
+ for (i=0;i<size;i++) cdest[i] = csrc[i];
+ }
+ } else {
+ /* must backward copy */
+ if (d-s >= sizeof(int) &&
+ !(s%sizeof(int)) &&
+ !(d%sizeof(int)) &&
+ !(size%sizeof(int))) {
+ /* do it all as words */
+ int *idest = (int *)dest;
+ int *isrc = (int *)src;
+ size /= sizeof(int);
+ for (i=size-1;i>=0;i--) idest[i] = isrc[i];
+ } else {
+ /* simplest */
+ char *cdest = (char *)dest;
+ char *csrc = (char *)src;
+ for (i=size-1;i>=0;i--) cdest[i] = csrc[i];
+ }
+ }
+ return(dest);
+}
#endif
+
+#ifndef HAVE_STRDUP
+/****************************************************************************
+duplicate a string
+****************************************************************************/
+ char *strdup(const char *s)
+{
+ int len;
+ char *ret;
+
+ if (!s) return(NULL);
+
+ len = strlen(s)+1;
+ ret = (char *)malloc(len);
+ if (!ret) return(NULL);
+ memcpy(ret,s,len);
+ return(ret);
}
-#define memcpy(d,s,l) memcpy_wrapped(d,s,l,__FILE__,__LINE__)
#endif
diff --git a/source3/lib/signal.c b/source3/lib/signal.c
new file mode 100644
index 0000000000..8f6f5a9cd4
--- /dev/null
+++ b/source3/lib/signal.c
@@ -0,0 +1,102 @@
+/*
+ Unix SMB/Netbios implementation.
+ Version 1.9.
+ signal handling functions
+
+ Copyright (C) Andrew Tridgell 1998
+
+ 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.
+*/
+
+#include "includes.h"
+
+
+/****************************************************************************
+catch child exits
+****************************************************************************/
+static void sig_cld(int signum)
+{
+ while (sys_waitpid((pid_t)-1,(int *)NULL, WNOHANG) > 0) ;
+
+ CatchSignal(SIGCLD, SIG_IGN);
+}
+
+
+
+/*******************************************************************
+block sigs
+********************************************************************/
+void BlockSignals(BOOL block,int signum)
+{
+#ifdef HAVE_SIGPROCMASK
+ sigset_t set;
+ sigemptyset(&set);
+ sigaddset(&set,signum);
+ sigprocmask(block?SIG_BLOCK:SIG_UNBLOCK,&set,NULL);
+#elif defined(HAVE_SIGBLOCK)
+ int block_mask = sigmask(signum);
+ static int oldmask = 0;
+ if (block) {
+ oldmask = sigblock(block_mask);
+ } else {
+ sigsetmask(oldmask);
+ }
+#else
+ /* yikes! This platform can't block signals? */
+ static int done;
+ if (!done) {
+ DEBUG(0,("WARNING: No signal blocking available\n"));
+ done=1;
+ }
+#endif
+}
+
+
+
+/*******************************************************************
+catch a signal. This should implement the following semantics:
+
+1) the handler remains installed after being called
+2) the signal should be blocked during handler execution
+********************************************************************/
+void CatchSignal(int signum,void (*handler)(int ))
+{
+#ifdef HAVE_SIGACTION
+ struct sigaction act;
+
+ memset(&act, 0, sizeof(act));
+
+ act.sa_handler = handler;
+#ifdef SA_RESTART
+ act.sa_flags = SA_RESTART;
+#endif
+ sigemptyset(&act.sa_mask);
+ sigaddset(&act.sa_mask,signum);
+ sigaction(signum,&act,NULL);
+#else
+ /* FIXME: need to handle sigvec and systems with broken signal() */
+ signal(signum, handler);
+#endif
+}
+
+
+
+/*******************************************************************
+ignore SIGCLD via whatever means is necessary for this OS
+********************************************************************/
+void CatchChild(void)
+{
+ CatchSignal(SIGCLD, sig_cld);
+}
diff --git a/source3/lib/slprintf.c b/source3/lib/slprintf.c
index 4de7b10f4f..acdcfee38f 100644
--- a/source3/lib/slprintf.c
+++ b/source3/lib/slprintf.c
@@ -83,7 +83,7 @@ int vslprintf(char *str, int n, char *format, va_list ap)
#endif
}
-#ifdef __STDC__
+#ifdef HAVE_STDARG_H
int slprintf(char *str, int n, char *format, ...)
{
#else
@@ -96,7 +96,7 @@ va_dcl
va_list ap;
int ret;
-#ifdef __STDC__
+#ifdef HAVE_STDARG_H
va_start(ap, format);
#else
va_start(ap);
diff --git a/source3/lib/system.c b/source3/lib/system.c
index f453741fdd..ab65339f6e 100644
--- a/source3/lib/system.c
+++ b/source3/lib/system.c
@@ -44,7 +44,7 @@ this replaces the normal select() system call
return if some data has arrived on one of the file descriptors
return -1 means error
********************************************************************/
-#ifdef NO_SELECT
+#ifndef HAVE_SELECT
static int pollfd(int fd)
{
int r=0;
@@ -146,11 +146,11 @@ The wait() calls vary between systems
********************************************************************/
int sys_waitpid(pid_t pid,int *status,int options)
{
-#ifdef USE_WAITPID
+#ifdef HAVE_WAITPID
return waitpid(pid,status,options);
-#else /* USE_WAITPID */
+#else /* HAVE_WAITPID */
return wait4(pid, status, options, NULL);
-#endif /* USE_WAITPID */
+#endif /* HAVE_WAITPID */
}
/*******************************************************************
@@ -343,10 +343,10 @@ for getwd
char *sys_getwd(char *s)
{
char *wd;
-#ifdef USE_GETCWD
- wd = (char *) getcwd (s, sizeof (pstring));
+#ifdef HAVE_GETCWD
+ wd = (char *)getcwd(s, sizeof (pstring));
#else
- wd = (char *) getwd (s);
+ wd = (char *)getwd(s);
#endif
if (wd)
unix_to_dos (wd, True);
@@ -358,10 +358,14 @@ chown isn't used much but OS/2 doesn't have it
********************************************************************/
int sys_chown(char *fname,int uid,int gid)
{
-#ifdef NO_CHOWN
- DEBUG(1,("Warning - chown(%s,%d,%d) not done\n",fname,uid,gid));
+#ifndef HAVE_CHOWN
+ static int done;
+ if (!done) {
+ DEBUG(1,("WARNING: no chown!\n"));
+ done=1;
+ }
#else
- return(chown(fname,uid,gid));
+ return(chown(fname,uid,gid));
#endif
}
@@ -370,10 +374,14 @@ os/2 also doesn't have chroot
********************************************************************/
int sys_chroot(char *dname)
{
-#ifdef NO_CHROOT
- DEBUG(1,("Warning - chroot(%s) not done\n",dname));
+#ifndef HAVE_CHROOT
+ static int done;
+ if (!done) {
+ DEBUG(1,("WARNING: no chroot!\n"));
+ done=1;
+ }
#else
- return(chroot(dname));
+ return(chroot(dname));
#endif
}
diff --git a/source3/lib/time.c b/source3/lib/time.c
index c73d219120..6eacf2a5ed 100644
--- a/source3/lib/time.c
+++ b/source3/lib/time.c
@@ -51,10 +51,10 @@ a gettimeofday wrapper
********************************************************************/
void GetTimeOfDay(struct timeval *tval)
{
-#ifdef GETTIMEOFDAY1
- gettimeofday(tval);
+#ifdef HAVE_GETTIMEOFDAY_TZ
+ gettimeofday(tval,NULL);
#else
- gettimeofday(tval,NULL);
+ gettimeofday(tval);
#endif
}
@@ -477,11 +477,11 @@ char *http_timestring(time_t t)
if (!tm)
slprintf(buf,sizeof(buf)-1,"%ld seconds since the Epoch",(long)t);
else
-#ifdef NO_STRFTIME
+#ifndef HAVE_STRFTIME
fstrcpy(buf, asctime(tm));
-#else /* NO_STRFTIME */
+#else /* !HAVE_STRFTIME */
strftime(buf, sizeof(buf)-1, "%a, %d %b %Y %H:%M:%S %Z", tm);
-#endif /* NO_STRFTIME */
+#endif /* !HAVE_STRFTIME */
return buf;
}
@@ -492,31 +492,20 @@ char *http_timestring(time_t t)
****************************************************************************/
char *timestring(void )
{
- static fstring TimeBuf;
- time_t t = time(NULL);
- struct tm *tm = LocalTime(&t);
-
- if (!tm)
- slprintf(TimeBuf,sizeof(TimeBuf)-1,"%ld seconds since the Epoch",(long)t);
- else
-#ifdef NO_STRFTIME
- fstrcpy(TimeBuf, asctime(tm));
-#elif defined(CLIX) || defined(CONVEX)
- strftime(TimeBuf,100,"%Y/%m/%d %I:%M:%S %p",tm);
-#elif defined(AMPM)
- strftime(TimeBuf,100,"%Y/%m/%d %r",tm);
-#elif defined(TZ_TIME)
- {
- int zone = TimeDiff(t);
- int absZoneMinutes = (zone<0 ? -zone : zone) / 60;
- size_t len = strftime(TimeBuf,sizeof(TimeBuf)-6,"%Y/%m/%d %T",tm);
- slprintf(TimeBuf+len, sizeof(fstring) - len - 1, " %c%02d%02d",
- zone<0?'+':'-',absZoneMinutes/60,absZoneMinutes%60);
- }
+ static fstring TimeBuf;
+ time_t t = time(NULL);
+ struct tm *tm = LocalTime(&t);
+
+ if (!tm) {
+ slprintf(TimeBuf,sizeof(TimeBuf)-1,"%ld seconds since the Epoch",(long)t);
+ } else {
+#ifdef HAVE_STRFTIME
+ strftime(TimeBuf,100,"%Y/%m/%d %T",tm);
#else
- strftime(TimeBuf,100,"%Y/%m/%d %T",tm);
+ fstrcpy(TimeBuf, asctime(tm));
#endif
- return(TimeBuf);
+ }
+ return(TimeBuf);
}
/****************************************************************************
diff --git a/source3/lib/ufc.c b/source3/lib/ufc.c
index 17fd970c5b..f464953498 100644
--- a/source3/lib/ufc.c
+++ b/source3/lib/ufc.c
@@ -16,7 +16,9 @@
*/
-#ifdef UFC_CRYPT
+#include "includes.h"
+
+#ifndef HAVE_CRYPT
/*
* UFC-crypt: ultra fast crypt(3) implementation
@@ -42,7 +44,6 @@
* Support routines
*
*/
-#include "includes.h"
#ifndef long32
diff --git a/source3/lib/username.c b/source3/lib/username.c
index b79e6aefc3..8fb81e22b0 100644
--- a/source3/lib/username.c
+++ b/source3/lib/username.c
@@ -212,7 +212,6 @@ struct passwd *Get_Pwnam(char *user,BOOL allow_change)
strlower(user);
last_char = strlen(user)-1;
user[last_char] = toupper(user[last_char]);
- DEBUG(3, ("Trying username %s\n", user));
ret = _Get_Pwnam(user);
if (ret) return(ret);
@@ -232,7 +231,7 @@ check if a user is in a netgroup user list
****************************************************************************/
static BOOL user_in_netgroup_list(char *user,char *ngname)
{
-#ifdef NETGROUP
+#ifdef HAVE_NETGROUP
static char *mydomain = NULL;
if (mydomain == NULL)
yp_get_default_domain(&mydomain);
@@ -252,7 +251,7 @@ static BOOL user_in_netgroup_list(char *user,char *ngname)
if (innetgr(ngname, NULL, user, mydomain))
return (True);
}
-#endif /* NETGROUP */
+#endif /* HAVE_NETGROUP */
return False;
}
@@ -261,7 +260,7 @@ check if a user is in a UNIX user list
****************************************************************************/
static BOOL user_in_group_list(char *user,char *gname)
{
-#if HAVE_GETGRNAM
+#ifdef HAVE_GETGRNAM
struct group *gptr;
char **member;
struct passwd *pass = Get_Pwnam(user,False);
diff --git a/source3/lib/util.c b/source3/lib/util.c
index 22db8d4ab6..8d1f619318 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -21,7 +21,7 @@
#include "includes.h"
-#if (defined(NETGROUP) && defined (AUTOMOUNT))
+#if (defined(HAVE_NETGROUP) && defined (WITH_AUTOMOUNT))
#ifdef NISPLUS_HOME
#include <rpcsvc/nis.h>
#else
@@ -29,12 +29,12 @@
#endif
#endif
-#ifdef USE_SSL
+#ifdef WITH_SSL
#include <ssl.h>
#undef Realloc /* SSLeay defines this and samba has a function of this name */
extern SSL *ssl;
extern int sslFd;
-#endif /* USE_SSL */
+#endif /* WITH_SSL */
pstring scope = "";
@@ -70,7 +70,7 @@ int trans_num = 0;
int case_default = CASE_LOWER;
pstring debugf = "";
-int syslog_level;
+int syslog_level = 0;
/* the following control case operations - they are put here so the
client can link easily */
@@ -119,17 +119,16 @@ int sig_usr2(void)
DEBUG( 0, ( "Got SIGUSR2 set debug level to %d.\n", DEBUGLEVEL ) );
BlockSignals( False, SIGUSR2);
-#ifndef DONT_REINSTALL_SIG
- signal(SIGUSR2, SIGNAL_CAST sig_usr2);
-#endif
+ CatchSignal(SIGUSR2, SIGNAL_CAST sig_usr2);
+
return(0);
}
#endif /* SIGUSR1 */
#if defined(SIGUSR1)
-/**************************************************************************** **
+/******************************************************************************
catch a sigusr1 - increase the debug log level.
- **************************************************************************** */
+ *****************************************************************************/
int sig_usr1(void)
{
BlockSignals( True, SIGUSR1);
@@ -142,9 +141,7 @@ int sig_usr1(void)
DEBUG( 0, ( "Got SIGUSR1 set debug level to %d.\n", DEBUGLEVEL ) );
BlockSignals( False, SIGUSR1);
-#ifndef DONT_REINSTALL_SIG
- signal(SIGUSR1, SIGNAL_CAST sig_usr1);
-#endif
+ CatchSignal(SIGUSR1, SIGNAL_CAST sig_usr1);
return(0);
}
#endif /* SIGUSR1 */
@@ -155,7 +152,7 @@ int sig_usr1(void)
******************************************************************/
void setup_logging(char *pname,BOOL interactive)
{
-#ifdef SYSLOG
+#ifdef WITH_SYSLOG
if (!interactive) {
char *p = strrchr(pname,'/');
if (p) pname = p+1;
@@ -273,7 +270,7 @@ static void check_log_size(void)
write an debug message on the debugfile. This is called by the DEBUG
macro
********************************************************************/
-#ifdef __STDC__
+#ifdef HAVE_STDARG_H
int Debug1(char *format_str, ...)
{
#else
@@ -286,7 +283,7 @@ va_dcl
int old_errno = errno;
if (stdout_logging) {
-#ifdef __STDC__
+#ifdef HAVE_STDARG_H
va_start(ap, format_str);
#else
va_start(ap);
@@ -298,7 +295,7 @@ va_dcl
return(0);
}
-#ifdef SYSLOG
+#ifdef WITH_SYSLOG
if (!lp_syslog_only())
#endif
{
@@ -318,7 +315,7 @@ va_dcl
}
}
-#ifdef SYSLOG
+#ifdef WITH_SYSLOG
if (syslog_level < lp_syslog())
{
/*
@@ -341,7 +338,7 @@ va_dcl
else
priority = priority_map[syslog_level];
-#ifdef __STDC__
+#ifdef HAVE_STDARG_H
va_start(ap, format_str);
#else
va_start(ap);
@@ -355,11 +352,11 @@ va_dcl
}
#endif
-#ifdef SYSLOG
+#ifdef WITH_SYSLOG
if (!lp_syslog_only())
#endif
{
-#ifdef __STDC__
+#ifdef HAVE_STDARG_H
va_start(ap, format_str);
#else
va_start(ap);
@@ -483,65 +480,6 @@ char **toktocliplist(int *ctok, char *sep)
return ret;
}
-#ifndef HAVE_MEMMOVE
-/*******************************************************************
-safely copies memory, ensuring no overlap problems.
-this is only used if the machine does not have it's own memmove().
-this is not the fastest algorithm in town, but it will do for our
-needs.
-********************************************************************/
-void *MemMove(void *dest,void *src,int size)
-{
- unsigned long d,s;
- int i;
- if (dest==src || !size) return(dest);
-
- d = (unsigned long)dest;
- s = (unsigned long)src;
-
- if ((d >= (s+size)) || (s >= (d+size))) {
- /* no overlap */
- memcpy(dest,src,size);
- return(dest);
- }
-
- if (d < s)
- {
- /* we can forward copy */
- if (s-d >= sizeof(int) &&
- !(s%sizeof(int)) && !(d%sizeof(int)) && !(size%sizeof(int))) {
- /* do it all as words */
- int *idest = (int *)dest;
- int *isrc = (int *)src;
- size /= sizeof(int);
- for (i=0;i<size;i++) idest[i] = isrc[i];
- } else {
- /* simplest */
- char *cdest = (char *)dest;
- char *csrc = (char *)src;
- for (i=0;i<size;i++) cdest[i] = csrc[i];
- }
- }
- else
- {
- /* must backward copy */
- if (d-s >= sizeof(int) &&
- !(s%sizeof(int)) && !(d%sizeof(int)) && !(size%sizeof(int))) {
- /* do it all as words */
- int *idest = (int *)dest;
- int *isrc = (int *)src;
- size /= sizeof(int);
- for (i=size-1;i>=0;i--) idest[i] = isrc[i];
- } else {
- /* simplest */
- char *cdest = (char *)dest;
- char *csrc = (char *)src;
- for (i=size-1;i>=0;i--) cdest[i] = csrc[i];
- }
- }
- return(dest);
-}
-#endif
/* ************************************************************************* **
* Duplicate a block of memory.
@@ -686,9 +624,9 @@ void set_socket_options(int fd, char *options)
****************************************************************************/
void close_sockets(void )
{
-#ifdef USE_SSL
+#ifdef WITH_SSL
sslutil_disconnect(Client);
-#endif /* USE_SSL */
+#endif /* WITH_SSL */
close(Client);
Client = 0;
@@ -2188,15 +2126,15 @@ int read_with_timeout(int fd,char *buf,int mincnt,int maxcnt,long time_out)
if (mincnt == 0) mincnt = maxcnt;
while (nread < mincnt) {
-#ifdef USE_SSL
+#ifdef WITH_SSL
if(fd == sslFd){
readret = SSL_read(ssl, buf + nread, maxcnt - nread);
}else{
readret = read(fd, buf + nread, maxcnt - nread);
}
-#else /* USE_SSL */
+#else /* WITH_SSL */
readret = read(fd, buf + nread, maxcnt - nread);
-#endif /* USE_SSL */
+#endif /* WITH_SSL */
if (readret == 0) {
smb_read_error = READ_EOF;
@@ -2242,15 +2180,15 @@ int read_with_timeout(int fd,char *buf,int mincnt,int maxcnt,long time_out)
return -1;
}
-#ifdef USE_SSL
+#ifdef WITH_SSL
if(fd == sslFd){
readret = SSL_read(ssl, buf + nread, maxcnt - nread);
}else{
readret = read(fd, buf + nread, maxcnt - nread);
}
-#else /* USE_SSL */
+#else /* WITH_SSL */
readret = read(fd, buf+nread, maxcnt-nread);
-#endif /* USE_SSL */
+#endif /* WITH_SSL */
if (readret == 0) {
/* we got EOF on the file descriptor */
@@ -2335,15 +2273,15 @@ int read_data(int fd,char *buffer,int N)
while (total < N)
{
-#ifdef USE_SSL
+#ifdef WITH_SSL
if(fd == sslFd){
ret = SSL_read(ssl, buffer + total, N - total);
}else{
ret = read(fd,buffer + total,N - total);
}
-#else /* USE_SSL */
+#else /* WITH_SSL */
ret = read(fd,buffer + total,N - total);
-#endif /* USE_SSL */
+#endif /* WITH_SSL */
if (ret == 0)
{
@@ -2371,15 +2309,15 @@ int write_data(int fd,char *buffer,int N)
while (total < N)
{
-#ifdef USE_SSL
+#ifdef WITH_SSL
if(fd == sslFd){
ret = SSL_write(ssl,buffer + total,N - total);
}else{
ret = write(fd,buffer + total,N - total);
}
-#else /* USE_SSL */
+#else /* WITH_SSL */
ret = write(fd,buffer + total,N - total);
-#endif /* USE_SSL */
+#endif /* WITH_SSL */
if (ret == -1) return -1;
if (ret == 0) return total;
@@ -3364,28 +3302,25 @@ become a daemon, discarding the controlling terminal
****************************************************************************/
void become_daemon(void)
{
-#ifndef NO_FORK_DEBUG
- if (fork())
- _exit(0);
+ if (fork()) {
+ _exit(0);
+ }
/* detach from the terminal */
-#ifdef USE_SETSID
- setsid();
-#else /* USE_SETSID */
-#ifdef TIOCNOTTY
- {
- int i = open("/dev/tty", O_RDWR);
- if (i >= 0)
- {
- ioctl(i, (int) TIOCNOTTY, (char *)0);
- close(i);
- }
- }
-#endif /* TIOCNOTTY */
-#endif /* USE_SETSID */
- /* Close fd's 0,1,2. Needed if started by rsh */
- close_low_fds();
-#endif /* NO_FORK_DEBUG */
+#ifdef HAVE_SETSID
+ setsid();
+#elif defined(TIOCNOTTY)
+ {
+ int i = open("/dev/tty", O_RDWR);
+ if (i != -1) {
+ ioctl(i, (int) TIOCNOTTY, (char *)0);
+ close(i);
+ }
+ }
+#endif /* HAVE_SETSID */
+
+ /* Close fd's 0,1,2. Needed if started by rsh */
+ close_low_fds();
}
@@ -3484,7 +3419,7 @@ int set_filelen(int fd, long len)
extend a file with ftruncate. Provide alternate implementation
for this */
-#if FTRUNCATE_CAN_EXTEND
+#ifdef HAVE_FTRUNCATE_EXTEND
return ftruncate(fd, len);
#else
struct stat st;
@@ -3606,22 +3541,6 @@ void *Realloc(void *p,int size)
return(ret);
}
-#ifdef NOSTRDUP
-/****************************************************************************
-duplicate a string
-****************************************************************************/
- char *strdup(char *s)
-{
- char *ret = NULL;
- int len;
- if (!s) return(NULL);
- ret = (char *)malloc((len = strlen(s))+1);
- if (!ret) return(NULL);
- safe_strcpy(ret,s,len);
- return(ret);
-}
-#endif
-
/****************************************************************************
Signal handler for SIGPIPE (write on a disconnected socket)
@@ -3707,7 +3626,8 @@ int open_socket_in(int type, int port, int dlevel,uint32 socket_addr)
bzero((char *)&sock,sizeof(sock));
memcpy((char *)&sock.sin_addr,(char *)hp->h_addr, hp->h_length);
-#if defined(__FreeBSD__) || defined(NETBSD) || defined(__OpenBSD__) /* XXX not the right ifdef */
+
+#ifdef HAVE_SOCK_SIN_LEN
sock.sin_len = sizeof(sock);
#endif
sock.sin_port = htons( port );
@@ -4065,7 +3985,7 @@ char *client_addr(int fd)
return addr_buf;
}
-#if (defined(NETGROUP) && defined(AUTOMOUNT))
+#if (defined(HAVE_NETGROUP) && defined(WITH_AUTOMOUNT))
/******************************************************************
Remove any mount options such as -rsize=2048,wsize=2048 etc.
Based on a fix from <Thomas.Hepper@icem.de>.
@@ -4213,10 +4133,10 @@ char *automount_server(char *user_name)
static pstring server_name;
/* use the local machine name as the default */
- /* this will be the default if AUTOMOUNT is not used or fails */
+ /* this will be the default if WITH_AUTOMOUNT is not used or fails */
pstrcpy(server_name, local_machine);
-#if (defined(NETGROUP) && defined (AUTOMOUNT))
+#if (defined(HAVE_NETGROUP) && defined (WITH_AUTOMOUNT))
if (lp_nis_home_map())
{
@@ -4248,11 +4168,11 @@ char *automount_path(char *user_name)
static pstring server_path;
/* use the passwd entry as the default */
- /* this will be the default if AUTOMOUNT is not used or fails */
+ /* this will be the default if WITH_AUTOMOUNT is not used or fails */
/* pstrcpy() copes with get_home_dir() returning NULL */
pstrcpy(server_path, get_home_dir(user_name));
-#if (defined(NETGROUP) && defined (AUTOMOUNT))
+#if (defined(HAVE_NETGROUP) && defined (WITH_AUTOMOUNT))
if (lp_nis_home_map())
{
@@ -4484,31 +4404,11 @@ turn a gid into a group name
********************************************************************/
char *gidtoname(int gid)
{
- static char name[40];
- struct group *grp = getgrgid(gid);
- if (grp) return(grp->gr_name);
- slprintf(name,sizeof(name) - 1, "%d",gid);
- return(name);
-}
-
-/*******************************************************************
-block sigs
-********************************************************************/
-void BlockSignals(BOOL block,int signum)
-{
-#ifdef USE_SIGBLOCK
- int block_mask = sigmask(signum);
- static int oldmask = 0;
- if (block)
- oldmask = sigblock(block_mask);
- else
- sigsetmask(oldmask);
-#elif defined(USE_SIGPROCMASK)
- sigset_t set;
- sigemptyset(&set);
- sigaddset(&set,signum);
- sigprocmask(block?SIG_BLOCK:SIG_UNBLOCK,&set,NULL);
-#endif
+ static char name[40];
+ struct group *grp = getgrgid(gid);
+ if (grp) return(grp->gr_name);
+ slprintf(name,sizeof(name) - 1, "%d",gid);
+ return(name);
}
#if AJT
@@ -4517,15 +4417,10 @@ my own panic function - not suitable for general use
********************************************************************/
void ajt_panic(void)
{
- system("/usr/bin/X11/xedit -display solen:0 /tmp/ERROR_FAULT");
+ system("/usr/bin/X11/xedit -display :0 /tmp/ERROR_FAULT");
}
#endif
-#ifdef USE_DIRECT
-#define DIRECT direct
-#else
-#define DIRECT dirent
-#endif
/*******************************************************************
a readdir wrapper which just returns the file name
@@ -4533,43 +4428,33 @@ also return the inode number if requested
********************************************************************/
char *readdirname(void *p)
{
- struct DIRECT *ptr;
- char *dname;
+ struct dirent *ptr;
+ char *dname;
- if (!p) return(NULL);
+ if (!p) return(NULL);
- ptr = (struct DIRECT *)readdir(p);
- if (!ptr) return(NULL);
+ ptr = (struct dirent *)readdir(p);
+ if (!ptr) return(NULL);
- dname = ptr->d_name;
+ dname = ptr->d_name;
#ifdef NEXT2
- if (telldir(p) < 0) return(NULL);
+ if (telldir(p) < 0) return(NULL);
#endif
-#ifdef SUNOS5
- /* this handles a broken compiler setup, causing a mixture
- of BSD and SYSV headers and libraries */
- {
- static BOOL broken_readdir = False;
- if (!broken_readdir && !(*(dname)) && strequal("..",dname-2))
- {
- DEBUG(0,("Your readdir() is broken. You have somehow mixed SYSV and BSD headers and libraries\n"));
- broken_readdir = True;
- }
- if (broken_readdir)
- dname = dname - 2;
- }
+#ifdef HAVE_BROKEN_READDIR
+ /* using /usr/ucb/cc is BAD */
+ dname = dname - 2;
#endif
- {
- static pstring buf;
- pstrcpy(buf, dname);
- unix_to_dos(buf, True);
- dname = buf;
- }
+ {
+ static pstring buf;
+ memcpy(buf, dname, NAMLEN(ptr)+1);
+ unix_to_dos(buf, True);
+ dname = buf;
+ }
- return(dname);
+ return(dname);
}
/*******************************************************************
diff --git a/source3/libsmb/clientgen.c b/source3/libsmb/clientgen.c
index 093b3aedf9..7dc57bfb47 100644
--- a/source3/libsmb/clientgen.c
+++ b/source3/libsmb/clientgen.c
@@ -19,9 +19,7 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#ifdef SYSLOG
-#undef SYSLOG
-#endif
+#define NO_SYSLOG
#include "includes.h"
#include "trans2.h"
@@ -1633,9 +1631,9 @@ BOOL cli_session_request(struct cli_state *cli, char *host, int name_type,
_smb_setlen(cli->outbuf,len);
CVAL(cli->outbuf,0) = 0x81;
-#ifdef USE_SSL
+#ifdef WITH_SSL
retry:
-#endif /* USE_SSL */
+#endif /* WITH_SSL */
send_smb(cli->fd,cli->outbuf);
DEBUG(5,("Sent session request\n"));
@@ -1643,14 +1641,14 @@ retry:
if (!client_receive_smb(cli->fd,cli->inbuf,cli->timeout))
return False;
-#ifdef USE_SSL
+#ifdef WITH_SSL
if(CVAL(cli->inbuf,0) == 0x83 && CVAL(cli->inbuf,4) == 0x8e){ /* use ssl */
if(!sslutil_fd_is_ssl(cli->fd)){
if(sslutil_connect(cli->fd) == 0)
goto retry;
}
}
-#endif /* USE_SSL */
+#endif /* WITH_SSL */
if (CVAL(cli->inbuf,0) != 0x82) {
/* This is the wrong place to put the error... JRA. */
@@ -1718,9 +1716,9 @@ void cli_shutdown(struct cli_state *cli)
{
if (cli->outbuf) free(cli->outbuf);
if (cli->inbuf) free(cli->inbuf);
-#ifdef USE_SSL
+#ifdef WITH_SSL
if (cli->fd != -1) sslutil_disconnect(cli->fd);
-#endif /* USE_SSL */
+#endif /* WITH_SSL */
if (cli->fd != -1) close(cli->fd);
memset(cli, 0, sizeof(*cli));
}
diff --git a/source3/libsmb/namequery.c b/source3/libsmb/namequery.c
index a578ad8947..344806083a 100644
--- a/source3/libsmb/namequery.c
+++ b/source3/libsmb/namequery.c
@@ -313,7 +313,7 @@ FILE *startlmhosts(char *fname)
{
FILE *fp = fopen(fname,"r");
if (!fp) {
- DEBUG(2,("startlmhosts: Can't open lmhosts file %s. Error was %s\n",
+ DEBUG(4,("startlmhosts: Can't open lmhosts file %s. Error was %s\n",
fname, strerror(errno)));
return NULL;
}
diff --git a/source3/libsmb/smberr.c b/source3/libsmb/smberr.c
index ee751c0f80..c2d8884d73 100644
--- a/source3/libsmb/smberr.c
+++ b/source3/libsmb/smberr.c
@@ -18,9 +18,7 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#ifdef SYSLOG
-#undef SYSLOG
-#endif
+#define NO_SYSLOG
#include "includes.h"
diff --git a/source3/locking/locking.c b/source3/locking/locking.c
index e4ca6bbb04..e303fb5482 100644
--- a/source3/locking/locking.c
+++ b/source3/locking/locking.c
@@ -88,7 +88,7 @@ BOOL is_locked(int fnum,int cnum,uint32 count,uint32 offset, int lock_type)
* Note that most UNIX's can *test* for a write lock on
* a read-only fd, just not *set* a write lock on a read-only
* fd. So we don't need to use map_lock_type here.
- */
+ */
return(fcntl_lock(fsp->fd_ptr->fd,F_GETLK,offset,count,lock_type));
}
@@ -161,13 +161,10 @@ BOOL locking_init(int read_only)
#ifdef FAST_SHARE_MODES
share_ops = locking_shm_init(read_only);
- if (!share_ops) {
- DEBUG(0,("ERROR: Failed to initialise fast share modes - trying slow code\n"));
- }
- if (share_ops) return True;
-#endif
-
+#else
share_ops = locking_slow_init(read_only);
+#endif
+
if (!share_ops) {
DEBUG(0,("ERROR: Failed to initialise share modes!\n"));
return False;
diff --git a/source3/locking/locking_shm.c b/source3/locking/locking_shm.c
index afca567033..43a927e14c 100644
--- a/source3/locking/locking_shm.c
+++ b/source3/locking/locking_shm.c
@@ -32,9 +32,10 @@
October 1997 - split into separate file (tridge)
*/
+#include "includes.h"
+
#ifdef FAST_SHARE_MODES
-#include "includes.h"
extern int DEBUGLEVEL;
extern connection_struct Connections[];
extern files_struct Files[];
@@ -678,13 +679,15 @@ struct share_ops *locking_shm_init(int ronly)
{
read_only = ronly;
-#ifdef USE_SYSV_IPC
+#ifdef HAVE_SYSV_IPC
shmops = sysv_shm_open(read_only);
if (shmops) return &share_ops;
#endif
+#ifdef HAVE_SHARED_MMAP
shmops = smb_shm_open(read_only);
if (shmops) return &share_ops;
+#endif
return NULL;
}
@@ -692,7 +695,7 @@ struct share_ops *locking_shm_init(int ronly)
#else
int locking_shm_dummy_procedure(void)
{return 0;}
-#endif
+#endif /* FAST_SHARE_MODES */
diff --git a/source3/locking/locking_slow.c b/source3/locking/locking_slow.c
index 183acd1f44..1f8f962ac9 100644
--- a/source3/locking/locking_slow.c
+++ b/source3/locking/locking_slow.c
@@ -33,6 +33,9 @@
*/
#include "includes.h"
+
+#ifndef FAST_SHARE_MODES
+
extern int DEBUGLEVEL;
extern connection_struct Connections[];
extern files_struct Files[];
@@ -504,17 +507,8 @@ mode file %s (%s)\n", fname, strerror(errno)));
return 0;
}
/* Now truncate the file at this point. */
-#ifdef FTRUNCATE_NEEDS_ROOT
- become_root(False);
-#endif /* FTRUNCATE_NEEDS_ROOT */
-
if(ftruncate(fd, newsize)!= 0)
{
-
-#ifdef FTRUNCATE_NEEDS_ROOT
- unbecome_root(False);
-#endif /* FTRUNCATE_NEEDS_ROOT */
-
DEBUG(0,("ERROR: get_share_modes: failed to ftruncate share \
mode file %s to size %d (%s)\n", fname, newsize, strerror(errno)));
if(*old_shares)
@@ -526,10 +520,6 @@ mode file %s to size %d (%s)\n", fname, newsize, strerror(errno)));
}
}
-#ifdef FTRUNCATE_NEEDS_ROOT
- unbecome_root(False);
-#endif /* FTRUNCATE_NEEDS_ROOT */
-
if(buf)
free(buf);
@@ -670,27 +660,14 @@ mode file %s (%s)\n", fname, strerror(errno)));
}
/* Now truncate the file at this point. */
-#ifdef FTRUNCATE_NEEDS_ROOT
- become_root(False);
-#endif /* FTRUNCATE_NEEDS_ROOT */
-
if(ftruncate(fd, newsize) != 0)
{
-
-#ifdef FTRUNCATE_NEEDS_ROOT
- unbecome_root(False);
-#endif /* FTRUNCATE_NEEDS_ROOT */
-
DEBUG(0,("ERROR: del_share_mode: failed to ftruncate share \
mode file %s to size %d (%s)\n", fname, newsize, strerror(errno)));
if(buf)
free(buf);
return;
}
-
-#ifdef FTRUNCATE_NEEDS_ROOT
- unbecome_root(False);
-#endif /* FTRUNCATE_NEEDS_ROOT */
}
/*******************************************************************
@@ -825,17 +802,8 @@ deleting it (%s).\n",fname, strerror(errno)));
/* Now truncate the file at this point - just for safety. */
-#ifdef FTRUNCATE_NEEDS_ROOT
- become_root(False);
-#endif /* FTRUNCATE_NEEDS_ROOT */
-
if(ftruncate(fd, header_size + (SMF_ENTRY_LENGTH*num_entries))!= 0)
{
-
-#ifdef FTRUNCATE_NEEDS_ROOT
- unbecome_root(False);
-#endif /* FTRUNCATE_NEEDS_ROOT */
-
DEBUG(0,("ERROR: set_share_mode: failed to ftruncate share \
mode file %s to size %d (%s)\n", fname, header_size + (SMF_ENTRY_LENGTH*num_entries),
strerror(errno)));
@@ -844,10 +812,6 @@ mode file %s to size %d (%s)\n", fname, header_size + (SMF_ENTRY_LENGTH*num_entr
return False;
}
-#ifdef FTRUNCATE_NEEDS_ROOT
- unbecome_root(False);
-#endif /* FTRUNCATE_NEEDS_ROOT */
-
if(buf)
free(buf);
@@ -1093,3 +1057,7 @@ struct share_ops *locking_slow_init(int ronly)
return &share_ops;
}
+#else
+ int locking_slow_dummy_procedure(void)
+{return 0;}
+#endif /* !FAST_SHARE_MODES */
diff --git a/source3/locking/shmem.c b/source3/locking/shmem.c
index 21aaa9e24f..48f78d2a5b 100644
--- a/source3/locking/shmem.c
+++ b/source3/locking/shmem.c
@@ -23,7 +23,7 @@
#include "includes.h"
-#ifdef FAST_SHARE_MODES
+#ifdef HAVE_SHARED_MMAP
extern int DEBUGLEVEL;
@@ -874,7 +874,7 @@ struct shmem_ops *smb_shm_open(int ronly)
}
-#else /* FAST_SHARE_MODES */
+#else /* HAVE_SHARED_MMAP */
int shmem_dummy_procedure(void)
{return 0;}
-#endif /* FAST_SHARE_MODES */
+#endif /* HAVE_SHARED_MMAP */
diff --git a/source3/locking/shmem_sysv.c b/source3/locking/shmem_sysv.c
index 3466930f4c..0809e0546f 100644
--- a/source3/locking/shmem_sysv.c
+++ b/source3/locking/shmem_sysv.c
@@ -23,7 +23,7 @@
#include "includes.h"
-#ifdef USE_SYSV_IPC
+#ifdef HAVE_SYSV_IPC
extern int DEBUGLEVEL;
@@ -542,15 +542,6 @@ struct shmem_ops *sysv_shm_open(int ronly)
int i;
int pid;
-
-
-#ifdef LINUX
- if (sizeof(shm_ds) == 52) {
- DEBUG(0,("WARNING: You probably have a broken set of glibc2 include files - disabling sysv shared memory\n"));
- return NULL;
- }
-#endif
-
read_only = ronly;
shm_size = lp_shmem_size();
diff --git a/source3/nmbd/asyncdns.c b/source3/nmbd/asyncdns.c
index 3d2d5303de..89be2b0ce0 100644
--- a/source3/nmbd/asyncdns.c
+++ b/source3/nmbd/asyncdns.c
@@ -135,7 +135,7 @@ void start_async_dns(void)
{
int fd1[2], fd2[2];
- signal(SIGCLD, SIG_IGN);
+ CatchChild();
if (pipe(fd1) || pipe(fd2)) {
return;
@@ -154,10 +154,10 @@ void start_async_dns(void)
fd_in = fd2[0];
fd_out = fd1[1];
- signal(SIGUSR2, SIG_IGN);
- signal(SIGUSR1, SIG_IGN);
- signal(SIGHUP, SIG_IGN);
- signal(SIGTERM, SIGNAL_CAST sig_term );
+ CatchSignal(SIGUSR2, SIG_IGN);
+ CatchSignal(SIGUSR1, SIG_IGN);
+ CatchSignal(SIGHUP, SIG_IGN);
+ CatchSignal(SIGTERM, SIGNAL_CAST sig_term );
asyncdns_process();
}
diff --git a/source3/nmbd/nmbd.c b/source3/nmbd/nmbd.c
index 1bb7ed55e4..3fa749b883 100644
--- a/source3/nmbd/nmbd.c
+++ b/source3/nmbd/nmbd.c
@@ -102,9 +102,7 @@ static int sig_hup(void)
set_samba_nb_type();
BlockSignals(False,SIGHUP);
-#ifndef DONT_REINSTALL_SIG
- signal(SIGHUP,SIGNAL_CAST sig_hup);
-#endif
+
return(0);
} /* sig_hup */
@@ -141,7 +139,7 @@ static BOOL dump_core(void)
return( False );
umask( ~(0700) );
-#ifndef NO_GETRLIMIT
+#ifdef HAVE_GETRLIMIT
#ifdef RLIMIT_CORE
{
struct rlimit rlp;
@@ -428,7 +426,7 @@ static BOOL open_sockets(BOOL isdaemon, int port)
if ( ClientNMB == -1 )
return( False );
- signal( SIGPIPE, SIGNAL_CAST sig_pipe );
+ CatchSignal( SIGPIPE, SIGNAL_CAST sig_pipe );
set_socket_options( ClientNMB, "SO_BROADCAST" );
set_socket_options( ClientDGRAM, "SO_BROADCAST" );
@@ -582,8 +580,8 @@ int main(int argc,char *argv[])
fault_setup((void (*)(void *))fault_continue );
- signal( SIGHUP, SIGNAL_CAST sig_hup );
- signal( SIGTERM, SIGNAL_CAST sig_term );
+ CatchSignal( SIGHUP, SIGNAL_CAST sig_hup );
+ CatchSignal( SIGTERM, SIGNAL_CAST sig_term );
/* Setup the signals that allow the debug log level
to by dynamically changed. */
@@ -592,11 +590,11 @@ int main(int argc,char *argv[])
SIGUSR1 and SIGUSR2 to do debug level changes. */
#ifndef MEM_MAN
#if defined(SIGUSR1)
- signal( SIGUSR1, SIGNAL_CAST sig_usr1 );
+ CatchSignal( SIGUSR1, SIGNAL_CAST sig_usr1 );
#endif /* SIGUSR1 */
#if defined(SIGUSR2)
- signal( SIGUSR2, SIGNAL_CAST sig_usr2 );
+ CatchSignal( SIGUSR2, SIGNAL_CAST sig_usr2 );
#endif /* SIGUSR2 */
#endif /* MEM_MAN */
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index da0210eee7..3e76dca731 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -176,10 +176,10 @@ typedef struct
int client_code_page;
int announce_as; /* This is initialised in init_globals */
int machine_password_timeout;
-#ifdef USE_LDAP
+#ifdef WITH_LDAP
int ldap_port;
-#endif /* USE_LDAP */
-#ifdef USE_SSL
+#endif /* WITH_LDAP */
+#ifdef WITH_SSL
int sslVersion;
char *sslHostsRequire;
char *sslHostsResign;
@@ -194,7 +194,7 @@ typedef struct
BOOL sslReqClientCert;
BOOL sslReqServerCert;
BOOL sslCompatibility;
-#endif /* USE_SSL */
+#endif /* WITH_SSL */
BOOL bDNSproxy;
BOOL bWINSsupport;
BOOL bWINSproxy;
@@ -454,7 +454,7 @@ static struct enum_list enum_case[] = {{CASE_LOWER, "lower"}, {CASE_UPPER, "uppe
static struct enum_list enum_lm_announce[] = {{0, "False"}, {1, "True"}, {2, "Auto"}, {-1, NULL}};
-#ifdef USE_SSL
+#ifdef WITH_SSL
static struct enum_list enum_ssl_version[] = {{SMB_SSL_V2, "ssl2"}, {SMB_SSL_V3, "ssl3"},
{SMB_SSL_V23, "ssl2or3"}, {SMB_SSL_TLS1, "tls1"}, {-1, NULL}};
#endif
@@ -526,7 +526,7 @@ static struct parm_struct parm_table[] =
{"hosts deny", P_STRING, P_LOCAL, &sDefault.szHostsdeny, NULL, NULL, FLAG_GLOBAL|FLAG_BASIC|FLAG_PRINT},
{"deny hosts", P_STRING, P_LOCAL, &sDefault.szHostsdeny, NULL, NULL, 0},
-#ifdef USE_SSL
+#ifdef WITH_SSL
{"Secure Socket Layer Options", P_SEP, P_SEPARATOR},
{"ssl", P_BOOL, P_GLOBAL, &Globals.sslEnabled, NULL, NULL, 0 },
{"ssl hosts", P_STRING, P_GLOBAL, &Globals.sslHostsRequire, NULL, NULL, 0 },
@@ -542,7 +542,7 @@ static struct parm_struct parm_table[] =
{"ssl ciphers", P_STRING, P_GLOBAL, &Globals.sslCiphers, NULL, NULL, 0 },
{"ssl version", P_ENUM, P_GLOBAL, &Globals.sslVersion, NULL, enum_ssl_version, 0},
{"ssl compatibility", P_BOOL, P_GLOBAL, &Globals.sslCompatibility, NULL, NULL, 0 },
-#endif /* USE_SSL */
+#endif /* WITH_SSL */
{"Logging Options", P_SEP, P_SEPARATOR},
{"log level", P_INTEGER, P_GLOBAL, &DEBUGLEVEL, NULL, NULL, FLAG_BASIC},
@@ -676,7 +676,7 @@ static struct parm_struct parm_table[] =
{"oplocks", P_BOOL, P_LOCAL, &sDefault.bOpLocks, NULL, NULL, FLAG_GLOBAL},
{"fake oplocks", P_BOOL, P_LOCAL, &sDefault.bFakeOplocks, NULL, NULL, 0},
-#ifdef USE_LDAP
+#ifdef WITH_LDAP
{"Ldap Options", P_SEP, P_SEPARATOR},
{"ldap server", P_STRING, P_GLOBAL, &Globals.szLdapServer, NULL, NULL, 0},
{"ldap port", P_INTEGER, P_GLOBAL, &Globals.ldap_port, NULL, NULL, 0},
@@ -684,7 +684,7 @@ static struct parm_struct parm_table[] =
{"ldap filter", P_STRING, P_GLOBAL, &Globals.szLdapFilter, NULL, NULL, 0},
{"ldap root", P_STRING, P_GLOBAL, &Globals.szLdapRoot, NULL, NULL, 0},
{"ldap root passwd", P_STRING, P_GLOBAL, &Globals.szLdapRootPassword,NULL, NULL, 0},
-#endif /* USE_LDAP */
+#endif /* WITH_LDAP */
{"Miscellaneous Options", P_SEP, P_SEPARATOR},
@@ -817,7 +817,7 @@ static void init_globals(void)
Globals.shmem_size = SHMEM_SIZE;
Globals.announce_as = ANNOUNCE_AS_NT;
Globals.bUnixRealname = False;
-#if (defined(NETGROUP) && defined(AUTOMOUNT))
+#if (defined(HAVE_NETGROUP) && defined(WITH_AUTOMOUNT))
Globals.bNISHomeMap = False;
#ifdef NISPLUS_HOME
string_set(&Globals.szNISHomeMapName, "auto_home.org_dir");
@@ -833,13 +833,13 @@ static void init_globals(void)
Globals.bUnixPasswdSync = False;
Globals.bPasswdChatDebug = False;
-#ifdef USE_LDAP
+#ifdef WITH_LDAP
/* default values for ldap */
string_set(&Globals.szLdapServer, "localhost");
Globals.ldap_port=389;
-#endif /* USE_LDAP */
+#endif /* WITH_LDAP */
-#ifdef USE_SSL
+#ifdef WITH_SSL
Globals.sslVersion = SMB_SSL_V23;
Globals.sslHostsRequire = NULL;
Globals.sslHostsResign = NULL;
@@ -854,7 +854,7 @@ static void init_globals(void)
Globals.sslReqClientCert = False;
Globals.sslReqServerCert = False;
Globals.sslCompatibility = False;
-#endif /* USE_SSL */
+#endif /* WITH_SSL */
/* these parameters are set to defaults that are more appropriate
for the increasing samba install base:
@@ -918,15 +918,15 @@ static void init_locals(void)
string_initial(&sDefault.szLpqcommand,"lpstat -o%p");
string_initial(&sDefault.szLprmcommand,"cancel %p-%j");
string_initial(&sDefault.szPrintcommand,"lp -c -d%p %s; rm %s");
-#ifdef SVR4
+#ifdef SYSV
string_initial(&sDefault.szLppausecommand,"lp -i %p-%j -H hold");
string_initial(&sDefault.szLpresumecommand,"lp -i %p-%j -H resume");
string_initial(&sDefault.szQueuepausecommand, "lpc stop %p");
string_initial(&sDefault.szQueueresumecommand, "lpc start %p");
-#else /* SVR4 */
+#else /* SYSV */
string_initial(&sDefault.szQueuepausecommand, "disable %p");
string_initial(&sDefault.szQueueresumecommand, "enable %p");
-#endif /* SVR4 */
+#endif /* SYSV */
break;
case PRINT_QNX:
@@ -1066,15 +1066,15 @@ FN_GLOBAL_STRING(lp_domain_guest_users,&Globals.szDomainGuestUsers)
FN_GLOBAL_STRING(lp_domain_hostsallow,&Globals.szDomainHostsallow)
FN_GLOBAL_STRING(lp_domain_hostsdeny,&Globals.szDomainHostsdeny)
-#ifdef USE_LDAP
+#ifdef WITH_LDAP
FN_GLOBAL_STRING(lp_ldap_server,&Globals.szLdapServer);
FN_GLOBAL_STRING(lp_ldap_suffix,&Globals.szLdapSuffix);
FN_GLOBAL_STRING(lp_ldap_filter,&Globals.szLdapFilter);
FN_GLOBAL_STRING(lp_ldap_root,&Globals.szLdapRoot);
FN_GLOBAL_STRING(lp_ldap_rootpasswd,&Globals.szLdapRootPassword);
-#endif /* USE_LDAP */
+#endif /* WITH_LDAP */
-#ifdef USE_SSL
+#ifdef WITH_SSL
FN_GLOBAL_INTEGER(lp_ssl_version,&Globals.sslVersion);
FN_GLOBAL_STRING(lp_ssl_hosts,&Globals.sslHostsRequire);
FN_GLOBAL_STRING(lp_ssl_hosts_resign,&Globals.sslHostsResign);
@@ -1089,7 +1089,7 @@ FN_GLOBAL_BOOL(lp_ssl_enabled,&Globals.sslEnabled);
FN_GLOBAL_BOOL(lp_ssl_reqClientCert,&Globals.sslReqClientCert);
FN_GLOBAL_BOOL(lp_ssl_reqServerCert,&Globals.sslReqServerCert);
FN_GLOBAL_BOOL(lp_ssl_compatibility,&Globals.sslCompatibility);
-#endif /* USE_SSL */
+#endif /* WITH_SSL */
FN_GLOBAL_BOOL(lp_dns_proxy,&Globals.bDNSproxy)
FN_GLOBAL_BOOL(lp_wins_support,&Globals.bWINSsupport)
@@ -1147,9 +1147,9 @@ FN_GLOBAL_INTEGER(lp_lm_announce,&Globals.lm_announce)
FN_GLOBAL_INTEGER(lp_lm_interval,&Globals.lm_interval)
FN_GLOBAL_INTEGER(lp_machine_password_timeout,&Globals.machine_password_timeout)
-#ifdef USE_LDAP
+#ifdef WITH_LDAP
FN_GLOBAL_INTEGER(lp_ldap_port,&Globals.ldap_port)
-#endif /* USE_LDAP */
+#endif /* WITH_LDAP */
FN_LOCAL_STRING(lp_preexec,szPreExec)
FN_LOCAL_STRING(lp_postexec,szPostExec)
diff --git a/source3/passdb/ldap.c b/source3/passdb/ldap.c
index b644e8bb69..2e98cad4be 100644
--- a/source3/passdb/ldap.c
+++ b/source3/passdb/ldap.c
@@ -20,7 +20,7 @@
*/
-#ifdef USE_LDAP_DB
+#ifdef WITH_LDAP
#include "includes.h"
diff --git a/source3/passdb/nispass.c b/source3/passdb/nispass.c
index 84eae0a40f..b43a52e48a 100644
--- a/source3/passdb/nispass.c
+++ b/source3/passdb/nispass.c
@@ -19,7 +19,7 @@
* Mass Ave, Cambridge, MA 02139, USA.
*/
-#ifdef USE_NISPLUS_DB
+#ifdef WITH_NISPLUS
#include "includes.h"
#include <rpcsvc/nis.h>
@@ -166,7 +166,7 @@ static nis_result *nisp_get_nis_list(char *nis_name)
result = nis_list(nis_name, FOLLOW_PATH|EXPAND_NAME|HARD_LOOKUP,NULL,NULL);
alarm(0);
- signal(SIGALRM, SIGNAL_CAST SIG_DFL);
+ CatchSignal(SIGALRM, SIGNAL_CAST SIG_DFL);
if (gotalarm)
{
@@ -531,13 +531,13 @@ static struct sam_passwd *getnisp21pwnam(char *name)
/* Search the table. */
gotalarm = 0;
- signal(SIGALRM, SIGNAL_CAST gotalarm_sig);
+ CatchSignal(SIGALRM, SIGNAL_CAST gotalarm_sig);
alarm(5);
result = nis_list(nisname, FOLLOW_PATH | EXPAND_NAME | HARD_LOOKUP, NULL, NULL);
alarm(0);
- signal(SIGALRM, SIGNAL_CAST SIG_DFL);
+ CatchSignal(SIGALRM, SIGNAL_CAST SIG_DFL);
if (gotalarm)
{
@@ -576,13 +576,13 @@ static struct sam_passwd *getnisp21pwrid(uint32 rid)
/* Search the table. */
gotalarm = 0;
- signal(SIGALRM, SIGNAL_CAST gotalarm_sig);
+ CatchSignal(SIGALRM, SIGNAL_CAST gotalarm_sig);
alarm(5);
result = nis_list(nisname, FOLLOW_PATH | EXPAND_NAME | HARD_LOOKUP, NULL, NULL);
alarm(0);
- signal(SIGALRM, SIGNAL_CAST SIG_DFL);
+ CatchSignal(SIGALRM, SIGNAL_CAST SIG_DFL);
if (gotalarm)
{
@@ -674,7 +674,7 @@ struct passdb_ops *nisplus_initialize_password_db(void)
#else
void nisplus_dummy_function(void) { } /* stop some compilers complaining */
-#endif /* USE_NISPLUS_DB */
+#endif /* WITH_NISPLUS */
/* useful code i can't bring myself to delete */
#if 0
diff --git a/source3/passdb/passdb.c b/source3/passdb/passdb.c
index cc4a8e5c55..0ca71dda94 100644
--- a/source3/passdb/passdb.c
+++ b/source3/passdb/passdb.c
@@ -88,17 +88,13 @@ BOOL initialize_password_db(void)
return True;
}
-#ifdef USE_NISPLUS_DB
+#ifdef WITH_NISPLUS
pdb_ops = nisplus_initialize_password_db();
-#endif /* USE_NISPLUS_DB */
-
-#ifdef USE_LDAP_DB
+#elif defined(WITH_LDAP)
pdb_ops = ldap_initialize_password_db();
-#endif /* USE_LDAP_DB */
-
-#ifdef USE_SMBPASS_DB
+#else
pdb_ops = file_initialize_password_db();
-#endif /* USE_SMBPASS_DB */
+#endif
return (pdb_ops != NULL);
}
@@ -899,159 +895,167 @@ static BOOL read_sid_from_file(int fd, char *sid_file)
Generate the global machine sid. Look for the MACHINE.SID file first, if
not found then look in smb.conf and use it to create the MACHINE.SID file.
****************************************************************************/
-
BOOL pdb_generate_machine_sid(void)
{
- int fd;
- char *p;
- pstring sid_file;
- fstring sid_string;
- struct stat st;
- uchar raw_sid_data[12];
-
- pstrcpy(sid_file, lp_smb_passwd_file());
- p = strrchr(sid_file, '/');
- if(p != NULL)
- *++p = '\0';
-
- pstrcat(sid_file, "MACHINE.SID");
-
- if((fd = open( sid_file, O_RDWR | O_CREAT, 0644)) < 0 ) {
- DEBUG(0,("generate_machine_sid: unable to open or create file %s. Error was %s\n",
- sid_file, strerror(errno) ));
- return False;
- }
-
- /*
- * Check if the file contains data.
- */
+ int fd;
+ char *p;
+ pstring sid_file;
+ fstring sid_string;
+ struct stat st;
+ uchar raw_sid_data[12];
+
+ pstrcpy(sid_file, lp_smb_passwd_file());
+ p = strrchr(sid_file, '/');
+ if(p != NULL) {
+ *++p = '\0';
+ }
+
+ if (!directory_exist(sid_file, NULL)) {
+ if (sys_mkdir(sid_file, 0700) != 0) {
+ DEBUG(0,("generate_machine_sid: can't create private directory %s : %s\n",
+ sid_file, strerror(errno)));
+ return False;
+ }
+ }
+
+ pstrcat(sid_file, "MACHINE.SID");
- if(fstat( fd, &st) < 0) {
- DEBUG(0,("generate_machine_sid: unable to stat file %s. Error was %s\n",
- sid_file, strerror(errno) ));
- close(fd);
- return False;
- }
+ if((fd = open(sid_file, O_RDWR | O_CREAT, 0644)) == -1) {
+ DEBUG(0,("generate_machine_sid: unable to open or create file %s. Error was %s\n",
+ sid_file, strerror(errno) ));
+ return False;
+ }
- if(st.st_size > 0) {
- /*
- * We have a valid SID - read it.
- */
- if(!read_sid_from_file( fd, sid_file)) {
- DEBUG(0,("generate_machine_sid: unable to read file %s. Error was %s\n",
- sid_file, strerror(errno) ));
- close(fd);
- return False;
- }
- close(fd);
- return True;
- }
+ /*
+ * Check if the file contains data.
+ */
+
+ if(fstat( fd, &st) < 0) {
+ DEBUG(0,("generate_machine_sid: unable to stat file %s. Error was %s\n",
+ sid_file, strerror(errno) ));
+ close(fd);
+ return False;
+ }
- /*
- * The file contains no data - we may need to generate our
- * own sid. Try the lp_domain_sid() first.
- */
-
- if(*lp_domain_sid())
- fstrcpy( sid_string, lp_domain_sid());
- else {
- /*
- * Generate the new sid data & turn it into a string.
- */
- int i;
- generate_random_buffer( raw_sid_data, 12, True);
-
- fstrcpy( sid_string, "S-1-5-21");
- for( i = 0; i < 3; i++) {
- fstring tmp_string;
- slprintf( tmp_string, sizeof(tmp_string) - 1, "-%u", IVAL(raw_sid_data, i*4));
- fstrcat( sid_string, tmp_string);
- }
- }
+ if(st.st_size > 0) {
+ /*
+ * We have a valid SID - read it.
+ */
+ if(!read_sid_from_file( fd, sid_file)) {
+ DEBUG(0,("generate_machine_sid: unable to read file %s. Error was %s\n",
+ sid_file, strerror(errno) ));
+ close(fd);
+ return False;
+ }
+ close(fd);
+ return True;
+ }
- fstrcat(sid_string, "\n");
-
- /*
- * Ensure our new SID is valid.
- */
-
- if(!string_to_sid( &global_machine_sid, sid_string)) {
- DEBUG(0,("generate_machine_sid: unable to generate machine SID.\n"));
- return False;
- }
+ /*
+ * The file contains no data - we may need to generate our
+ * own sid. Try the lp_domain_sid() first.
+ */
+
+ if(*lp_domain_sid())
+ fstrcpy( sid_string, lp_domain_sid());
+ else {
+ /*
+ * Generate the new sid data & turn it into a string.
+ */
+ int i;
+ generate_random_buffer( raw_sid_data, 12, True);
+
+ fstrcpy( sid_string, "S-1-5-21");
+ for( i = 0; i < 3; i++) {
+ fstring tmp_string;
+ slprintf( tmp_string, sizeof(tmp_string) - 1, "-%u", IVAL(raw_sid_data, i*4));
+ fstrcat( sid_string, tmp_string);
+ }
+ }
+
+ fstrcat(sid_string, "\n");
+
+ /*
+ * Ensure our new SID is valid.
+ */
+
+ if(!string_to_sid( &global_machine_sid, sid_string)) {
+ DEBUG(0,("generate_machine_sid: unable to generate machine SID.\n"));
+ return False;
+ }
- /*
- * Do an exclusive blocking lock on the file.
- */
-
- if(!do_file_lock( fd, 60, F_WRLCK)) {
- DEBUG(0,("generate_machine_sid: unable to lock file %s. Error was %s\n",
- sid_file, strerror(errno) ));
- close(fd);
- return False;
- }
+ /*
+ * Do an exclusive blocking lock on the file.
+ */
+
+ if(!do_file_lock( fd, 60, F_WRLCK)) {
+ DEBUG(0,("generate_machine_sid: unable to lock file %s. Error was %s\n",
+ sid_file, strerror(errno) ));
+ close(fd);
+ return False;
+ }
- /*
- * At this point we have a blocking lock on the SID
- * file - check if in the meantime someone else wrote
- * SID data into the file. If so - they were here first,
- * use their data.
- */
-
- if(fstat( fd, &st) < 0) {
- DEBUG(0,("generate_machine_sid: unable to stat file %s. Error was %s\n",
- sid_file, strerror(errno) ));
- close(fd);
- return False;
- }
+ /*
+ * At this point we have a blocking lock on the SID
+ * file - check if in the meantime someone else wrote
+ * SID data into the file. If so - they were here first,
+ * use their data.
+ */
+
+ if(fstat( fd, &st) < 0) {
+ DEBUG(0,("generate_machine_sid: unable to stat file %s. Error was %s\n",
+ sid_file, strerror(errno) ));
+ close(fd);
+ return False;
+ }
- if(st.st_size > 0) {
- /*
- * Unlock as soon as possible to reduce
- * contention on the exclusive lock.
- */
- do_file_lock( fd, 60, F_UNLCK);
-
- /*
- * We have a valid SID - read it.
- */
-
- if(!read_sid_from_file( fd, sid_file)) {
- DEBUG(0,("generate_machine_sid: unable to read file %s. Error was %s\n",
- sid_file, strerror(errno) ));
- close(fd);
- return False;
- }
- close(fd);
- return True;
- }
-
- /*
- * The file is still empty and we have an exlusive lock on it.
- * Write out out SID data into the file.
- */
-
- if(fchmod(fd, 0644) < 0) {
- DEBUG(0,("generate_machine_sid: unable to set correct permissions on file %s. \
+ if(st.st_size > 0) {
+ /*
+ * Unlock as soon as possible to reduce
+ * contention on the exclusive lock.
+ */
+ do_file_lock( fd, 60, F_UNLCK);
+
+ /*
+ * We have a valid SID - read it.
+ */
+
+ if(!read_sid_from_file( fd, sid_file)) {
+ DEBUG(0,("generate_machine_sid: unable to read file %s. Error was %s\n",
+ sid_file, strerror(errno) ));
+ close(fd);
+ return False;
+ }
+ close(fd);
+ return True;
+ }
+
+ /*
+ * The file is still empty and we have an exlusive lock on it.
+ * Write out out SID data into the file.
+ */
+
+ if(fchmod(fd, 0644) < 0) {
+ DEBUG(0,("generate_machine_sid: unable to set correct permissions on file %s. \
Error was %s\n", sid_file, strerror(errno) ));
- close(fd);
- return False;
- }
-
- if(write( fd, sid_string, strlen(sid_string)) != strlen(sid_string)) {
- DEBUG(0,("generate_machine_sid: unable to write file %s. Error was %s\n",
- sid_file, strerror(errno) ));
- close(fd);
- return False;
- }
-
- /*
- * Unlock & exit.
- */
-
- do_file_lock( fd, 60, F_UNLCK);
- close(fd);
- return True;
+ close(fd);
+ return False;
+ }
+
+ if(write( fd, sid_string, strlen(sid_string)) != strlen(sid_string)) {
+ DEBUG(0,("generate_machine_sid: unable to write file %s. Error was %s\n",
+ sid_file, strerror(errno) ));
+ close(fd);
+ return False;
+ }
+
+ /*
+ * Unlock & exit.
+ */
+
+ do_file_lock( fd, 60, F_UNLCK);
+ close(fd);
+ return True;
}
/*******************************************************************
diff --git a/source3/passdb/smbpass.c b/source3/passdb/smbpass.c
index 9c811a3728..abdcb9eb50 100644
--- a/source3/passdb/smbpass.c
+++ b/source3/passdb/smbpass.c
@@ -953,5 +953,5 @@ struct passdb_ops *file_initialize_password_db(void)
#else
/* Do *NOT* make this function static. It breaks the compile on gcc. JRA */
- void dummy_function(void) { } /* stop some compilers complaining */
+ void smbpass_dummy_function(void) { } /* stop some compilers complaining */
#endif /* USE_SMBPASS_DB */
diff --git a/source3/passdb/smbpassfile.c b/source3/passdb/smbpassfile.c
index 3988fd1c78..efbbbd78bf 100644
--- a/source3/passdb/smbpassfile.c
+++ b/source3/passdb/smbpassfile.c
@@ -44,7 +44,7 @@ BOOL do_file_lock(int fd, int waitsecs, int type)
int ret;
gotalarm = 0;
- signal(SIGALRM, SIGNAL_CAST gotalarm_sig);
+ CatchSignal(SIGALRM, SIGNAL_CAST gotalarm_sig);
lock.l_type = type;
lock.l_whence = SEEK_SET;
@@ -55,7 +55,7 @@ BOOL do_file_lock(int fd, int waitsecs, int type)
alarm(5);
ret = fcntl(fd, F_SETLKW, &lock);
alarm(0);
- signal(SIGALRM, SIGNAL_CAST SIG_DFL);
+ CatchSignal(SIGALRM, SIGNAL_CAST SIG_DFL);
if (gotalarm) {
DEBUG(0, ("do_file_lock: failed to %s file.\n",
diff --git a/source3/printing/pcap.c b/source3/printing/pcap.c
index f26f81207d..d51e69ad74 100644
--- a/source3/printing/pcap.c
+++ b/source3/printing/pcap.c
@@ -232,8 +232,9 @@ static BOOL ScanQconfig(char *psz,char *pszPrintername)
fclose(pfile);
return(False);
}
+#endif /* AIX */
+
-#endif
/***************************************************************************
Scan printcap file pszPrintcapname for a printer called pszPrintername.
Return True if found, else False. Returns False on error, too, after logging
diff --git a/source3/script/installman.sh b/source3/script/installman.sh
index 3c8fc71865..95611dcc22 100755
--- a/source3/script/installman.sh
+++ b/source3/script/installman.sh
@@ -2,7 +2,7 @@
#5 July 96 Dan.Shearer@unisa.edu.au removed hardcoded values
MANDIR=$1
-SRCDIR=$2
+SRCDIR=$2/
echo Installing man pages in $MANDIR
diff --git a/source3/script/installswat.sh b/source3/script/installswat.sh
index a51fd56272..93f534fd72 100755
--- a/source3/script/installswat.sh
+++ b/source3/script/installswat.sh
@@ -2,7 +2,9 @@
#fist version March 1998, Andrew Tridgell
SWATDIR=$1
-SRCDIR=$2
+SRCDIR=$2/
+
+echo Installing SWAT in $SWATDIR
echo Installing the Samba Web Admisistration Tool
diff --git a/source3/smbd/chgpasswd.c b/source3/smbd/chgpasswd.c
index 560d989b47..af6746a699 100644
--- a/source3/smbd/chgpasswd.c
+++ b/source3/smbd/chgpasswd.c
@@ -51,25 +51,20 @@
extern int DEBUGLEVEL;
-#ifdef ALLOW_CHANGE_PASSWORD
-
+#if ALLOW_CHANGE_PASSWORD
#define MINPASSWDLENGTH 5
#define BUFSIZE 512
static int findpty(char **slave)
{
int master;
-#if defined(USE_GRANTPT)
-#if defined(SVR4) || defined(SUNOS5)
- extern char *ptsname();
-#endif /* defined(SVR4) || defined(SUNOS5) */
-#else /* USE_GRANTPT */
+#ifndef HAVE_GRANTPT
static fstring line;
void *dirp;
char *dpname;
-#endif /* USE_GRANTPT */
+#endif /* !HAVE_GRANTPT */
-#if defined(USE_GRANTPT)
+#if defined(HAVE_GRANTPT)
if ((master = open("/dev/ptmx", O_RDWR)) >= 1) {
grantpt(master);
unlockpt(master);
@@ -82,7 +77,7 @@ static int findpty(char **slave)
return (master);
}
}
-#else /* USE_GRANTPT */
+#else /* HAVE_GRANTPT */
fstrcpy( line, "/dev/ptyXX" );
dirp = OpenDir(-1, "/dev", False);
@@ -102,7 +97,7 @@ static int findpty(char **slave)
}
}
CloseDir(dirp);
-#endif /* USE_GRANTPT */
+#endif /* HAVE_GRANTPT */
return (-1);
}
@@ -122,11 +117,11 @@ static int dochild(int master,char *slavedev, char *name, char *passwordprogram,
gid = pass->pw_gid;
uid = pass->pw_uid;
-#ifdef USE_SETRES
+#ifdef HAVE_SETRESUID
setresuid(0,0,0);
-#else /* USE_SETRES */
+#else
setuid(0);
-#endif /* USE_SETRES */
+#endif
/* Start new session - gets rid of controlling terminal. */
if (setsid() < 0) {
@@ -140,17 +135,15 @@ static int dochild(int master,char *slavedev, char *name, char *passwordprogram,
slavedev));
return(False);
}
-#if defined(SVR4) || defined(SUNOS5) || defined(SCO)
+#ifdef I_PUSH
ioctl(slave, I_PUSH, "ptem");
ioctl(slave, I_PUSH, "ldterm");
-#else /* defined(SVR4) || defined(SUNOS5) || defined(SCO) */
-#if defined(TIOCSCTTY)
+#elif defined(TIOCSCTTY)
if (ioctl(slave,TIOCSCTTY,0) <0) {
DEBUG(3,("Error in ioctl call for slave pty\n"));
/* return(False); */
}
-#endif /* defined(TIOCSCTTY) */
-#endif /* defined(SVR4) || defined(SUNOS5) || defined(SCO) */
+#endif
/* Close master. */
close(master);
@@ -188,18 +181,18 @@ static int dochild(int master,char *slavedev, char *name, char *passwordprogram,
/* make us completely into the right uid */
if(!as_root) {
-#ifdef USE_SETRES
- setresgid(0,0,0);
- setresuid(0,0,0);
- setresgid(gid,gid,gid);
- setresuid(uid,uid,uid);
+#ifdef HAVE_SETRESUID
+ setresgid(0,0,0);
+ setresuid(0,0,0);
+ setresgid(gid,gid,gid);
+ setresuid(uid,uid,uid);
#else
- setuid(0);
- seteuid(0);
- setgid(gid);
- setegid(gid);
- setuid(uid);
- seteuid(uid);
+ setuid(0);
+ seteuid(0);
+ setgid(gid);
+ setegid(gid);
+ setuid(uid);
+ seteuid(uid);
#endif
}
@@ -391,13 +384,8 @@ BOOL chgpasswd(char *name,char *oldpass,char *newpass, BOOL as_root)
return (False); /* inform the user */
}
-#if (defined(PASSWD_PROGRAM) && defined(PASSWD_CHAT))
- pstrcpy(passwordprogram,PASSWD_PROGRAM);
- pstrcpy(chatsequence,PASSWD_CHAT);
-#else
pstrcpy(passwordprogram,lp_passwd_program());
pstrcpy(chatsequence,lp_passwd_chat());
-#endif
if (!*chatsequence) {
DEBUG(2,("Null chat sequence - no password changing\n"));
diff --git a/source3/smbd/dfree.c b/source3/smbd/dfree.c
new file mode 100644
index 0000000000..799ff6a24c
--- /dev/null
+++ b/source3/smbd/dfree.c
@@ -0,0 +1,231 @@
+/*
+ Unix SMB/Netbios implementation.
+ Version 1.9.
+ functions to calculate the free disk space
+ Copyright (C) Andrew Tridgell 1998
+
+ 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.
+*/
+
+#include "includes.h"
+
+
+extern int DEBUGLEVEL;
+
+/****************************************************************************
+normalise for DOS usage
+****************************************************************************/
+static void disk_norm(int *bsize,int *dfree,int *dsize)
+{
+ /* check if the disk is beyond the max disk size */
+ int maxdisksize = lp_maxdisksize();
+ if (maxdisksize) {
+ /* convert to blocks - and don't overflow */
+ maxdisksize = ((maxdisksize*1024)/(*bsize))*1024;
+ if (*dsize > maxdisksize) *dsize = maxdisksize;
+ if (*dfree > maxdisksize) *dfree = maxdisksize-1;
+ /* the -1 should stop applications getting div by 0
+ errors */
+ }
+
+ while (*dfree > WORDMAX || *dsize > WORDMAX || *bsize < 512) {
+ *dfree /= 2;
+ *dsize /= 2;
+ *bsize *= 2;
+ if (*bsize > WORDMAX) {
+ *bsize = WORDMAX;
+ if (*dsize > WORDMAX)
+ *dsize = WORDMAX;
+ if (*dfree > WORDMAX)
+ *dfree = WORDMAX;
+ break;
+ }
+ }
+}
+
+
+/* Return the number of TOSIZE-byte blocks used by
+ BLOCKS FROMSIZE-byte blocks, rounding away from zero.
+ TOSIZE must be positive. Return -1 if FROMSIZE is not positive. */
+static int adjust_blocks(int blocks, int fromsize, int tosize)
+{
+ if (tosize <= 0 || fromsize <= 0) {
+ return -1;
+ }
+
+ if (fromsize == tosize) /* e.g., from 512 to 512 */
+ return blocks;
+ else if (fromsize > tosize) /* e.g., from 2048 to 512 */
+ return blocks * (fromsize / tosize);
+ else /* e.g., from 256 to 512 */
+ return (blocks + (blocks < 0 ? -1 : 1)) / (tosize / fromsize);
+}
+
+/* this does all of the system specific guff to get the free disk space.
+ It is derived from code in the GNU fileutils package, but has been
+ considerably mangled for use here
+
+ results are returned in *dfree and *dsize, in 512 byte units
+*/
+static int fsusage(const char *path, int *dfree, int *dsize)
+{
+#ifdef STAT_STATFS3_OSF1
+#define CONVERT_BLOCKS(B) adjust_blocks ((B), fsd.f_fsize, 512)
+ struct statfs fsd;
+
+ if (statfs (path, &fsd, sizeof (struct statfs)) != 0)
+ return -1;
+#endif /* STAT_STATFS3_OSF1 */
+
+#ifdef STAT_STATFS2_FS_DATA /* Ultrix */
+#define CONVERT_BLOCKS(B) adjust_blocks ((B), 1024, 512)
+ struct fs_data fsd;
+
+ if (statfs (path, &fsd) != 1)
+ return -1;
+
+ (*dsize) = CONVERT_BLOCKS (fsd.fd_req.btot);
+ (*dfree) = CONVERT_BLOCKS (fsd.fd_req.bfreen);
+#endif /* STAT_STATFS2_FS_DATA */
+
+#ifdef STAT_STATFS2_BSIZE /* 4.3BSD, SunOS 4, HP-UX, AIX */
+#define CONVERT_BLOCKS(B) adjust_blocks ((B), fsd.f_bsize, 512)
+ struct statfs fsd;
+
+ if (statfs (path, &fsd) < 0)
+ return -1;
+
+#ifdef STATFS_TRUNCATES_BLOCK_COUNTS
+ /* In SunOS 4.1.2, 4.1.3, and 4.1.3_U1, the block counts in the
+ struct statfs are truncated to 2GB. These conditions detect that
+ truncation, presumably without botching the 4.1.1 case, in which
+ the values are not truncated. The correct counts are stored in
+ undocumented spare fields. */
+ if (fsd.f_blocks == 0x1fffff && fsd.f_spare[0] > 0) {
+ fsd.f_blocks = fsd.f_spare[0];
+ fsd.f_bfree = fsd.f_spare[1];
+ fsd.f_bavail = fsd.f_spare[2];
+ }
+#endif /* STATFS_TRUNCATES_BLOCK_COUNTS */
+#endif /* STAT_STATFS2_BSIZE */
+
+
+#ifdef STAT_STATFS2_FSIZE /* 4.4BSD */
+#define CONVERT_BLOCKS(B) adjust_blocks ((B), fsd.f_fsize, 512)
+
+ struct statfs fsd;
+
+ if (statfs (path, &fsd) < 0)
+ return -1;
+#endif /* STAT_STATFS2_FSIZE */
+
+#ifdef STAT_STATFS4 /* SVR3, Dynix, Irix, AIX */
+# if _AIX || defined(_CRAY)
+# define CONVERT_BLOCKS(B) adjust_blocks ((B), fsd.f_bsize, 512)
+# ifdef _CRAY
+# define f_bavail f_bfree
+# endif
+# else
+# define CONVERT_BLOCKS(B) (B)
+# ifndef _SEQUENT_ /* _SEQUENT_ is DYNIX/ptx */
+# ifndef DOLPHIN /* DOLPHIN 3.8.alfa/7.18 has f_bavail */
+# define f_bavail f_bfree
+# endif
+# endif
+# endif
+
+ struct statfs fsd;
+
+ if (statfs (path, &fsd, sizeof fsd, 0) < 0)
+ return -1;
+ /* Empirically, the block counts on most SVR3 and SVR3-derived
+ systems seem to always be in terms of 512-byte blocks,
+ no matter what value f_bsize has. */
+
+#endif /* STAT_STATFS4 */
+
+#ifdef STAT_STATVFS /* SVR4 */
+# define CONVERT_BLOCKS(B) \
+ adjust_blocks ((B), fsd.f_frsize ? fsd.f_frsize : fsd.f_bsize, 512)
+
+ struct statvfs fsd;
+
+ if (statvfs (path, &fsd) < 0)
+ return -1;
+ /* f_frsize isn't guaranteed to be supported. */
+
+#endif /* STAT_STATVFS */
+
+#ifndef CONVERT_BLOCKS
+ /* we don't have any dfree code! */
+ return -1;
+#else
+#if !defined(STAT_STATFS2_FS_DATA)
+ /* !Ultrix */
+ (*dsize) = CONVERT_BLOCKS (fsd.f_blocks);
+ (*dfree) = CONVERT_BLOCKS (fsd.f_bavail);
+#endif /* not STAT_STATFS2_FS_DATA */
+#endif
+
+ return 0;
+}
+
+/****************************************************************************
+ return number of 1K blocks available on a path and total number
+****************************************************************************/
+static int disk_free(char *path,int *bsize,int *dfree,int *dsize)
+{
+ int dfree_retval;
+
+ (*dfree) = (*dsize) = 0;
+ (*bsize) = 512;
+
+ fsusage(path, dfree, dsize);
+
+ if (*bsize < 256) {
+ *bsize = 512;
+ }
+
+ if ((*dsize)<1) {
+ static int done;
+ if (!done) {
+ DEBUG(0,("WARNING: dfree is broken on this system\n"));
+ done=1;
+ }
+ *dsize = 20*1024*1024/(*bsize);
+ *dfree = MAX(1,*dfree);
+ }
+
+ disk_norm(bsize,dfree,dsize);
+
+ if ((*bsize) < 1024) {
+ dfree_retval = (*dfree)/(1024/(*bsize));
+ } else {
+ dfree_retval = ((*bsize)/1024)*(*dfree);
+ }
+
+ return(dfree_retval);
+}
+
+
+/****************************************************************************
+wrap it to get filenames right
+****************************************************************************/
+int sys_disk_free(char *path,int *bsize,int *dfree,int *dsize)
+{
+ return(disk_free(dos_to_unix(path,False),bsize,dfree,dsize));
+}
+
+
diff --git a/source3/smbd/dir.c b/source3/smbd/dir.c
index ceb9ae7633..44e0556f20 100644
--- a/source3/smbd/dir.c
+++ b/source3/smbd/dir.c
@@ -30,7 +30,7 @@ extern connection_struct Connections[];
-uint32 dircounter = 0;
+static uint32 dircounter = 0;
#define NUMDIRPTRS 256
@@ -723,7 +723,7 @@ char *DirCacheCheck( char *path, char *name, int snum )
return(NULL);
} /* DirCacheCheck */
-void DirCacheFlush( int snum )
+void DirCacheFlush(int snum)
/* ------------------------------------------------------------------------ **
* Remove all cache entries which have an snum that matches the input.
*
@@ -733,18 +733,18 @@ void DirCacheFlush( int snum )
*
* ------------------------------------------------------------------------ **
*/
- {
- dir_cache_entry *entry;
- ubi_dlNodePtr next;
-
- for( entry = (dir_cache_entry *)ubi_dlFirst( dir_cache ); NULL != entry; )
- {
- next = ubi_dlNext( entry );
- if( entry->snum == snum )
- free( ubi_dlRemThis( dir_cache, entry ) );
- entry = (dir_cache_entry *)next;
- }
- } /* DirCacheFlush */
+{
+ dir_cache_entry *entry;
+ ubi_dlNodePtr next;
+
+ for(entry = (dir_cache_entry *)ubi_dlFirst( dir_cache );
+ NULL != entry; ) {
+ next = ubi_dlNext( entry );
+ if( entry->snum == snum )
+ free( ubi_dlRemThis( dir_cache, entry ) );
+ entry = (dir_cache_entry *)next;
+ }
+} /* DirCacheFlush */
/* -------------------------------------------------------------------------- **
* End of the section that manages the global directory cache.
@@ -752,276 +752,3 @@ void DirCacheFlush( int snum )
*/
-#ifdef REPLACE_GETWD
-/* This is getcwd.c from bash. It is needed in Interactive UNIX. To
- * add support for another OS you need to determine which of the
- * conditional compilation macros you need to define. All the options
- * are defined for Interactive UNIX.
- */
-#ifdef ISC
-#define HAVE_UNISTD_H
-#define USGr3
-#define USG
-#endif
-
-#if defined (HAVE_UNISTD_H)
-# include <unistd.h>
-#endif
-
-#if defined (__STDC__)
-# define CONST const
-# define PTR void *
-#else /* !__STDC__ */
-# define CONST
-# define PTR char *
-#endif /* !__STDC__ */
-
-#if !defined (PATH_MAX)
-# if defined (MAXPATHLEN)
-# define PATH_MAX MAXPATHLEN
-# else /* !MAXPATHLEN */
-# define PATH_MAX 1024
-# endif /* !MAXPATHLEN */
-#endif /* !PATH_MAX */
-
-#if defined (_POSIX_VERSION) || defined (USGr3) || defined (HAVE_DIRENT_H)
-# if !defined (HAVE_DIRENT)
-# define HAVE_DIRENT
-# endif /* !HAVE_DIRENT */
-#endif /* _POSIX_VERSION || USGr3 || HAVE_DIRENT_H */
-
-#if defined (HAVE_DIRENT)
-# define D_NAMLEN(d) (strlen ((d)->d_name))
-#else
-# define D_NAMLEN(d) ((d)->d_namlen)
-#endif /* ! (_POSIX_VERSION || USGr3) */
-
-#if defined (USG) || defined (USGr3)
-# define d_fileno d_ino
-#endif
-
-#if !defined (alloca)
-extern char *alloca ();
-#endif /* alloca */
-
-/* Get the pathname of the current working directory,
- and put it in SIZE bytes of BUF. Returns NULL if the
- directory couldn't be determined or SIZE was too small.
- If successful, returns BUF. In GNU, if BUF is NULL,
- an array is allocated with `malloc'; the array is SIZE
- bytes long, unless SIZE <= 0, in which case it is as
- big as necessary. */
-#if defined (__STDC__)
-char *
-getcwd (char *buf, size_t size)
-#else /* !__STDC__ */
-char *
-getcwd (buf, size)
- char *buf;
- int size;
-#endif /* !__STDC__ */
-{
- static CONST char dots[]
- = "../../../../../../../../../../../../../../../../../../../../../../../\
-../../../../../../../../../../../../../../../../../../../../../../../../../../\
-../../../../../../../../../../../../../../../../../../../../../../../../../..";
- CONST char *dotp, *dotlist;
- size_t dotsize;
- dev_t rootdev, thisdev;
- ino_t rootino, thisino;
- char path[PATH_MAX + 1];
- register char *pathp;
- char *pathbuf;
- size_t pathsize;
- struct stat st;
-
- if (buf != NULL && size == 0)
- {
- errno = EINVAL;
- return ((char *)NULL);
- }
-
- pathsize = sizeof (path);
- pathp = &path[pathsize];
- *--pathp = '\0';
- pathbuf = path;
-
- if (stat (".", &st) < 0)
- return ((char *)NULL);
- thisdev = st.st_dev;
- thisino = st.st_ino;
-
- if (stat ("/", &st) < 0)
- return ((char *)NULL);
- rootdev = st.st_dev;
- rootino = st.st_ino;
-
- dotsize = sizeof (dots) - 1;
- dotp = &dots[sizeof (dots)];
- dotlist = dots;
- while (!(thisdev == rootdev && thisino == rootino))
- {
- register DIR *dirstream;
- register struct dirent *d;
- dev_t dotdev;
- ino_t dotino;
- char mount_point;
- int namlen;
-
- /* Look at the parent directory. */
- if (dotp == dotlist)
- {
- /* My, what a deep directory tree you have, Grandma. */
- char *new;
- if (dotlist == dots)
- {
- new = malloc (dotsize * 2 + 1);
- if (new == NULL)
- goto lose;
- memcpy (new, dots, dotsize);
- }
- else
- {
- new = realloc ((PTR) dotlist, dotsize * 2 + 1);
- if (new == NULL)
- goto lose;
- }
- memcpy (&new[dotsize], new, dotsize);
- dotp = &new[dotsize];
- dotsize *= 2;
- new[dotsize] = '\0';
- dotlist = new;
- }
-
- dotp -= 3;
-
- /* Figure out if this directory is a mount point. */
- if (stat (dotp, &st) < 0)
- goto lose;
- dotdev = st.st_dev;
- dotino = st.st_ino;
- mount_point = dotdev != thisdev;
-
- /* Search for the last directory. */
- dirstream = opendir(dotp);
- if (dirstream == NULL)
- goto lose;
- while ((d = (struct dirent *)readdir(dirstream)) != NULL)
- {
- if (d->d_name[0] == '.' &&
- (d->d_name[1] == '\0' ||
- (d->d_name[1] == '.' && d->d_name[2] == '\0')))
- continue;
- if (mount_point || d->d_fileno == thisino)
- {
- char *name;
-
- namlen = D_NAMLEN(d);
- name = (char *)
- alloca (dotlist + dotsize - dotp + 1 + namlen + 1);
- memcpy (name, dotp, dotlist + dotsize - dotp);
- name[dotlist + dotsize - dotp] = '/';
- memcpy (&name[dotlist + dotsize - dotp + 1],
- d->d_name, namlen + 1);
- if (lstat (name, &st) < 0)
- {
- int save = errno;
- closedir(dirstream);
- errno = save;
- goto lose;
- }
- if (st.st_dev == thisdev && st.st_ino == thisino)
- break;
- }
- }
- if (d == NULL)
- {
- int save = errno;
- closedir(dirstream);
- errno = save;
- goto lose;
- }
- else
- {
- size_t space;
-
- while ((space = pathp - pathbuf) <= namlen)
- {
- char *new;
-
- if (pathbuf == path)
- {
- new = malloc (pathsize * 2);
- if (!new)
- goto lose;
- }
- else
- {
- new = realloc ((PTR) pathbuf, (pathsize * 2));
- if (!new)
- goto lose;
- pathp = new + space;
- }
- (void) memcpy (new + pathsize + space, pathp, pathsize - space);
- pathp = new + pathsize + space;
- pathbuf = new;
- pathsize *= 2;
- }
-
- pathp -= namlen;
- (void) memcpy (pathp, d->d_name, namlen);
- *--pathp = '/';
- closedir(dirstream);
- }
-
- thisdev = dotdev;
- thisino = dotino;
- }
-
- if (pathp == &path[sizeof(path) - 1])
- *--pathp = '/';
-
- if (dotlist != dots)
- free ((PTR) dotlist);
-
- {
- size_t len = pathbuf + pathsize - pathp;
- if (buf == NULL)
- {
- if (len < (size_t) size)
- len = size;
- buf = (char *) malloc (len);
- if (buf == NULL)
- goto lose2;
- }
- else if ((size_t) size < len)
- {
- errno = ERANGE;
- goto lose2;
- }
- (void) memcpy((PTR) buf, (PTR) pathp, len);
- }
-
- if (pathbuf != path)
- free (pathbuf);
-
- return (buf);
-
- lose:
- if ((dotlist != dots) && dotlist)
- {
- int e = errno;
- free ((PTR) dotlist);
- errno = e;
- }
-
- lose2:
- if ((pathbuf != path) && pathbuf)
- {
- int e = errno;
- free ((PTR) pathbuf);
- errno = e;
- }
- return ((char *)NULL);
-}
-#endif
diff --git a/source3/smbd/ipc.c b/source3/smbd/ipc.c
index 8b06fc91a3..adc3fcdcb5 100644
--- a/source3/smbd/ipc.c
+++ b/source3/smbd/ipc.c
@@ -342,7 +342,7 @@ static BOOL init_package(struct pack_desc* p, int count, int subcount)
return(p->errcode == NERR_Success);
}
-#ifdef __STDC__
+#ifdef HAVE_STDARG_H
static int package(struct pack_desc* p, ...)
{
#else
@@ -357,7 +357,7 @@ va_dcl
int is_string=0, stringused;
int32 temp;
-#ifdef __STDC__
+#ifdef HAVE_STDARG_H
va_start(args,p);
#else
va_start(args);
diff --git a/source3/smbd/password.c b/source3/smbd/password.c
index 711729f86d..aae398dbda 100644
--- a/source3/smbd/password.c
+++ b/source3/smbd/password.c
@@ -21,7 +21,7 @@
#include "includes.h"
-#if (defined(NETGROUP) && defined (AUTOMOUNT))
+#if (defined(HAVE_NETGROUP) && defined (WITH_AUTOMOUNT))
#include "rpcsvc/ypclnt.h"
#endif
@@ -347,44 +347,6 @@ void add_session_user(char *user)
}
-#ifdef NO_GETSPNAM
-/* a fake shadow password routine which just fills a fake spwd struct
- * with the sp_pwdp field. (sreiz@aie.nl)
- */
-static struct spwd *getspnam(char *username) /* fake shadow password routine */
-{
- FILE *f;
- char line[1024];
- static fstring pw;
- static struct spwd static_spwd;
-
- static_spwd.sp_pwdp=0;
- if (!(f=fopen("/etc/master.passwd", "r")))
- return 0;
- while (fgets(line, 1024, f)) {
- if (!strncmp(line, username, strlen(username)) &&
- line[strlen(username)]==':') { /* found entry */
- char *p, *q;
-
- p=line+strlen(username)+1;
- if ((q=strchr(p, ':'))) {
- *q=0;
- if (q-p+1>20)
- break;
- fstrcpy(pw, p);
- static_spwd.sp_pwdp=pw;
- }
- break;
- }
- }
- fclose(f);
- if (static_spwd.sp_pwdp)
- return &static_spwd;
- return 0;
-}
-#endif
-
-
#ifdef OSF1_ENH_SEC
/****************************************************************************
an enhanced crypt for OSF1
@@ -480,7 +442,7 @@ static void update_protected_database( char *user, BOOL result)
}
-#ifdef USE_PAM
+#ifdef HAVE_PAM
/*******************************************************************
check on PAM authentication
********************************************************************/
@@ -583,7 +545,7 @@ static BOOL pam_auth(char *this_user,char *password)
#endif
-#ifdef AFS_AUTH
+#ifdef WITH_AFS
/*******************************************************************
check on AFS authentication
********************************************************************/
@@ -610,7 +572,7 @@ static BOOL afs_auth(char *this_user,char *password)
#endif
-#ifdef DFS_AUTH
+#ifdef WITH_DFS
/*****************************************************************
This new version of the DFS_AUTH code was donated by Karsten Muuss
@@ -645,7 +607,7 @@ static BOOL dfs_auth(char *this_user,char *password)
if (dcelogin_atmost_once) return(False);
-#ifndef NO_CRYPT
+#ifdef HAVE_CRYPT
/*
* We only go for a DCE login context if the given password
* matches that stored in the local password file..
@@ -1099,24 +1061,24 @@ core of password checking routine
BOOL password_check(char *password)
{
-#ifdef USE_PAM
+#ifdef HAVE_PAM
/* This falls through if the password check fails
- - if NO_CRYPT is defined this causes an error msg
+ - if HAVE_CRYPT is not defined this causes an error msg
saying Warning - no crypt available
- - if NO_CRYPT is NOT defined this is a potential security hole
+ - if HAVE_CRYPT is defined this is a potential security hole
as it may authenticate via the crypt call when PAM
settings say it should fail.
- if (pam_auth(this_user,password)) return(True);
-Hence we make a direct return to avoid a second chance!!!
+ if (pam_auth(this_user,password)) return(True);
+ Hence we make a direct return to avoid a second chance!!!
*/
return (pam_auth(this_user,password));
#endif
-#ifdef AFS_AUTH
+#ifdef WITH_AFS
if (afs_auth(this_user,password)) return(True);
#endif
-#ifdef DFS_AUTH
+#ifdef WITH_DFS
if (dfs_auth(this_user,password)) return(True);
#endif
@@ -1128,11 +1090,6 @@ Hence we make a direct return to avoid a second chance!!!
if (krb4_auth(this_user,password)) return(True);
#endif
-#ifdef PWDAUTH
- if (pwdauth(this_user,password) == 0)
- return(True);
-#endif
-
#ifdef OSF1_ENH_SEC
{
BOOL ret = (strcmp(osf1_bigcrypt(password,this_salt),this_crypted) == 0);
@@ -1152,11 +1109,11 @@ Hence we make a direct return to avoid a second chance!!!
return(linux_bigcrypt(password,this_salt,this_crypted));
#endif
-#ifdef HPUX_10_TRUSTED
+#ifdef HAVE_BIGCRYPT
return(strcmp(bigcrypt(password,this_salt),this_crypted) == 0);
#endif
-#ifdef NO_CRYPT
+#ifndef HAVE_CRYPT
DEBUG(1,("Warning - no crypt available\n"));
return(False);
#else
@@ -1364,7 +1321,7 @@ BOOL password_ok(char *user,char *password, int pwlen, struct passwd *pwd)
return(False);
}
-#ifdef SHADOW_PWD
+#ifdef HAVE_GETSPNAM
{
struct spwd *spass;
@@ -1388,15 +1345,7 @@ BOOL password_ok(char *user,char *password, int pwlen, struct passwd *pwd)
}
#endif
-#ifdef SecureWare
- {
- struct pr_passwd *pr_pw = getprpwnam(pass->pw_name);
- if (pr_pw && pr_pw->ufld.fd_encrypt)
- pass->pw_passwd = pr_pw->ufld.fd_encrypt;
- }
-#endif
-
-#ifdef HPUX_10_TRUSTED
+#ifdef HAVE_GETPRPWNAM
{
struct pr_passwd *pr_pw = getprpwnam(pass->pw_name);
if (pr_pw && pr_pw->ufld.fd_encrypt)
@@ -1436,23 +1385,21 @@ BOOL password_ok(char *user,char *password, int pwlen, struct passwd *pwd)
/* extract relevant info */
fstrcpy(this_user,pass->pw_name);
fstrcpy(this_salt,pass->pw_passwd);
-#ifdef HPUX
- /* The crypt on HPUX won't work with more than 2 salt characters. */
+ /* crypt on some platforms (HPUX in particular)
+ won't work with more than 2 salt characters. */
this_salt[2] = 0;
-#endif /* HPUX */
+
fstrcpy(this_crypted,pass->pw_passwd);
if (!*this_crypted) {
if (!lp_null_passwords()) {
- DEBUG(2,("Disallowing access to %s due to null password\n",this_user));
- return(False);
+ DEBUG(2,("Disallowing access to %s due to null password\n",this_user));
+ return(False);
}
-#ifndef PWDAUTH
if (!*password) {
- DEBUG(3,("Allowing access to %s with null password\n",this_user));
- return(True);
+ DEBUG(3,("Allowing access to %s with null password\n",this_user));
+ return(True);
}
-#endif
}
/* try it as it came to us */
@@ -1551,7 +1498,7 @@ validate a group username entry. Return the username or NULL
****************************************************************************/
static char *validate_group(char *group,char *password,int pwlen,int snum)
{
-#ifdef NETGROUP
+#ifdef HAVE_NETGROUP
{
char *host, *user, *domain;
setnetgrent(group);
@@ -1568,7 +1515,7 @@ static char *validate_group(char *group,char *password,int pwlen,int snum)
}
#endif
-#if HAVE_GETGRNAM
+#ifdef HAVE_GETGRNAM
{
struct group *gptr = (struct group *)getgrnam(group);
char **member;
@@ -1824,7 +1771,7 @@ static BOOL check_user_equiv(char *user, char *remote, char *equiv_file)
{
BOOL host_ok = False;
-#ifdef NETGROUP
+#ifdef HAVE_NETGROUP
if (is_group)
{
static char *mydomain = NULL;
@@ -1836,7 +1783,7 @@ static BOOL check_user_equiv(char *user, char *remote, char *equiv_file)
#else
if (is_group)
{
- DEBUG(1,("Netgroups not configured - add -DNETGROUP and recompile\n"));
+ DEBUG(1,("Netgroups not configured\n"));
continue;
}
#endif
diff --git a/source3/smbd/quotas.c b/source3/smbd/quotas.c
index ee08e48e65..dbdbd49921 100644
--- a/source3/smbd/quotas.c
+++ b/source3/smbd/quotas.c
@@ -581,7 +581,7 @@ BOOL disk_quotas(char *path, int *bsize, int *dfree, int *dsize)
euser_id = geteuid();
-#ifdef USE_SETRES
+#ifdef HPUX
{
uid_t user_id;
@@ -592,7 +592,7 @@ BOOL disk_quotas(char *path, int *bsize, int *dfree, int *dsize)
if (setresuid(user_id,-1,-1))
DEBUG(5,("Unable to reset uid to %d\n", user_id));
}
-#else /* USE_SETRES */
+#else
#if defined(__FreeBSD__) || defined(__OpenBSD__)
{
/* FreeBSD patches from Marty Moll <martym@arbor.edu> */
@@ -620,7 +620,7 @@ BOOL disk_quotas(char *path, int *bsize, int *dfree, int *dsize)
#else /* !__FreeBSD__ && !AIX && !__OpenBSD__ */
r=quotactl(Q_GETQUOTA, dev_disk, euser_id, &D);
#endif /* !__FreeBSD__ && !AIX && !__OpenBSD__ */
-#endif /* USE_SETRES */
+#endif /* HAVE_SETRES */
/* Use softlimit to determine disk space, except when it has been exceeded */
#if defined(__FreeBSD__) || defined(__OpenBSD__)
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index 151a6d7ded..3469e45732 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -33,7 +33,6 @@ char *OutBuffer = NULL;
char *last_inbuf = NULL;
int am_parent = 1;
-int atexit_set = 0;
/* the last message the was processed */
int last_message = -1;
@@ -56,9 +55,9 @@ extern int smb_read_error;
extern pstring user_socket_options;
-#ifdef DFS_AUTH
+#ifdef WITH_DFS
extern int dcelogin_atmost_once;
-#endif /* DFS_AUTH */
+#endif /* WITH_DFS */
/*
* This is set on startup - it defines the SID for this
@@ -696,236 +695,6 @@ BOOL unix_convert(char *name,int cnum,pstring saved_last_component, BOOL *bad_pa
/****************************************************************************
-normalise for DOS usage
-****************************************************************************/
-static void disk_norm(int *bsize,int *dfree,int *dsize)
-{
- /* check if the disk is beyond the max disk size */
- int maxdisksize = lp_maxdisksize();
- if (maxdisksize) {
- /* convert to blocks - and don't overflow */
- maxdisksize = ((maxdisksize*1024)/(*bsize))*1024;
- if (*dsize > maxdisksize) *dsize = maxdisksize;
- if (*dfree > maxdisksize) *dfree = maxdisksize-1; /* the -1 should stop
- applications getting
- div by 0 errors */
- }
-
- while (*dfree > WORDMAX || *dsize > WORDMAX || *bsize < 512)
- {
- *dfree /= 2;
- *dsize /= 2;
- *bsize *= 2;
- if (*bsize > WORDMAX )
- {
- *bsize = WORDMAX;
- if (*dsize > WORDMAX)
- *dsize = WORDMAX;
- if (*dfree > WORDMAX)
- *dfree = WORDMAX;
- break;
- }
- }
-}
-
-/****************************************************************************
- return number of 1K blocks available on a path and total number
-****************************************************************************/
-int disk_free(char *path,int *bsize,int *dfree,int *dsize)
-{
- char *df_command = lp_dfree_command();
- int dfree_retval;
-#ifdef QUOTAS
- int dfreeq_retval;
- int dfreeq = 0;
- int bsizeq = *bsize;
- int dsizeq = *dsize;
-#endif
-
-#ifndef NO_STATFS
-#ifdef USE_STATVFS
- struct statvfs fs;
-#else
-#ifdef ULTRIX
- struct fs_data fs;
-#else
- struct statfs fs;
-#endif
-#endif
-#endif
-
- /* possibly use system() to get the result */
- if (df_command && *df_command)
- {
- int ret;
- pstring syscmd;
- pstring outfile;
-
- slprintf(outfile,sizeof(outfile)-1, "%s/dfree.smb.%d",tmpdir(),(int)getpid());
- slprintf(syscmd,sizeof(syscmd)-1,"%s %s",df_command,path);
- standard_sub_basic(syscmd);
-
- ret = smbrun(syscmd,outfile,False);
- DEBUG(3,("Running the command `%s' gave %d\n",syscmd,ret));
-
- {
- FILE *f = fopen(outfile,"r");
- *dsize = 0;
- *dfree = 0;
- *bsize = 1024;
- if (f)
- {
- fscanf(f,"%d %d %d",dsize,dfree,bsize);
- fclose(f);
- }
- else
- DEBUG(0,("Can't open %s\n",outfile));
- }
-
- unlink(outfile);
- disk_norm(bsize,dfree,dsize);
- dfree_retval = ((*bsize)/1024)*(*dfree);
-#ifdef QUOTAS
- /* Ensure we return the min value between the users quota and
- what's free on the disk. Thanks to Albrecht Gebhardt
- <albrecht.gebhardt@uni-klu.ac.at> for this fix.
- */
- if (disk_quotas(path, &bsizeq, &dfreeq, &dsizeq))
- {
- disk_norm(&bsizeq, &dfreeq, &dsizeq);
- dfreeq_retval = ((bsizeq)/1024)*(dfreeq);
- dfree_retval = ( dfree_retval < dfreeq_retval ) ?
- dfree_retval : dfreeq_retval ;
- /* maybe dfree and dfreeq are calculated using different bsizes
- so convert dfree from bsize into bsizeq */
- /* avoid overflows due to multiplication, so do not:
- *dfree = ((*dfree) * (*bsize)) / (bsizeq);
- bsize and bsizeq are powers of 2 so its better to
- to divide them getting a multiplication or division factor
- for dfree. Rene Nieuwenhuizen (07-10-1997) */
- if (*bsize >= bsizeq)
- *dfree = *dfree * (*bsize / bsizeq);
- else
- *dfree = *dfree / (bsizeq / *bsize);
- *dfree = ( *dfree < dfreeq ) ? *dfree : dfreeq ;
- *bsize = bsizeq;
- *dsize = dsizeq;
- }
-#endif
- return(dfree_retval);
- }
-
-#ifdef NO_STATFS
- DEBUG(1,("Warning - no statfs function\n"));
- return(1);
-#else
-#ifdef STATFS4
- if (statfs(path,&fs,sizeof(fs),0) != 0)
-#else
-#ifdef USE_STATVFS
- if (statvfs(path, &fs))
-#else
-#ifdef STATFS3
- if (statfs(path,&fs,sizeof(fs)) == -1)
-#else
- if (statfs(path,&fs) == -1)
-#endif /* STATFS3 */
-#endif /* USE_STATVFS */
-#endif /* STATFS4 */
- {
- DEBUG(3,("dfree call failed code errno=%d\n",errno));
- *bsize = 1024;
- *dfree = 1;
- *dsize = 1;
- return(((*bsize)/1024)*(*dfree));
- }
-
-#ifdef ULTRIX
- *bsize = 1024;
- *dfree = fs.fd_req.bfree;
- *dsize = fs.fd_req.btot;
-#else
-#ifdef USE_STATVFS
- *bsize = fs.f_frsize;
-#else
-#ifdef USE_F_FSIZE
- /* eg: osf1 has f_fsize = fundamental filesystem block size,
- f_bsize = optimal transfer block size (MX: 94-04-19) */
- *bsize = fs.f_fsize;
-#else
- *bsize = fs.f_bsize;
-#endif /* STATFS3 */
-#endif /* USE_STATVFS */
-
-#ifdef STATFS4
- *dfree = fs.f_bfree;
-#else
- *dfree = fs.f_bavail;
-#endif /* STATFS4 */
- *dsize = fs.f_blocks;
-#endif /* ULTRIX */
-
-#if defined(SCO) || defined(ISC) || defined(MIPS)
- *bsize = 512;
-#endif
-
-/* handle rediculous bsize values - some OSes are broken */
-if ((*bsize) < 512 || (*bsize)>0xFFFF) *bsize = 1024;
-
- disk_norm(bsize,dfree,dsize);
-
- if (*bsize < 256)
- *bsize = 512;
- if ((*dsize)<1)
- {
- DEBUG(0,("dfree seems to be broken on your system\n"));
- *dsize = 20*1024*1024/(*bsize);
- *dfree = MAX(1,*dfree);
- }
- dfree_retval = ((*bsize)/1024)*(*dfree);
-#ifdef QUOTAS
- /* Ensure we return the min value between the users quota and
- what's free on the disk. Thanks to Albrecht Gebhardt
- <albrecht.gebhardt@uni-klu.ac.at> for this fix.
- */
- if (disk_quotas(path, &bsizeq, &dfreeq, &dsizeq))
- {
- disk_norm(&bsizeq, &dfreeq, &dsizeq);
- dfreeq_retval = ((bsizeq)/1024)*(dfreeq);
- dfree_retval = ( dfree_retval < dfreeq_retval ) ?
- dfree_retval : dfreeq_retval ;
- /* maybe dfree and dfreeq are calculated using different bsizes
- so convert dfree from bsize into bsizeq */
- /* avoid overflows due to multiplication, so do not:
- *dfree = ((*dfree) * (*bsize)) / (bsizeq);
- bsize and bsizeq are powers of 2 so its better to
- to divide them getting a multiplication or division factor
- for dfree. Rene Nieuwenhuizen (07-10-1997) */
- if (*bsize >= bsizeq)
- *dfree = *dfree * (*bsize / bsizeq);
- else
- *dfree = *dfree / (bsizeq / *bsize);
- *dfree = ( *dfree < dfreeq ) ? *dfree : dfreeq ;
- *bsize = bsizeq;
- *dsize = dsizeq;
- }
-#endif
- return(dfree_retval);
-#endif
-}
-
-
-/****************************************************************************
-wrap it to get filenames right
-****************************************************************************/
-int sys_disk_free(char *path,int *bsize,int *dfree,int *dsize)
-{
- return(disk_free(dos_to_unix(path,False),bsize,dfree,dsize));
-}
-
-
-
-/****************************************************************************
check a filename - possibly caling reducename
This is called by every routine before it allows an operation on a filename.
@@ -1541,7 +1310,7 @@ static void open_file(int fnum,int cnum,char *fname1,int flags,int mode, struct
}
-#if USE_MMAP
+#if WITH_MMAP
/* mmap it if read-only */
if (!fsp->can_write)
{
@@ -1563,9 +1332,9 @@ sync a file
********************************************************************/
void sync_file(int cnum, int fnum)
{
-#ifndef NO_FSYNC
- if(lp_strict_sync(SNUM(cnum)))
- fsync(Files[fnum].fd_ptr->fd);
+#ifdef HAVE_FSYNC
+ if(lp_strict_sync(SNUM(cnum)))
+ fsync(Files[fnum].fd_ptr->fd);
#endif
}
@@ -1627,7 +1396,7 @@ static void close_filestruct(files_struct *fs_p)
fs_p->wbmpx_ptr = NULL;
}
-#if USE_MMAP
+#if WITH_MMAP
if(fs_p->mmap_ptr)
{
munmap(fs_p->mmap_ptr,fs_p->mmap_size);
@@ -2303,7 +2072,7 @@ int read_file(int fnum,char *data,uint32 pos,int n)
}
#endif
-#if USE_MMAP
+#if WITH_MMAP
if (Files[fnum].mmap_ptr)
{
int num = (Files[fnum].mmap_size > pos) ? (Files[fnum].mmap_size - pos) : -1;
@@ -2627,52 +2396,6 @@ int error_packet(char *inbuf,char *outbuf,int error_class,uint32 error_code,int
}
-#ifndef SIGCLD_IGNORE
-/****************************************************************************
-this prevents zombie child processes
-****************************************************************************/
-static int sig_cld(void)
-{
- static int depth = 0;
- if (depth != 0)
- {
- DEBUG(0,("ERROR: Recursion in sig_cld? Perhaps you need `#define USE_WAITPID'?\n"));
- depth=0;
- return(0);
- }
- depth++;
-
- BlockSignals(True,SIGCLD);
- DEBUG(5,("got SIGCLD\n"));
-
-#ifdef USE_WAITPID
- while (sys_waitpid((pid_t)-1,(int *)NULL, WNOHANG) > 0);
-#endif
-
- /* Stop zombies */
- /* Stevens, Adv. Unix Prog. says that on system V you must call
- wait before reinstalling the signal handler, because the kernel
- calls the handler from within the signal-call when there is a
- child that has exited. This would lead to an infinite recursion
- if done vice versa. */
-
-#ifndef DONT_REINSTALL_SIG
-#ifdef SIGCLD_IGNORE
- signal(SIGCLD, SIG_IGN);
-#else
- signal(SIGCLD, SIGNAL_CAST sig_cld);
-#endif
-#endif
-
-#ifndef USE_WAITPID
- while (wait3(WAIT3_CAST1 NULL, WNOHANG, WAIT3_CAST2 NULL) > 0);
-#endif
- depth--;
- BlockSignals(False,SIGCLD);
- return 0;
-}
-#endif
-
/****************************************************************************
this is called when the client exits abruptly
**************************************************************************/
@@ -2684,9 +2407,6 @@ static int sig_pipe(void)
if ((cli = server_client()) && cli->initialised) {
DEBUG(3,("lost connection to password server\n"));
cli_shutdown(cli);
-#ifndef DONT_REINSTALL_SIG
- signal(SIGPIPE, SIGNAL_CAST sig_pipe);
-#endif
BlockSignals(False,SIGPIPE);
return 0;
}
@@ -2710,15 +2430,17 @@ static BOOL open_sockets(BOOL is_daemon,int port)
int s;
int i;
- /* Stop zombies */
-#ifdef SIGCLD_IGNORE
- signal(SIGCLD, SIG_IGN);
-#else
- signal(SIGCLD, SIGNAL_CAST sig_cld);
+#ifdef HAVE_ATEXIT
+ static int atexit_set;
+ if(atexit_set == 0) {
+ atexit_set=1;
+ atexit(killkids);
+ }
#endif
- if(atexit_set == 0)
- atexit(killkids);
+ /* Stop zombies */
+ CatchChild();
+
FD_ZERO(&listen_set);
@@ -2825,21 +2547,12 @@ max can be %d\n", num_interfaces, FD_SETSIZE));
continue;
}
-#ifdef NO_FORK_DEBUG
-#ifndef NO_SIGNAL_TEST
- signal(SIGPIPE, SIGNAL_CAST sig_pipe);
- signal(SIGCLD, SIGNAL_CAST SIG_DFL);
-#endif /* NO_SIGNAL_TEST */
- return True;
-#else /* NO_FORK_DEBUG */
if (Client != -1 && fork()==0)
{
/* Child code ... */
-#ifndef NO_SIGNAL_TEST
- signal(SIGPIPE, SIGNAL_CAST sig_pipe);
- signal(SIGCLD, SIGNAL_CAST SIG_DFL);
-#endif /* NO_SIGNAL_TEST */
+ CatchSignal(SIGPIPE, SIGNAL_CAST sig_pipe);
+
/* close the listening socket(s) */
for(i = 0; i < num_interfaces; i++)
close(fd_listenset[i]);
@@ -2860,20 +2573,19 @@ max can be %d\n", num_interfaces, FD_SETSIZE));
}
close(Client); /* The parent doesn't need this socket */
- /*
- * Force parent to check log size after spawning child.
- * Fix from klausr@ITAP.Physik.Uni-Stuttgart.De.
- * The parent smbd will log to logserver.smb.
- * It writes only two messages for each child
- * started/finished. But each child writes, say, 50 messages also in
- * logserver.smb, begining with the debug_count of the parent, before the
- * child opens its own log file logserver.client. In a worst case
- * scenario the size of logserver.smb would be checked after about
- * 50*50=2500 messages (ca. 100kb).
- */
- force_check_log_size();
-
-#endif /* NO_FORK_DEBUG */
+ /*
+ * Force parent to check log size after spawning child.
+ * Fix from klausr@ITAP.Physik.Uni-Stuttgart.De.
+ * The parent smbd will log to logserver.smb.
+ * It writes only two messages for each child
+ * started/finished. But each child writes, say, 50 messages also in
+ * logserver.smb, begining with the debug_count of the parent, before the
+ * child opens its own log file logserver.client. In a worst case
+ * scenario the size of logserver.smb would be checked after about
+ * 50*50=2500 messages (ca. 100kb).
+ */
+ force_check_log_size();
+
} /* end for num */
} /* end while 1 */
} /* end if is_daemon */
@@ -2882,9 +2594,7 @@ max can be %d\n", num_interfaces, FD_SETSIZE));
/* Started from inetd. fd 0 is the socket. */
/* We will abort gracefully when the client or remote system
goes away */
-#ifndef NO_SIGNAL_TEST
- signal(SIGPIPE, SIGNAL_CAST sig_pipe);
-#endif
+ CatchSignal(SIGPIPE, SIGNAL_CAST sig_pipe);
Client = dup(0);
/* close our standard file descriptors */
@@ -2905,10 +2615,10 @@ max can be %d\n", num_interfaces, FD_SETSIZE));
static void process_smb(char *inbuf, char *outbuf)
{
extern int Client;
-#ifdef USE_SSL
+#ifdef WITH_SSL
extern BOOL sslEnabled; /* don't use function for performance reasons */
static int sslConnected = 0;
-#endif /* USE_SSL */
+#endif /* WITH_SSL */
static int trans_num;
int msg_type = CVAL(inbuf,0);
int32 len = smb_len(inbuf);
@@ -2933,7 +2643,7 @@ static void process_smb(char *inbuf, char *outbuf)
DEBUG(6,("got message type 0x%x of len 0x%x\n",msg_type,len));
DEBUG(3,("%s Transaction %d of length %d\n",timestring(),trans_num,nread));
-#ifdef USE_SSL
+#ifdef WITH_SSL
if(sslEnabled && !sslConnected){
sslConnected = sslutil_negotiate_ssl(Client, msg_type);
if(sslConnected < 0){ /* an error occured */
@@ -2943,7 +2653,7 @@ static void process_smb(char *inbuf, char *outbuf)
return;
}
}
-#endif /* USE_SSL */
+#endif /* WITH_SSL */
#ifdef WITH_VTP
if(trans_num == 1 && VT_Check(inbuf))
@@ -3641,9 +3351,6 @@ static int sig_hup(void)
*/
reload_after_sighup = True;
-#ifndef DONT_REINSTALL_SIG
- signal(SIGHUP,SIGNAL_CAST sig_hup);
-#endif
BlockSignals(False,SIGHUP);
return(0);
}
@@ -3811,7 +3518,7 @@ int make_connection(char *service,char *user,char *password, int pwlen, char *de
string_set(&pcon->dirpath,"");
string_set(&pcon->user,user);
-#if HAVE_GETGRNAM
+#ifdef HAVE_GETGRNAM
if (*lp_force_group(snum))
{
struct group *gptr;
@@ -4596,7 +4303,7 @@ static BOOL dump_core(void)
if (chdir(dname)) return(False);
umask(~(0700));
-#ifndef NO_GETRLIMIT
+#ifdef HAVE_GETRLIMIT
#ifdef RLIMIT_CORE
{
struct rlimit rlp;
@@ -4631,7 +4338,7 @@ void exit_server(char *reason)
for (i=0;i<MAX_CONNECTIONS;i++)
if (Connections[i].open)
close_cnum(i,(uint16)-1);
-#ifdef DFS_AUTH
+#ifdef WITH_DFS
if (dcelogin_atmost_once)
dfs_unlogin();
#endif
@@ -5431,11 +5138,12 @@ static void usage(char *pname)
int opt;
extern char *optarg;
-#ifdef NEED_AUTH_PARAMETERS
+#ifdef HAVE_SET_AUTH_PARAMETERS
set_auth_parameters(argc,argv);
#endif
-#ifdef SecureWare
+#ifdef HAVE_SETLUID
+ /* needed for SecureWare on SCO */
setluid(0);
#endif
@@ -5453,7 +5161,7 @@ static void usage(char *pname)
/* make absolutely sure we run as root - to handle cases where people
are crazy enough to have it setuid */
-#ifdef USE_SETRES
+#ifdef HAVE_SETRESUID
setresuid(0,0,0);
#else
setuid(0);
@@ -5463,7 +5171,7 @@ static void usage(char *pname)
#endif
fault_setup((void (*)(void *))exit_server);
- signal(SIGTERM , SIGNAL_CAST dflt_sig);
+ CatchSignal(SIGTERM , SIGNAL_CAST dflt_sig);
/* we want total control over the permissions on created files,
so set our umask to 0 */
@@ -5533,7 +5241,7 @@ static void usage(char *pname)
DEBUG(2,("%s smbd version %s started\n",timestring(),VERSION));
DEBUG(2,("Copyright Andrew Tridgell 1992-1997\n"));
-#ifndef NO_GETRLIMIT
+#ifdef HAVE_GETRLIMIT
#ifdef RLIMIT_NOFILE
{
struct rlimit rlp;
@@ -5566,28 +5274,25 @@ static void usage(char *pname)
if (!reload_services(False))
return(-1);
-#ifdef USE_SSL
+#ifdef WITH_SSL
{
extern BOOL sslEnabled;
sslEnabled = lp_ssl_enabled();
if(sslEnabled)
sslutil_init(True);
}
-#endif /* USE_SSL */
+#endif /* WITH_SSL */
codepage_initialise(lp_client_code_page());
pstrcpy(global_myworkgroup, lp_workgroup());
- if(!pdb_generate_machine_sid())
- {
- DEBUG(0,("ERROR: Samba cannot get a machine SID.\n"));
- exit(1);
+ if(!pdb_generate_machine_sid()) {
+ DEBUG(0,("ERROR: Samba cannot get a machine SID.\n"));
+ exit(1);
}
-#ifndef NO_SIGNAL_TEST
- signal(SIGHUP,SIGNAL_CAST sig_hup);
-#endif
+ CatchSignal(SIGHUP,SIGNAL_CAST sig_hup);
/* Setup the signals that allow the debug log level
to by dynamically changed. */
@@ -5597,11 +5302,11 @@ static void usage(char *pname)
#ifndef MEM_MAN
#if defined(SIGUSR1)
- signal( SIGUSR1, SIGNAL_CAST sig_usr1 );
+ CatchSignal( SIGUSR1, SIGNAL_CAST sig_usr1 );
#endif /* SIGUSR1 */
#if defined(SIGUSR2)
- signal( SIGUSR2, SIGNAL_CAST sig_usr2 );
+ CatchSignal( SIGUSR2, SIGNAL_CAST sig_usr2 );
#endif /* SIGUSR2 */
#endif /* MEM_MAN */
diff --git a/source3/smbd/smbrun.c b/source3/smbd/smbrun.c
index 1b1802c95f..2a94ac3235 100644
--- a/source3/smbd/smbrun.c
+++ b/source3/smbd/smbrun.c
@@ -59,7 +59,7 @@ becoming a non-root user */
/* first become root - we may need to do this in order to lose
our privilages! */
-#ifdef USE_SETRES
+#ifdef HAVE_SETRESUID
setresgid(0,0,0);
setresuid(0,0,0);
#else
@@ -67,12 +67,7 @@ becoming a non-root user */
seteuid(0);
#endif
-#ifdef USE_SETFS
- setfsuid(uid);
- setfsgid(gid);
-#endif
-
-#ifdef USE_SETRES
+#ifdef HAVE_SETRESUID
setresgid(gid,gid,gid);
setresuid(uid,uid,uid);
#else
diff --git a/source3/smbd/ssl.c b/source3/smbd/ssl.c
index 1bb89f05b1..68b45016b8 100644
--- a/source3/smbd/ssl.c
+++ b/source3/smbd/ssl.c
@@ -19,7 +19,7 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#ifdef USE_SSL /* should always be defined if this module is compiled */
+#ifdef WITH_SSL /* should always be defined if this module is compiled */
#include "includes.h"
#include <ssl.h>
@@ -261,6 +261,6 @@ char *reqHosts, *resignHosts;
return 1;
}
-#else /* USE_SSL */
+#else /* WITH_SSL */
void ssl_dummy(void) {;} /* So some compilers don't complain. */
-#endif /* USE_SSL */
+#endif /* WITH_SSL */
diff --git a/source3/smbd/uid.c b/source3/smbd/uid.c
index 2a75b660b5..a8e0bf0d03 100644
--- a/source3/smbd/uid.c
+++ b/source3/smbd/uid.c
@@ -36,26 +36,25 @@ initialise the uid routines
****************************************************************************/
void init_uid(void)
{
- initial_uid = current_user.uid = geteuid();
- initial_gid = current_user.gid = getegid();
+ initial_uid = current_user.uid = geteuid();
+ initial_gid = current_user.gid = getegid();
- if (initial_gid != 0 && initial_uid == 0)
- {
-#ifdef HPUX
- setresgid(0,0,0);
+ if (initial_gid != 0 && initial_uid == 0) {
+#ifdef HAVE_SETRESUID
+ setresgid(0,0,0);
#else
- setgid(0);
- setegid(0);
+ setgid(0);
+ setegid(0);
#endif
- }
-
- initial_uid = geteuid();
- initial_gid = getegid();
+ }
- current_user.cnum = -1;
- current_user.vuid = UID_FIELD_INVALID;
+ initial_uid = geteuid();
+ initial_gid = getegid();
- ChDir(OriginalDir);
+ current_user.cnum = -1;
+ current_user.vuid = UID_FIELD_INVALID;
+
+ ChDir(OriginalDir);
}
@@ -64,141 +63,33 @@ void init_uid(void)
****************************************************************************/
static BOOL become_uid(int uid)
{
- if (initial_uid != 0)
- return(True);
-
- if (uid == -1 || uid == 65535) {
- DEBUG(1,("WARNING: using uid %d is a security risk\n",uid));
- }
-
-#ifdef AIX
- {
- /* AIX 3 stuff - inspired by a code fragment in wu-ftpd */
- /* MWW: This is all undocumented, of course. There's a patch to WU-ftpd
- in the AIX FAQ which does the setpriv, then sets the gid stuff, then
- sets uid. Since Samba separates setting the gid and setting the uid,
- I've duplicated the setpriv code in become_gid. I've also made the
- requisite changes to become_gid to match the WU-ftpd patch.
-
- I believe we'll still get errors in the Samba logs. This setpriv
- call is supposed to disable "trapdooring" on AIX - ie. normally
- once a seteuid / setegid is done, the effective ID can't be set back
- to what it was before. See the comments in become_root / unbecome_root.
- I *think* that we may have to do something additional here to prevent
- the "Can't set uid (AIX3)" messages, though - possibly change the
- values of priv.pv_priv to keep the SET_PROC_DAC privilege, and
- possibly SET_OBJ_DAC and SET_OBJ_STAT as well.
-
- The pv_priv array is two longwords, and the constants in sys/priv.h
- have values between 1 and 64, according to the comments in priv.h.
- This strongly suggests a bit vector - but does BYPASS_DAC_WRITE
- (#define'd to 1) mean 1<<0 or 1<<1? Unfortunately, nothing's
- defined to 0 or 64, which would be a dead giveaway. Also, what's the
- fullword-boundary endianness? That is, is pv_priv[0] the high or
- the low 32 bits? Fortunately, the values used by "su" (see below)
- don't make much sense if pv_priv[0] is the high bits. Also, based
- on analysis of the values used by su, I concluded that, for example,
- BYPASS_DAC_READ (defined to 2) is bit "2" counting from 1 - ie.
- if (pv_priv[0] & (1 << (BYPASS_DAC_READ - 1))) then BYPASS_DAC_READ
- is on. That's a bit odd, but it makes more sense than if the
- privilege constants are meant to be taken as exponents of 2.
-
- For analysis, I ran "su" as root under dbx, and stopped in setpriv.
- The first argument to setpriv can be examined using
-
- print $r3 (eg. "0x30009" = PRIV_SET|PRIV_MAXIMUM|PRIV_EFFECTIV)
-
- the contents of the pv_priv array can be examined using
-
- ($r4)/2X
-
- Here's what su does:
-
- setpriv(PRIV_SET | PRIV_INHERITED | PRIV_BEQUEATH, {0,0})
- setpriv(PRIV_SET | PRIV_EFFECTIVE | PRIV_MAXIMUM,
- {0x02800006, 0x00040000})
- 0x02800006 = SET_PROC_AUDIT | SET_PROC_ENV |
- BYPASS_DAC_EXEC | BYPASS_DAC_READ
- 0x00040000 = TPATH_CONFIG
- setpriv(PRIV_SET | PRIV_EFFECTIVE, {0, 0})
-
- Analysis:
-
- Reduce inherited privileges to none, so the child doesn't inherit
- anything special.
- Change su's privileges so it can execute the shell even if someone
- has goofed up the permissions to it or to directories on the
- search path; so it can set the process auditing characteristics
- and privileged environment (stuff in /etc/security/environ with
- the sysenv attribute); and so that it can set the trusted path
- characteristics for this login.
- Zap those privileges back off when we don't need them any more.
-
- I'm guessing we want to keep SET_PROC_DAC in the current priv set,
- but not in the inherited one. That is, set PRIV_INHERITED and
- PRIV_BEQUEATH to 0. We also probably want to set PRIV_MAXIMUM and
- PRIV_EFFECTIVE to only the privs we need, which at this point would
- appear to be just SET_PROC_DAC. *Note*: setting PRIV_MAXIMUM
- with any of the privilege sets higher than what you're trying to
- set the maximum to will produce an EINVAL. For example, if we
- try to set PRIV_MAXIMUM to SET_PROC_DAC *before* we reduce
- PRIV_INHERITED and PRIV_BEQUEATH, it won't work. Zero out the
- inherited privileges first.
-
- Some experimentation with simple programs confirms that if we're
- running with an EUID of 0 we can switch our UID/EUID back and
- forth with setuidx - *unless* we call setpriv({0,0}, ...) first.
- In other words, by default root has SET_PROC_DAT set, but we can
- remove it from our privilege set. This is what we want to do for
- child processes, I believe.
-
- Also, calling setpriv(PRIV_SUB|PRIV_EFFECTIVE,...) with pv_priv[0]
- set to SET_PROC_DAC (1 << (SET_PROC_DAC - 1)) will prevent an
- EUID-root process from switching its EUID back with setuidx.
-
- In other words, setuidx on AIX is *not* trapdoor. setuid is
- trapdoor. We need a non-trapdoor setuid function, but we don't
- want processes we fork to have access to it. Thus we use setuidx
- but first we disable it for our children.
-
- Note, however, that we can only increase our privileges (as we
- do in the first call to setpriv) if we're EUID-root. If we
- started out as root, and then switched to a non-root user ID,
- that's OK; we've already set them. Just don't try to set them
- again.
-
- Also, I suspect that after using setpriv / setuidx / etc. here in
- the AIX-specific code we DON'T want to fall through to the code that
- calls setuid, etc. However, I haven't noticed any more problems with
- the code the way it is here.
- */
-
- priv_t priv;
-
- priv.pv_priv[0] = 0;
- priv.pv_priv[1] = 0;
- if (setpriv(PRIV_SET|PRIV_INHERITED|PRIV_BEQUEATH,
- &priv, sizeof(priv_t)) < 0) {
- DEBUG(1, ("Can't set child privileges (AIX3): %s\n", strerror(errno)));
- }
-
- priv.pv_priv[0] = (1 << (SET_PROC_DAC - 1));
- if (setpriv(PRIV_SET|PRIV_EFFECTIVE|PRIV_MAXIMUM,
- &priv, sizeof(priv_t)) < 0) {
- DEBUG(1, ("Can't set own privileges (AIX3): %s\n", strerror(errno)));
- }
+ if (initial_uid != 0) {
+ return(True);
+ }
+
+ if (uid == -1 || uid == 65535) {
+ static int done;
+ if (!done) {
+ DEBUG(1,("WARNING: using uid %d is a security risk\n",
+ uid));
+ done=1;
+ }
+ }
- if (setuidx(ID_REAL|ID_EFFECTIVE, (uid_t)uid) < 0 ||
- seteuid((uid_t)uid) < 0) {
- DEBUG(1,("Can't set uid (AIX3)\n"));
- }
- }
+#ifdef HAVE_TRAPDOOR_UID
+#ifdef HAVE_SETUIDX
+ /* AIX3 has setuidx which is NOT a trapoor function (tridge) */
+ if (setuidx(ID_EFFECTIVE, (uid_t)uid) != 0) {
+ if (seteuid((uid_t)uid) != 0) {
+ DEBUG(1,("Can't set uid (setuidx)\n"));
+ return False;
+ }
+ }
+#endif
#endif
-#ifdef USE_SETRES
- if (setresuid(-1,uid,-1) != 0)
-#elif defined(USE_SETFS)
- if (setfsuid(uid) != 0)
+#ifdef HAVE_SETRESUID
+ if (setresuid(-1,uid,-1) != 0)
#else
if ((seteuid(uid) != 0) &&
(setuid(uid) != 0))
@@ -206,19 +97,20 @@ static BOOL become_uid(int uid)
{
DEBUG(0,("Couldn't set uid %d currently set to (%d,%d)\n",
uid,getuid(), geteuid()));
- if (uid > 32000)
- DEBUG(0,("Looks like your OS doesn't like high uid values - try using a different account\n"));
+ if (uid > 32000) {
+ DEBUG(0,("Looks like your OS doesn't like high uid values - try using a different account\n"));
+ }
return(False);
}
- if (((uid == -1) || (uid == 65535)) && geteuid() != uid) {
- DEBUG(0,("Invalid uid -1. perhaps you have a account with uid 65535?\n"));
- return(False);
- }
+ if (((uid == -1) || (uid == 65535)) && geteuid() != uid) {
+ DEBUG(0,("Invalid uid -1. perhaps you have a account with uid 65535?\n"));
+ return(False);
+ }
- current_user.uid = uid;
+ current_user.uid = uid;
- return(True);
+ return(True);
}
@@ -234,36 +126,17 @@ static BOOL become_gid(int gid)
DEBUG(1,("WARNING: using gid %d is a security risk\n",gid));
}
-#ifdef AIX
- {
- /* MWW: See comment above in become_uid. */
- priv_t priv;
-
- priv.pv_priv[0] = 0;
- priv.pv_priv[1] = 0;
- if (setpriv(PRIV_SET|PRIV_INHERITED|PRIV_EFFECTIVE|PRIV_BEQUEATH,
- &priv, sizeof(priv_t)) < 0) {
- DEBUG(1, ("Can't set privilege (AIX3)\n"));
- }
- if (setgidx(ID_REAL|ID_EFFECTIVE, (gid_t)gid) < 0 ||
- setegid((gid_t)gid) < 0) {
- DEBUG(1,("Can't set gid (AIX3)\n"));
- }
- }
-#endif
-
-#ifdef USE_SETRES
+#ifdef HAVE_SETRESUID
if (setresgid(-1,gid,-1) != 0)
-#elif defined(USE_SETFS)
- if (setfsgid(gid) != 0)
#else
if (setgid(gid) != 0)
#endif
{
DEBUG(0,("Couldn't set gid %d currently set to (%d,%d)\n",
gid,getgid(),getegid()));
- if (gid > 32000)
- DEBUG(0,("Looks like your OS doesn't like high gid values - try using a different account\n"));
+ if (gid > 32000) {
+ DEBUG(0,("Looks like your OS doesn't like high gid values - try using a different account\n"));
+ }
return(False);
}
@@ -278,7 +151,7 @@ static BOOL become_gid(int gid)
****************************************************************************/
static BOOL become_id(int uid,int gid)
{
- return(become_gid(gid) && become_uid(uid));
+ return(become_gid(gid) && become_uid(uid));
}
/****************************************************************************
@@ -300,10 +173,12 @@ BOOL become_guest(void)
/* MWW: From AIX FAQ patch to WU-ftpd: call initgroups before setting IDs */
initgroups(pass->pw_name, (gid_t)pass->pw_gid);
#endif
+
ret = become_id(pass->pw_uid,pass->pw_gid);
- if (!ret)
+ if (!ret) {
DEBUG(1,("Failed to become guest. Invalid guest account?\n"));
+ }
current_user.cnum = -2;
current_user.vuid = UID_FIELD_INVALID;
@@ -390,7 +265,7 @@ BOOL become_user(connection_struct *conn, int cnum, uint16 vuid)
{
if (!become_gid(gid)) return(False);
-#ifndef NO_SETGROUPS
+#ifdef HAVE_SETGROUPS
if (!(VALID_CNUM(cnum) && conn->ipc)) {
/* groups stuff added by ih/wreu */
if (current_user.ngroups > 0)
@@ -424,34 +299,30 @@ BOOL unbecome_user(void )
if (initial_uid == 0)
{
-#ifdef USE_SETRES
+#ifdef HAVE_SETRESUID
setresuid(-1,getuid(),-1);
setresgid(-1,getgid(),-1);
-#elif defined(USE_SETFS)
- setfsuid(initial_uid);
- setfsgid(initial_gid);
#else
if (seteuid(initial_uid) != 0)
setuid(initial_uid);
setgid(initial_gid);
#endif
}
+
#ifdef NO_EID
if (initial_uid == 0)
DEBUG(2,("Running with no EID\n"));
initial_uid = getuid();
initial_gid = getgid();
#else
- if (geteuid() != initial_uid)
- {
- DEBUG(0,("Warning: You appear to have a trapdoor uid system\n"));
- initial_uid = geteuid();
- }
- if (getegid() != initial_gid)
- {
- DEBUG(0,("Warning: You appear to have a trapdoor gid system\n"));
- initial_gid = getegid();
- }
+ if (geteuid() != initial_uid) {
+ DEBUG(0,("Warning: You appear to have a trapdoor uid system\n"));
+ initial_uid = geteuid();
+ }
+ if (getegid() != initial_gid) {
+ DEBUG(0,("Warning: You appear to have a trapdoor gid system\n"));
+ initial_gid = getegid();
+ }
#endif
current_user.uid = initial_uid;
@@ -485,13 +356,13 @@ static BOOL setup_stdout_file(char *outfile,BOOL shared)
close(1);
if (shared) {
- /* become root - unprivilaged users can't delete these files */
-#ifdef USE_SETRES
- setresgid(0,0,0);
- setresuid(0,0,0);
+ /* become root - unprivilaged users can't delete these files */
+#ifdef HAVE_SETRESUID
+ setresgid(0,0,0);
+ setresuid(0,0,0);
#else
- setuid(0);
- seteuid(0);
+ setuid(0);
+ seteuid(0);
#endif
}
@@ -534,7 +405,7 @@ int smbrun(char *cmd,char *outfile,BOOL shared)
int uid = current_user.uid;
int gid = current_user.gid;
-#if USE_SYSTEM
+#ifndef HAVE_EXECL
int ret;
pstring syscmd;
char *path = lp_smbrun();
@@ -583,7 +454,7 @@ int smbrun(char *cmd,char *outfile,BOOL shared)
/* now completely lose our privilages. This is a fairly paranoid
way of doing it, but it does work on all systems that I know of */
-#ifdef USE_SETRES
+#ifdef HAVE_SETRESUID
setresgid(0,0,0);
setresuid(0,0,0);
setresgid(gid,gid,gid);
@@ -668,7 +539,7 @@ void unbecome_root(BOOL restore_dir)
exit_server("Failed to restore gid");
}
-#ifndef NO_SETGROUPS
+#ifdef HAVE_SETGROUPS
if (current_user_saved.ngroups > 0) {
if (setgroups(current_user_saved.ngroups,
current_user_saved.groups)<0)
diff --git a/source3/smbd/vt_mode.c b/source3/smbd/vt_mode.c
index 19f8259464..6e95bac3c2 100644
--- a/source3/smbd/vt_mode.c
+++ b/source3/smbd/vt_mode.c
@@ -156,7 +156,7 @@ void VT_SigCLD(int sig)
if(wait(NULL) == VT_ChildPID)
VT_ChildDied = True;
else
- signal(SIGCLD, VT_SigCLD);
+ CatchSignal(SIGCLD, VT_SigCLD);
}
@@ -305,12 +305,12 @@ int VT_Start(void)
VT_ChildDied = False;
VT_Fd = master;
- signal(SIGCLD, VT_SigCLD);
+ CatchSignal(SIGCLD, VT_SigCLD);
- signal(SIGHUP, VT_SigEXIT);
- signal(SIGTERM, VT_SigEXIT);
- signal(SIGINT, VT_SigEXIT);
- signal(SIGQUIT, VT_SigEXIT);
+ CatchSignal(SIGHUP, VT_SigEXIT);
+ CatchSignal(SIGTERM, VT_SigEXIT);
+ CatchSignal(SIGINT, VT_SigEXIT);
+ CatchSignal(SIGQUIT, VT_SigEXIT);
memset(OutBuf, 0, sizeof(OutBuf));
OutBuf [4] = 0x06;
diff --git a/source3/tests/README b/source3/tests/README
new file mode 100644
index 0000000000..cf1be8b00a
--- /dev/null
+++ b/source3/tests/README
@@ -0,0 +1,10 @@
+This directory contains autoconf test programs that are too large to
+comfortably fit in configure.in.
+
+These programs should test one feature of the OS and exit(0) if it
+works or exit(1) if it doesn't work (do _not_ use return)
+
+The programs should be kept simple and to the point. Beautiful/fast
+code is not necessary
+
+
diff --git a/source3/tests/fcntl_lock.c b/source3/tests/fcntl_lock.c
new file mode 100644
index 0000000000..c54479434e
--- /dev/null
+++ b/source3/tests/fcntl_lock.c
@@ -0,0 +1,78 @@
+/* test whether fcntl locking works on this system */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#ifdef HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+
+#ifdef HAVE_SYS_FCNTL_H
+#include <sys/fcntl.h>
+#endif
+
+#include <errno.h>
+
+static int sys_waitpid(pid_t pid,int *status,int options)
+{
+#ifdef HAVE_WAITPID
+ return waitpid(pid,status,options);
+#else /* USE_WAITPID */
+ return wait4(pid, status, options, NULL);
+#endif /* USE_WAITPID */
+}
+
+#define DATA "conftest.fcntl"
+
+#ifndef SEEK_SET
+#define SEEK_SET 0
+#endif
+
+/* lock a byte range in a open file */
+int main(int argc, char *argv[])
+{
+ struct flock lock;
+ int fd, pid, ret, status=1;
+
+ if (!(pid=fork())) {
+ sleep(2);
+ fd = open(DATA, O_RDONLY);
+
+ if (fd == -1) exit(1);
+
+ lock.l_type = F_WRLCK;
+ lock.l_whence = SEEK_SET;
+ lock.l_start = 0;
+ lock.l_len = 4;
+ lock.l_pid = getpid();
+
+ lock.l_type = F_WRLCK;
+
+ /* check if a lock applies */
+ ret = fcntl(fd,F_GETLK,&lock);
+
+ if ((ret == -1) ||
+ (lock.l_type == F_UNLCK)) {
+ exit(1);
+ } else {
+ exit(0);
+ }
+ }
+
+ fd = open(DATA, O_RDWR|O_CREAT|O_TRUNC, 0600);
+
+ lock.l_type = F_WRLCK;
+ lock.l_whence = SEEK_SET;
+ lock.l_start = 0;
+ lock.l_len = 4;
+ lock.l_pid = getpid();
+
+ /* set a 4 byte write lock */
+ fcntl(fd,F_SETLK,&lock);
+
+ sys_waitpid(pid, &status, 0);
+
+ unlink(DATA);
+
+ exit(status);
+}
diff --git a/source3/tests/ftruncate.c b/source3/tests/ftruncate.c
new file mode 100644
index 0000000000..8d5e8942e3
--- /dev/null
+++ b/source3/tests/ftruncate.c
@@ -0,0 +1,24 @@
+/* test whether ftruncte() can extend a file */
+
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
+#define DATA "conftest.trunc"
+#define LEN 7663
+
+main()
+{
+ int *buf;
+ int fd = open(DATA,O_RDWR|O_CREAT|O_TRUNC,0666);
+
+ ftruncate(fd, LEN);
+
+ unlink(DATA);
+
+ if (lseek(fd, 0, SEEK_END) == LEN) {
+ exit(0);
+ }
+ exit(1);
+}
diff --git a/source3/tests/shared_mmap.c b/source3/tests/shared_mmap.c
new file mode 100644
index 0000000000..fb8a2a32d5
--- /dev/null
+++ b/source3/tests/shared_mmap.c
@@ -0,0 +1,66 @@
+/* this tests whether we can use a shared writeable mmap on a file -
+ as needed for the mmap varient of FAST_SHARE_MODES */
+
+#include <unistd.h>
+#include <sys/mman.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
+#define DATA "conftest.mmap"
+
+#ifndef MAP_FILE
+#define MAP_FILE 0
+#endif
+
+main()
+{
+ int *buf;
+ int i, pid;
+ int fd = open(DATA,O_RDWR|O_CREAT|O_TRUNC,0666);
+ int count=7;
+
+ if (fd == -1) exit(1);
+
+ for (i=0;i<10000;i++) {
+ write(fd,&i,sizeof(i));
+ }
+
+ close(fd);
+
+ if (fork() == 0) {
+ fd = open(DATA,O_RDWR);
+ if (fd == -1) exit(1);
+
+ buf = (int *)mmap(NULL, 10000*sizeof(int),
+ (PROT_READ | PROT_WRITE),
+ MAP_FILE | MAP_SHARED,
+ fd, 0);
+
+ while (count-- && buf[9124] != 55732) sleep(1);
+
+ if (count <= 0) exit(1);
+
+ buf[1763] = 7268;
+ exit(0);
+ }
+
+ fd = open(DATA,O_RDWR);
+ if (fd == -1) exit(1);
+
+ buf = (int *)mmap(NULL, 10000*sizeof(int),
+ (PROT_READ | PROT_WRITE),
+ MAP_FILE | MAP_SHARED,
+ fd, 0);
+
+ if (buf == (int *)-1) exit(1);
+
+ buf[9124] = 55732;
+
+ while (count-- && buf[1763] != 7268) sleep(1);
+
+ unlink(DATA);
+
+ if (count > 0) exit(0);
+ exit(1);
+}
diff --git a/source3/tests/sysv_ipc.c b/source3/tests/sysv_ipc.c
new file mode 100644
index 0000000000..2374174e8f
--- /dev/null
+++ b/source3/tests/sysv_ipc.c
@@ -0,0 +1,66 @@
+/* this tests whether we can use a sysv shared memory segment
+ as needed for the sysv varient of FAST_SHARE_MODES */
+
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/ipc.h>
+#include <sys/shm.h>
+
+#define KEY 0x963796
+#define SIZE (32*1024)
+
+main()
+{
+ int id;
+ int *buf;
+ int count=7;
+
+#ifdef LINUX
+ if (sizeof(struct shmid_ds) == 52) {
+ printf("WARNING: You probably have a broken set of glibc2 include files - disabling sysv shared memory\n");
+ exit(1);
+ }
+#endif
+
+ id = shmget(KEY, 0, 0);
+ if (id != -1) {
+ if (shmctl(id, IPC_RMID, 0) != 0) exit(1);
+ }
+
+ if (fork() == 0) {
+ /* uggh - need locking */
+ sleep(2);
+
+ /* get an existing area */
+ id = shmget(KEY, 0, 0);
+ if (id == -1) exit(1);
+
+ buf = (int *)shmat(id, 0, 0);
+ if (buf == (int *)-1) exit(1);
+
+
+ while (count-- && buf[6124] != 55732) sleep(1);
+
+ if (count <= 0) exit(1);
+
+ buf[1763] = 7268;
+ exit(0);
+ }
+
+ id = shmget(KEY, SIZE, IPC_CREAT | IPC_EXCL | 0600);
+ if (id == -1) exit(1);
+
+ buf = (int *)shmat(id, 0, 0);
+
+ if (buf == (int *)-1) exit(1);
+
+ buf[6124] = 55732;
+
+ while (count-- && buf[1763] != 7268) sleep(1);
+
+ shmctl(id, IPC_RMID, 0);
+
+ if (count <= 0) exit(1);
+ exit(0);
+}
diff --git a/source3/tests/trapdoor.c b/source3/tests/trapdoor.c
new file mode 100644
index 0000000000..83e10d0613
--- /dev/null
+++ b/source3/tests/trapdoor.c
@@ -0,0 +1,25 @@
+/* test for a trapdoor uid system */
+
+#include <stdlib.h>
+#include <unistd.h>
+#include <stdio.h>
+
+main()
+{
+ if (getuid() != 0) {
+ fprintf(stderr,"ERROR: This test must be run as root - assuming non-trapdoor system\n");
+ exit(0);
+ }
+
+ if (seteuid(1) != 0) exit(1);
+ if (geteuid() != 1) exit(1);
+ if (seteuid(0) != 0) exit(1);
+ if (geteuid() != 0) exit(1);
+
+ if (setegid(1) != 0) exit(1);
+ if (getegid() != 1) exit(1);
+ if (setegid(0) != 0) exit(1);
+ if (getegid() != 0) exit(1);
+
+ exit(0);
+}
diff --git a/source3/ubiqx/.cvsignore b/source3/ubiqx/.cvsignore
new file mode 100644
index 0000000000..421376db9e
--- /dev/null
+++ b/source3/ubiqx/.cvsignore
@@ -0,0 +1 @@
+dummy
diff --git a/source3/utils/nmblookup.c b/source3/utils/nmblookup.c
index 59d5771c5d..551d453dba 100644
--- a/source3/utils/nmblookup.c
+++ b/source3/utils/nmblookup.c
@@ -20,9 +20,7 @@
*/
-#ifdef SYSLOG
-#undef SYSLOG
-#endif
+#define NO_SYSLOG
#include "includes.h"
diff --git a/source3/utils/status.c b/source3/utils/status.c
index 2900d3acbe..8ece6ed4c1 100644
--- a/source3/utils/status.c
+++ b/source3/utils/status.c
@@ -32,9 +32,7 @@
* This program reports current SMB connections
*/
-#ifdef SYSLOG
-#undef SYSLOG
-#endif
+#define NO_SYSLOG
#include "includes.h"
diff --git a/source3/utils/torture.c b/source3/utils/torture.c
index 1abfee0541..53226d00e6 100644
--- a/source3/utils/torture.c
+++ b/source3/utils/torture.c
@@ -19,9 +19,7 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#ifdef SYSLOG
-#undef SYSLOG
-#endif
+#define NO_SYSLOG
#include "includes.h"
diff --git a/source3/web/.cvsignore b/source3/web/.cvsignore
new file mode 100644
index 0000000000..421376db9e
--- /dev/null
+++ b/source3/web/.cvsignore
@@ -0,0 +1 @@
+dummy