Restructure for camke build

This commit is contained in:
Mario Fetka 2011-11-13 17:37:22 +01:00
parent 79813c691a
commit 0fbc9baf41
102 changed files with 771 additions and 201 deletions

136
CMakeLists.txt Normal file
View File

@ -0,0 +1,136 @@
project(mars_nwe)
cmake_minimum_required(VERSION 2.6.0)
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules)
enable_language(C)
SET (VERSION_MAJOR "0")
SET (VERSION_MINOR "99")
SET (VERSION_PATCH "22")
SET (VERSION_SUB "0")
SET (VERSION_DEVEL "0")
SET (VERSION_SUFFIX ".0")
SET (VERSION_PATCH "${VERSION_PATCH}${VERSION_SUFFIX}")
IF (VERSION_SUB)
SET (VERSION_PATCH "${VERSION_PATCH}.${VERSION_SUB}${VERSION_SUFFIX}")
ENDIF (VERSION_SUB)
IF (VERSION_DEVEL)
# for snapshot Version Number
find_package(Subversion)
IF (Subversion_FOUND)
Subversion_WC_INFO(${PROJECT_SOURCE_DIR} CASA)
MESSAGE("Current revision is ${CASA_WC_REVISION}")
ENDIF (Subversion_FOUND)
SET (VERSION_PATCH "${VERSION_PATCH}.${CASA_WC_REVISION})${VERSION_SUFFIX}")
ENDIF (VERSION_DEVEL)
SET (MARS_NWE_VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")
INCLUDE(${CMAKE_ROOT}/Modules/GNUInstallDirs.cmake)
INCLUDE(${CMAKE_MODULE_PATH}/MarsNweInstallDirs.cmake)
# Add options for build
option(ENABLE_DEBUG "Should we build with Debug?" ON)
option(ENABLE_DEBUG_DOSUTILS "Should we build with Mars Nwe Dosutils Debugging?" OFF)
option(ENABLE_INTERNAL_RIP_SAP "Should we build Mars Nwe with Internal Router?" OFF)
option(ENABLE_SHADOW_PWD "Should we build Mars Nwe with Shadow Password Support?" ON)
option(ENABLE_QUOTA_SUPPORT "Should we build Mars Nwe with Quota Support?" OFF)
IF (ENABLE_DEBUG)
SET (MARS_NWE_DEBUG "1")
ELSE (ENABLE_DEBUG)
SET (MARS_NWE_DEBUG "0")
ENDIF (ENABLE_DEBUG)
IF (ENABLE_DEBUG_DOSUTILS)
SET (MARS_NWE_DEBUG_DOSUTILS "1")
ELSE (ENABLE_DEBUG_DOSUTILS)
SET (MARS_NWE_DEBUG_DOSUTILS "0")
ENDIF (ENABLE_DEBUG_DOSUTILS)
IF (ENABLE_INTERNAL_RIP_SAP)
SET (MARS_NWE_INTERNAL_RIP_SAP "1")
ELSE (ENABLE_INTERNAL_RIP_SAP)
SET (MARS_NWE_INTERNAL_RIP_SAP "0")
ENDIF (ENABLE_INTERNAL_RIP_SAP)
IF (ENABLE_SHADOW_PWD)
SET (MARS_NWE_SHADOW_PWD "1")
ELSE (ENABLE_SHADOW_PWD)
SET (MARS_NWE_SHADOW_PWD "0")
ENDIF (ENABLE_SHADOW_PWD)
IF (ENABLE_QUOTA_SUPPORT)
SET (MARS_NWE_QUOTA_SUPPORT "1")
ELSE (ENABLE_QUOTA_SUPPORT)
SET (MARS_NWE_QUOTA_SUPPORT "0")
ENDIF (ENABLE_QUOTA_SUPPORT)
IF (NOT MAX_CONNECTIONS)
SET (MAX_CONNECTIONS "50")
ENDIF (NOT MAX_CONNECTIONS)
IF (NOT MAX_VOLS)
SET (MAX_VOLS "50")
ENDIF (NOT MAX_VOLS)
IF (NOT MAX_FILES)
SET (MAX_FILES "256")
ENDIF (NOT MAX_FILES)
find_package( Crypt REQUIRED)
find_package( GDBM REQUIRED)
message(STATUS "Mars Nwe version: ${MARS_NWE_VERSION}")
message(STATUS "bin: ${CMAKE_INSTALL_FULL_BINDIR}")
message(STATUS "sbin: ${CMAKE_INSTALL_FULL_SBINDIR}")
message(STATUS "lib: ${CMAKE_INSTALL_FULL_LIBDIR}")
message(STATUS "include: ${CMAKE_INSTALL_FULL_INCLUDEDIR}")
message(STATUS "libexec: ${CMAKE_INSTALL_FULL_LIBEXECDIR}")
message(STATUS "doc: ${CMAKE_INSTALL_FULL_DOCDIR}")
message(STATUS "man: ${CMAKE_INSTALL_FULL_MANDIR}")
message(STATUS "sysconf: ${CMAKE_INSTALL_FULL_SYSCONFDIR}")
message(STATUS "Mars Nwe libexec: ${MARS_NWE_INSTALL_FULL_LIBEXEC}")
message(STATUS "Mars Nwe config: ${MARS_NWE_INSTALL_FULL_CONFDIR}")
message(STATUS "Mars Nwe data: ${MARS_NWE_DATA_DIR}")
message(STATUS "Mars Nwe log: ${MARS_NWE_LOG_DIR}")
message(STATUS "Mars Nwe pid: ${MARS_NWE_PID_DIR}")
# put the include dirs which are in the source or build tree
# before all other include dirs, so the headers in the sources
# are prefered over the already installed ones
# since cmake 2.4.1
set(CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE ON)
add_custom_target(uninstall
"${CMAKE_COMMAND}" -P "${CMAKE_BINARY_DIR}/cmake_uninstall.cmake")
add_custom_target(dist COMMAND ${CMAKE_MAKE_PROGRAM} package_source)
add_subdirectory(include)
add_subdirectory(src)
add_subdirectory(opt)
#SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Common Authentication Service Adapter (CASA).")
#SET(CPACK_PACKAGE_VENDOR "http://code.google.com/p/casa-auth/")
#SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README")
#SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/COPYING")
#set(CPACK_PACKAGE_VERSION_MAJOR "${VERSION_MAJOR}")
#set(CPACK_PACKAGE_VERSION_MINOR "${VERSION_MINOR}")
#set(CPACK_PACKAGE_VERSION_PATCH "pl${VERSION_PATCH}")
#set(CPACK_SOURCE_GENERATOR "TBZ2")
#SET(CPACK_PACKAGE_INSTALL_DIRECTORY "mars_nwe-${VERSION}")
#SET(CPACK_SOURCE_IGNORE_FILES CMakeCache.txt CMakeFiles progress.make cmake_install.cmake CPackConfig.cmake CPackSourceConfig.cmake "\\\\.git" "\\\\.svn" "\\\\.swp$" "\\\\.cvs" "\\\\.tar.gz" "\\\\.o")
#set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
#include(CPack)

View File

@ -0,0 +1,23 @@
# - Find libcrypt
# Find libcrypt that is provided by GNU C Library
# This module defines
# CRYPT_LIBRARIES, the libraries needed to use Crypt.
# CRYPT_FOUND, If false, do not try to use Crypt.
#
IF(CRYPT_LIBRARIES)
SET(CRYPT_FOUND TRUE)
ELSE(CRYPT_LIBRARIES)
find_library(CRYPT_LIBRARIES NAMES crypt PATHS
/usr/lib
/usr/local/lib
)
IF(CRYPT_LIBRARIES)
SET(CRYPT_FOUND TRUE)
MESSAGE(STATUS "Found Crypt: ${CRYPT_LIBRARIES}")
ELSE(CRYPT_LIBRARIES)
SET(CRYPT_FOUND FALSE)
ENDIF(CRYPT_LIBRARIES)
mark_as_advanced(CRYPT_LIBRARIES)
ENDIF(CRYPT_LIBRARIES)

View File

@ -0,0 +1,48 @@
# - Find gdbm
# Find the native GDBM includes and library
#
# GDBM_INCLUDE_DIR - where to find gdbm.h, etc.
# GDBM_LIBRARIES - List of libraries when using gdbm.
# GDBM_FOUND - True if gdbm found.
IF (GDBM_INCLUDE_DIR)
# Already in cache, be silent
SET(GDBM_FIND_QUIETLY TRUE)
ENDIF (GDBM_INCLUDE_DIR)
FIND_PATH(GDBM_INCLUDE_DIR gdbm.h
/usr/local/include
/usr/include
/opt/local/include
)
SET(GDBM_NAMES gdbm)
FIND_LIBRARY(GDBM_LIBRARY
NAMES ${GDBM_NAMES}
PATHS /usr/lib /usr/local/lib /opt/local/lib
)
IF (GDBM_INCLUDE_DIR AND GDBM_LIBRARY)
SET(GDBM_FOUND TRUE)
SET( GDBM_LIBRARIES ${GDBM_LIBRARY} )
ELSE (GDBM_INCLUDE_DIR AND GDBM_LIBRARY)
SET(GDBM_FOUND FALSE)
SET( GDBM_LIBRARIES )
ENDIF (GDBM_INCLUDE_DIR AND GDBM_LIBRARY)
IF (GDBM_FOUND)
IF (NOT GDBM_FIND_QUIETLY)
MESSAGE(STATUS "Found GDBM: ${GDBM_LIBRARY}")
ENDIF (NOT GDBM_FIND_QUIETLY)
ELSE (GDBM_FOUND)
IF (GDBM_FIND_REQUIRED)
MESSAGE(STATUS "Looked for gdbm libraries named ${GDBMS_NAMES}.")
MESSAGE(FATAL_ERROR "Could NOT find gdbm library")
ENDIF (GDBM_FIND_REQUIRED)
ENDIF (GDBM_FOUND)
MARK_AS_ADVANCED(
GDBM_LIBRARY
GDBM_INCLUDE_DIR
)

View File

@ -0,0 +1,100 @@
# - Define mars_nwe standard installation directories
# Inclusion of this module defines the following variables:
# MARS_NWE_INSTALL_<dir> - destination for files of a given type
# MARS_NWE_INSTALL_FULL_<dir> - corresponding absolute path
# where <dir> is one of:
# WEBDIR - user executables (bin)
# WEBBINDIR - user executables (bin)
# MODULESDIR - system admin executables (sbin)
# WEBACCESSDIR - read-only single-machine data (etc)
# ADMINDIR - modifiable single-machine data (var)
# CONFDIR - object code libraries (lib or lib64)
# BOOTSTRAPDIR - C header files for non-gcc (/usr/include)
# Each MARS_NWE_INSTALL_<dir> value may be passed to the DESTINATION options of
# install() commands for the corresponding file type. If the includer does
# not define a value the above-shown default will be used and the value will
# appear in the cache for editing by the user.
# Each MARS_NWE_INSTALL_FULL_<dir> value contains an absolute path constructed
# from the corresponding destination by prepending (if necessary) the value
# of MARS_NWE_INSTALL_PREFIX.
#=============================================================================
# Copyright 2011 Nikita Krupen'ko <krnekit@gmail.com>
# Copyright 2011 Kitware, Inc.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
# Values whose defaults are relative to WEBDIR. Store empty values in
# the cache and store the defaults in local variables if the cache values are
# not set explicitly. This auto-updates the defaults as WEBDIRDIR changes.
if(NOT MARS_NWE_INSTALL_LIBEXECDIR)
set(MARS_NWE_INSTALL_LIBEXECDIR "" CACHE PATH "Shared libs (LIBDIR/mars_nwe)")
set(MARS_NWE_INSTALL_LIBEXECDIR "${CMAKE_INSTALL_LIBDIR}/mars_nwe")
endif()
if(NOT MARS_NWE_INSTALL_CONFDIR)
set(MARS_NWE_INSTALL_CONFDIR "" CACHE PATH "Mars Nwe config (SYSCONFDIR/mars_nwe)")
set(MARS_NWE_INSTALL_CONFDIR "${CMAKE_INSTALL_SYSCONFDIR}/mars_nwe")
endif()
if(NOT MARS_NWE_INSTALL_FILEDIR)
set(MARS_NWE_INSTALL_FILEDIR "" CACHE PATH "Mars Nwe file (LOCALSTATEDIR/mars_nwe)")
set(MARS_NWE_INSTALL_FILEDIR "/${CMAKE_INSTALL_LOCALSTATEDIR}/mars_nwe")
endif()
if(NOT MARS_NWE_INSTALL_SPOOLDIR)
set(MARS_NWE_INSTALL_SPOOLDIR "" CACHE PATH "Mars Nwe spool (LOCALSTATEDIR/spool/mars_nwe)")
set(MARS_NWE_INSTALL_SPOOLDIR "/${CMAKE_INSTALL_LOCALSTATEDIR}/spool/mars_nwe")
endif()
if(NOT MARS_NWE_DATA_DIR)
set(MARS_NWE_DATA_DIR "" CACHE PATH "Mars Nwe data (LOCALSTATEDIR/lib/mars_nwe)")
set(MARS_NWE_DATA_DIR "/${CMAKE_INSTALL_LOCALSTATEDIR}/lib/mars_nwe")
endif()
if(NOT MARS_NWE_LOG_DIR)
set(MARS_NWE_LOG_DIR "" CACHE PATH "Mars Nwe log (LOCALSTATEDIR/log/mars_nwe)")
set(MARS_NWE_LOG_DIR "/${CMAKE_INSTALL_LOCALSTATEDIR}/log/mars_nwe")
endif()
if(NOT MARS_NWE_PID_DIR)
set(MARS_NWE_PID_DIR "" CACHE PATH "Mars Nwe pid (LOCALSTATEDIR/run/mars_nwe)")
set(MARS_NWE_PID_DIR "/${CMAKE_INSTALL_LOCALSTATEDIR}/run/mars_nwe")
endif()
#-----------------------------------------------------------------------------
mark_as_advanced(
MARS_NWE_INSTALL_LIBEXEC
MARS_NWE_INSTALL_CONFDIR
MARS_NWE_INSTALL_FILEDIR
MARS_NWE_INSTALL_SPOOLDIR
MARS_NWE_DATA_DIR
MARS_NWE_LOG_DIR
MARS_NWE_PID_DIR
)
# Result directories
#
foreach(dir
LIBEXECDIR
CONFDIR
FILEDIR
SPOOLDIR
)
if(NOT IS_ABSOLUTE ${MARS_NWE_INSTALL_${dir}})
set(MARS_NWE_INSTALL_FULL_${dir} "${CMAKE_INSTALL_PREFIX}/${MARS_NWE_INSTALL_${dir}}")
else()
set(MARS_NWE_INSTALL_FULL_${dir} "${MARS_NWE_INSTALL_${dir}}")
endif()
endforeach()

View File

@ -0,0 +1,22 @@
IF(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt")
MESSAGE(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_BINARY_DIR@/install_manifest.txt\"")
ENDIF(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt")
FILE(READ "@CMAKE_BINARY_DIR@/install_manifest.txt" files)
STRING(REGEX REPLACE "\n" ";" files "${files}")
FOREACH(file ${files})
MESSAGE(STATUS "Uninstalling \"${file}\"")
IF(EXISTS "${file}")
EXEC_PROGRAM(
"@CMAKE_COMMAND@" ARGS "-E remove \"${file}\""
OUTPUT_VARIABLE rm_out
RETURN_VALUE rm_retval
)
IF("${rm_retval}" STREQUAL 0)
ELSE("${rm_retval}" STREQUAL 0)
MESSAGE(FATAL_ERROR "Problem when removing \"${file}\"")
ENDIF("${rm_retval}" STREQUAL 0)
ELSE(EXISTS "${file}")
MESSAGE(STATUS "File \"${file}\" does not exist.")
ENDIF(EXISTS "${file}")
ENDFOREACH(file)

47
include/CMakeLists.txt Normal file
View File

@ -0,0 +1,47 @@
#################################
# Project
##############
#################################
# Dependencies
##############
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/config.h"
IMMEDIATE @ONLY)
#################################
# Compiler Switches
##############
INCLUDE_DIRECTORIES(
)
link_directories(
)
add_definitions(
)
#################################
# Source Files
##############
#SET (include_src
# cbmcopy.h
# d64copy.h
# opencbm.h
# )
#################################
# Linking
##############
#################################
# Install Files
##############
#install(FILES ${include_src} DESTINATION ${INCLUDE_INSTALL_DIR})

View File

@ -1,8 +1,10 @@
/* config.h: 22-Jun-00 */
/* some of this config is needed by make, others by cc */
#define DO_DEBUG 1 /* compile in debug code */
#define FUNC_17_02_IS_DEBUG 0 /* allow debugging with mars_dosutils */
#define DO_DEBUG @MARS_NWE_DEBUG@
/* compile in debug code */
#define FUNC_17_02_IS_DEBUG @MARS_NWE_DEBUG_DOSUTILS@
/* allow debugging with mars_dosutils */
#define DO_TESTING 0 /* set this to "1" to test only */
@ -11,15 +13,18 @@
# define PATHNAME_PROGS "." /* where to find the executables */
# define PATHNAME_BINDERY "." /* directory for bindery-files */
#else
# define FILENAME_NW_INI "/etc/nwserv.conf"
# define FILENAME_NW_INI "@MARS_NWE_INSTALL_FULL_CONFDIR@/nwserv.conf"
/* full name of ini (conf) file */
# define PATHNAME_PROGS "/usr/sbin" /* where to find the executables */
# define PATHNAME_BINDERY "/var/nwserv/db" /* directory for bindery-files */
# define PATHNAME_PROGS "@CMAKE_INSTALL_FULL_SBINDIR@"
/* where to find the executables */
# define PATHNAME_BINDERY "@MARS_NWE_DATA_DIR@/bindery"
/* directory for bindery-files */
#endif
#define PATHNAME_PIDFILES "/var/run" /* directory for 'pidfiles' */
#define PATHNAME_PIDFILES "@MARS_NWE_PID_DIR@"
/* directory for 'pidfiles' */
/* ----- logging the logins via "mars_nwe" in utmp/wtmp ------------------ */
/* <---- logging the logins via "mars_nwe" in utmp/wtmp ----------------> */
#define FILENAME_UTMP UTMP_FILE /* use "NULL" instead of UTMP_FILE */
/* to disable logging via utmp */
#define FILENAME_WTMP WTMP_FILE /* use "NULL" instead of WTMP_FILE */
@ -29,11 +34,12 @@
/* serial number (4 byte) */
#define NETWORK_APPL_NMBR 0x2222 /* application number (2 byte) */
#define MAX_CONNECTIONS 50 /* max. number of simultaneous */
#define MAX_CONNECTIONS @MAX_CONNECTIONS@
/* max. number of simultaneous */
/* connections handled by mars_nwe */
/* !! NOTE !! */
/* If set > 255 some NCP calls will probably not work, try it with caution */
/* and you should apply examples/kpatch2.0.29 to kernels prior 2.0.32 */
/* !! NOTE !! */
/* If set > 255 some NCP calls will probably not work, try it with caution */
/* and you should apply examples/kpatch2.0.29 to kernels prior 2.0.32 */
#define IPX_DATA_GR_546 2 /* 0 = max. IPX Packets = 546 +30 Byte ( 512 Byte RWBuff) */
@ -42,11 +48,11 @@
/* 3 = max. IPX packets = 4130 +30 Byte (4096 Byte RWBuff) */
#define ENABLE_BURSTMODE 0 /* 0 = disable burstmode, 1 = enable burstmode */
/* still NOT working correct !!!!! */
/* to get Burstmode really enabled, section '6' in conf-file */
/* must be set to a value > 1 (3.12 Server) */
/* and kernel-patch examples/kpatch2.0.29 should be used for */
/* kernels prior 2.0.32 */
/* still NOT working correct !!!!! */
/* to get Burstmode really enabled, section '6' in conf-file */
/* must be set to a value > 1 (3.12 Server) */
/* and kernel-patch examples/kpatch2.0.29 should be used for */
/* kernels prior 2.0.32 */
#define USE_MMAP 1 /* use mmap systen call, not always best choice */
@ -57,8 +63,10 @@
#endif
/* <--------------------------------------------------------------------> */
#define MAX_NW_VOLS 10 /* max. number of mars_nwe-volumes */
#define MAX_FILE_HANDLES_CONN 255 /* max. number of open files per */
#define MAX_NW_VOLS @MAX_VOLS@
/* max. number of mars_nwe-volumes */
#define MAX_FILE_HANDLES_CONN @MAX_FILES@
/* max. number of open files per */
/* connection */
/* <--------------- new namespace services call -----------------------> */
#define MAX_DIR_BASE_ENTRIES 50 /* max. cached base entries per */
@ -76,15 +84,18 @@
/* used. */
#define PERSISTENT_SYMLINKS 0 /* change to '1' for persistent symlinks */
/* main idea from Victor Khimenko */
/* still NOT working !! */
/* main idea from Victor Khimenko */
/* still NOT working !! */
/* <--------------- next is for linux only ----------------------------> */
#define INTERNAL_RIP_SAP 1 /* use internal/own rip/sap routines */
#define INTERNAL_RIP_SAP @MARS_NWE_INTERNAL_RIP_SAP@
/* use internal/own rip/sap routines */
#define SHADOW_PWD 0 /* change to '1' for shadow passwds */
#define QUOTA_SUPPORT 0 /* change to '1' for quota support */
#define SHADOW_PWD @MARS_NWE_SHADOW_PWD@
/* change to '1' for shadow passwds */
#define QUOTA_SUPPORT @MARS_NWE_QUOTA_SUPPORT@
/* change to '1' for quota support */
/* for sending 'Request being serviced' replys, /lenz */
/* for sending 'Request being serviced' replys, /lenz */
#define CALL_NWCONN_OVER_SOCKET 0

View File

@ -7,7 +7,7 @@
#define _NAMEOS2_H_
#if WITH_NAME_SPACE_CALLS
extern void mangle_os2_name(NW_VOL *vol, uint8 *unixname, uint8 *pp);
extern void mangle_os2_name(NW_VOL *vol, uint8 *unixname, uint8 *pp, int len);
extern int fn_os2_match(uint8 *s, uint8 *p, int soptions);
#endif

View File

@ -27,7 +27,6 @@
#define NWBIND 5
#define NWROUTED 6
extern FILE *logfile;
extern void x_x_xfree(char **p);
extern int x_x_xnewstr(uint8 **p, uint8 *s);

143
mk.li
View File

@ -1,143 +0,0 @@
#!/bin/sh
# mk.li 15-Dec-99
# please edit this file !
mk()
{
MYBASE=`pwd`;
ERRFILE=$TMP/`basename $MYBASE`.err;
rm -f $ERRFILE;
if [ $V_VPATH = '..' ] ; then
if [ ! -d $OBJDIR ] ; then mkdir $OBJDIR; fi
cd $OBJDIR;
fi
if $MAKE -f $V_VPATH/makefile.unx $@ 2>&1;then true;else kill -HUP $MK_PPID;fi | tee $ERRFILE
if [ $V_VPATH = '..' ] ; then
cd ..;
fi
if [ -f $ERRFILE ] ; then
chmod 666 $ERRFILE
fi
}
print_error()
{
echo ""
echo "The errors are also reported in '$ERRFILE'"
echo "============================================================="
}
TOLOWER='tr "[A-Z]" "[a-z]"'
UNX=`uname -s | $TOLOWER`
MASCHINE=`uname -m`
MK_PPID=$$
export MK_PPID
trap 'print_error; exit 1' 1
case $UNX in
linux)
V_VPATH=".."
OBJDIR="obj"
CC=cc
CPP="cc -E"
# CFLAGS="-pipe -O2 -fomit-frame-pointer"
# problems gcc2.5.8 ^^^^^^^^^^^^^^^^^^^^^
# CFLAGS="-pipe -Wall -Dsignal=sysv_signal"
CFLAGS="$RPM_OPT_FLAGS -pipe -Wall -D_GNU_SOURCE"
case $MASCHINE in
sparc)
HOSTCFLAGS="-DLINUX -DSPARC"
;;
*)
HOSTCFLAGS="-DLINUX"
;;
esac
if [ -f /usr/lib/libgdbm.a ] || [ -f /usr/lib/libgdbm.so ] ; then
NDBMLIB="-lgdbm"
else
NDBMLIB="-ldbm"
fi
if [ -f /usr/lib/libcrypt.so ] ; then
CRYPTLIB="-lcrypt"
else
CRYPTLIB=""
fi
if [ -f /usr/include/sys/quota.h ] ; then
HOSTCFLAGS="$HOSTCFLAGS -DQTAINSYS"
fi
NSLLIB=""
MAKE=make
TMP=/tmp
INSTALL=install
;;
########### SYSV (UnixWare) ##############
unix_sv)
V_VPATH="."
OBJDIR="."
CC=cc
CPP="cc -E"
CFLAGS=
HOSTCFLAGS=""
NDBMLIB="/usr/ucblib/libucb.a"
CRYPTLIB="-lgen"
NSLLIB="-lnsl"
MAKE=make
TMP=/tmp
INSTALL=/usr/ucb/install
;;
########## FreeBSD ############
# created by Boris Popov
freebsd)
V_VPATH=".."
OBJDIR="obj"
CC=gcc
CPP="gcc -E"
if [ "x$CFLAGS" = "x" ]; then
CFLAGS="native"
fi
HOSTCFLAGS="-DFREEBSD -DLINUX"
CRYPTLIB="-lcrypt -lipx"
NSLLIB=""
MAKE=make
TMP="./"
INSTALL="install -c"
;;
*) echo "mk.li: Unknown or not supported OS, probably you must set \$UNX"
;;
esac
## BEGIN try to pass around what the dbm is to the compiler (acli 19970709)
case "$NDBMLIB" in
*gdbm*)
HOSTCFLAGS="$HOSTCFLAGS -DUSE_GDBM"
;;
esac
## END
export CC
export CPP
if [ "X$CFLAGS" != "Xnative" ]; then
export CFLAGS
fi
export HOSTCFLAGS
export NDBMLIB
export CRYPTLIB
export NSLLIB
export TMP
export INSTALL
export V_VPATH
export OBJDIR
mk $@

