mirror of
https://github.com/samba-team/samba.git
synced 2025-03-24 10:50:22 +03:00
merge from the autoconf2 branch to the main branch
(This used to be commit 3bda7ac417107a7b01d91805ca71c4330657ed21)
This commit is contained in:
parent
c48b3fce6b
commit
64578c0589
@ -1,4 +1,8 @@
|
||||
Makefile.RPM
|
||||
config.cache
|
||||
config.h
|
||||
config.log
|
||||
config.status
|
||||
cvs.log
|
||||
make_printerdef
|
||||
make_smbcodepage
|
||||
|
322
source3/Makefile.in
Normal file
322
source3/Makefile.in
Normal file
@ -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
|
49
source3/acconfig.h
Normal file
49
source3/acconfig.h
Normal file
@ -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
|
@ -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
|
||||
|
||||
|
@ -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)){
|
||||
|
@ -20,9 +20,7 @@
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifdef SYSLOG
|
||||
#undef SYSLOG
|
||||
#endif
|
||||
#define NO_SYSLOG
|
||||
|
||||
#include "includes.h"
|
||||
|
||||
|
@ -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);
|
||||
|
4791
source3/configure
vendored
Executable file
4791
source3/configure
vendored
Executable file
File diff suppressed because it is too large
Load Diff
578
source3/configure.in
Normal file
578
source3/configure.in
Normal file
@ -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)
|
397
source3/include/config.h.in
Normal file
397
source3/include/config.h.in
Normal file
@ -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
|
File diff suppressed because it is too large
Load Diff
@ -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
|
||||
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
238
source3/install-sh
Executable file
238
source3/install-sh
Executable file
@ -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
|
@ -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;
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
uint32 nm;
|
||||
short onbc;
|
||||
short offbc;
|
||||
|
||||
#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);
|
||||
|
||||
/* get a default netmask and broadcast */
|
||||
default_netmask(if_nmask, if_ipaddr);
|
||||
get_netmask(if_ipaddr, if_nmask);
|
||||
|
||||
#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;
|
||||
/* 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;
|
||||
/* 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);
|
||||
|
||||
/* 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);
|
||||
}
|
||||
|
||||
DEBUG(4,("Derived broadcast address %s\n", inet_ntoa(*if_bcast)));
|
||||
} /* get_broadcast */
|
||||
DEBUG(4,("Derived broadcast address %s\n", inet_ntoa(*if_bcast)));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
351
source3/lib/netmask.c
Normal file
351
source3/lib/netmask.c
Normal file
@ -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
|
@ -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);
|
||||
#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;
|
||||
#ifndef HAVE_SETGROUPS
|
||||
static int done;
|
||||
if (!done) {
|
||||
DEBUG(1,("WARNING: running without setgroups\n"));
|
||||
done=1;
|
||||
}
|
||||
gr = g->gr_mem[++j];
|
||||
}
|
||||
}
|
||||
endgrent();
|
||||
return(setgroups(i,grouplst));
|
||||
/* 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;
|
||||
}
|
||||
gr = g->gr_mem[++j];
|
||||
}
|
||||
}
|
||||
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));
|
||||
#endif
|
||||
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
|
||||
|
||||
|
102
source3/lib/signal.c
Normal file
102
source3/lib/signal.c
Normal file
@ -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);
|
||||
}
|
@ -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);
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
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);
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
|
@ -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));
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -18,9 +18,7 @@
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifdef SYSLOG
|
||||
#undef SYSLOG
|
||||
#endif
|
||||
#define NO_SYSLOG
|
||||
|
||||
#include "includes.h"
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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 */
|
||||
|
||||
|
||||
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
@ -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();
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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 */
|
||||
|
||||
|
@ -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)
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
*/
|
||||
|
||||
#ifdef USE_LDAP_DB
|
||||
#ifdef WITH_LDAP
|
||||
|
||||
#include "includes.h"
|
||||
|
||||
|
@ -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
|
||||
|
@ -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];
|
||||
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';
|
||||
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");
|
||||
|
||||
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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
/*
|
||||
* 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;
|
||||
}
|
||||
/*
|
||||
* 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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
/*
|
||||
* 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);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
|
@ -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 */
|
||||
|
@ -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",
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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"));
|
||||
|
231
source3/smbd/dfree.c
Normal file
231
source3/smbd/dfree.c
Normal file
@ -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));
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
{
|
||||
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 */
|
||||
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
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
@ -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__)
|
||||
|
@ -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
|
||||
@ -695,236 +694,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
|
||||
|
||||
@ -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 */
|
||||
|
||||
|
@ -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
|
||||
|
@ -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 */
|
||||
|
@ -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();
|
||||
initial_uid = geteuid();
|
||||
initial_gid = getegid();
|
||||
|
||||
current_user.cnum = -1;
|
||||
current_user.vuid = UID_FIELD_INVALID;
|
||||
|
||||
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 (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 (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 (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)
|
||||
|
@ -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;
|
||||
|
10
source3/tests/README
Normal file
10
source3/tests/README
Normal file
@ -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
|
||||
|
||||
|
78
source3/tests/fcntl_lock.c
Normal file
78
source3/tests/fcntl_lock.c
Normal file
@ -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);
|
||||
}
|
24
source3/tests/ftruncate.c
Normal file
24
source3/tests/ftruncate.c
Normal file
@ -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);
|
||||
}
|
66
source3/tests/shared_mmap.c
Normal file
66
source3/tests/shared_mmap.c
Normal file
@ -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);
|
||||
}
|
66
source3/tests/sysv_ipc.c
Normal file
66
source3/tests/sysv_ipc.c
Normal file
@ -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);
|
||||
}
|
25
source3/tests/trapdoor.c
Normal file
25
source3/tests/trapdoor.c
Normal file
@ -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);
|
||||
}
|
1
source3/ubiqx/.cvsignore
Normal file
1
source3/ubiqx/.cvsignore
Normal file
@ -0,0 +1 @@
|
||||
dummy
|
@ -20,9 +20,7 @@
|
||||
|
||||
*/
|
||||
|
||||
#ifdef SYSLOG
|
||||
#undef SYSLOG
|
||||
#endif
|
||||
#define NO_SYSLOG
|
||||
|
||||
#include "includes.h"
|
||||
|
||||
|
@ -32,9 +32,7 @@
|
||||
* This program reports current SMB connections
|
||||
*/
|
||||
|
||||
#ifdef SYSLOG
|
||||
#undef SYSLOG
|
||||
#endif
|
||||
#define NO_SYSLOG
|
||||
|
||||
#include "includes.h"
|
||||
|
||||
|
@ -19,9 +19,7 @@
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifdef SYSLOG
|
||||
#undef SYSLOG
|
||||
#endif
|
||||
#define NO_SYSLOG
|
||||
|
||||
#include "includes.h"
|
||||
|
||||
|
1
source3/web/.cvsignore
Normal file
1
source3/web/.cvsignore
Normal file
@ -0,0 +1 @@
|
||||
dummy
|
Loading…
x
Reference in New Issue
Block a user