update patches

This commit is contained in:
Mario Fetka 2011-11-14 19:58:21 +01:00
parent 53086a5b03
commit be2d60525a
18 changed files with 183 additions and 64 deletions

View File

@ -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)

View File

@ -44,7 +44,10 @@
typedef unsigned char uint8;
typedef unsigned short int uint16;
/* amd64 not working
typedef unsigned int uint32;
*/
typedef unsigned long int uint32;
#define IPX_NET_SIZE 4
#define IPX_NODE_SIZE 6

View File

@ -23,7 +23,9 @@
#ifndef _XOPEN_SOURCE
# define _XOPEN_SOURCE 1
#endif
#ifndef _SVID_SOURCE
#define _SVID_SOURCE 1
#endif
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>

BIN
opt/nw.ini.cnv.pl.852-iso2 Normal file

Binary file not shown.

BIN
opt/nw.ini.cnv.pl.852-none Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

11
opt/nwserv.logrotate Normal file
View File

@ -0,0 +1,11 @@
/var/log/nw.log {
postrotate
/bin/killall -HUP nwserv
endrotate
}
/var/log/nw.routes {
postrotate
/bin/killall -HUP nwserv
endrotate
}

19
opt/prn Executable file
View File

@ -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

7
opt/prn-clr Executable file
View File

@ -0,0 +1,7 @@
#!/bin/sh
# clear print spool
#
PRINTER=lp
/usr/bin/lprm -P $PRINTER -

2
opt/uptime Executable file
View File

@ -0,0 +1,2 @@
#!/bin/sh
[ "$1" = READ ] && echo -e "`uptime`\r"

View File

@ -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}

View File

@ -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,

View File

@ -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 <dirent.h>
#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){

View File

@ -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 <string.h>
static void
shuffle1(buf32 temp, unsigned char *target)

View File

@ -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,6 +814,22 @@ int nw_read_file(int fhandle, uint8 *data, int size, uint32 offset)
}
#endif
} else if (use_mmap && fh->p_mmap) {
/* 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?)
*/
rw_lck=(entry8_flags & 0x100);
if (!rw_lck) {
/* added by: Ingmar Thiemann <ingmar@gefas.com>
* Netware allows no read/write on locked sections
*/
@ -824,7 +841,9 @@ int nw_read_file(int fhandle, uint8 *data, int size, uint32 offset)
flockd.l_start = offset;
flockd.l_len = size;
fcntl(fh->fd, F_GETLK, &flockd);
if (flockd.l_type != F_WRLCK) {
rw_lck=(flockd.l_type != F_WRLCK);
}
if (rw_lck) {
while (1) {
if (offset < fh->size_mmap) {
if (size + offset > fh->size_mmap)
@ -849,6 +868,8 @@ int nw_read_file(int fhandle, uint8 *data, int size, uint32 offset)
}
}
if (fh->offd > -1L) {
rw_lck=(entry8_flags & 0x100); /* pcz: 07-12-00 */
if (!rw_lck) {
/* added by: Ingmar Thiemann <ingmar@gefas.com>
* Netware allows no read/write on locked sections
*/
@ -859,7 +880,9 @@ int nw_read_file(int fhandle, uint8 *data, int size, uint32 offset)
flockd.l_start = offset;
flockd.l_len = size;
fcntl(fh->fd, F_GETLK, &flockd);
if (flockd.l_type == F_UNLCK) {
rw_lck=(flockd.l_type == F_UNLCK);
}
if (rw_lck) {
if ((size = read(fh->fd, data, size)) > -1) {
fh->offd+=(long)size;
} else {
@ -912,6 +935,8 @@ 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) {
int rw_lck=(entry8_flags & 0x100); /* pcz: 07-12-00 */
if (!rw_lck) {
/* added by: Ingmar Thiemann <ingmar@gefas.com>
* Netware allows no read/write on locked sections
*/
@ -922,9 +947,10 @@ int nw_write_file(int fhandle, uint8 *data, int size, uint32 offset)
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) {*/
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,
@ -1031,13 +1060,9 @@ int nw_log_physical_record(int fhandle, uint32 offset,
? 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));

View File

@ -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 {

View File

@ -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
}