76
opt/CMakeLists.txt Normal file
View File

@ -0,0 +1,76 @@
#################################
# Project
##############
#################################
# Dependencies
##############
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/nw.ini.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/nwserv.conf"
IMMEDIATE @ONLY)
#################################
# Compiler Switches
##############
INCLUDE_DIRECTORIES(
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_SOURCE_DIR}/include
${CMAKE_BINARY_DIR}/include
)
if (CMAKE_SYSTEM_NAME MATCHES Linux)
add_definitions(
-DLINUX -D_GNU_SOURCE -Dsignal=__sysv_signal
)
endif (CMAKE_SYSTEM_NAME MATCHES Linux)
add_definitions(
-D_VERS_H_=\"${VERSION_MAJOR}\"
-D_VERS_L_=\"${VERSION_MINOR}\"
-D_VERS_P_=\"${VERSION_PATCH}\"
)
#################################
# Source Files
##############
#SET (include_src
# cbmcopy.h
# d64copy.h
# opencbm.h
# )
add_executable( comm comm.c )
add_executable( sendm sendm.c )
add_executable( unxcomm unxcomm.c )
add_executable( unxsendm unxsendm.c )
# add_executable( xsockrt xsockrt.c )
#################################
# Linking
##############
#################################
# Install Files
##############
#install(FILES ${include_src} DESTINATION ${INCLUDE_INSTALL_DIR})
install(FILES nwserv.conf DESTINATION ${MARS_NWE_INSTALL_FULL_CONFDIR})
install(FILES nwserv.stations DESTINATION ${MARS_NWE_INSTALL_FULL_CONFDIR})
install(FILES nw.ini.cnv.437 DESTINATION ${MARS_NWE_INSTALL_FULL_CONFDIR}/nwserv.cnv.437)
install(FILES nw.ini.cnv.cyr DESTINATION ${MARS_NWE_INSTALL_FULL_CONFDIR}/nwserv.cnv.cyr)
install(FILES nw.ini.cnv.min DESTINATION ${MARS_NWE_INSTALL_FULL_CONFDIR}/nwserv.cnv.min)
install(FILES nwopt DESTINATION ${MARS_NWE_INSTALL_FULL_FILEDIR}/SYS/.nwopt.vol)
install(FILES nwopt DESTINATION ${CMAKE_INSTALL_FULL_SYSCONFDIR}/skel/.nwopt)
install(TARGETS comm DESTINATION ${MARS_NWE_INSTALL_FULL_LIBEXECDIR})
install(TARGETS sendm DESTINATION ${MARS_NWE_INSTALL_FULL_LIBEXECDIR})
install(TARGETS unxcomm DESTINATION ${MARS_NWE_INSTALL_FULL_LIBEXECDIR})
install(TARGETS unxsendm DESTINATION ${MARS_NWE_INSTALL_FULL_LIBEXECDIR})
# install(TARGETS xsockrt DESTINATION ${MARS_NWE_INSTALL_FULL_LIBEXECDIR})

