diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..2f17758 --- /dev/null +++ b/CMakeLists.txt @@ -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) diff --git a/cmake/modules/FindCrypt.cmake b/cmake/modules/FindCrypt.cmake new file mode 100644 index 0000000..85f5f28 --- /dev/null +++ b/cmake/modules/FindCrypt.cmake @@ -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) \ No newline at end of file diff --git a/cmake/modules/FindGDBM.cmake b/cmake/modules/FindGDBM.cmake new file mode 100644 index 0000000..e1ba00a --- /dev/null +++ b/cmake/modules/FindGDBM.cmake @@ -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 +) diff --git a/cmake/modules/MarsNweInstallDirs.cmake b/cmake/modules/MarsNweInstallDirs.cmake new file mode 100644 index 0000000..250affc --- /dev/null +++ b/cmake/modules/MarsNweInstallDirs.cmake @@ -0,0 +1,100 @@ +# - Define mars_nwe standard installation directories +# Inclusion of this module defines the following variables: +# MARS_NWE_INSTALL_ - destination for files of a given type +# MARS_NWE_INSTALL_FULL_ - corresponding absolute path +# where 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_ 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_ 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 +# 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() diff --git a/cmake/modules/cmake_uninstall.cmake.in b/cmake/modules/cmake_uninstall.cmake.in new file mode 100644 index 0000000..36dd9ba --- /dev/null +++ b/cmake/modules/cmake_uninstall.cmake.in @@ -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) diff --git a/Makefile b/doc/old/Makefile similarity index 100% rename from Makefile rename to doc/old/Makefile diff --git a/examples/README.dosemu b/doc/old/README.dosemu similarity index 100% rename from examples/README.dosemu rename to doc/old/README.dosemu diff --git a/examples/README.important b/doc/old/README.important similarity index 100% rename from examples/README.important rename to doc/old/README.important diff --git a/examples/README.kpatch1.2.13 b/doc/old/README.kpatch1.2.13 similarity index 100% rename from examples/README.kpatch1.2.13 rename to doc/old/README.kpatch1.2.13 diff --git a/config.h b/doc/old/config.h similarity index 100% rename from config.h rename to doc/old/config.h diff --git a/examples/dosemu-patch b/doc/old/dosemu-patch similarity index 100% rename from examples/dosemu-patch rename to doc/old/dosemu-patch diff --git a/examples/e.pck b/doc/old/e.pck similarity index 100% rename from examples/e.pck rename to doc/old/e.pck diff --git a/examples/kpatch1.2.13 b/doc/old/kpatch1.2.13 similarity index 100% rename from examples/kpatch1.2.13 rename to doc/old/kpatch1.2.13 diff --git a/examples/kpatch2.0.1 b/doc/old/kpatch2.0.1 similarity index 100% rename from examples/kpatch2.0.1 rename to doc/old/kpatch2.0.1 diff --git a/examples/kpatch2.0.28 b/doc/old/kpatch2.0.28 similarity index 100% rename from examples/kpatch2.0.28 rename to doc/old/kpatch2.0.28 diff --git a/examples/kpatch2.0.29 b/doc/old/kpatch2.0.29 similarity index 100% rename from examples/kpatch2.0.29 rename to doc/old/kpatch2.0.29 diff --git a/makefile.unx b/doc/old/makefile.unx similarity index 100% rename from makefile.unx rename to doc/old/makefile.unx diff --git a/examples/mk b/doc/old/mk similarity index 100% rename from examples/mk rename to doc/old/mk diff --git a/examples/mk.li b/doc/old/mk.li similarity index 100% rename from examples/mk.li rename to doc/old/mk.li diff --git a/examples/nw.ini b/doc/old/nw.ini similarity index 100% rename from examples/nw.ini rename to doc/old/nw.ini diff --git a/examples/nw.ini.old b/doc/old/nw.ini.old similarity index 100% rename from examples/nw.ini.old rename to doc/old/nw.ini.old diff --git a/tools.sh b/doc/old/tools.sh similarity index 100% rename from tools.sh rename to doc/old/tools.sh diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt new file mode 100644 index 0000000..11f8a6e --- /dev/null +++ b/include/CMakeLists.txt @@ -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}) \ No newline at end of file diff --git a/examples/config.h b/include/config.h.cmake similarity index 60% rename from examples/config.h rename to include/config.h.cmake index 3549736..f7f57a4 100644 --- a/examples/config.h +++ b/include/config.h.cmake @@ -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 diff --git a/connect.h b/include/connect.h similarity index 100% rename from connect.h rename to include/connect.h diff --git a/debmask.h b/include/debmask.h similarity index 100% rename from debmask.h rename to include/debmask.h diff --git a/emutli.h b/include/emutli.h similarity index 100% rename from emutli.h rename to include/emutli.h diff --git a/emutli1.h b/include/emutli1.h similarity index 100% rename from emutli1.h rename to include/emutli1.h diff --git a/extpipe.h b/include/extpipe.h similarity index 100% rename from extpipe.h rename to include/extpipe.h diff --git a/nameos2.h b/include/nameos2.h similarity index 95% rename from nameos2.h rename to include/nameos2.h index 489ff1a..7957f09 100644 --- a/nameos2.h +++ b/include/nameos2.h @@ -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 diff --git a/namspace.h b/include/namspace.h similarity index 100% rename from namspace.h rename to include/namspace.h diff --git a/net.h b/include/net.h similarity index 100% rename from net.h rename to include/net.h diff --git a/net1.h b/include/net1.h similarity index 100% rename from net1.h rename to include/net1.h diff --git a/nwattrib.h b/include/nwattrib.h similarity index 100% rename from nwattrib.h rename to include/nwattrib.h diff --git a/nwbind.h b/include/nwbind.h similarity index 100% rename from nwbind.h rename to include/nwbind.h diff --git a/nwconn.h b/include/nwconn.h similarity index 100% rename from nwconn.h rename to include/nwconn.h diff --git a/nwcrypt.h b/include/nwcrypt.h similarity index 100% rename from nwcrypt.h rename to include/nwcrypt.h diff --git a/nwdbm.h b/include/nwdbm.h similarity index 100% rename from nwdbm.h rename to include/nwdbm.h diff --git a/nwfile.h b/include/nwfile.h similarity index 100% rename from nwfile.h rename to include/nwfile.h diff --git a/nwfname.h b/include/nwfname.h similarity index 100% rename from nwfname.h rename to include/nwfname.h diff --git a/nwqconn.h b/include/nwqconn.h similarity index 100% rename from nwqconn.h rename to include/nwqconn.h diff --git a/nwqueue.h b/include/nwqueue.h similarity index 100% rename from nwqueue.h rename to include/nwqueue.h diff --git a/nwserv.h b/include/nwserv.h similarity index 100% rename from nwserv.h rename to include/nwserv.h diff --git a/nwshare.h b/include/nwshare.h similarity index 100% rename from nwshare.h rename to include/nwshare.h diff --git a/nwvolume.h b/include/nwvolume.h similarity index 100% rename from nwvolume.h rename to include/nwvolume.h diff --git a/queuedef.h b/include/queuedef.h similarity index 100% rename from queuedef.h rename to include/queuedef.h diff --git a/sema.h b/include/sema.h similarity index 100% rename from sema.h rename to include/sema.h diff --git a/tools.h b/include/tools.h similarity index 99% rename from tools.h rename to include/tools.h index 49ee041..e8115ca 100644 --- a/tools.h +++ b/include/tools.h @@ -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); diff --git a/trustee.h b/include/trustee.h similarity index 100% rename from trustee.h rename to include/trustee.h diff --git a/unxfile.h b/include/unxfile.h similarity index 100% rename from unxfile.h rename to include/unxfile.h diff --git a/unxlog.h b/include/unxlog.h similarity index 100% rename from unxlog.h rename to include/unxlog.h diff --git a/mk.li b/mk.li deleted file mode 100755 index 0be7419..0000000 --- a/mk.li +++ /dev/null @@ -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 $@ diff --git a/opt/CMakeLists.txt b/opt/CMakeLists.txt new file mode 100644 index 0000000..1a428cf --- /dev/null +++ b/opt/CMakeLists.txt @@ -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}) + diff --git a/examples/comm.c b/opt/comm.c similarity index 100% rename from examples/comm.c rename to opt/comm.c diff --git a/nw.ini b/opt/nw.ini.cmake similarity index 98% rename from nw.ini rename to opt/nw.ini.cmake index e7fb1a6..3733eb6 100644 --- a/nw.ini +++ b/opt/nw.ini.cmake @@ -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 # 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 diff --git a/examples/nw.ini.cnv.437 b/opt/nw.ini.cnv.437 similarity index 100% rename from examples/nw.ini.cnv.437 rename to opt/nw.ini.cnv.437 diff --git a/examples/nw.ini.cnv.cyr b/opt/nw.ini.cnv.cyr similarity index 100% rename from examples/nw.ini.cnv.cyr rename to opt/nw.ini.cnv.cyr diff --git a/examples/nw.ini.cnv.min b/opt/nw.ini.cnv.min similarity index 100% rename from examples/nw.ini.cnv.min rename to opt/nw.ini.cnv.min diff --git a/examples/nwopt b/opt/nwopt similarity index 100% rename from examples/nwopt rename to opt/nwopt diff --git a/examples/nwserv.stations b/opt/nwserv.stations similarity index 100% rename from examples/nwserv.stations rename to opt/nwserv.stations diff --git a/examples/sendm.c b/opt/sendm.c similarity index 100% rename from examples/sendm.c rename to opt/sendm.c diff --git a/examples/unxcomm.c b/opt/unxcomm.c similarity index 100% rename from examples/unxcomm.c rename to opt/unxcomm.c diff --git a/examples/unxsendm.c b/opt/unxsendm.c similarity index 100% rename from examples/unxsendm.c rename to opt/unxsendm.c diff --git a/examples/xsockrt.c b/opt/xsockrt.c similarity index 100% rename from examples/xsockrt.c rename to opt/xsockrt.c diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000..0bb2779 --- /dev/null +++ b/src/CMakeLists.txt @@ -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}) + diff --git a/connect.c b/src/connect.c similarity index 99% rename from connect.c rename to src/connect.c index 20ede15..6adb5ce 100644 --- a/connect.c +++ b/src/connect.c @@ -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); } diff --git a/dbmtool.c b/src/dbmtool.c similarity index 100% rename from dbmtool.c rename to src/dbmtool.c diff --git a/src/empty.c b/src/empty.c new file mode 100644 index 0000000..e69de29 diff --git a/emutli.c b/src/emutli.c similarity index 100% rename from emutli.c rename to src/emutli.c diff --git a/emutli1.c b/src/emutli1.c similarity index 99% rename from emutli1.c rename to src/emutli1.c index 947d6e6..5aac1fd 100644 --- a/emutli1.c +++ b/src/emutli1.c @@ -33,7 +33,6 @@ #include #include #include -#include #if 0 # include #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 = diff --git a/extpipe.c b/src/extpipe.c similarity index 100% rename from extpipe.c rename to src/extpipe.c diff --git a/ftrustee.c b/src/ftrustee.c similarity index 100% rename from ftrustee.c rename to src/ftrustee.c diff --git a/ipxif.c b/src/ipxif.c similarity index 100% rename from ipxif.c rename to src/ipxif.c diff --git a/nameos2.c b/src/nameos2.c similarity index 98% rename from nameos2.c rename to src/nameos2.c index c0c5f10..26bde9e 100644 --- a/nameos2.c +++ b/src/nameos2.c @@ -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--) { diff --git a/namspace.c b/src/namspace.c similarity index 99% rename from namspace.c rename to src/namspace.c index 76f2c07..e54ab3e 100644 --- a/namspace.c +++ b/src/namspace.c @@ -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); diff --git a/ncpserv.c b/src/ncpserv.c similarity index 100% rename from ncpserv.c rename to src/ncpserv.c diff --git a/net1.c b/src/net1.c similarity index 100% rename from net1.c rename to src/net1.c diff --git a/nwattrib.c b/src/nwattrib.c similarity index 97% rename from nwattrib.c rename to src/nwattrib.c index 4c24bdd..c72f4b3 100644 --- a/nwattrib.c +++ b/src/nwattrib.c @@ -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], diff --git a/nwbind.c b/src/nwbind.c similarity index 99% rename from nwbind.c rename to src/nwbind.c index e08a266..482153f 100644 --- a/nwbind.c +++ b/src/nwbind.c @@ -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; diff --git a/nwclient.c b/src/nwclient.c similarity index 100% rename from nwclient.c rename to src/nwclient.c diff --git a/nwconn.c b/src/nwconn.c similarity index 100% rename from nwconn.c rename to src/nwconn.c diff --git a/nwcrypt.c b/src/nwcrypt.c similarity index 100% rename from nwcrypt.c rename to src/nwcrypt.c diff --git a/nwdbm.c b/src/nwdbm.c similarity index 99% rename from nwdbm.c rename to src/nwdbm.c index 31886ef..d18ace5 100644 --- a/nwdbm.c +++ b/src/nwdbm.c @@ -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; } } diff --git a/nwfile.c b/src/nwfile.c similarity index 99% rename from nwfile.c rename to src/nwfile.c index ad68792..2c40a86 100644 --- a/nwfile.c +++ b/src/nwfile.c @@ -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); diff --git a/nwfname.c b/src/nwfname.c similarity index 100% rename from nwfname.c rename to src/nwfname.c diff --git a/nwqconn.c b/src/nwqconn.c similarity index 99% rename from nwqconn.c rename to src/nwqconn.c index f30bb05..b1cc7e1 100644 --- a/nwqconn.c +++ b/src/nwqconn.c @@ -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); diff --git a/nwqueue.c b/src/nwqueue.c similarity index 100% rename from nwqueue.c rename to src/nwqueue.c diff --git a/nwroute.c b/src/nwroute.c similarity index 100% rename from nwroute.c rename to src/nwroute.c diff --git a/nwroute1.c b/src/nwroute1.c similarity index 100% rename from nwroute1.c rename to src/nwroute1.c diff --git a/nwrouted.c b/src/nwrouted.c similarity index 100% rename from nwrouted.c rename to src/nwrouted.c diff --git a/nwserv.c b/src/nwserv.c similarity index 99% rename from nwserv.c rename to src/nwserv.c index 064a499..1f12fb7 100644 --- a/nwserv.c +++ b/src/nwserv.c @@ -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; diff --git a/nwshare.c b/src/nwshare.c similarity index 100% rename from nwshare.c rename to src/nwshare.c diff --git a/nwvolume.c b/src/nwvolume.c similarity index 99% rename from nwvolume.c rename to src/nwvolume.c index 931c6e1..d516292 100644 --- a/nwvolume.c +++ b/src/nwvolume.c @@ -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]); diff --git a/sema.c b/src/sema.c similarity index 100% rename from sema.c rename to src/sema.c diff --git a/tools.c b/src/tools.c similarity index 99% rename from tools.c rename to src/tools.c index 50a6a47..9c3a45e 100644 --- a/tools.c +++ b/src/tools.c @@ -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; diff --git a/trustee.c b/src/trustee.c similarity index 100% rename from trustee.c rename to src/trustee.c diff --git a/unxfile.c b/src/unxfile.c similarity index 97% rename from unxfile.c rename to src/unxfile.c index 8242479..49d48e7 100644 --- a/unxfile.c +++ b/src/unxfile.c @@ -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 diff --git a/unxlog.c b/src/unxlog.c similarity index 100% rename from unxlog.c rename to src/unxlog.c diff --git a/sys/comm.c b/sys/comm.c new file mode 100644 index 0000000..3ac9d37 --- /dev/null +++ b/sys/comm.c @@ -0,0 +1 @@ +#include "../opt/comm.c" diff --git a/examples/comm.exe b/sys/comm.exe similarity index 100% rename from examples/comm.exe rename to sys/comm.exe diff --git a/examples/comm32.exe b/sys/comm32.exe similarity index 100% rename from examples/comm32.exe rename to sys/comm32.exe diff --git a/sys/net$log.dat.cmake b/sys/net$log.dat.cmake new file mode 100644 index 0000000..32d0799 --- /dev/null +++ b/sys/net$log.dat.cmake @@ -0,0 +1,149 @@ +MAP DISPLAY OFF +BREAK ON +Write +Write +Write "WELCOME %LOGIN_NAME TO MARS NWE +NETWORK" +Write "YOU ARE PRESENT AT THE HOME OF MARS NWE" +Write "WE HOPE YOU WILL ENJOY YOUR TIME WITH US!" +PAUSE +WRITE +WRITE +WRITE "GOOD %GREETING_TIME, %LOGIN_NAME" +WRITE "TODAY'S DATE: %MONTH_NAME %DAY, %YEAR" +WRITE "THE TIME IS: %HOUR: %MINUTE %AM_PM" +WRITE "YOU HAVE LOGGED IN FROM STATION: %STATION." +WRITE +WRITE +WRITE "FILE SERVER: %FILE_SERVER" +PAUSE +;GENERIC MAPPINGS (REGULAR) +;THIS COMMAND SETS UP ACCESS TO THE USERS HOME DIRECTORY. +;IT ALSO SETS UP ACCESS TO THE SCHOOL WIDE SHARED DIRECTORY. +IF MEMBER OF "EVERYONE" THEN + MAP F:=FS1\SYS: + MAP J:=FS1\APPS: + MAP K:=FS1\APPS:SHARED\GENERAL\ + MAP ROOT M:=FS1\APPS:\HOME\%LOGIN_NAME\ + ATTACH FS-CD-1/%LOGIN_NAME + SET TMP="c:\dos" + MAP G:=FS-CD-1\BCD2: + MAP H:=FS-CD-1\VOL3: + MAP I:=FS-CD-1\95049: + MAP N:=FS-CD-1\VOL2:INFOTRAC + MAP O:=FS-CD-1\960312A: + MAP P:=FS-CD-1\SOFTKEY: +END +IF LOGIN_NAME="SUPERVISOR" THEN + MAP ROOT M:=FS1_1\APPS:HOME\WARREN +END +IF MEMBER OF "SALES" THEN + MAP L:=FS1_1\APPS:SHARED\DEPARTMN END +IF MEMBER OF "IS" THEN + MAP L:=FS1_1\APPS:SHARED\DEPARTMN +END +IF MEMBER OF "TRAINING" THEN + MAP L:=FS1_1\APPS:SHARED\DEPARTMN +END +IF MEMBER OF "MANAGEMENT" THEN + MAP L:=FS1_1\APPS:SHARED\DEPARTMN +END +IF MEMBER OF "ADVERTISING" THEN + MAP L:=FS1_1\APPS:SHARED\DEPARTMN +END +IF MEMBER OF "ACCOUNTING" THEN + MAP L:=FS1_1\APPS:SHARED\DEPARTMN +END +IF MEMBER OF "SUPPORT" THEN + MAP L:=FS1_1\APPS:SHARED\DEPARTMN +END +IF MEMBER OF "OFFICE" THEN + MAP L:=FS1_1\APPS:SHARED\DEPARTMN +END +IF MEMBER OF "SERVICE" THEN + MAP L:=FS1_1\APPS:SHARED\DEPARTMN +END +IF MEMBER OF "FACULTY" THEN + MAP L:=FS1_1\APPS:SHARED\DEPARTMN +END +IF MEMBER OF "EXECUTIVES" THEN + MAP L:=FS1_1\APPS:SHARED\DEPARTMN +END +;IF MEMBER OF "3WS" THEN +; MAP L:=FS1-CD-1\95049: +;END +WRITE +WRITE +WRITE +;GENERIC MAPPINGS (SEARCH) + MAP INS S1:=SYS:PUBLIC +;THIS COMMAND SETS UP ACCESS TO DOS ON THE NETWORK +;MAP INS S2:=C:\ +;COMSPEC=S2:COMMAND.COM +;GENERIC SEARCH MAPPING TO HOME DIRECTORY + MAP INS S3:=M: +;GENERIC SEARCH MAPPING TO PEGASUS MAIL + MAP S16:=APPS:APPS\EMAIL\PEGASUS ;GENERIC SEARCH MAPPING TO AUTOMENU + MAP S16:=APPS:AUTOMENU +;GENERIC SEARCH MAPPING TO WORDPERFECT 5.1 + MAP S16:=APPS:APPS\WP\WP51 +;GENERIC SEARCH MAPPING TO QUATTRO PRO V + MAP S16:=APPS:APPS\SS\QPRO +WRITE +WRITE +WRITE +;IF MEMBER OF "3WS" THEN +; MAP INS S16:=SYS:TOOLS\LANSKOOL +; #TEACHER QUIET +END +IF MEMBER OF "APPLIED" THEN + MAP INS S16:=SYS:TOOLS\LANSKOOL + #STUDENT QUIET +END +IF MEMBER OF "3WS" THEN + MAP I:=FS1_1/INTERNET: + MAP L:=FS1-CD-1/95049: +END +WRITE +;THIS ESTABLISHES A SEARCH PATH TO THE GRADEBOOK +IF MEMBER OF "GRADEBOOK" THEN + MAP INS S4:=APPS:GRADE2NW +END +WRITE +WRITE +WRITE +WRITE +IF DAY_OF_WEEK="FRIDAY" THEN +WRITE "HANG IN THERE! THE WEEKEND IS COMING!" +END +PAUSE +FIRE PHASERS 4 TIMES +WRITE +WRITE +;THESE ARE THE SETUPS FOR THE PSERVER AND RPRINTER STATIONS +;ACCORDING TO LOGIN_NAME +IF LOGIN_NAME="PRINTSERV1" THEN #SYS:PUBLIC\PSERVER.EXE ROOM125_PS +END +WRITE +WRITE +WRITE +WRITE +;EVENTUALLY REMOVE WISECRAK LINE AND PUT IN CLOSING BAT FILE TO ;INCLUDE MENU AND VIRUS SCAN OF LOCAL HARDDRIVE. +;ALSO INCLUDE WSUPDATE LINE WITH # TO UPDATE FPROT. +;# SYS:PUBLIC\WISECRAK\WISECRAK.EXE +WRITE +WRITE +WRITE +WRITE +WRITE +WRITE +WRITE +PAUSE +DRIVE M: +IF P_STATION="0040333119DD" THEN + EXIT "FS1_2.BAT" +END +IF P_STATION<>"0040333119DD" THEN + EXIT "FS1_1.BAT" +END +;EXIT "FS1_1.BAT" \ No newline at end of file