From 3b6ddaabdfb692fc3b7f19cbbb9698ff8d4046ba Mon Sep 17 00:00:00 2001 From: Mario Fetka Date: Sun, 13 Nov 2011 00:38:58 +0100 Subject: [PATCH] mars_nwe-0.98.pl10 --- doc/CHANGES | 5 +++++ doc/mars_nwe.lsm | 6 +++--- makefile.unx | 4 ++-- nwbind.c | 48 ++++++++++++++++-------------------------------- nwconn.c | 41 ++++++++++++++++++++++++++++++++++++++--- nwfile.c | 47 ++++++++++++++++++++++++++++++----------------- nwfile.h | 5 +++-- tools.c | 2 +- 8 files changed, 98 insertions(+), 60 deletions(-) diff --git a/doc/CHANGES b/doc/CHANGES index 0b04ff7..a598b37 100644 --- a/doc/CHANGES +++ b/doc/CHANGES @@ -286,4 +286,9 @@ Erste 'oeffentliche' Version nach Tests von Arne de Bruijn Probleme mit Netx beseitigt sein. - Section 13 erweitert um 'fixed passwords'. <----- ^^^^^^^^^^ pl9 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +- neue Routine 0x17,0x1a (Get Connection Internet Address, new) + von Arne de Bruijn eingebaut. +- Result code von nw_lock_file() korrigiert (0x21 -> 0xfd). + ( MS-Access meckerte unter Win3.xx fehlendes SHARE.EXE an ) +<----- ^^^^^^^^^^ pl10 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/doc/mars_nwe.lsm b/doc/mars_nwe.lsm index 342a6c0..266c3ce 100644 --- a/doc/mars_nwe.lsm +++ b/doc/mars_nwe.lsm @@ -1,7 +1,7 @@ Begin3 Title: mars_nwe -Version: 0.98.pl9 -Entered-date: 18-Apr-97 +Version: 0.98.pl10 +Entered-date: 24-Apr-97 Description: Full netware-emulator (src), beta. Supports file-services, bindery-services, printing-services, routing-services. @@ -9,7 +9,7 @@ Keywords: novell, netware, server, ipx, ncp, tli Author: mstover@stover.f.eunet.de (Martin Stover) Maintained-by: mstover@stover.f.eunet.de (Martin Stover) Primary-site: ftp.gwdg.de:/pub/linux/misc/ncpfs - 200kB mars_nwe-0.98.pl9.tgz + 200kB mars_nwe-0.98.pl10.tgz Alternate-site: sunsite.unc.edu:/pub/Linux/system/filesystems/ncpfs Platforms: Linux (1.2.xx, 1.3.xx, 2.xx), UnixWare (2.xx) Copying-policy: GNU diff --git a/makefile.unx b/makefile.unx index b449144..f1c1d5c 100644 --- a/makefile.unx +++ b/makefile.unx @@ -1,5 +1,5 @@ #if 0 -#makefile.unx 09-Jan-97 +#makefile.unx 18-Apr-97 #endif VPATH=$(V_VPATH) @@ -9,7 +9,7 @@ C=.c V_H=0 V_L=98 -P_L=9 +P_L=10 #define D_P_L 1 DISTRIB=mars_nwe diff --git a/nwbind.c b/nwbind.c index bcf5a4d..68ca7b2 100644 --- a/nwbind.c +++ b/nwbind.c @@ -1,5 +1,5 @@ /* nwbind.c */ -#define REVISION_DATE "17-Apr-97" +#define REVISION_DATE "20-Apr-97" /* NCP Bindery SUB-SERVER */ /* authentification and some message handling */ @@ -434,13 +434,20 @@ static void handle_fxx(int gelen, int func) } break; - case 0x13 : { /* Get Connection Internet Address */ - int conn = (int)*(rdata); /* Connection Nr */ + case 0x13 : /* Get Connection Internet Address, old */ + case 0x1a : { /* Get Connection Internet Address, new */ + int conn = (ufunc == 0x13) + ? (int) *rdata + : GET_32(rdata); if (conn && --conn < MAX_CONNECTIONS && connections[conn].active ) { CONNECTION *cx=&(connections[conn]); data_len = sizeof(ipxAddr_t); memcpy(responsedata, (char*)&(cx->client_adr), data_len); + if (ufunc==0x1a) { + *(responsedata+data_len)=0x02; /* NCP connection */ + data_len++; + } } else completition = 0xff; } break; @@ -511,7 +518,8 @@ static void handle_fxx(int gelen, int func) } break; - case 0x16 : { /* Get Connection Info, OLD */ + case 0x16 : /* Get Connection Info, old */ + case 0x1c : { /* Get Connection Info, new */ struct XDATA { uint8 object_id[4]; uint8 object_type[2]; @@ -519,7 +527,10 @@ static void handle_fxx(int gelen, int func) uint8 login_time[7]; uint8 reserved; } *xdata = (struct XDATA*) responsedata; - int conn = (uint16)*(rdata); /* Connection Nr */ + int conn = (ufunc == 0x16) + ? (int) *rdata + : GET_32(rdata); + memset(xdata, 0, sizeof(struct XDATA)); data_len = sizeof(struct XDATA); if (conn && conn <= MAX_CONNECTIONS @@ -589,33 +600,6 @@ static void handle_fxx(int gelen, int func) } break; - case 0x1c : { /* Get Connection Info, new */ - struct XDATA { - uint8 object_id[4]; - uint8 object_type[2]; - uint8 object_name[48]; - uint8 login_time[7]; - uint8 reserved; - } *xdata = (struct XDATA*) responsedata; - int conn = (uint16)*(rdata); /* Connection Nr */ - if (conn && --conn < MAX_CONNECTIONS){ - CONNECTION *cx=&(connections[conn]); - NETOBJ obj; - int result; - obj.id = cx->object_id; - result = nw_get_obj(&obj); - if (!result) { - memset(xdata, 0, sizeof(struct XDATA)); - U32_TO_BE32(obj.id, xdata->object_id); - U16_TO_BE16(obj.type, xdata->object_type); - strncpy(xdata->object_name, obj.name, 48); - get_login_time(xdata->login_time, cx); - data_len = sizeof(struct XDATA); - } else completition = (uint8)(-result); - } else completition = 0xff; - } break; - - case 0x32 : { /* Create Bindery Object */ NETOBJ obj; int result; diff --git a/nwconn.c b/nwconn.c index bc11e08..dd94614 100644 --- a/nwconn.c +++ b/nwconn.c @@ -883,7 +883,7 @@ static int handle_ncp_serv(void) int fhandle = GET_32 (input->fhandle); int offset = GET_BE32(input->offset); int size = GET_BE32(input->size); - completition = (uint8)(-nw_lock_datei(fhandle, + completition = (uint8)(-nw_lock_file(fhandle, offset, size, (int)(function == 0x1a))); } @@ -1073,6 +1073,24 @@ static int handle_ncp_serv(void) } *input = (struct INPUT *)ncprequest; uint32 fhandle = GET_32(input->fhandle); completition = (uint8)(-nw_close_file(fhandle, 0)); + +#if 0 +#ifdef SIOCIPXNCPCONN + { + struct { + int fh; + int fd; + int mode; + } ncp_1; + ncp_1.fh = 0; + ncp_1.fd = -1; + ncp_1.mode = 0; + ioctl(0, SIOCIPXNCPCONN+1, &ncp_1); + } +#endif +#endif + + #if TEST_FNAME if (!completition && fhandle == test_handle) { do_druck++; @@ -1233,6 +1251,21 @@ static int handle_ncp_serv(void) if (size > -1) { U16_TO_BE16(size, xdata->size); data_len=size+zusatz+2; +#if 0 +#ifdef SIOCIPXNCPCONN + { + struct { + int fh; + int fd; + int mode; + } ncp_1; + ncp_1.fh = fhandle; + ncp_1.fd = get_nwfd(fhandle); + ncp_1.mode = 0; + ioctl(0, SIOCIPXNCPCONN+1, &ncp_1); + } +#endif +#endif } else completition = (uint8) -size; } break; @@ -1679,7 +1712,7 @@ static void set_sig(void) signal(SIGBUS, sig_bus_mmap); /* in nwfile.c */ #endif } - +#include int main(int argc, char **argv) { if (argc != 6) { @@ -1740,7 +1773,9 @@ int main(int argc, char **argv) set_sig(); while (fl_get_int >= 0) { - int data_len = read(0, readbuff, sizeof(readbuff)); + int data_len ; +/* setpriority(PRIO_PROCESS, 0, 0); */ + data_len = read(0, readbuff, sizeof(readbuff)); /* this read is a pipe or a socket read, * depending on CALL_NWCONN_OVER_SOCKET */ diff --git a/nwfile.c b/nwfile.c index 8db0770..a2d0031 100644 --- a/nwfile.c +++ b/nwfile.c @@ -1,4 +1,4 @@ -/* nwfile.c 14-Jan-97 */ +/* nwfile.c 23-Apr-97 */ /* (C)opyright (C) 1993,1996 Martin Stover, Marburg, Germany * * This program is free software; you can redistribute it and/or modify @@ -723,21 +723,17 @@ int nw_server_copy(int qfhandle, uint32 qoffset, return(-0x88); /* wrong filehandle */ } -int nw_lock_datei(int fhandle, int offset, int size, int do_lock) +int nw_lock_file(int fhandle, int offset, int size, int do_lock) { - MDEBUG(D_FH_LOCK, { - char fname[200]; - int r=fd_2_fname(fhandle, fname, sizeof(fname)); - dprintf("nw_%s_datei: fd=%d, fn=`%s`,r=%d,offs=%d,len=%d", - (do_lock) ? "lock" : "unlock", - fhandle, fname,r,offset, size); - }) - if (fhandle > HOFFS && (--fhandle < anz_fhandles)) { - FILE_HANDLE *fh=&(file_handles[fhandle]); + int result=-0x88; /* wrong filehandle */ + if (fhandle > HOFFS && (fhandle <= anz_fhandles)) { + FILE_HANDLE *fh=&(file_handles[fhandle-1]); if (fh->fd > -1) { struct flock flockd; - int result; - if (fh->fh_flags & FH_IS_PIPE) return(0); + if (fh->fh_flags & FH_IS_PIPE) { + result=0; + goto leave; + } flockd.l_type = (do_lock) ? ((fh->fh_flags & FH_OPENED_RO) ? F_RDLCK : F_WRLCK) @@ -756,11 +752,20 @@ int nw_lock_datei(int fhandle, int offset, int size, int do_lock) result = fcntl(fh->fd, F_SETLK, &flockd); XDPRINTF((2, 0, "nw_%s_datei result=%d, fh=%d, offset=%d, size=%d", (do_lock) ? "lock" : "unlock", result, fhandle, offset, size)); - if (!result) return(0); - else return(-0x21); /* LOCK Violation */ - } else if (fh->fd == -3) return(0); + if (result) + result= (do_lock) ? -0xfd : -0xff; + } else if (fh->fd == -3) result=0; } - return(-0x88); /* wrong filehandle */ +leave: + MDEBUG(D_FH_LOCK, { + char fname[200]; + (void)fd_2_fname(fhandle, fname, sizeof(fname)); + dprintf("nw_%s_datei: fd=%d, fn=`%s`,r=0x%x, offs=%d, len=%d", + (do_lock) ? "lock" : "unlock", + fhandle, fname, -result, offset, size); + }) + + return(result); } int fd_2_fname(int fhandle, char *buf, int bufsize) @@ -782,5 +787,13 @@ FILE_HANDLE *fd_2_fh(int fhandle) return(NULL); } +int get_nwfd(int fhandle) +{ + if (fhandle > HOFFS && (--fhandle < anz_fhandles)) { + FILE_HANDLE *fh=&(file_handles[fhandle]); + return(fh ? fh->fd : -1); + } + return(-1); +} diff --git a/nwfile.h b/nwfile.h index 7201dff..a1717d0 100644 --- a/nwfile.h +++ b/nwfile.h @@ -1,4 +1,4 @@ -/* nwfile.h 19-Oct-96 */ +/* nwfile.h 23-Apr-97 */ #ifndef _NWFILE_H_ #define _NWFILE_H_ #include "nwqueue.h" @@ -49,9 +49,10 @@ extern int nw_server_copy(int qfhandle, uint32 qoffset, int zfhandle, uint32 zoffset, uint32 size); -extern int nw_lock_datei(int fhandle, int offset, int size, int do_lock); +extern int nw_lock_file(int fhandle, int offset, int size, int do_lock); extern int fd_2_fname(int fhandle, char *buf, int bufsize); extern FILE_HANDLE *fd_2_fh(int fhandle); +extern int get_nwfd(int fhandle); #endif diff --git a/tools.c b/tools.c index cf0eb0d..82bd2ea 100644 --- a/tools.c +++ b/tools.c @@ -101,7 +101,7 @@ void dprintf(char *p, ...) { va_list ap; if (nw_debug){ - fprintf(logfile, "%-8s:", get_modstr()); + fprintf(logfile, "%-8s %d:", get_modstr(), connection); va_start(ap, p); vfprintf(logfile, p, ap); va_end(ap);