View File

@ -159,7 +159,7 @@
# 1 WORLD /var/world kiO 777 666
# 1 FAXQ /var/spool/fax/faxqueue k
1 SYS /u3/SYS/ kt 711 600
1 SYS @MARS_NWE_INSTALL_FULL_FILEDIR@/SYS/ kt 711 600
# =========================================================================
@ -761,19 +761,19 @@
#
# -------------------------------------------------------------------------
# 40 = path for vol/dev/inode->path cache, needed for client-32,namespace
40 /var/spool/nwserv/.volcache
40 @MARS_NWE_INSTALL_FULL_SPOOLDIR@/.volcache
# 41 = path for share/lock files
41 /var/spool/nwserv/.locks
41 @MARS_NWE_INSTALL_FULL_SPOOLDIR@/.locks
# 42 = path for spool dir, e.g. internal print queue handling
42 /var/spool/nwserv
42 @MARS_NWE_INSTALL_FULL_SPOOLDIR@
#
#
# 45 = path for bindery file's
45 /var/nwserv/db
45 @MARS_NWE_DATA_DIR@/bindery
# 46 = path for attribute handling
46 /var/nwserv/attrib
46 @MARS_NWE_DATA_DIR@/attrib
# 47 = path for trustee handling
47 /var/nwserv/trustees
47 @MARS_NWE_DATA_DIR@/trustees
# =========================================================================
# Section 50: Conversion tables by Victor Khimenko <khim@mccme.ru>
# Tables for DOS->Unix names translation & upper/lowercase translations
@ -789,7 +789,7 @@
# 50 Filename of conversation file.
#
# Examples:
# 50 /etc/nwserv.cnv
# 50 @MARS_NWE_INSTALL_FULL_CONFDIR@/nwserv.cnv
# Changing defaults from config.h
@ -831,7 +831,7 @@
#
200 1 # 0 = no logfile and dont daemonize nwserv/nwrouted
# 1 = daemonize nwserv/nwrouted and use logfile
201 /var/log/nw.log # filename of logfile
201 @MARS_NWE_LOG_DIR@/nw.log # filename of logfile
#201 syslog # if filename == syslog then syslogd will be used for
# all messages
@ -854,7 +854,7 @@
300 1 # > 0 print routing info to file every x broadcasts.
# ( normally minutes )
301 /var/log/nw.routes # filename of logfile
301 @MARS_NWE_LOG_DIR@/nw.routes # filename of logfile
302 0x1 # flags will be interpreted as hex value.
# 0 = append to this file
@ -870,7 +870,7 @@
# Section 400:
# station file for special handling of stations.
400 /etc/nwserv.stations # for syntax see file in the examples directory.
400 @MARS_NWE_INSTALL_FULL_CONFDIR@/nwserv.stations # for syntax see file in the examples directory.
# Section 401: nearest server

