mars_nwe-0.96.pl04

This commit is contained in:
Mario Fetka 2011-11-13 00:38:55 +01:00
parent 475b65b9b9
commit c374994026
22 changed files with 683 additions and 607 deletions

10
CHANGES
View File

@ -44,5 +44,11 @@ Erste 'oeffentliche' Version
- Noch einen Wildcard Fehler korrigiert. (James MacLean) - Noch einen Wildcard Fehler korrigiert. (James MacLean)
- Debug Routine und Levels veraendert. - Debug Routine und Levels veraendert.
- Packet Groesse > 546 Byte erlaubt. - Packet Groesse > 546 Byte erlaubt.
- MAX_NW_ROUTES ist nun in config.h.
- nwroute.c build_rip_buff if condition richtig geklammert.
- Code mittels cc -Wall etwas gesaeubert.
- RIP Broadcast's werden nun ueber einen temporaeren socket
geschrieben.
- direkte Responses von ncpserv werden nun ueber einen
temporaeren socket und nicht mehr ueber den NCP-Socket
geschrieben.

836
connect.c

File diff suppressed because it is too large Load Diff

71
connect.h Normal file
View File

@ -0,0 +1,71 @@
/* connect.h 08-Jan-96 */
typedef struct {
int fd; /* von System bei Open bzw. Create */
long offd; /* aktueller File Offset */
time_t tmodi; /* modification TIME */
char name[256]; /* UNIX Dateiname */
} FILE_HANDLE;
typedef struct {
DIR *f;
char unixname[256]; /* kompletter unixname */
ino_t inode; /* Unix Inode */
time_t timestamp; /* f<>r letzte Allocierung */
char *kpath; /* Ein Zeichen nach unixname */
uint8 vol_options; /* Suchoptions */
uint8 volume; /* Volume Number */
} DIR_HANDLE;
typedef struct {
uint8 *sysname; /* VOL_NAME */
uint8 *unixname; /* UNIX-Verzeichnis */
uint8 options; /* *_1_* alles in Kleinbuchstaben */
} NW_VOL;
typedef struct {
uint8 path[256]; /* directory */
uint8 fn[256]; /* file */
int volume; /* Volume Number */
int has_wild; /* fn has wildcards */
} NW_PATH;
typedef struct {
ino_t inode; /* Unix Inode dieses Verzeichnisses */
time_t timestamp; /* Zeitmarke */
uint8 *path; /* path ab Volume */
uint8 volume; /* Welches Volume */
uint8 is_temp; /* 0:perm. 1:temp 2: spez. temp */
uint8 drive; /* driveletter */
uint8 task; /* actual task */
} NW_DIR;
extern int conn_get_kpl_path(NW_PATH *nwpath, int dirhandle,
uint8 *data, int len, int only_dir) ;
extern char *conn_get_nwpath_name(NW_PATH *p);
extern void set_default_guid(void);
extern void set_guid(int gid, int uid);
extern int nw_scan_a_directory(uint8 *rdata,
int dirhandle,
uint8 *data,
int len,
int searchattrib,
uint32 searchbeg); /* 32 bit */
extern int nw_scan_a_root_dir(uint8 *rdata,
int dirhandle);
/* queues */
extern int nw_creat_queue(int connection, uint8 *queue_id, uint8 *queue_job,
uint8 *dirname, int dir_nam_len, int old_call);
extern int nw_close_file_queue(uint8 *queue_id,
uint8 *job_id,
uint8 *prc, int prc_len);

View File

