From be2d60525af04fc6950425035cdb18db1685e61b Mon Sep 17 00:00:00 2001 From: Mario Fetka Date: Mon, 14 Nov 2011 19:58:21 +0100 Subject: [PATCH] update patches --- CMakeLists.txt | 2 +- include/emutli.h | 5 +- include/net.h | 2 + opt/nw.ini.cnv.pl.852-iso2 | Bin 0 -> 1024 bytes opt/nw.ini.cnv.pl.852-none | Bin 0 -> 1024 bytes opt/nw.ini.cnv.pl.cp1250-iso2 | Bin 0 -> 1024 bytes opt/nw.ini.cnv.pl.mazovia-iso2 | Bin 0 -> 1024 bytes opt/nwserv.logrotate | 11 ++++ opt/prn | 19 ++++++ opt/prn-clr | 7 +++ opt/uptime | 2 + src/CMakeLists.txt | 8 ++- src/namspace.c | 10 +-- src/nwattrib.c | 14 ++++- src/nwcrypt.c | 3 +- src/nwfile.c | 111 ++++++++++++++++++++------------- src/nwshare.c | 34 +++++++--- src/trustee.c | 19 +++++- 18 files changed, 183 insertions(+), 64 deletions(-) create mode 100644 opt/nw.ini.cnv.pl.852-iso2 create mode 100644 opt/nw.ini.cnv.pl.852-none create mode 100644 opt/nw.ini.cnv.pl.cp1250-iso2 create mode 100644 opt/nw.ini.cnv.pl.mazovia-iso2 create mode 100644 opt/nwserv.logrotate create mode 100755 opt/prn create mode 100755 opt/prn-clr create mode 100755 opt/uptime diff --git a/CMakeLists.txt b/CMakeLists.txt index 4982c37..90f02e0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,7 +27,7 @@ IF (VERSION_DEVEL) SET (VERSION_PATCH "${VERSION_PATCH}.${CASA_WC_REVISION})${VERSION_SUFFIX}") ENDIF (VERSION_DEVEL) -SET (MARS_NWE_VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}") +SET (MARS_NWE_VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.pl${VERSION_PATCH}") INCLUDE(${CMAKE_ROOT}/Modules/GNUInstallDirs.cmake) INCLUDE(${CMAKE_MODULE_PATH}/MarsNweInstallDirs.cmake) diff --git a/include/emutli.h b/include/emutli.h index a545dcd..35391a3 100644 --- a/include/emutli.h +++ b/include/emutli.h @@ -44,7 +44,10 @@ typedef unsigned char uint8; typedef unsigned short int uint16; -typedef unsigned int uint32; +/* amd64 not working +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 48185b2..83f0fb7 100644 --- a/include/net.h +++ b/include/net.h @@ -23,7 +23,9 @@ #ifndef _XOPEN_SOURCE # define _XOPEN_SOURCE 1 #endif +#ifndef _SVID_SOURCE #define _SVID_SOURCE 1 +#endif #include #include #include diff --git a/opt/nw.ini.cnv.pl.852-iso2 b/opt/nw.ini.cnv.pl.852-iso2 new file mode 100644 index 0000000000000000000000000000000000000000..5ca316d045a4b0396c6f47f847c367c3ea485acb GIT binary patch literal 1024 zcmZQzWMXDvWn<^yMC+6cQE@6%&_`l#-T_m6KOcR8m$^Ra4i{)Y8_`)zddH zG%_|ZH8Z!cw6eCbwX=6{baHlab#wRd^z!!c_45x13a(;~Y1A9wmd zivRxhxoG~M4)g!Q2aA_1S+;z|idDTB@xOO3!T1OH|1mA&A9wmDA^k(+e|29QH2!CR jMC+6cQE@6%&_`l#-T_m6KOcR8m$^Ra4i{)Y8_`)zddH zG%_|ZH8Z!cw6eCbwX=6{baHlab#wRd^z!!c_45x13WQW?CS1`>T{kjanj@|Q>O(N z&zv=Tj?cXL3l`=tc1&Eh+%E zCr+L^edg@B^A|2&x_ss8wd*%--nxC~?!Ei|4&lpTB(l z_Wj4tU%&tS{r8_?Q24*Cy#wU`-oAdQ|EJFY`F}3R|BDtcS-Ncbij}KYWB7mXK7#&# z@bJ;&Cj;q!-01@;{`=eKqWOP1-2V?2FIfWg|B6+;nEu~Ol>Z;o(*L;AHwoz<8vm>N h+Mw}2104SykoaE;jQ^F`;(s6E_+Rw!(Gz^}4*-63_@e*- literal 0 HcmV?d00001 diff --git a/opt/nw.ini.cnv.pl.cp1250-iso2 b/opt/nw.ini.cnv.pl.cp1250-iso2 new file mode 100644 index 0000000000000000000000000000000000000000..7c29d384b833115e59c485edd6f2bf942056ab27 GIT binary patch literal 1024 zcmZQzWMXDvWn<^yMC+6cQE@6%&_`l#-T_m6KOcR8m$^Ra4i{)Y8_`)zddH zG%_|ZH8Z!cw6eCbwX=6{baHlab#wRd^z!!c_45x13`o>x6PfmXTicnidRhmRaR zcKpQ2Q>V|IJ$L@X#Y>m3T)lSv#?4!|@7%q2|G~pYkDok!_WZ@mSFhi^efR#u$4{TX zeEs(Q$IoBC|NQ;;pJ5RBzo)maAKCwN=FXeHU@6f5OMAfn?+5vRC&>SEw(r=vYxn%2 z;D6ld10(*?{ogZpUOzbgm!ib~VsQK~1;_t-;^O}pF#bF$xgWc_rudaF#Zwg{~0j-zk;OykC#4^lKug_R{jtG literal 0 HcmV?d00001 diff --git a/opt/nw.ini.cnv.pl.mazovia-iso2 b/opt/nw.ini.cnv.pl.mazovia-iso2 new file mode 100644 index 0000000000000000000000000000000000000000..ca13722041e685a1d7a4c7380a07bec1d1b9a67f GIT binary patch literal 1024 zcmZQzWMXDvWn<^yMC+6cQE@6%&_`l#-T_m6KOcR8m$^Ra4i{)Y8_`)zddH zG%_|ZH8Z!cw6eCbwX=6{baHlab#wRd^z!!c_45x13nAuU@}-`|kaRkDoq& z`TFhqkDtGO|M~mxKf|E#e;dUAy?y-?CQh0>W$Lu)Gl2e|Gk4zn1^tWWELl2ZImrJD z)~;K)p>5NoEnDY-{l9GQzU2`APX+pa0>uAIFD=IOe=pGg6CwUz@@WxW{f|3+AjN+_ z#Q#%){+}=h$^SFvFIc#E@zSLW77p6@$DO`ONdNHoZ<`2;|K4fS=KT{ty5F literal 0 HcmV?d00001 diff --git a/opt/nwserv.logrotate b/opt/nwserv.logrotate new file mode 100644 index 0000000..3dacd28 --- /dev/null +++ b/opt/nwserv.logrotate @@ -0,0 +1,11 @@ +/var/log/nw.log { + postrotate + /bin/killall -HUP nwserv + endrotate +} + +/var/log/nw.routes { + postrotate + /bin/killall -HUP nwserv + endrotate +} diff --git a/opt/prn b/opt/prn new file mode 100755 index 0000000..86bff37 --- /dev/null +++ b/opt/prn @@ -0,0 +1,19 @@ +#!/bin/sh +# print using lpr nad lp printer when writing +# return spool and printer status when reading +# + +PRINTER=lp + +case "$1" in + WRITE) + /usr/bin/lpr -P $PRINTER - + ;; + READ) + CR=`echo -n -e '\r'` + /usr/sbin/lpc status $PRINTER | sed "s/$/$CR/g" + /usr/bin/lpq -l -P $PRINTER | sed "s/$/$CR/g" + ;; + *) + ;; +esac diff --git a/opt/prn-clr b/opt/prn-clr new file mode 100755 index 0000000..c306788 --- /dev/null +++ b/opt/prn-clr @@ -0,0 +1,7 @@ +#!/bin/sh +# clear print spool +# + +PRINTER=lp + +/usr/bin/lprm -P $PRINTER - diff --git a/opt/uptime b/opt/uptime new file mode 100755 index 0000000..f31249e --- /dev/null +++ b/opt/uptime @@ -0,0 +1,2 @@ +#!/bin/sh +[ "$1" = READ ] && echo -e "`uptime`\r" diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0abe02a..19f8d7e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -11,10 +11,16 @@ if (CMAKE_SYSTEM_NAME MATCHES Linux) add_definitions( - -DLINUX -D_GNU_SOURCE -Dsignal=__sysv_signal + -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/namspace.c b/src/namspace.c index e54ab3e..baed42d 100644 --- a/src/namspace.c +++ b/src/namspace.c @@ -1,9 +1,9 @@ -/* namspace.c 21-Apr-00 : NameSpace Services, mars_nwe */ +/* namspace.c 07-Oct-00 : NameSpace Services, mars_nwe */ /* !!!!!!!!!!!! NOTE !!!!!!!!!! */ /* Its still dirty, but it should work fairly well */ -/* (C)opyright (C) 1993,1998 Martin Stover, Marburg, Germany +/* (C)opyright (C) 1993,2000 Martin Stover, Marburg, Germany * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -24,7 +24,7 @@ * * mst:21-Apr-00: fixed routine 0x57/0x18, Get Name Spaces Loaded * count_namespaces is word field, not byte. - * + * mst:07-Oct-00: fixed nw_search_file_dir() * */ @@ -1750,7 +1750,9 @@ int nw_search_file_dir(int namespace, int datastream, if (dest_entry > -1) { char *funixname; dest_dbe=dir_base[dest_entry]; - funixname = alloc_nwpath2unix(&(dbe->nwpath), 2); + //funixname = alloc_nwpath2unix(&(dbe->nwpath), 2); + /* mst:07-Oct-00 corrected */ + funixname = alloc_nwpath2unix(&(dest_dbe->nwpath), 2); (void) nwp_stat(&(dest_dbe->nwpath), "nw_search_file_dir"); result = build_dir_info(dest_dbe, funixname, datastream, diff --git a/src/nwattrib.c b/src/nwattrib.c index c72f4b3..bebb6de 100644 --- a/src/nwattrib.c +++ b/src/nwattrib.c @@ -1,5 +1,5 @@ -/* nwattrib.c 10-May-98 */ -/* (C)opyright (C) 1998 Martin Stover, Marburg, Germany +/* nwattrib.c 07-Oct-00 */ +/* (C)opyright (C) 1998,2000 Martin Stover, Marburg, Germany * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,6 +18,12 @@ /* Attrib routines for mars_nwe */ +/* history since 07-Oct-00 + * + * mst:07-Oct-00: unix dot files are hidden as default. + * + */ + #include "net.h" #include #include "unxfile.h" @@ -113,6 +119,10 @@ uint32 get_nw_attrib_dword(int volume, char *unixname, struct stat *stb) if (S_ISDIR(stb->st_mode)) attrib |= FILE_ATTR_DIR; else attrib &= (~FILE_ATTR_DIR); + } else { /* mst: 07-Oct-00, mark unix dot files as hidden */ + char *p = strrchr(unixname, '/'); + if (p && *(p+1) == '.' && *(p+2) != 0 && *(p+2) != '.' ) + attrib |= FILE_ATTR_H; /* We say hidden here */ } if (voloptions & VOL_OPTION_READONLY){ diff --git a/src/nwcrypt.c b/src/nwcrypt.c index 8d9caef..633abff 100644 --- a/src/nwcrypt.c +++ b/src/nwcrypt.c @@ -119,8 +119,7 @@ static buf32 encryptkeys = 0xF4,0x47,0xDC,0xA7,0xEC,0xCF,0x50,0xC0}; #include "nwcrypt.h" - -extern void memset(void* p, int c, int size); +#include static void shuffle1(buf32 temp, unsigned char *target) diff --git a/src/nwfile.c b/src/nwfile.c index 2c40a86..59898ac 100644 --- a/src/nwfile.c +++ b/src/nwfile.c @@ -772,6 +772,7 @@ int nw_read_file(int fhandle, uint8 *data, int size, uint32 offset) if (fh->fh_flags & FH_IS_PIPE_COMMAND) open_pipe_command(fh, 0); if (fh->fd > -1) { + int rw_lck; /* pcz: 07-12-00 */ if (fh->fh_flags & FH_IS_PIPE) { /* PIPE */ int readsize=size; #if 1 @@ -813,18 +814,36 @@ int nw_read_file(int fhandle, uint8 *data, int size, uint32 offset) } #endif } else if (use_mmap && fh->p_mmap) { - /* added by: Ingmar Thiemann - * Netware allows no read/write on locked sections + /* pcz: 07-12-00 + * there is a problem with blocking reading/writing from + * locked file region. Some DOS aplications uses phantom + * locks at very high file region (offset>0x7ffffff) to + * eliminate that. In POSSIX locks cannot be set at such + * offset so we are remaping them (offset & 0x7fffffff) + * this demages some database systems (locking region at + * 0x80000000-0x8000000f bloks reading of first 16 bytes of + * file) so we need an option to disable such feature as + * temporary solution (section 8, flags 0x100). + * I think we have to write our own 32bit lock system + * (some samba compatible system will be realy nice for + * mixed clients - who is similar to samba locks?) */ - /* check for lock */ - struct flock flockd; - flockd.l_type = F_RDLCK; /* if file is not locked exclusive - * we should allow read it. /lenz */ - flockd.l_whence = SEEK_SET; - flockd.l_start = offset; - flockd.l_len = size; - fcntl(fh->fd, F_GETLK, &flockd); - if (flockd.l_type != F_WRLCK) { + rw_lck=(entry8_flags & 0x100); + if (!rw_lck) { + /* added by: Ingmar Thiemann + * Netware allows no read/write on locked sections + */ + /* check for lock */ + struct flock flockd; + flockd.l_type = F_RDLCK; /* if file is not locked exclusive + * we should allow read it. /lenz */ + flockd.l_whence = SEEK_SET; + flockd.l_start = offset; + flockd.l_len = size; + fcntl(fh->fd, F_GETLK, &flockd); + rw_lck=(flockd.l_type != F_WRLCK); + } + if (rw_lck) { while (1) { if (offset < fh->size_mmap) { if (size + offset > fh->size_mmap) @@ -849,17 +868,21 @@ int nw_read_file(int fhandle, uint8 *data, int size, uint32 offset) } } if (fh->offd > -1L) { - /* added by: Ingmar Thiemann - * Netware allows no read/write on locked sections - */ - /* check for lock */ - struct flock flockd; - flockd.l_type = F_WRLCK; - flockd.l_whence = SEEK_SET; - flockd.l_start = offset; - flockd.l_len = size; - fcntl(fh->fd, F_GETLK, &flockd); - if (flockd.l_type == F_UNLCK) { + rw_lck=(entry8_flags & 0x100); /* pcz: 07-12-00 */ + if (!rw_lck) { + /* added by: Ingmar Thiemann + * Netware allows no read/write on locked sections + */ + /* check for lock */ + struct flock flockd; + flockd.l_type = F_WRLCK; + flockd.l_whence = SEEK_SET; + flockd.l_start = offset; + flockd.l_len = size; + fcntl(fh->fd, F_GETLK, &flockd); + rw_lck=(flockd.l_type == F_UNLCK); + } + if (rw_lck) { if ((size = read(fh->fd, data, size)) > -1) { fh->offd+=(long)size; } else { @@ -912,19 +935,22 @@ int nw_write_file(int fhandle, uint8 *data, int size, uint32 offset) fh->offd = lseek(fh->fd, offset, SEEK_SET); if (size) { if (fh->offd > -1L) { - /* added by: Ingmar Thiemann - * Netware allows no read/write on locked sections - */ - /* check for lock */ - struct flock flockd; - flockd.l_type = F_WRLCK; - flockd.l_whence = SEEK_SET; - flockd.l_start = offset; - flockd.l_len = size; - fcntl(fh->fd, F_GETLK, &flockd); - if (flockd.l_type == F_UNLCK) { - /*if (share_lock( fh->st_dev, fh->st_ino, fh->fd, 2, offset, size ) == 0) {*/ - + int rw_lck=(entry8_flags & 0x100); /* pcz: 07-12-00 */ + if (!rw_lck) { + /* added by: Ingmar Thiemann + * Netware allows no read/write on locked sections + */ + /* check for lock */ + struct flock flockd; + flockd.l_type = F_WRLCK; + flockd.l_whence = SEEK_SET; + flockd.l_start = offset; + flockd.l_len = size; + fcntl(fh->fd, F_GETLK, &flockd); + rw_lck=(flockd.l_type == F_UNLCK); + /* rw_lck=(share_lock( fh->st_dev, fh->st_ino, fh->fd, 2, offset, size ) == 0); */ + } + if (rw_lck) { size = write(fh->fd, data, size); fh->offd+=(long)size; if (!fh->modified) @@ -1017,6 +1043,9 @@ int nw_log_physical_record(int fhandle, uint32 offset, * the rest of the file, starting from the offset, to do this with * linux, a size of 0 has to be passed to the fcntl function. * ( Peter Gerhard ) + * + * PCZ: 30-Jul-01 + * offset and size conversion moved to share_lock function */ result = share_lock( fh->st_dev, fh->st_ino, @@ -1030,14 +1059,10 @@ int nw_log_physical_record(int fhandle, uint32 offset, : ( (fh->fh_flags & FH_IS_READONLY) ? 3 /* no exclusiv lock */ : lock_flag ), - - offset & 0x7fffffff, - - (size==MAX_U32) - ? 0 - : size & 0x7fffffff, - - timeout); + + offset, + size, + timeout ); XDPRINTF((4, 0, "nw_log_phy_rec:pid=%d uid=%d flag=%2d, result=%d, fh=%d, offset=%d, size=%d, timeout=%d", getpid(), geteuid(), lock_flag, result, fhandle, offset, size, timeout)); diff --git a/src/nwshare.c b/src/nwshare.c index fbd8d33..1b704fc 100644 --- a/src/nwshare.c +++ b/src/nwshare.c @@ -319,11 +319,11 @@ int share_file(int dev, int inode, int open_mode, int action) #if 0 /* mst:13-Apr-00, I think this is all NOT needed. */ if (entry8_flags & 0x100) { /* dos ? mode */ - if ( (open_mode & 0x10) ? !(act_mode & 0x10) && (act_mode & 0x06) : - (act_mode & 0x10) && (open_mode & 0x06)) + if ((open_mode & 0x10) != (act_mode & 0x10)) result=-1; } else { /* Standard Novell mode mode, i hope */ - if ((open_mode & 0x10) != (act_mode & 0x10)) + if ( (open_mode & 0x10) ? !(act_mode & 0x10) && (act_mode & 0x06) : + (act_mode & 0x10) && (open_mode & 0x06)) result = -1; /* if one file opened compatible then all files must be opened compatible */ #if 0 @@ -501,6 +501,18 @@ int share_lock( int dev, int inode, int fd, int action, sprintf(tbuf,"dev=0x%x,inode=%d,fd=%d,action=%d,lock_flag=%d", dev, inode, fd, action, lock_flag); +#if 0 + /* pcz: 30-Jul-01 different locking conversion from 32Bit space + Now it's a dirty hack only, It should be an option in nwserv.conf */ + if (l_start & 0x80000000) + l_start |= 0x40000000; /* 0x20000000 - other possible value */ +#endif + + l_start &= 0x7fffffff; + + if (l_len==MAX_U32) + l_len = 0; + if (!_get_inode( dev, inode, &sd, &si )) { XDPRINTF((1, 0, "Could not find share for lock %s", tbuf)); return -1; @@ -511,9 +523,15 @@ int share_lock( int dev, int inode, int fd, int action, flockd.l_len = l_len; /* find lock */ + /* pcz: 23-Aug-2001 + 1) some application remove locks using offset only and len=0 + 2) we cannot compare offset1 < offset2 + size2 because the + sum can be signed (minus) eg. 0x7fffffff + 1 = 0x80000000 + It should be offset1 - offset2 < size2 */ for (psl=&si->first_lock; *psl; psl=&(*psl)->next) { - if ((*psl)->l_start < l_start + l_len - || (!l_len && (*psl)->l_start <= l_start)) { + if ((*psl)->l_start - l_start < l_len + || (!l_len && ( action ? (*psl)->l_start <= l_start + : (*psl)->l_start == l_start))) { sl = *psl; break; } @@ -521,7 +539,9 @@ int share_lock( int dev, int inode, int fd, int action, if (!action) { /* unlock */ - if (sl && sl->fd == fd && sl->l_start == l_start && sl->l_len == l_len) { + if (sl && sl->fd == fd && sl->l_start == l_start && + (sl->l_len == l_len || l_len ==0)) { + flockd.l_len = sl->l_len; flockd.l_type = F_UNLCK; fcntl( fd, F_SETLK, &flockd ); *psl = sl->next; @@ -532,7 +552,7 @@ int share_lock( int dev, int inode, int fd, int action, } } else { /* lock or test */ - if (sl && (l_start < sl->l_start + sl->l_len || !sl->l_len) + if (sl && (l_start - sl->l_start < sl->l_len || !sl->l_len) && (sl->exclusive || lock_flag == 1) ) result = -0xfd; /* collision */ else { diff --git a/src/trustee.c b/src/trustee.c index dae5cbe..e592bac 100644 --- a/src/trustee.c +++ b/src/trustee.c @@ -23,7 +23,9 @@ * mst:01-Jun-00: removed SIG_SEGV in get_eff_rights_by_trustees(), * when stat error * mst:01-Sep-00: pcz:added real unix rights patch from Przemyslaw Czerpak - * + * mst:07-Sep-00: corrected trustee rights of subdirs. + * mst:07-Oct-00: corrected result from tru_eff_rights_exists() + * and un_nw_rights(). * */ @@ -101,6 +103,9 @@ static int un_nw_rights(int voloptions, uint8 *unixname, struct stat *stb) norights |= TRUSTEE_E; /* no erase right */ norights |= TRUSTEE_M; /* no modify rights */ } + /* mst:07-Oct-00 */ + if ( (!is_dir) && !(accp & R_OK) ) + norights |= TRUSTEE_F; /* no file scan rights */ } if (voloptions & VOL_OPTION_READONLY) { @@ -739,7 +744,9 @@ static int insert_ugid_trustee(IDS_TRUSTEE *ugid_trustees, int count, { while (count--) { if (ugid_trustees->id==id) { - ugid_trustees->trustee|=trustee; + /* ugid_trustees->trustee|=trustee; wrong */ + ugid_trustees->trustee = trustee; /* correct, mst:07-Sep-00 */ + /* new trustees must always override the current one */ return(0); } ugid_trustees++; @@ -942,7 +949,13 @@ int tru_eff_rights_exists(int volume, uint8 *unixname, struct stat *stb, if ((lookfor == TRUSTEE_T) && (rights&TRUSTEE_F) ) /* mst: 13-Apr-00 */ return(0); - return(((rights & TRUSTEE_S)||((rights&lookfor)==lookfor)) ? 0 : -1); +/* return(((rights & TRUSTEE_S)||((rights&lookfor)==lookfor)) ? 0 : -1);*/ + if (rights) { + /* mst: 07-Oct-00, -1 as result was bad, because nw_search_file_dir() + * expected the real rights. + */ + return(((rights & TRUSTEE_S)||((rights&lookfor)==lookfor)) ? 0 : rights); + } else return(1 << 31); // no rights }