101
src/CMakeLists.txt Normal file
View File

@ -0,0 +1,101 @@
#################################
# Project
##############
#project(mars-nwe)
#################################
# Dependencies
##############
if (CMAKE_SYSTEM_NAME MATCHES Linux)
add_definitions(
-DLINUX -D_GNU_SOURCE -Dsignal=__sysv_signal
)
endif (CMAKE_SYSTEM_NAME MATCHES Linux)
add_definitions(
-D_VERS_H_=\"${VERSION_MAJOR}\"
-D_VERS_L_=\"${VERSION_MINOR}\"
-D_VERS_P_=\"${VERSION_PATCH}\"
)
IF(ENABLE_QUOTA_SUPPORT)
add_definitions(
-DQTAINSYS
)
ENDIF(ENABLE_QUOTA_SUPPORT)
IF(GDBM_FOUND)
add_definitions(
-DUSE_GDBM
)
ENDIF(GDBM_FOUND)
#################################
# Compiler Switches
##############
INCLUDE_DIRECTORIES(
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_SOURCE_DIR}/include
${CMAKE_BINARY_DIR}/include
)
#################################
# Source Files
##############
IF(ENABLE_INTERNAL_RIP_SAP)
SET(EMUTLI emutli.c)
SET(EMUTLI1 emutli1.c)
SET(NWROUTE_0 nwroute.c)
ELSE(ENABLE_INTERNAL_RIP_SAP)
SET(EMUTLI emutli.c)
SET(EMUTLI1 empty.c)
SET(NWROUTE_0 nwroute1.c)
ENDIF(ENABLE_INTERNAL_RIP_SAP)
add_executable(nwserv nwserv.c net1.c tools.c ${EMUTLI} ${EMUTLI1} ${NWROUTE_0} )
add_executable(nwconn nwconn.c net1.c tools.c connect.c namspace.c nwvolume.c nwfile.c unxfile.c nwqconn.c nameos2.c nwfname.c nwshare.c extpipe.c nwattrib.c trustee.c ${EMUTLI} )
add_executable(ncpserv ncpserv.c net1.c tools.c ${EMUTLI} )
add_executable(nwclient nwclient.c net1.c tools.c ${EMUTLI} )
add_executable(nwbind nwbind.c net1.c tools.c nwdbm.c nwcrypt.c unxlog.c sema.c nwqueue.c unxfile.c ${EMUTLI} )
IF(ENABLE_INTERNAL_RIP_SAP)
add_executable(nwrouted nwrouted.c net1.c tools.c ${EMUTLI} ${EMUTLI1} )
ENDIF(ENABLE_INTERNAL_RIP_SAP)
add_executable(dbmtool dbmtool.c net1.c tools.c nwdbm.c nwcrypt.c unxlog.c sema.c nwqueue.c unxfile.c ${EMUTLI} )
add_executable(ftrustee ftrustee.c tools.c nwfname.c unxfile.c nwvolume.c nwattrib.c trustee.c )
#################################
# Linking
##############
target_link_libraries(nwserv ${CRYPT_LIBRARIES} )
target_link_libraries(nwconn ${CRYPT_LIBRARIES} )
target_link_libraries(ncpserv ${CRYPT_LIBRARIES} )
target_link_libraries(nwclient ${CRYPT_LIBRARIES} )
target_link_libraries(nwbind ${CRYPT_LIBRARIES} ${GDBM_LIBRARIES} )
IF(ENABLE_INTERNAL_RIP_SAP)
target_link_libraries(nwrouted ${CRYPT_LIBRARIES} )
ENDIF(ENABLE_INTERNAL_RIP_SAP)
target_link_libraries(dbmtool ${CRYPT_LIBRARIES} ${GDBM_LIBRARIES} )
target_link_libraries(ftrustee ${CRYPT_LIBRARIES} )
#################################
# Install Files
##############
install(TARGETS nwserv DESTINATION ${CMAKE_INSTALL_SBINDIR})
install(TARGETS nwconn DESTINATION ${CMAKE_INSTALL_SBINDIR})
install(TARGETS ncpserv DESTINATION ${CMAKE_INSTALL_SBINDIR})
install(TARGETS nwclient DESTINATION ${CMAKE_INSTALL_SBINDIR})
install(TARGETS nwbind DESTINATION ${CMAKE_INSTALL_SBINDIR})
IF(ENABLE_INTERNAL_RIP_SAP)
install(TARGETS nwrouted DESTINATION ${CMAKE_INSTALL_SBINDIR})
ENDIF(ENABLE_INTERNAL_RIP_SAP)
install(TARGETS dbmtool DESTINATION ${CMAKE_INSTALL_SBINDIR})
install(TARGETS ftrustee DESTINATION ${CMAKE_INSTALL_SBINDIR})

