From 35d12ee7aa4630af373421799bfac7162ae0b126 Mon Sep 17 00:00:00 2001 From: Mario Fetka Date: Tue, 5 Nov 2013 11:54:31 +0100 Subject: [PATCH] Update to pld patches and integrate koan patch --- CMakeLists.txt | 2 +- doc/old/Makefile | 101 -------------------------------- doc/old/config.h | 6 +- doc/old/mk | 1 - doc/old/mk.li | 143 --------------------------------------------- doc/old/nw.ini | 41 +++++++------ doc/old/tools.sh | 33 ----------- include/emutli.h | 10 +--- include/net.h | 4 +- include/tools.h | 1 + opt/CMakeLists.txt | 10 ++++ src/CMakeLists.txt | 7 --- src/emutli1.c | 2 +- src/namspace.c | 20 ++++++- src/nwserv.c | 4 +- src/tools.c | 8 ++- 16 files changed, 70 insertions(+), 323 deletions(-) delete mode 100644 doc/old/Makefile delete mode 100755 doc/old/mk delete mode 100755 doc/old/mk.li delete mode 100755 doc/old/tools.sh diff --git a/CMakeLists.txt b/CMakeLists.txt index 90f02e0..96c8c37 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,7 +7,7 @@ enable_language(C) SET (VERSION_MAJOR "0") SET (VERSION_MINOR "99") -SET (VERSION_PATCH "22") +SET (VERSION_PATCH "23") SET (VERSION_SUB "0") SET (VERSION_DEVEL "0") SET (VERSION_SUFFIX ".0") diff --git a/doc/old/Makefile b/doc/old/Makefile deleted file mode 100644 index 50200f8..0000000 --- a/doc/old/Makefile +++ /dev/null @@ -1,101 +0,0 @@ -# Makefile mars_nwe: 10-Feb-96 - -VPATH= - -.EXPORT_ALL_VARIABLES: -# defaults, can be overwritten in mk.li -V_VPATH=.. -OBJDIR=obj - -all: rmeflag mk.li config.h nw.ini - @if [ -r .eflag ] ; then \ - echo ""; \ - echo "********************************************************"; \ - cat .eflag; rm -f .eflag; \ - echo "";\ - echo "Please make your changes and run make again"; \ - echo "********************************************************"; \ - echo "";\ - echo ""; else ./mk.li && (\ - if [ -r .mk.notes ] ; then echo "" ; \ - echo ""; \ - echo "********************************************************" ; \ - echo ""; \ - cat .mk.notes; rm -f .mk.notes ; \ - echo ""; \ - echo "********************************************************" ; \ - echo ""; echo "" ; fi ) fi - -routed: - ./mk.li $@ - -install: - ./mk.li $@ - -reboot: - ./mk.li $@ - - -install_ini: nw.ini - ./mk.li $@ - -clean: mk.li nw.ini - ./mk.li $@ - rm -f .mk.notes - rm -f .eflag - -distrib: mk.li nw.ini - ./mk.li $@ - -distrib_bin: mk.li nw.ini - ./mk.li $@ - -bintgz: - ./mk.li $@ - -diff: - ./mk.li $@ - -showconf: - ./mk.li -s $@ - -mk.li: examples/mk.li - @if [ -r $@ ] ; then \ - cp -f $@ $@.org && ( \ - echo "********************************************************"; \ - echo "";\ - echo "saved: $@ -> $@.org, there is a new examples/$@"; \ - echo "";\ - echo "********************************************************"; \ - echo "" ) ; fi - @ echo "" - @ echo "" - @- cp -i examples/$@ . - @ touch -c $@ - @ echo "" - @ echo "********************************************************" - @ echo "" - @ echo "perhaps $@ is new and you need to edit it." - @ echo "" - @ echo "********************************************************" - @ echo "" - @ echo "" > .eflag - -config.h: examples/config.h - @if [ -r $@ ] ; then echo "note:examples/$@ is newer then $@" >> .eflag ;\ - echo "$@ will be touched now" >> .eflag; touch -c $@ ; \ - else cp examples/$@ . ; \ - echo "$@ created (from examples/$@) Please edit $@" >> .eflag;\ - echo "and change it to your requirements." >> .eflag ; fi - -rmeflag: - @- rm -f .eflag - -nw.ini: examples/nw.ini - @rm -f .mk.notes - @if [ -r $@ ] ; then echo "NOTE:examples/$@ is newer then $@" > .mk.notes ; \ - echo "please compare examples/$@ with $@" >> .mk.notes; \ - echo "make the changes you need and touch $@" >> .mk.notes; \ - else cp examples/$@ . ; \ - echo "$@ created (from examples/$@) Please edit $@" > .mk.notes;\ - echo "and change it to your requirements." >> .mk.notes ; fi diff --git a/doc/old/config.h b/doc/old/config.h index 3549736..d24fc68 100644 --- a/doc/old/config.h +++ b/doc/old/config.h @@ -11,10 +11,10 @@ # 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 "/etc/nwserv/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_BINDERY "/var/lib/nwserv/bindery" /* directory for bindery-files */ #endif #define PATHNAME_PIDFILES "/var/run" /* directory for 'pidfiles' */ @@ -82,7 +82,7 @@ /* <--------------- next is for linux only ----------------------------> */ #define INTERNAL_RIP_SAP 1 /* use internal/own rip/sap routines */ -#define SHADOW_PWD 0 /* change to '1' for shadow passwds */ +#define SHADOW_PWD 1 /* change to '1' for shadow passwds */ #define QUOTA_SUPPORT 0 /* change to '1' for quota support */ /* for sending 'Request being serviced' replys, /lenz */ diff --git a/doc/old/mk b/doc/old/mk deleted file mode 100755 index 088f013..0000000 --- a/doc/old/mk +++ /dev/null @@ -1 +0,0 @@ -make unxcomm && mv unxcomm /u3/pipes/. diff --git a/doc/old/mk.li b/doc/old/mk.li deleted file mode 100755 index 0be7419..0000000 --- a/doc/old/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/doc/old/nw.ini b/doc/old/nw.ini index e7fb1a6..b2263a7 100644 --- a/doc/old/nw.ini +++ b/doc/old/nw.ini @@ -158,9 +158,10 @@ # 1 PRIVAT ~/privat kO 700 600 # 1 WORLD /var/world kiO 777 666 # 1 FAXQ /var/spool/fax/faxqueue k - - 1 SYS /u3/SYS/ kt 711 600 - +1 SYS /var/lib/nwserv/sys kt -1 +1 PIPE /var/lib/nwserv/pipe kp +1 CDROM /mnt/cdrom kmnor +1 HOME ~ k -1 # ========================================================================= # Section 2: servername (optional) @@ -310,7 +311,7 @@ 4 0x22 eth0 ethernet_ii 1 - 4 0x0 * AUTO 1 +# 4 0x0 * AUTO 1 # Section 5: special device flags # ========================================================================= @@ -465,7 +466,7 @@ # Volumes depended values can be set in section 1. # 9 -1 0640 # -9 0751 0640 +9 0755 0664 # Section 10: UID and GID with minimal rights # ========================================================================= @@ -499,8 +500,8 @@ # 10 65534 # 11 65534 - 10 65534 - 11 65534 + 10 99 + 11 99 # ========================================================================= @@ -549,7 +550,7 @@ # Example: # 12 SUPERVISOR nw-adm top-secret -12 SUPERVISOR root +12 SUPERVISOR root top-secret # ========================================================================= @@ -632,6 +633,8 @@ 15 0 top-secret +13 GUEST nobody - 0x1 + # ========================================================================= # Section 16: Tests on startup @@ -715,9 +718,8 @@ # 21 OCTOPUSS # 21 FAXPRINT - /usr/bin/psfaxprn /var/spool/fax/faxqueue # ------------------------------------------------------------------------- -21 LP - lpr - -#21 LP_PS - +21 LP SYS:/PRINT/LP lpr +21 LP_PS # ========================================================================= @@ -735,7 +737,7 @@ # Examples: # 22 PS1 OCTOPUSS -#22 PS_NWE LP_PS 1 +22 PS_NWE LP_PS 1 # ========================================================================= @@ -769,11 +771,11 @@ # # # 45 = path for bindery file's -45 /var/nwserv/db +45 /var/lib/nwserv/bindery # 46 = path for attribute handling -46 /var/nwserv/attrib +46 /var/lib/nwserv/attrib # 47 = path for trustee handling -47 /var/nwserv/trustees +47 /var/lib/nwserv/trustees # ========================================================================= # Section 50: Conversion tables by Victor Khimenko # Tables for DOS->Unix names translation & upper/lowercase translations @@ -791,6 +793,7 @@ # Examples: # 50 /etc/nwserv.cnv +50 /etc/nwserv/nwserv.cnv # Changing defaults from config.h # more information in config.h @@ -835,7 +838,7 @@ #201 syslog # if filename == syslog then syslogd will be used for # all messages -202 0x1 # flag in hex notation +202 0x0 # flag in hex notation # 0x0=append all messages to logfile. # & 0x1=creat new logfile instead of appending. #202 0x3 # & 0x2=use syslogd for error messages instead of logfile. @@ -845,7 +848,7 @@ # Sections 210,211: timing -210 10 # 1 .. 600 (default 10) seconds after server +210 5 # 1 .. 600 (default 10) seconds after server # really goes down after a down command 211 60 # 10 .. 600 (default 60) broadcasts every x seconds @@ -856,7 +859,7 @@ # ( normally minutes ) 301 /var/log/nw.routes # filename of logfile -302 0x1 # flags will be interpreted as hex value. +302 0x0 # flags will be interpreted as hex value. # 0 = append to this file # & 0x1 = creat new routing info file # & 0x2 = split info into several files @@ -870,7 +873,7 @@ # Section 400: # station file for special handling of stations. -400 /etc/nwserv.stations # for syntax see file in the examples directory. +400 /etc/nwserv/nwserv.stations # for syntax see file in the examples directory. # Section 401: nearest server diff --git a/doc/old/tools.sh b/doc/old/tools.sh deleted file mode 100755 index 5b24854..0000000 --- a/doc/old/tools.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/sh - -yesno() -{ - echo "" - echo $@ - while true; do - echo "please answer with (Y)es or (N)o and ." - read X - case "$X" in - ('y'|'Y') - return 0 - ;; - ('n'|'N') - return 1 - ;; - *) - ;; - esac - done -} - -COMMAND=$1 -shift - -case "$COMMAND" in - 'yesno') - if yesno $@ ; then exit 0; fi - ;; - -esac - -exit 1 diff --git a/include/emutli.h b/include/emutli.h index 35391a3..35b06d6 100644 --- a/include/emutli.h +++ b/include/emutli.h @@ -35,19 +35,13 @@ #else # include # include -# ifdef _GNU_SOURCE_ -# include -# else -# include -# endif +# include #endif typedef unsigned char uint8; typedef unsigned short int uint16; -/* amd64 not working +/* typedef unsigned long int uint32; */ typedef unsigned int uint32; -*/ -typedef unsigned long int uint32; #define IPX_NET_SIZE 4 #define IPX_NODE_SIZE 6 diff --git a/include/net.h b/include/net.h index 83f0fb7..5137c8a 100644 --- a/include/net.h +++ b/include/net.h @@ -173,11 +173,11 @@ extern int errno; #endif #ifndef MAX_CONNECTIONS -# define MAX_CONNECTIONS 5 /* maximum Number of connections */ +# define MAX_CONNECTIONS 50 /* maximum Number of connections */ #endif #ifndef MAX_NW_VOLS -# define MAX_NW_VOLS 10 /* maximum Number of volumes */ +# define MAX_NW_VOLS 20 /* maximum Number of volumes */ #endif #ifndef MAX_FILE_HANDLES_CONN diff --git a/include/tools.h b/include/tools.h index e8115ca..6e5f8d0 100644 --- a/include/tools.h +++ b/include/tools.h @@ -27,6 +27,7 @@ #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/opt/CMakeLists.txt b/opt/CMakeLists.txt index 1095803..71ad281 100644 --- a/opt/CMakeLists.txt +++ b/opt/CMakeLists.txt @@ -56,6 +56,11 @@ install(FILES nwserv.stations DESTINATION ${MARS_NWE_INSTALL_FULL_CONFDIR}) install(FILES nw.ini.cnv.437 DESTINATION ${MARS_NWE_INSTALL_FULL_CONFDIR} RENAME nwserv.cnv.437) install(FILES nw.ini.cnv.cyr DESTINATION ${MARS_NWE_INSTALL_FULL_CONFDIR} RENAME nwserv.cnv.cyr) install(FILES nw.ini.cnv.min DESTINATION ${MARS_NWE_INSTALL_FULL_CONFDIR} RENAME nwserv.cnv.min) +install(FILES nw.ini.cnv.pl.852-iso2 DESTINATION ${MARS_NWE_INSTALL_FULL_CONFDIR} RENAME nwserv.cnv.pl.852-iso2) +install(FILES nw.ini.cnv.pl.852-none DESTINATION ${MARS_NWE_INSTALL_FULL_CONFDIR} RENAME nwserv.cnv.pl.852-none) +install(FILES nw.ini.cnv.pl.cp1250-iso2 DESTINATION ${MARS_NWE_INSTALL_FULL_CONFDIR} RENAME nwserv.cnv.pl.cp1250-iso2) +install(FILES nw.ini.cnv.pl.mazovia-iso2 DESTINATION ${MARS_NWE_INSTALL_FULL_CONFDIR} RENAME nwserv.cnv.pl.mazovia-iso2) + install(FILES nwopt DESTINATION ${MARS_NWE_INSTALL_FULL_FILEDIR}/SYS RENAME .nwopt.vol) install(FILES nwopt DESTINATION ${CMAKE_INSTALL_FULL_SYSCONFDIR}/skel RENAME .nwopt) @@ -65,3 +70,8 @@ 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}) +install(FILES prn DESTINATION ${MARS_NWE_INSTALL_FULL_LIBEXECDIR}) +install(FILES prn-clr DESTINATION ${MARS_NWE_INSTALL_FULL_LIBEXECDIR}) +install(FILES uptime DESTINATION ${MARS_NWE_INSTALL_FULL_LIBEXECDIR}) + + diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 19f8d7e..8bd4cfb 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -8,19 +8,12 @@ # Dependencies ############## - if (CMAKE_SYSTEM_NAME MATCHES Linux) add_definitions( -pipe -Wall -DLINUX -D_GNU_SOURCE ) endif (CMAKE_SYSTEM_NAME MATCHES Linux) -IF(UNIX) - IF(CMAKE_COMPILER_IS_GNUCC) - SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall") - ENDIF(CMAKE_COMPILER_IS_GNUCC) -ENDIF(UNIX) - add_definitions( -D_VERS_H_=${VERSION_MAJOR} -D_VERS_L_=${VERSION_MINOR} diff --git a/src/emutli1.c b/src/emutli1.c index 5aac1fd..00b1b5e 100644 --- a/src/emutli1.c +++ b/src/emutli1.c @@ -339,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 { - struct ipx_config_data cfgdata; + ipx_config_data cfgdata; struct sockaddr_ipx ipxs; ioctl(sock, SIOCIPXCFGDATA, &cfgdata); org_auto_interfaces = diff --git a/src/namspace.c b/src/namspace.c index baed42d..1697d6f 100644 --- a/src/namspace.c +++ b/src/namspace.c @@ -1867,6 +1867,15 @@ static int nw_open_creat_file_or_dir( #endif creatmode = 1; } + + /* + * 18/10/2007 - pascalek (pascalek@pld-linux.org): + * If file is opened just in truncate mode (at least windows XP Client is + * affected) its opencreatemode equals 0x2. Opening it with creatmode == 0 + * corrupt files. + */ + if (opencreatmode == 0x2) + creatmode = 1; if ((result = file_creat_open(dbe->nwpath.volume, nwpath_2_unix(&dbe->nwpath, 2), &(dbe->nwpath.statb), @@ -2040,9 +2049,18 @@ static int nw_delete_file_dir(int namespace, int searchattrib, DIR_BASE_ENTRY *dbe=dir_base[result]; if (get_volume_options(dbe->nwpath.volume) & VOL_OPTION_READONLY) result = -0x8a; - else result=func_search_entry(dbe, namespace, + else { + result=func_search_entry(dbe, namespace, search_entry, strlen(search_entry), searchattrib, delete_file_dir, NULL); + /* ncpfs deletes file with file handle and NAME_DOS so we have + to try NAME_OS2 too while deleting files */ + if ((result == -255) && (namespace == NAME_DOS)) { + result=func_search_entry(dbe, NAME_OS2, + search_entry, strlen(search_entry), searchattrib, + delete_file_dir, NULL); + } + } } return(result); } diff --git a/src/nwserv.c b/src/nwserv.c index 1f12fb7..930cc3c 100644 --- a/src/nwserv.c +++ b/src/nwserv.c @@ -1238,7 +1238,7 @@ static int server_is_down=0; static int usage(char *prog) { - fprintf(stderr, "============== mars_nwe by Koan ===============\n\n") ; // (M@) + fprintf(stderr, "============== mars_nwe by Geos One ===============\n\n") ; // (M@) #if IN_NWROUTED || INTERNAL_RIP_SAP @@ -1330,7 +1330,7 @@ int main(int argc, char **argv) case 'f' : init_mode = 5; break; case 'q' : if (init_mode == 2) init_mode=4; break; case 'v' : - case 'V' : fprintf(stderr, "\n%s:Version %d.%d.pl%d [ KOAN ]\n", + case 'V' : fprintf(stderr, "\n%s:Version %d.%d.pl%d [ GEOS_ONE ]\n", argv[0], _VERS_H_, _VERS_L_, _VERS_P_ ); return(0); default : return(usage(argv[0])); diff --git a/src/tools.c b/src/tools.c index 9c3a45e..d55ec21 100644 --- a/src/tools.c +++ b/src/tools.c @@ -51,7 +51,7 @@ int act_ncpsequence=0; /* for debugging */ int act_connection=0; /* which connection (nwconn, nwbind) */ time_t act_time=0L; /* actual time */ -static FILE *logfile=NULL; +FILE *logfile=NULL; static int use_syslog=0; /* 1 = use syslog for all loggings * 2 = only for errors */ @@ -160,6 +160,7 @@ void xdprintf(int dlevel, int mode, char *p, ...) va_list ap; static char *buffered=NULL; int errnum = errno; + if (!logfile) logfile = stderr; if (nw_debug >= dlevel) { if (use_syslog==1) { char *buf; @@ -227,6 +228,10 @@ void errorp(int mode, char *what, char *p, ...) FILE *lologfile = logfile; char errbuf[200]; const char *errstr = errbuf; + if (!logfile) { + lologfile = stderr; + logfile = stderr; + } if (mode > 9) { errnum = -1; mode -= 10; @@ -277,6 +282,7 @@ FILE *open_nw_ini(void) char *fname=FILENAME_NW_INI; FILE *f=fopen(fname, "r"); int uid=geteuid(); + if (!logfile) logfile = stderr; if (f == (FILE*)NULL && uid > 0) { seteuid(0); f=fopen(fname, "r");