@ -1,4 +1,4 @@
/* emutli.c 24-Dec-95 */ /* emutli.c 08-Jan-96 */
/* /*
* One short try to emulate TLI with SOCKETS. * One short try to emulate TLI with SOCKETS.
*/ */
@ -307,7 +307,6 @@ void ipx_route_add(uint32 dest_net,
void ipx_route_del(uint32 net) void ipx_route_del(uint32 net)
{ {
struct rtentry rd; struct rtentry rd;
int result;
int sock; int sock;
/* Router */ /* Router */
struct sockaddr_ipx *sr = (struct sockaddr_ipx *)&rd.rt_gateway; struct sockaddr_ipx *sr = (struct sockaddr_ipx *)&rd.rt_gateway;
@ -315,7 +314,6 @@ void ipx_route_del(uint32 net)
struct sockaddr_ipx *st = (struct sockaddr_ipx *)&rd.rt_dst; struct sockaddr_ipx *st = (struct sockaddr_ipx *)&rd.rt_dst;
rd.rt_flags = RTF_GATEWAY; rd.rt_flags = RTF_GATEWAY;
st->sipx_network = htonl(net); st->sipx_network = htonl(net);
if ( (sock = socket(AF_IPX, SOCK_DGRAM, AF_IPX)) < 0){ if ( (sock = socket(AF_IPX, SOCK_DGRAM, AF_IPX)) < 0){
errorp(0, "EMUTLI:ipx_route_del", NULL); errorp(0, "EMUTLI:ipx_route_del", NULL);
return; return;

View File

@ -1,12 +1,17 @@
/* config.h: 10-Dec-95 */ /* config.h: 03-Jan-96 */
/* some of this config is needed by make, others by cc */ /* some of this config is needed by make, others by cc */
#define FILENAME_NW_INI "/etc/nwserv.conf" /* full name of ini (conf) file */ #define FILENAME_NW_INI "/etc/nwserv.conf" /* full name of ini (conf) file */
#define PATHNAME_PROGS "/sbin" /* path location of progs */ #define PATHNAME_PROGS "/sbin" /* path location of progs */
#define PATHNAME_BINDERY "/etc" /* path location of bindery */ #define PATHNAME_BINDERY "/etc" /* path location of bindery */
#define MAX_CONNECTIONS 5 /* max. Number of Connections */ #define MAX_CONNECTIONS 5 /* max. Number of Connections */
/* must be < 256 !!! */
#define MAX_NW_VOLS 10 /* max. Volumes */ #define MAX_NW_VOLS 10 /* max. Volumes */
#define MAX_NET_DEVICES 1 /* max. Netdevices, frames */ #define MAX_NET_DEVICES 1 /* max. Netdevices, frames */
#define IPX_DATA_GR_546 1 /* allow ipx packets > 546+30 Byte */ #define IPX_DATA_GR_546 1 /* allow ipx packets > 546+30 Byte */
#define MAX_NW_ROUTES 50 /* max. networks (internal + external) */

View File

@ -1,4 +1,4 @@
# makefile.unx 25-Dec-95 # makefile.unx 09-Jan-96
VPATH=.. VPATH=..
O=.o O=.o
C=.c C=.c
@ -6,7 +6,7 @@ C=.c
DEBUG=-DDB DEBUG=-DDB
V_H=0 V_H=0
V_L=96 V_L=96
P_L=2 P_L=4
#define D_P_L 1 #define D_P_L 1
DISTRIB=mars_nwe DISTRIB=mars_nwe
#if D_P_L #if D_P_L
@ -87,7 +87,6 @@ M_PATHNAME_PROGS="."
OBJ1= $(EMUTLIOBJ) net1$(O) tools$(O) OBJ1= $(EMUTLIOBJ) net1$(O) tools$(O)
OBJ2= $(OBJ1) nwroute$(O) OBJ2= $(OBJ1) nwroute$(O)
#nwdbm$(O)
OBJ3= $(OBJ1) connect$(O) namspace$(O) OBJ3= $(OBJ1) connect$(O) namspace$(O)
OBJ4= $(OBJ1) nwdbm$(O) nwcrypt$(O) OBJ4= $(OBJ1) nwdbm$(O) nwcrypt$(O)
OBJ5= $(OBJ1) OBJ5= $(OBJ1)
@ -95,6 +94,8 @@ OBJ5= $(OBJ1)
OBJS= net1$(O) tools$(O) connect$(O) nwdbm$(O) \ OBJS= net1$(O) tools$(O) connect$(O) nwdbm$(O) \
$(PROG2)$(O) $(PROG3)$(O) $(PROG4)$(O) $(PROG5)$(O) $(PROG2)$(O) $(PROG3)$(O) $(PROG4)$(O) $(PROG5)$(O)
HOBJ3= $(PROG3)$(O) connect$(O) namspace$(O)
$(PROG1): $(PROG1)$(O) $(OBJ1) $(PROG1): $(PROG1)$(O) $(OBJ1)
$(CC) -o ../$(PROG1) $(PROG1)$(O) $(OBJ1) $(NSLLIB) $(CC) -o ../$(PROG1) $(PROG1)$(O) $(OBJ1) $(NSLLIB)
@ -112,7 +113,10 @@ $(PROG4): $(PROG4)$(O) $(OBJ4)
$(PROG5): $(PROG5)$(O) $(OBJ5) $(PROG5): $(PROG5)$(O) $(OBJ5)
$(CC) -o ../$(PROG5) $(PROG5)$(O) $(OBJ5) $(NSLLIB) $(CC) -o ../$(PROG5) $(PROG5)$(O) $(OBJ5) $(NSLLIB)
$(OBJS): net.h config.h $(PROG3)$(O): namspace.h connect.h
connect$(O): namspace.h connect.h
namspace$(O): namspace.h connect.h
$(OBJS): net.h config.h
$(C)$(O): $(C)$(O):
$(CC) -c $(CFLAGS) $(HOSTCFLAGS) $(DEBUG)\ $(CC) -c $(CFLAGS) $(HOSTCFLAGS) $(DEBUG)\
@ -173,6 +177,8 @@ n_make_dir: n_clean1
$(DISTRIB).lsm \ $(DISTRIB).lsm \
$(DISTRIB)/. \ $(DISTRIB)/. \
; rm -f $(DISTRIB)/config.h \ ; rm -f $(DISTRIB)/config.h \
; rm -f $(DISTRIB)/namspace.? \
; cp old/namspace.? $(DISTRIB)/. \
; ln -f \ ; ln -f \
examples/$(STERN) \ examples/$(STERN) \
$(DISTRIB)/examples/. \ $(DISTRIB)/examples/. \

View File

@ -1,7 +1,7 @@
Begin3 Begin3
Title: mars_nwe Title: mars_nwe
Version: 0.96 Version: 0.96pl4
Entered-date: 20-Dec-95 Entered-date: 09-Jan-96
Description: full novell-server-emulator (src),beta Description: full novell-server-emulator (src),beta
file-services, bindery-services, printing-services file-services, bindery-services, printing-services
needs no kernelchanges, usefull for testing ipx needs no kernelchanges, usefull for testing ipx
@ -9,8 +9,8 @@ Keywords: novell, netware, server, ipx, ncp, tli
Author: mstover@freeway.de (Martin Stover) Author: mstover@freeway.de (Martin Stover)
Maintained-by: mstover@freeway.de (Martin Stover) Maintained-by: mstover@freeway.de (Martin Stover)
Primary-site: linux01.gwdg.de /pub/ncpfs Primary-site: linux01.gwdg.de /pub/ncpfs
90kB mars_nwe-0.96.tgz 100kB mars_nwe-0.96.pl4.tgz
Alternate-site: ftp.uni-duisburg.de /pub/linux/ipxware Alternate-site: ftp.uni-duisburg.de /pub/linux/ipxware
Platforms: Linux (1.2.xx, 1.3.32 tested, others should work) Platforms: Linux (1.2.xx, 1.3.32, 1.3.55 tested, others should work)
Copying-policy: GNU Copying-policy: GNU
End End

View File

@ -1,4 +1,4 @@
/* namspace.c 26-Nov-95 : NameSpace Services, mars_nwe */ /* namspace.c 08-Jan-96 : NameSpace Services, mars_nwe */
/* (C)opyright (C) 1993,1995 Martin Stover, Marburg, Germany /* (C)opyright (C) 1993,1995 Martin Stover, Marburg, Germany
* *
@ -18,87 +18,10 @@
*/ */
#include "net.h" #include "net.h"
#include <dirent.h>
#include <utime.h>
#include "connect.h"
#include "namspace.h"
typedef struct { #if WITH_NAME_SPACE_CALLS
int x; #endif
} DIR_BASE_ENTRY;
#define MAX_DIR_BASE 20
int nw_generate_dir_path(uint8 *nwpathstruct,
uint8 *ns_dir_base, uint8 *dos_dir_base)
/* returns Volume Number >=0 or errcode < 0 if error */
{
return(-0xfb); /* TODO: complete call */
}
int handle_func_0x57(uint8 *p, uint8 *responsedata)
{
int result = -0xfb; /* unknown request */
int ufunc = (int) *p++; /* now p locates at 4 byte boundary */
int namspace = (int) *p; /* for most calls */
switch (ufunc) {
case 0x02 : /* Initialize Search */
{
/* NW PATH STRUC */
}
break;
case 0x07 : /* Modify File or Dir Info */
{
}
break;
case 0x09 : /* Set short Dir Handle*/
{
}
break;
case 0x15 : /* Get Path String from short dir neu*/
{
}
break;
case 0x16 : /* Generate Dir BASE and VolNumber */
{
uint8 *nwpathstruct = p+3;
struct OUTPUT {
uint8 ns_dir_base[4]; /* BASEHANDLE */
uint8 dos_dir_base[4]; /* BASEHANDLE */
uint8 volume; /* Volumenumber*/
} *xdata= (struct OUTPUT*)responsedata;
result = nw_generate_dir_path(nwpathstruct,
xdata->ns_dir_base, xdata->dos_dir_base);
if (result >-1) {
xdata->volume = result;
result = sizeof(struct OUTPUT);
}
}
break;
case 0x0c : /* alloc short dir Handle */
{
}
break;
case 0x1a : /* Get Huge NS Info new*/
{
}
break;
case 0x1c : /* GetFullPathString new*/
{
}
break;
case 0x1d : /* GetEffDirRights new */
{
}
break;
default : result = -0xfb; /* unknown request */
} /* switch */
return(result);
}

20
namspace.h Normal file
View File

@ -0,0 +1,20 @@
/* namspace.h 08-Jan-96 : NameSpace Services, mars_nwe */
/* (C)opyright (C) 1993,1995 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#define WITH_NAME_SPACE_CALLS 0

View File

@ -1,5 +1,5 @@
/* ncpserv.c, 24-Dec-95 */ /* ncpserv.c */
#define REVISION_DATE "09-Jan-96"
/* (C)opyright (C) 1993,1995 Martin Stover, Marburg, Germany /* (C)opyright (C) 1993,1995 Martin Stover, Marburg, Germany
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -126,7 +126,6 @@ static int anz_connect=0; /* actual anz connections */
static int new_conn_nr(void) static int new_conn_nr(void)
{ {
int j = -1; int j = -1;
int not_logged=-1;
if (!anz_connect){ /* init all */ if (!anz_connect){ /* init all */
j = MAX_CONNECTIONS; j = MAX_CONNECTIONS;
while (j--) { while (j--) {
@ -293,8 +292,9 @@ static int handle_fxx(CONNECTION *c, int gelen, int func)
NCPRESPONSE *ncpresponse = (NCPRESPONSE*)&ipxoutdata; NCPRESPONSE *ncpresponse = (NCPRESPONSE*)&ipxoutdata;
uint8 *responsedata = ((uint8*)&ipxoutdata)+sizeof(NCPRESPONSE); uint8 *responsedata = ((uint8*)&ipxoutdata)+sizeof(NCPRESPONSE);
uint8 *requestdata = ((uint8*)ncprequest)+sizeof(NCPREQUEST); uint8 *requestdata = ((uint8*)ncprequest)+sizeof(NCPREQUEST);
#if 0
uint8 len = *(requestdata+1); uint8 len = *(requestdata+1);
#endif
uint8 ufunc = *(requestdata+2); uint8 ufunc = *(requestdata+2);
uint8 *rdata = requestdata+3; uint8 *rdata = requestdata+3;
uint8 completition = 0; uint8 completition = 0;
@ -478,7 +478,7 @@ static int handle_fxx(CONNECTION *c, int gelen, int func)
if (!result) { if (!result) {
c->object_id = obj.id; /* actuell Object ID */ c->object_id = obj.id; /* actuell Object ID */
c->t_login = akttime; /* u. login Time */ c->t_login = akttime; /* u. login Time */
get_guid(rdata+2, rdata+2+sizeof(int), obj.id); get_guid((int*) (rdata+2), (int*) (rdata+2+sizeof(int)), obj.id);
in_len=12 + 2*sizeof(int); in_len=12 + 2*sizeof(int);
return(-1); /* nwconn must do the rest */ return(-1); /* nwconn must do the rest */
} else completition = (uint8) -result; } else completition = (uint8) -result;
@ -540,7 +540,7 @@ static int handle_fxx(CONNECTION *c, int gelen, int func)
if (result > -1) { if (result > -1) {
c->object_id = obj.id; /* actuell Object */ c->object_id = obj.id; /* actuell Object */
c->t_login = akttime; /* and login time */ c->t_login = akttime; /* and login time */
get_guid(rdata+2, rdata+2+sizeof(int), obj.id); get_guid((int*)(rdata+2), (int*)(rdata+2+sizeof(int)), obj.id);
in_len=12 + 2*sizeof(int); in_len=12 + 2*sizeof(int);
return(-1); /* nwconn must do the rest */ return(-1); /* nwconn must do the rest */
} else completition = (uint8) -result; } else completition = (uint8) -result;
@ -948,7 +948,6 @@ static int handle_fxx(CONNECTION *c, int gelen, int func)
case 0x49 : { /* IS CALLING STATION A MANAGER */ case 0x49 : { /* IS CALLING STATION A MANAGER */
NETOBJ obj; NETOBJ obj;
int result;
obj.id = GET_BE32(rdata); obj.id = GET_BE32(rdata);
/* TODO !! */ /* TODO !! */
completition = 0; /* here allways Manager */ completition = 0; /* here allways Manager */
@ -1061,10 +1060,10 @@ static int handle_fxx(CONNECTION *c, int gelen, int func)
} break; } break;
case 0xc9 : { /* GET FILE SERVER DESCRIPTION STRINGs */ case 0xc9 : { /* GET FILE SERVER DESCRIPTION STRINGs */
char *company = "Mars :-)"; char *company = "Mars :-)";
char *revision = "Version %d.%d"; char *revision = "Version %d.%d";
char *revision_date= "24-Dec-95"; char *revision_date = REVISION_DATE;
char *copyright = "(C)opyright Martin Stover"; char *copyright = "(C)opyright Martin Stover";
int k=strlen(company)+1; int k=strlen(company)+1;
memset(responsedata, 0, 512); memset(responsedata, 0, 512);
@ -1163,11 +1162,11 @@ static void ncp_response(int type, int sequence,
if (nw_debug){ if (nw_debug){
char comment[80]; char comment[80];
sprintf(comment, "NCP-RESP compl=0x%x ", completition); sprintf(comment, "NCP-RESP compl=0x%x ", completition);
send_ipx_data(ncp_fd, 17, sizeof(NCPRESPONSE) + data_len, send_ipx_data(-1, 17, sizeof(NCPRESPONSE) + data_len,
(char *) ncpresponse, (char *) ncpresponse,
&from_addr, comment); &from_addr, comment);
} else } else
send_ipx_data(ncp_fd, 17, sizeof(NCPRESPONSE) + data_len, send_ipx_data(-1, 17, sizeof(NCPRESPONSE) + data_len,
(char *) ncpresponse, (char *) ncpresponse,
&from_addr, NULL); &from_addr, NULL);
} }
@ -1286,7 +1285,7 @@ static int handle_ctrl(void)
data_len = read(0, (char*)&conn, sizeof(conn)); data_len = read(0, (char*)&conn, sizeof(conn));
if (sizeof(int) == data_len && conn == what) if (sizeof(int) == data_len && conn == what)
sent_down_message(); sent_down_message();
break; break;
default : break; default : break;
} /* switch */ } /* switch */
@ -1362,6 +1361,7 @@ int main(int argc, char *argv[])
if (diff_time > 50) /* after max. 50 seconds */ if (diff_time > 50) /* after max. 50 seconds */
nwserv_reset_wdog(connection); nwserv_reset_wdog(connection);
/* tell the wdog there's no need to look */ /* tell the wdog there's no need to look */
if (ncprequest->sequence == c->sequence if (ncprequest->sequence == c->sequence
&& !c->retry++) { && !c->retry++) {
/* perhaps nwconn is busy */ /* perhaps nwconn is busy */
@ -1409,7 +1409,10 @@ int main(int argc, char *argv[])
ncp_response(0x3333, ncprequest->sequence, ncp_response(0x3333, ncprequest->sequence,
ncprequest->connection, ncprequest->connection,
0, 0xff, 0x08, 0); 0,
0xff, /* completition */
0xff, /* conn status */
0);
} else if (type == 0x1111) { } else if (type == 0x1111) {
/* GIVE CONNECTION Nr connection */ /* GIVE CONNECTION Nr connection */

16
net.h
View File

@ -1,4 +1,4 @@
/* net.h 02-Jan-96 */ /* net.h 08-Jan-96 */
/* (C)opyright (C) 1993,1995 Martin Stover, Marburg, Germany /* (C)opyright (C) 1993,1995 Martin Stover, Marburg, Germany
* *
@ -34,6 +34,7 @@
#include "unistd.h" #include "unistd.h"
#include <sys/stat.h> #include <sys/stat.h>
#include <time.h> #include <time.h>
#include <sys/wait.h>
#ifndef LINUX #ifndef LINUX
# include "stropts.h" # include "stropts.h"
@ -107,6 +108,10 @@
# define IPX_DATA_GR_546 1 # define IPX_DATA_GR_546 1
#endif #endif
#ifndef MAX_NW_ROUTES
# define MAX_NW_ROUTES 50
#endif
#if IPX_DATA_GR_546 #if IPX_DATA_GR_546
# define IPX_MAX_DATA 1058 # define IPX_MAX_DATA 1058
#else #else
@ -351,15 +356,6 @@ typedef struct {
} QUEUE_PRINT_AREA; } QUEUE_PRINT_AREA;
typedef struct {
uint8 volume;
uint8 base[4]; /* Base or Handle */
uint8 flag; /* 0=base, 1=handle, 0xff=not path nor handle */
uint8 components; /* nmbrs of pathes, components */
uint8 pathes[1]; /* form len+name */
} NW_HPATH;
extern int nw_init_connect(void); extern int nw_init_connect(void);
extern int nw_free_handles(int task); extern int nw_free_handles(int task);

43
net1.c
View File

@ -1,4 +1,4 @@
/* net1.c, 24-Dec-95 */ /* net1.c, 09-Jan-96 */
/* (C)opyright (C) 1993,1995 Martin Stover, Marburg, Germany /* (C)opyright (C) 1993,1995 Martin Stover, Marburg, Germany
* *
@ -138,13 +138,14 @@ void ipx_addr_to_adr(char *s, ipxAddr_t *p)
} }
int send_ipx_data(int fd, int pack_typ, int send_ipx_data(int fdx, int pack_typ,
int data_len, char *data, int data_len, char *data,
ipxAddr_t *to_addr, char *comment) ipxAddr_t *to_addr, char *comment)
{ {
int fd=fdx;
int result=0;
struct t_unitdata ud; struct t_unitdata ud;
uint8 ipx_pack_typ = (uint8) pack_typ; uint8 ipx_pack_typ = (uint8) pack_typ;
ud.opt.len = sizeof(ipx_pack_typ); ud.opt.len = sizeof(ipx_pack_typ);
ud.opt.maxlen = sizeof(ipx_pack_typ); ud.opt.maxlen = sizeof(ipx_pack_typ);
ud.opt.buf = (char*)&ipx_pack_typ; ud.opt.buf = (char*)&ipx_pack_typ;
@ -156,16 +157,32 @@ int send_ipx_data(int fd, int pack_typ,
ud.addr.buf = (char*)to_addr; ud.addr.buf = (char*)to_addr;
if (comment != NULL) XDPRINTF((2,0,"%s TO: ", comment)); if (comment != NULL) XDPRINTF((2,0,"%s TO: ", comment));
if (nw_debug > 1) print_ipx_addr(to_addr); if (nw_debug > 1) print_ipx_addr(to_addr);
if (t_sndudata(fd, &ud) < 0){ if (fd < 0) {
if (nw_debug > 1) t_error("t_sndudata !OK"); struct t_bind bind;
return(-1); ipxAddr_t addr;
fd=t_open("/dev/ipx", O_RDWR, NULL);
if (fd < 0) {
t_error("t_open !Ok");
return(-1);
}
memset(&addr,0, sizeof(ipxAddr_t));
bind.addr.len = sizeof(ipxAddr_t);
bind.addr.maxlen = sizeof(ipxAddr_t);
bind.addr.buf = (char*)&addr;
bind.qlen = 0; /* ever */
if (t_bind(fd, &bind, &bind) < 0){
t_error("t_bind in send_ipx_data");
t_close(fd);
return(-1);
}
} }
return(0); if ((result=t_sndudata(fd, &ud)) < 0){
if (nw_debug > 1) t_error("t_sndudata !OK");
}
if (fdx < 0 && fd > -1) {
t_unbind(fd);
t_close(fd);
}
return(result);
} }

View File

@ -1,4 +1,4 @@
/* nwconn.c 02-Jan-96 */ /* nwconn.c 09-Jan-96 */
/* one process / connection */ /* one process / connection */
/* (C)opyright (C) 1993,1995 Martin Stover, Marburg, Germany /* (C)opyright (C) 1993,1995 Martin Stover, Marburg, Germany
@ -19,6 +19,9 @@
*/ */
#include "net.h" #include "net.h"
#include <dirent.h>
#include "connect.h"
#include "namspace.h"
static int father_pid = -1; static int father_pid = -1;
static ipxAddr_t from_addr; static ipxAddr_t from_addr;
@ -306,21 +309,25 @@ static void handle_ncp_serv()
} else if (*p == 0xa){ /* legt Verzeichnis an */ } else if (*p == 0xa){ /* legt Verzeichnis an */
/******** Create Dir *********************/ /******** Create Dir *********************/
int dir_handle = (int) *(p+1); int dir_handle = (int) *(p+1);
#if 0
int rightmask = (int) *(p+2); int rightmask = (int) *(p+2);
#endif
int pathlen = (int) *(p+3); int pathlen = (int) *(p+3);
uint8 *path = p+4; uint8 *path = p+4;
int code = nw_mk_rd_dir(dir_handle, path, pathlen, 1); int code = nw_mk_rd_dir(dir_handle, path, pathlen, 1);
if (code) completition = (uint8) -code; if (code) completition = (uint8) -code;
} else if (*p == 0xb){ /* l”scht Verzeichnis */ } else if (*p == 0xb){ /* deletes dir */
/******** Delete DIR *********************/ /******** Delete DIR *********************/
int dir_handle = (int) *(p+1); int dir_handle = (int) *(p+1);
#if 0
int reserved = (int) *(p+2); /* Res. by NOVELL */ int reserved = (int) *(p+2); /* Res. by NOVELL */
#endif
int pathlen = (int) *(p+3); int pathlen = (int) *(p+3);
uint8 *path = p+4; uint8 *path = p+4;
int code = nw_mk_rd_dir(dir_handle, path, pathlen, 0); int code = nw_mk_rd_dir(dir_handle, path, pathlen, 0);
if (code) completition = (uint8) -code; if (code) completition = (uint8) -code;
} else if (*p == 0xd){ /* Add Trustees to DIR */ } else if (*p == 0xd){ /* Add Trustees to DIR */
/******** GetDirektoryPATH ***************/ /******** AddTrustesstoDir ***************/
struct INPUT { struct INPUT {
uint8 header[7]; /* Requestheader */ uint8 header[7]; /* Requestheader */
uint8 div[3]; /* 0x0, dlen, typ */ uint8 div[3]; /* 0x0, dlen, typ */
@ -1195,11 +1202,13 @@ static void handle_ncp_serv()
} }
break; break;
#if 0 #if WITH_NAME_SPACE_CALLS
case 0x57 : /* some new namespace calls */ case 0x57 : /* some new namespace calls */
int result = handle_func_0x57(requestdata, responsedata); {
if (result > -1) data_len = result; int result = handle_func_0x57(requestdata, responsedata);
else completition=(uint8)-result; if (result > -1) data_len = result;
else completition=(uint8)-result;
}
break; break;
#endif #endif
@ -1288,7 +1297,6 @@ static void set_sig(void)
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
int completition = 0;
if (argc != 4) { if (argc != 4) {
fprintf(stderr, "usage nwconn PID FROM_ADDR Connection\n"); fprintf(stderr, "usage nwconn PID FROM_ADDR Connection\n");
exit(1); exit(1);
@ -1299,7 +1307,8 @@ int main(int argc, char **argv)
init_tools(NWCONN); init_tools(NWCONN);
XDPRINTF((1, 0, "FATHER PID=%d, ADDR=%s CON:%s", father_pid, *(argv+2), *(argv+3))); XDPRINTF((1, 0, "FATHER PID=%d, ADDR=%s CON:%s", father_pid, *(argv+2), *(argv+3)));
adr_to_ipx_addr(&from_addr, *(argv+2));
adr_to_ipx_addr(&from_addr, *(argv+2));
if (nw_init_connect()) exit(1); if (nw_init_connect()) exit(1);

View File

@ -118,7 +118,7 @@ static buf32 encryptkeys =
0x6B,0x0F,0xD5,0x70,0xAE,0xFB,0xAD,0x11, 0x6B,0x0F,0xD5,0x70,0xAE,0xFB,0xAD,0x11,
0xF4,0x47,0xDC,0xA7,0xEC,0xCF,0x50,0xC0}; 0xF4,0x47,0xDC,0xA7,0xEC,0xCF,0x50,0xC0};
#include "nwcrypt.h"
static void static void
shuffle1(buf32 temp, unsigned char *target) shuffle1(buf32 temp, unsigned char *target)
{ {

7
nwcrypt.h Normal file
View File

@ -0,0 +1,7 @@
/* nwcrypt.h */
extern void shuffle(unsigned char *lon,
const unsigned char *buf, int buflen,
unsigned char *target);
extern void nw_encrypt(unsigned char *fra,
unsigned char *buf,unsigned char *til);

18
nwdbm.c
View File

@ -1,4 +1,4 @@
/* nwdbm.c 24-Dec-95 data base for mars_nwe */ /* nwdbm.c 08-Jan-96 data base for mars_nwe */
/* (C)opyright (C) 1993,1995 Martin Stover, Marburg, Germany /* (C)opyright (C) 1993,1995 Martin Stover, Marburg, Germany
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -23,12 +23,14 @@
#include "net.h" #include "net.h"
#include "nwdbm.h" #include "nwdbm.h"
#include "nwcrypt.h"
#ifdef LINUX #ifdef LINUX
# include <ndbm.h> # include <ndbm.h>
#else #else
# include </usr/ucbinclude/ndbm.h> # include </usr/ucbinclude/ndbm.h>
#endif #endif
int tells_server_version=0; int tells_server_version=0;
static char *fnprop = "nwprop"; static char *fnprop = "nwprop";
@ -1062,7 +1064,7 @@ static void add_pr_queue(uint32 q_id,
} }
static uint32 add_user(uint32 u_id, uint32 g_id, static void add_user(uint32 u_id, uint32 g_id,
char *name, char *unname, char *password) char *name, char *unname, char *password)
{ {
uint8 buff[4]; uint8 buff[4];
@ -1089,17 +1091,17 @@ static uint32 add_user(uint32 u_id, uint32 g_id,
void nw_fill_standard(char *servername, ipxAddr_t *adr) void nw_fill_standard(char *servername, ipxAddr_t *adr)
/* fills the Standardproperties */ /* fills the Standardproperties */
{ {
char serverna[50]; char serverna[MAX_SERVER_NAME+2];
uint8 buff[12];
uint32 su_id = 0x00000001; uint32 su_id = 0x00000001;
uint32 ge_id = 0x01000001; uint32 ge_id = 0x01000001;
uint32 guest_id = 0x02000001;
uint32 serv_id = 0x03000001; uint32 serv_id = 0x03000001;
uint32 q1_id = 0x0E000001;
#if 0
uint32 guest_id = 0x02000001;
uint32 nbo_id = 0x0B000001; uint32 nbo_id = 0x0B000001;
uint32 ngr_id = 0x0C000001; uint32 ngr_id = 0x0C000001;
uint32 ps1_id = 0x0D000001; uint32 ps1_id = 0x0D000001;
uint32 q1_id = 0x0E000001; #endif
FILE *f = open_nw_ini(); FILE *f = open_nw_ini();
ge_id = ge_id =
nw_new_create_prop(ge_id, "EVERYONE", 0x2, 0x0, 0x31, nw_new_create_prop(ge_id, "EVERYONE", 0x2, 0x0, 0x31,
@ -1162,7 +1164,7 @@ void nw_fill_standard(char *servername, ipxAddr_t *adr)
fclose(f); fclose(f);
} }
if (servername && adr) { if (servername && adr) {
strmaxcpy(serverna, servername, 48); strmaxcpy(serverna, servername, MAX_SERVER_NAME);
upstr(serverna); upstr(serverna);
nw_new_create_prop(serv_id, serverna, 0x4, O_FL_DYNA, 0x40, nw_new_create_prop(serv_id, serverna, 0x4, O_FL_DYNA, 0x40,
"NET_ADDRESS", P_FL_ITEM | P_FL_DYNA, 0x40, "NET_ADDRESS", P_FL_ITEM | P_FL_DYNA, 0x40,

View File

@ -1,4 +1,4 @@
/* nwdbm.h 11-Sep-95 */ /* nwdbm.h 08-Jan-96 */
/* (C)opyright (C) 1993,1995 Martin Stover, Marburg, Germany /* (C)opyright (C) 1993,1995 Martin Stover, Marburg, Germany
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -168,6 +168,12 @@ extern uint32 nw_new_create_prop(uint32 wanted_id,
char *propname, int propflags, int propsecurity, char *propname, int propflags, int propsecurity,
char *value, int valuesize); char *value, int valuesize);
extern int get_guid(int *gid, int *uid, uint32 obj_id);
extern int nw_test_passwd(uint32 obj_id, uint8 *vgl_key, uint8 *akt_key);
extern int nw_get_q_dirname(uint32 q_id, uint8 *buff);
extern int nw_get_q_prcommand(uint32 q_id, uint8 *buff);
extern void nw_fill_standard(char *servername, ipxAddr_t *adr); extern void nw_fill_standard(char *servername, ipxAddr_t *adr);
extern void nw_init_dbm(char *servername, ipxAddr_t *adr); extern void nw_init_dbm(char *servername, ipxAddr_t *adr);

View File

@ -1,4 +1,4 @@
/* nwroute.c 24-Dec-95 */ /* nwroute.c 08-Jan-96 */
/* (C)opyright (C) 1993,1995 Martin Stover, Marburg, Germany /* (C)opyright (C) 1993,1995 Martin Stover, Marburg, Germany
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -19,7 +19,6 @@
#include "net.h" #include "net.h"
#include "nwserv.h" #include "nwserv.h"
#define MAX_NW_ROUTES 50 /* max. 1 complete RIP packet should be enough */
typedef struct { typedef struct {
uint32 net; /* destnet */ uint32 net; /* destnet */
@ -65,7 +64,10 @@ static void insert_delete_net(uint32 destnet,
if (k == anz_routes) { /* no route slot found */ if (k == anz_routes) { /* no route slot found */
if (do_delete) return; /* nothing to delete */ if (do_delete) return; /* nothing to delete */
if (freeslot < 0) { if (freeslot < 0) {
if (anz_routes == MAX_NW_ROUTES) return; if (anz_routes == MAX_NW_ROUTES) {
XDPRINTF((1, 0, "too many routes=%d, increase MAX_NW_ROUTES in config.h", anz_routes));
return;
}
nw_routes[k] = (NW_ROUTES*)xmalloc(sizeof(NW_ROUTES)); nw_routes[k] = (NW_ROUTES*)xmalloc(sizeof(NW_ROUTES));
anz_routes++; anz_routes++;
} else k=freeslot; } else k=freeslot;
@ -153,7 +155,7 @@ static void build_rip_buff(uint32 destnet)
k=-1; k=-1;
while (++k < anz_routes) { while (++k < anz_routes) {
NW_ROUTES *nr=nw_routes[k]; NW_ROUTES *nr=nw_routes[k];
if ((is_wild || nr->net == destnet) && rmode==1 || nr->hops < 2) if ( (is_wild || nr->net == destnet) && (rmode==1 || nr->hops < 2) )
ins_rip_buff(nr->net, (rmode==1) ? 16 : nr->hops, nr->ticks); ins_rip_buff(nr->net, (rmode==1) ? 16 : nr->hops, nr->ticks);
} }
} }
@ -178,7 +180,9 @@ static void send_rip_buff(ipxAddr_t *from_addr)
(operation==1) ? "Request" : "Response", rentries)); (operation==1) ? "Request" : "Response", rentries));
p+=2; p+=2;
while (rentries--) { while (rentries--) {
#if 0
uint32 net = GET_BE32(p); uint32 net = GET_BE32(p);
#endif
uint16 hops = GET_BE16(p+4); uint16 hops = GET_BE16(p+4);
uint16 ticks = GET_BE16(p+6); uint16 ticks = GET_BE16(p+6);
XDPRINTF((2,0, "hops=%3d, ticks %3d, network:%02x.%02x.%02x.%02x", XDPRINTF((2,0, "hops=%3d, ticks %3d, network:%02x.%02x.%02x.%02x",
@ -298,7 +302,13 @@ void send_sap_broadcast(int mode)
U16_TO_BE16(1, ipx_data.sip.intermediate_networks); U16_TO_BE16(1, ipx_data.sip.intermediate_networks);
/* I hope 1 is ok here */ /* I hope 1 is ok here */
} }
send_ipx_data(sockfd[MY_BROADCAST_SLOT], 0,
#ifdef MY_BROADCAST_SLOT
send_ipx_data(sockfd[MY_BROADCAST_SLOT],
#else
send_ipx_data(-1,
#endif
0,
sizeof(ipx_data.sip), sizeof(ipx_data.sip),
(char *)&(ipx_data.sip), (char *)&(ipx_data.sip),
&wild, "SIP Broadcast"); &wild, "SIP Broadcast");

View File

@ -1,4 +1,4 @@
/* nwserv.c 20-Dec-95 */ /* nwserv.c 09-Jan-96 */
/* (C)opyright (C) 1993,1995 Martin Stover, Marburg, Germany /* (C)opyright (C) 1993,1995 Martin Stover, Marburg, Germany
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -27,8 +27,13 @@ char my_nwname[50]; /* Name of this server */
int anz_net_devices=0; int anz_net_devices=0;
NW_NET_DEVICE *net_devices[MAX_NET_DEVICES]; NW_NET_DEVICE *net_devices[MAX_NET_DEVICES];
uint16 ipx_sock_nummern[]={ 0, /* auto sock */ uint16 ipx_sock_nummern[]={
#ifdef MY_BROADCAST_SLOT
0, /* auto sock */ 0, /* auto sock */
#endif
#ifdef WDOG_SLOT
0, /* auto sock */
#endif
SOCK_SAP, SOCK_SAP,
SOCK_RIP, SOCK_RIP,
SOCK_ROUTE, SOCK_ROUTE,
@ -578,8 +583,12 @@ static void handle_event(int fd, uint16 socknr, int slot)
IPXCMPNET (source_adr.net, my_server_adr.net)) { IPXCMPNET (source_adr.net, my_server_adr.net)) {
int source_sock = (int) GET_BE16(source_adr.sock); int source_sock = (int) GET_BE16(source_adr.sock);
#if 0
if ( source_sock == sock_nummern[MY_BROADCAST_SLOT] if ( source_sock == sock_nummern[MY_BROADCAST_SLOT]
|| source_sock == sock_nummern[WDOG_SLOT] #endif
if ( source_sock == sock_nummern[WDOG_SLOT]
|| source_sock == SOCK_SAP || source_sock == SOCK_SAP
|| source_sock == SOCK_RIP) { || source_sock == SOCK_RIP) {
XDPRINTF((2,0,"OWN Packet from sock:0x%04x, ignored", source_sock)); XDPRINTF((2,0,"OWN Packet from sock:0x%04x, ignored", source_sock));
@ -639,8 +648,8 @@ static void get_ini(int full)
char inhalt4[500]; char inhalt4[500];
char dummy; char dummy;
int anz; int anz;
if ((anz=sscanf((char*)buff, "%s %s %s", inhalt, inhalt2, if ((anz=sscanf((char*)buff, "%s %s %s %s", inhalt, inhalt2,
inhalt3, inhalt4)) > 0) { inhalt3, inhalt4)) > 0) {
switch (what) { switch (what) {
case 2 : if (full) { case 2 : if (full) {
strncpy(my_nwname, inhalt, 48); strncpy(my_nwname, inhalt, 48);

View File

@ -1,4 +1,4 @@
/* nwserv.h 09-Dec-95 */ /* nwserv.h 09-Jan-96 */
/* (C)opyright (C) 1993,1995 Martin Stover, Marburg, Germany /* (C)opyright (C) 1993,1995 Martin Stover, Marburg, Germany
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -33,16 +33,18 @@ extern int anz_net_devices;
extern NW_NET_DEVICE *net_devices[]; extern NW_NET_DEVICE *net_devices[];
/* <======== SOCKETS =========> */ /* <======== SOCKETS =========> */
#define MY_BROADCAST_SLOT 0 /* Server Broadcast OUT */
#define WDOG_SLOT 1 /* Watchdog send + recv */
#define SAP_SLOT 2
#define RIP_SLOT 3
#define ROUTE_SLOT 4
#define DIAG_SLOT 5
#if 0 #if 0
#define ECHO_SLOT 6 #define MY_BROADCAST_SLOT 0 /* Server Broadcast OUT */
#define ERR_SLOT 7 #endif
#define WDOG_SLOT 0 /* Watchdog send + recv */
#define SAP_SLOT 1
#define RIP_SLOT (SAP_SLOT +1)
#define ROUTE_SLOT (RIP_SLOT +1)
#define DIAG_SLOT (ROUTE_SLOT +1)
#if 0
#define ECHO_SLOT (DIAG_SLOT +1)
#define ERR_SLOT (ECHO_SLOT +1)
#endif #endif
extern int sockfd[]; extern int sockfd[];

11
tools.c
View File

@ -1,4 +1,4 @@
/* tools.c 24-Dec-95 */ /* tools.c 07-Jan-96 */
/* (C)opyright (C) 1993,1995 Martin Stover, Marburg, Germany /* (C)opyright (C) 1993,1995 Martin Stover, Marburg, Germany
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -45,6 +45,13 @@ char *xmalloc(uint size)
return(p); return(p);
} }
char *xcmalloc(uint size)
{
char *p = xmalloc(size);
if (size) memset(p, 0, size);
return(p);
}
void x_x_xfree(char **p) void x_x_xfree(char **p)
{ {
if (*p != (char *)NULL){ if (*p != (char *)NULL){
@ -301,7 +308,7 @@ int get_fs_usage(char *path, struct fs_usage *fsp)
struct statfs fsd; struct statfs fsd;
if (statfs (path, &fsd) < 0) return (-1); if (statfs (path, &fsd) < 0) return (-1);
XDPRINTF((3, 0, XDPRINTF((3, 0,
"blocks=%d, bfree=%d, bavail=%d, files=%d, ffree=%d, bsize=%d\n", "blocks=%d, bfree=%d, bavail=%d, files=%d, ffree=%d, bsize=%d",
fsd.f_blocks, fsd.f_bfree, fsd.f_bavail, fsd.f_blocks, fsd.f_bfree, fsd.f_bavail,
fsd.f_files, fsd.f_ffree, fsd.f_bsize)); fsd.f_files, fsd.f_ffree, fsd.f_bsize));
#define convert_blocks(b) adjust_blocks ((b), fsd.f_bsize, 512) #define convert_blocks(b) adjust_blocks ((b), fsd.f_bsize, 512)

View File

@ -1,4 +1,4 @@
/* tools.h : 14-Nov-95 */ /* tools.h : 07-Jan-96 */
/* (C)opyright (C) 1993,1995 Martin Stover, Marburg, Germany /* (C)opyright (C) 1993,1995 Martin Stover, Marburg, Germany
* *
@ -30,6 +30,7 @@ extern int x_x_xnewstr(uint8 **p, uint8 *s);
#define new_str(p, s) x_x_xnewstr((uint8 **)&(p), s) #define new_str(p, s) x_x_xnewstr((uint8 **)&(p), s)
extern char *xmalloc(uint size); extern char *xmalloc(uint size);
extern char *xcmalloc(uint size);
extern int strmaxcpy(char *dest, char *source, int len); extern int strmaxcpy(char *dest, char *source, int len);
extern void dprintf(char *p, ...); extern void dprintf(char *p, ...);
extern void xdprintf(int dlevel, int mode, char *p, ...); extern void xdprintf(int dlevel, int mode, char *p, ...);