View File

@ -824,7 +824,8 @@ static void conn_build_path_fn(uint8 *vol,
uint8 *fn,
int *has_wild,
uint8 *data,
int len)
int len,
int lenn)
/* is called from build_path */
{
@ -884,7 +885,7 @@ static int build_path( NW_PATH *path,
(only_dir) ? (uint8)NULL
: path->fn,
&(path->has_wild),
data, len);
data, len, sizeof(path->fn));
path->volume = -1;
if (only_dir) path->fn[0] = '\0';
@ -1926,7 +1927,7 @@ int nw_init_connect(void)
entry8_flags = hextoi((char*)buff);
} else if (what == 9) { /* umode */
uint8 buf1[300], buf2[300];
if (2 == sscanf((char*)buff, "%s %s", buf1, buf2)) {
if (2 == sscanf((char*)buff, "%300s %300s", buf1, buf2)) {
default_umode_dir = octtoi(buf1);
default_umode_file = octtoi(buf2);
}

0
src/empty.c Normal file
View File

View File

@ -33,7 +33,6 @@
#include <sys/time.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <linux/config.h>
#if 0
# include <linux/sockios.h>
#endif
@ -340,7 +339,7 @@ int init_ipx(uint32 network, uint32 node, int ipx_debug, int flags)
errorp(10, "Problem", "probably kernel-IPX is not setup correctly");
exit(1);
} else {
ipx_config_data cfgdata;
struct ipx_config_data cfgdata;
struct sockaddr_ipx ipxs;
ioctl(sock, SIOCIPXCFGDATA, &cfgdata);
org_auto_interfaces =

View File

@ -116,7 +116,7 @@ static int get_name(uint8 *s, uint8 *unixname, int hit, uint8 *p)
}
#endif
void mangle_os2_name(NW_VOL *vol, uint8 *unixname, uint8 *pp)
void mangle_os2_name(NW_VOL *vol, uint8 *unixname, uint8 *pp, int len)
{
#if MAX_NAME_OS2_CACHE
int k = -1;
@ -149,7 +149,7 @@ void mangle_os2_name(NW_VOL *vol, uint8 *unixname, uint8 *pp)
new_str(b->cache[0], pp);
}
} else {
strcpy(pp, b->cache[besthit]);
strncpy(pp, b->cache[besthit], len-1);
if (besthit > 2) {
uint8 *sp=b->cache[besthit];
while (besthit--) {

View File

@ -639,7 +639,7 @@ leave_build_nwpath:
if (nwpath->namespace == NAME_OS2) {
dos2unixcharset(pp);
pp += npbeg;
mangle_os2_name(v, unixname, pp);
mangle_os2_name(v, unixname, pp, sizeof(unixname)-v->unixnamlen-npbeg);
if (nplen > 0) {
unix2doscharset(pp);
memcpy(nwpath->path+npbeg, pp, nplen);

View File

View File

@ -33,7 +33,7 @@ static void put_attr_to_disk(int dev, ino_t inode, uint32 attrib)
int l;
uint8 buf_uc[4];
U32_TO_BE32(inode, buf_uc);
l=sprintf(buf, "%s/%x/%x/%x/%x", path_attributes,
l=snprintf(buf, sizeof(buf), "%s/%x/%x/%x/%x", path_attributes,
dev,
(int) buf_uc[0],
(int) buf_uc[1],
@ -52,7 +52,7 @@ static void free_attr_from_disk(int dev, ino_t inode)
char buf[255];
uint8 buf_uc[4];
U32_TO_BE32(inode, buf_uc);
sprintf(buf, "%s/%x/%x/%x/%x/%x", path_attributes,
snprintf(buf, sizeof(buf), "%s/%x/%x/%x/%x/%x", path_attributes,
dev,
(int) buf_uc[0],
(int) buf_uc[1],
@ -71,7 +71,7 @@ static int get_attr_from_disk(int dev, ino_t inode, uint32 *attrib)
int l;
uint8 buf_uc[4];
U32_TO_BE32(inode, buf_uc);
sprintf(buf, "%s/%x/%x/%x/%x/%x", path_attributes,
snprintf(buf, sizeof(buf), "%s/%x/%x/%x/%x/%x", path_attributes,
dev,
(int) buf_uc[0],
(int) buf_uc[1],

View File

@ -677,7 +677,7 @@ static void handle_fxx(int gelen, int func)
} *xdata = (struct XDATA*) responsedata;
int k, i, h;
memset(xdata, 0, sizeof(struct XDATA));
strcpy(xdata->servername, my_nwname);
strncpy(xdata->servername, my_nwname, sizeof(xdata->servername)-1);
if (!tells_server_version) {
xdata->version = 2;
xdata->subversion = 15;

View File

@ -2445,7 +2445,7 @@ int nw_fill_standard(char *servername, ipxAddr_t *adr)
pp=directory;
state++;
} else if (state==3) {
strcpy(command, p-1);
strncpy(command, p-1, sizeof(command)-1);
break;
}
}

View File

@ -756,7 +756,7 @@ static void open_pipe_command(FILE_HANDLE *fh, int dowrite)
{
if (NULL == fh->f) {
char pipecommand[512];
sprintf(pipecommand, "%s %s %d %d",
snprintf(pipecommand, sizeof(pipecommand), "%s %s %d %d",
fh->fname,
dowrite ? "WRITE" : "READ",
act_connection, act_pid);

View File

@ -213,7 +213,7 @@ int close_queue_job2(uint32 q_id, int job_id,
FILE *f=NULL;
if (prc_len && *(prc+prc_len-1)=='!'){
strmaxcpy((uint8*)buff, prc, prc_len-1);
sprintf(printcommand, "%s %s %s", buff,
snprintf(printcommand, sizeof(printcommand), "%s %s %s", buff,
qpa.banner_user_name, qpa.banner_file_name);
} else
strmaxcpy((uint8*)printcommand, prc, prc_len);

View File

@ -851,7 +851,7 @@ static void get_ini(int full)
char inhalt4[500];
char dummy;
int anz;
if ((anz=sscanf((char*)buff, "%s %s %s %s", inhalt, inhalt2,
if ((anz=sscanf((char*)buff, "%500s %500s %500s %500s", inhalt, inhalt2,
inhalt3, inhalt4)) > 0) {
switch (what) {
case 2 : if (full) {
@ -1290,7 +1290,7 @@ int main(int argc, char **argv)
int frame=-1;
uint32 netnum=0L;
char buf[256];
strcpy(buf, argv[j+2]);
strncpy(buf, argv[j+2], sizeof(buf)-1);
upstr(buf);
if (!strcmp(buf, "802.3"))
frame=IPX_FRAME_8023;

View File

@ -156,7 +156,7 @@ void nw_init_volumes(FILE *f)
uint8 umode_filestr[256];
uint8 *p;
int len;
int founds = sscanf((char*)buff, "%s %s %s %s %s",
int founds = sscanf((char*)buff, "%256s %256s %256s %256s %256s",
sysname, unixname, optionstr, umode_dirstr, umode_filestr);
if (founds > 1) {
NW_VOL *vol=&(nw_volumes[used_nw_volumes]);

View File

View File

@ -189,7 +189,7 @@ static char *buffered=NULL;
sprintf(identstr, "%s %d %3d", get_debstr(0),
act_connection, act_ncpsequence);
openlog(identstr, LOG_CONS, LOG_DAEMON);
syslog(LOG_DEBUG, buf);
syslog(LOG_DEBUG, "%s", buf);
closelog();
} else {
int l=strlen(buf);
@ -249,7 +249,7 @@ void errorp(int mode, char *what, char *p, ...)
}
sprintf(identstr, "%s %d %3d", get_debstr(0), act_connection, act_ncpsequence);
openlog(identstr, LOG_CONS, LOG_DAEMON);
syslog(prio, buf);
syslog(prio, "%s", buf);
closelog();
if (!mode) return;
lologfile=stderr;

View File

@ -125,7 +125,7 @@ int unx_mvdir(uint8 *oldname, uint8 *newname)
if (!stat(newname, &statb)) return(EEXIST);
if (stat(oldname, &statb)) return(-1);
else if (!S_ISDIR(statb.st_mode)) return(-1);
sprintf(command, "mv %s %s 2>&1 >/dev/null" , oldname, newname);
snprintf(command, sizeof(command)-1, "mv %s %s 2>&1 >/dev/null" , oldname, newname);
return(system(command));
}
#endif

1
sys/comm.c Normal file
View File

@ -0,0 +1 @@
#include "../opt/comm.c"

Some files were not shown because too many files have changed in this diff Show More