mars_nwe-0.96.pl02
This commit is contained in:
parent
cfe799f9df
commit
475b65b9b9
8
CHANGES
8
CHANGES
@ -1,5 +1,5 @@
|
||||
Sorry, this is in German only. :-(
|
||||
Aenderungen in mars_nwe bis zum : 20-Dec-95
|
||||
Aenderungen in mars_nwe bis zum : 02-Jan-96
|
||||
--------------------------------
|
||||
Erste 'oeffentliche' Version
|
||||
^^^^^^^^^^ VERSION 0.94 ^^^^^^^^
|
||||
@ -39,4 +39,10 @@ Erste 'oeffentliche' Version
|
||||
- Server kann sich als 2.15 Server melden oder als 3.11 .
|
||||
- Drucken mit OLD Job's (pre 3.11) Struktur eingebaut.
|
||||
^^^^^^^^^^ VERSION 0.96 ^^^^^^^^
|
||||
- Direktory Search Wildcard Fehler '????????.???' korrigiert.
|
||||
- delete mit wildcards eingebaut.
|
||||
- Noch einen Wildcard Fehler korrigiert. (James MacLean)
|
||||
- Debug Routine und Levels veraendert.
|
||||
- Packet Groesse > 546 Byte erlaubt.
|
||||
|
||||
|
||||
|
187
connect.c
187
connect.c
@ -1,4 +1,4 @@
|
||||
/* connect.h 18-Dec-95 */
|
||||
/* connect.c 02-Jan-96 */
|
||||
/* (C)opyright (C) 1993,1995 Martin Stover, Marburg, Germany
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -25,7 +25,8 @@
|
||||
#include <sys/errno.h>
|
||||
extern int errno;
|
||||
|
||||
#define TEST_FNAME "PRINT.000"
|
||||
/* #define TEST_FNAME "PRINT.000"
|
||||
*/
|
||||
static int test_handle=-1;
|
||||
|
||||
static int default_uid=-1;
|
||||
@ -256,7 +257,7 @@ void set_guid(int gid, int uid)
|
||||
|| seteuid(uid) == -1 ) {
|
||||
DPRINTF(("SET GID=%d, UID=%d failed\n", gid, uid));
|
||||
set_default_guid();
|
||||
} else XDPRINTF((2,"SET GID=%d, UID=%d OK\n", gid, uid));
|
||||
} else XDPRINTF((5,0,"SET GID=%d, UID=%d OK", gid, uid));
|
||||
}
|
||||
|
||||
static char *get_nwpath_name(NW_PATH *p)
|
||||
@ -289,10 +290,20 @@ static int x_str_match(uint8 *s, uint8 *p)
|
||||
if (*p++ != *s++) return(0);
|
||||
break;
|
||||
|
||||
case '?' : if (! *s++) return(0); /* one character */
|
||||
case '?' : if ((sc = *s++) == '.') {
|
||||
uint8 *pp=p;
|
||||
while (*pp) {
|
||||
if (*pp++ == '.') p=pp;
|
||||
}
|
||||
} else if (!sc) return(1); /* one character */
|
||||
break;
|
||||
|
||||
case '.' : if (!*s && !*p) return(1); /* point at end */
|
||||
case '.' :
|
||||
#if 0
|
||||
if (!*s && !*p) return(1); /* point at end */
|
||||
#else
|
||||
if (!*s && (!*p || *p == '*' || *p == '?')) return(1);
|
||||
#endif
|
||||
if (pc != *s++) return(0);
|
||||
if (*p == '*') return(1);
|
||||
break;
|
||||
@ -377,6 +388,71 @@ static int str_match(uint8 *s, uint8 *p, uint8 options)
|
||||
return(x_str_match(s, p));
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
int attrib;
|
||||
struct stat statb;
|
||||
} FUNC_SEARCH;
|
||||
|
||||
static int func_search_entry(NW_PATH *nwpath, int attrib,
|
||||
int (*fs_func)(NW_PATH *nwpath, FUNC_SEARCH *fs), FUNC_SEARCH *fs)
|
||||
|
||||
/* returns > 0 if OK < 1 if not ok or not found */
|
||||
{
|
||||
struct dirent* dirbuff;
|
||||
DIR *f;
|
||||
int result=0;
|
||||
int okflag=0;
|
||||
char xkpath[256];
|
||||
uint8 entry[256];
|
||||
int volume = nwpath->volume;
|
||||
uint8 soptions;
|
||||
FUNC_SEARCH fs_local;
|
||||
if (!fs) fs = &fs_local;
|
||||
fs->attrib = attrib;
|
||||
if (volume < 0 || volume >= used_vols) return(-1); /* something wrong */
|
||||
else soptions = vols[volume].options;
|
||||
strcpy(entry, nwpath->fn);
|
||||
if (soptions & 1) downstr(entry); /* now downshift chars */
|
||||
nwpath->fn[0] = '\0';
|
||||
strcpy(xkpath, build_unix_name(nwpath, 1|2));
|
||||
|
||||
XDPRINTF((5,0,"func_search_entry attrib=0x%x path:%s:, xkpath:%s:, entry:%s:",
|
||||
attrib, nwpath->path, xkpath, entry));
|
||||
if ((f=opendir(xkpath)) != (DIR*)NULL) {
|
||||
char *kpath=xkpath+strlen(xkpath);
|
||||
*kpath++ = '/';
|
||||
while ((dirbuff = readdir(f)) != (struct dirent*)NULL){
|
||||
okflag = 0;
|
||||
if (dirbuff->d_ino) {
|
||||
uint8 *name=(uint8*)(dirbuff->d_name);
|
||||
okflag = (name[0] != '.' &&
|
||||
( (entry[0] == '*' && entry[1] == '\0')
|
||||
|| (!strcmp(name, entry))
|
||||
|| str_match(name, entry, soptions)));
|
||||
if (okflag) {
|
||||
*kpath = '\0';
|
||||
strcpy(kpath, name);
|
||||
if (!stat(xkpath, &(fs->statb))) {
|
||||
okflag = ( ( ( (fs->statb.st_mode & S_IFMT) == S_IFDIR) && (attrib & 0x10))
|
||||
|| ( ( (fs->statb.st_mode & S_IFMT) != S_IFDIR) && !(attrib & 0x10)));
|
||||
if (okflag){
|
||||
strcpy(nwpath->fn, name);
|
||||
if (soptions & 1) upstr(nwpath->fn);
|
||||
XDPRINTF((5,0,"FOUND=:%s: attrib=0x%x", nwpath->fn, fs->statb.st_mode));
|
||||
result = (*fs_func)(nwpath, fs);
|
||||
if (result < 0) break;
|
||||
else result=1;
|
||||
}
|
||||
} else okflag = 0;
|
||||
}
|
||||
XDPRINTF((6,0, "NAME=:%s: OKFLAG %d", name, okflag));
|
||||
} /* if */
|
||||
} /* while */
|
||||
closedir(f);
|
||||
} /* if */
|
||||
return(result);
|
||||
}
|
||||
|
||||
static int get_dir_entry(NW_PATH *nwpath,
|
||||
int *sequence,
|
||||
int attrib,
|
||||
@ -398,7 +474,7 @@ static int get_dir_entry(NW_PATH *nwpath,
|
||||
|
||||
nwpath->fn[0] = '\0';
|
||||
strcpy(xkpath, build_unix_name(nwpath, 1|2));
|
||||
XDPRINTF((2,"get_dir_entry attrib=0x%x path:%s:, xkpath:%s:, entry:%s:\n",
|
||||
XDPRINTF((5,0,"get_dir_entry attrib=0x%x path:%s:, xkpath:%s:, entry:%s:",
|
||||
attrib, nwpath->path, xkpath, entry));
|
||||
|
||||
if ((f=opendir(xkpath)) != (DIR*)NULL) {
|
||||
@ -424,12 +500,12 @@ static int get_dir_entry(NW_PATH *nwpath,
|
||||
if (okflag){
|
||||
strcpy(nwpath->fn, name);
|
||||
if (soptions & 1) upstr(nwpath->fn);
|
||||
XDPRINTF((2,"FOUND=:%s: attrib=0x%x\n", nwpath->fn, statb->st_mode));
|
||||
XDPRINTF((5,0,"FOUND=:%s: attrib=0x%x", nwpath->fn, statb->st_mode));
|
||||
break; /* ready */
|
||||
}
|
||||
} else okflag = 0;
|
||||
}
|
||||
XDPRINTF((4, "NAME=:%s: OKFLAG %d\n", name, okflag));
|
||||
XDPRINTF((6,0, "NAME=:%s: OKFLAG %d", name, okflag));
|
||||
} /* if */
|
||||
} /* while */
|
||||
*sequence = (int) telldir(f);
|
||||
@ -457,7 +533,7 @@ static int get_dh_entry(DIR_HANDLE *dh,
|
||||
if ( (uint16)*sequence == MAX_U16) *sequence = 0;
|
||||
seekdir(f, (long) *sequence);
|
||||
|
||||
XDPRINTF((2,"get_dh_entry attrib=0x%x path:%s:, entry:%s:\n",
|
||||
XDPRINTF((5,0,"get_dh_entry attrib=0x%x path:%s:, entry:%s:",
|
||||
attrib, dh->unixname, entry));
|
||||
|
||||
while ((dirbuff = readdir(f)) != (struct dirent*)NULL){
|
||||
@ -471,7 +547,7 @@ static int get_dh_entry(DIR_HANDLE *dh,
|
||||
|
||||
if (okflag) {
|
||||
strcpy(dh->kpath, name);
|
||||
XDPRINTF((2,"get_dh_entry Name=%s unixname=%s\n",
|
||||
XDPRINTF((5,0,"get_dh_entry Name=%s unixname=%s",
|
||||
name, dh->unixname));
|
||||
|
||||
if (!stat(dh->unixname, statb)) {
|
||||
@ -592,7 +668,7 @@ static int nw_path_ok(NW_PATH *nwpath)
|
||||
if (!stat(build_unix_name(nwpath, 1 | 2 ), &stbuff)
|
||||
&& (stbuff.st_mode & S_IFMT) == S_IFDIR) result=stbuff.st_ino;
|
||||
else {
|
||||
XDPRINTF((2, "NW_PATH_OK failed:`%s`\n", get_nwpath_name(nwpath)));
|
||||
XDPRINTF((4,0, "NW_PATH_OK failed:`%s`", get_nwpath_name(nwpath)));
|
||||
}
|
||||
return(result);
|
||||
}
|
||||
@ -630,7 +706,7 @@ static int build_verz_name(NW_PATH *nwpath, /* gets complete path */
|
||||
int state = 0;
|
||||
while ((!completition) && (w = *p++) > 0){
|
||||
if (!state){
|
||||
XDPRINTF((2,"in build_verz_name path=:%s:\n", nwpath->path));
|
||||
XDPRINTF((5,0,"in build_verz_name path=:%s:", nwpath->path));
|
||||
if (w == '.') state = 20;
|
||||
else if (w == '/') state = 30;
|
||||
else state++;
|
||||
@ -743,7 +819,7 @@ static uint16 un_time_2_nw(time_t time, uint8 *d)
|
||||
static int get_file_attrib(NW_FILE_INFO *f, struct stat *stb,
|
||||
NW_PATH *nwpath)
|
||||
{
|
||||
XDPRINTF((2, "get_file_attrib of %s\n", get_nwpath_name(nwpath) ));
|
||||
XDPRINTF((5,0, "get_file_attrib of %s", get_nwpath_name(nwpath) ));
|
||||
strncpy(f->name, nwpath->fn, sizeof(f->name));
|
||||
/* Attribute */
|
||||
/* 0x20 Archive Flag */
|
||||
@ -766,7 +842,7 @@ static int get_file_attrib(NW_FILE_INFO *f, struct stat *stb,
|
||||
static int get_dir_attrib(NW_DIR_INFO *d, struct stat *stb,
|
||||
NW_PATH *nwpath)
|
||||
{
|
||||
XDPRINTF((2, "get_dir_attrib of %s\n", get_nwpath_name(nwpath)));
|
||||
XDPRINTF((5,0, "get_dir_attrib of %s", get_nwpath_name(nwpath)));
|
||||
strncpy(d->name, nwpath->fn, sizeof(d->name));
|
||||
|
||||
d->attrib = 0x10; /* Verzeichnis */
|
||||
@ -816,16 +892,16 @@ int nw_creat_open_file(int dir_handle, uint8 *data, int len,
|
||||
if (creatmode) { /* creat File */
|
||||
if (creatmode & 0x2) { /* creatnew */
|
||||
if (!stat(fh->name, &stbuff)) {
|
||||
XDPRINTF((2,"CREAT File exist!! :%s:\n", fh->name));
|
||||
XDPRINTF((5,0,"CREAT File exist!! :%s:", fh->name));
|
||||
fh->fd = -1;
|
||||
completition = -0x85; /* No Priv */
|
||||
} else {
|
||||
XDPRINTF((2,"CREAT FILE:%s: Handle=%d\n", fh->name, fhandle));
|
||||
XDPRINTF((5,0,"CREAT FILE:%s: Handle=%d", fh->name, fhandle));
|
||||
fh->fd = creat(fh->name, 0777);
|
||||
if (fh->fd < 0) completition = -0x84; /* no create Rights */
|
||||
}
|
||||
} else {
|
||||
XDPRINTF((2,"CREAT FILE, ever with attrib:0x%x, access:0x%x, fh->name:%s: handle:%d\n",
|
||||
XDPRINTF((5,0,"CREAT FILE, ever with attrib:0x%x, access:0x%x, fh->name:%s: handle:%d",
|
||||
attrib, access, fh->name, fhandle));
|
||||
fh->fd = open(fh->name, O_CREAT|O_TRUNC|O_RDWR, 0777);
|
||||
if (fh->fd < 0) completition = -0x85; /* no delete /create Rights */
|
||||
@ -842,7 +918,7 @@ int nw_creat_open_file(int dir_handle, uint8 *data, int len,
|
||||
int acm = (access & 2) ? (int) O_RDWR /*|O_CREAT*/ : (int)O_RDONLY;
|
||||
if ( (!statr && (stbuff.st_mode & S_IFMT) != S_IFDIR)
|
||||
|| (statr && (acm & O_CREAT))){
|
||||
XDPRINTF((2,"OPEN FILE with attrib:0x%x, access:0x%x, fh->name:%s: fhandle=%d\n",attrib,access, fh->name, fhandle));
|
||||
XDPRINTF((5,0,"OPEN FILE with attrib:0x%x, access:0x%x, fh->name:%s: fhandle=%d",attrib,access, fh->name, fhandle));
|
||||
fh->fd = open(fh->name, acm, 0777);
|
||||
fh->offd = 0L;
|
||||
if (fh->fd > -1) {
|
||||
@ -861,7 +937,7 @@ int nw_creat_open_file(int dir_handle, uint8 *data, int len,
|
||||
}
|
||||
}
|
||||
|
||||
XDPRINTF((2,"OPEN FILE not OK ! fh->name:%s: fhandle=%d\n",fh->name, fhandle));
|
||||
XDPRINTF((5,0,"OPEN FILE not OK ! fh->name:%s: fhandle=%d",fh->name, fhandle));
|
||||
free_file_handle(fhandle);
|
||||
#ifdef TEST_FNAME
|
||||
if (got_testfn) {
|
||||
@ -873,20 +949,23 @@ int nw_creat_open_file(int dir_handle, uint8 *data, int len,
|
||||
} else return(-0x81); /* no more File Handles */
|
||||
}
|
||||
|
||||
int nw_delete_datei(int dir_handle, uint8 *data, int len)
|
||||
/* TODO: handle wildcards !!! */
|
||||
static int do_delete_file(NW_PATH *nwpath, FUNC_SEARCH *fs)
|
||||
{
|
||||
char unname[256];
|
||||
strcpy(unname, build_unix_name(nwpath, 0));
|
||||
XDPRINTF((5,0,"DELETE FILE unname:%s:", unname));
|
||||
if (!unlink(unname)) return(0);
|
||||
return(-0x8a); /* NO Delete Privileges */
|
||||
}
|
||||
|
||||
int nw_delete_datei(int dir_handle, uint8 *data, int len)
|
||||
{
|
||||
NW_PATH nwpath;
|
||||
int completition = get_kpl_path(&nwpath, dir_handle, data, len, 0);
|
||||
if (completition > -1) {
|
||||
char unname[256];
|
||||
struct stat stbuff;
|
||||
strcpy(unname, build_unix_name(&nwpath, 0));
|
||||
XDPRINTF((2,"DELETE FILE unname:%s:\n", unname));
|
||||
if (!stat(unname, &stbuff)){
|
||||
if (!unlink(unname)) return(0);
|
||||
return(-0x8a); /* NO Delete Privileges */
|
||||
} else completition= -0xff; /* No Files Found */
|
||||
completition = func_search_entry(&nwpath, 0x6, do_delete_file, NULL);
|
||||
if (completition < 0) return(completition);
|
||||
else if (!completition) return(-0xff);
|
||||
}
|
||||
return(completition);
|
||||
}
|
||||
@ -903,7 +982,7 @@ int nw_chmod_datei(int dir_handle, uint8 *data, int len, int modus)
|
||||
}
|
||||
if (completition < 0) return(completition);
|
||||
strcpy(unname, build_unix_name(&nwpath, 2));
|
||||
XDPRINTF((2,"CHMOD DATEI unname:%s:\n", unname));
|
||||
XDPRINTF((5,0,"CHMOD DATEI unname:%s:", unname));
|
||||
if (!stat(unname, &stbuff)){
|
||||
return(0);
|
||||
}
|
||||
@ -992,7 +1071,7 @@ int nw_write_datei(int fhandle, uint8 *data, int size, uint32 offset)
|
||||
flockd.l_len = 0;
|
||||
#if HAVE_TLI
|
||||
result = fcntl(fh->fd, F_FREESP, &flockd);
|
||||
XDPRINTF((2,"File %s is stripped, result=%d\n", fh->name, result));
|
||||
XDPRINTF((5,0,"File %s is stripped, result=%d", fh->name, result));
|
||||
#endif
|
||||
return(result);
|
||||
}
|
||||
@ -1079,11 +1158,11 @@ int nw_mk_rd_dir(int dir_handle, uint8 *data, int len, int mode)
|
||||
#endif
|
||||
|
||||
if (mode) {
|
||||
XDPRINTF((2,"MKDIR dirname:%s:\n", unname));
|
||||
XDPRINTF((5,0,"MKDIR dirname:%s:", unname));
|
||||
if (!mkdir(unname, 0777)) return(0);
|
||||
completition = -0x84; /* No Create Priv.*/ /* -0x9f Direktory Aktive */
|
||||
} else { /* rmdir */
|
||||
XDPRINTF((2,"RMDIR dirname:%s:\n", unname));
|
||||
XDPRINTF((5,0,"RMDIR dirname:%s:", unname));
|
||||
if (!rmdir(unname)) {
|
||||
NW_DIR *d=&(dirs[0]);
|
||||
int j = 0;
|
||||
@ -1312,7 +1391,7 @@ int nw_search(uint8 *info,
|
||||
{
|
||||
NW_PATH nwpath;
|
||||
int completition = get_kpl_path(&nwpath, dirhandle, data, len, 0);
|
||||
XDPRINTF((2,"nw_search path:%s:, fn:%s:, completition:0x%x\n",
|
||||
XDPRINTF((5,0,"nw_search path:%s:, fn:%s:, completition:0x%x",
|
||||
nwpath.path, nwpath.fn, completition));
|
||||
if (completition > -1) {
|
||||
struct stat stbuff;
|
||||
@ -1381,7 +1460,7 @@ int nw_alloc_dir_handle( int dir_handle, /* Suche ab Pfad dirhandle */
|
||||
int inode=get_kpl_path(&nwpath, dir_handle, data, len, 1);
|
||||
if (inode > -1)
|
||||
inode = insert_new_dir(&nwpath, inode, driveletter, is_temphandle, task);
|
||||
XDPRINTF((2,"Allocate %shandle:%s, Handle=%d, drive=%d, result=0x%x\n",
|
||||
XDPRINTF((5,0,"Allocate %shandle:%s, Handle=%d, drive=%d, result=0x%x",
|
||||
(is_temphandle) ? "Temp" : "Perm", get_nwpath_name(&nwpath),
|
||||
dir_handle, driveletter, inode));
|
||||
return(inode);
|
||||
@ -1404,7 +1483,7 @@ int nw_open_dir_handle( int dir_handle,
|
||||
NW_PATH nwpath;
|
||||
int completition = get_kpl_path(&nwpath, dir_handle, data, len, 1);
|
||||
if (completition > -1) {
|
||||
XDPRINTF((2,"NW_OPEN_DIR: completition = 0x%x; nwpath= %s\n",
|
||||
XDPRINTF((5,0,"NW_OPEN_DIR: completition = 0x%x; nwpath= %s",
|
||||
(int)completition, get_nwpath_name(&nwpath) ));
|
||||
|
||||
completition = new_dir_handle((ino_t)completition, &nwpath);
|
||||
@ -1415,10 +1494,10 @@ int nw_open_dir_handle( int dir_handle,
|
||||
*searchsequence = MAX_U16;
|
||||
completition = 0xff; /* Alle Rechte */
|
||||
}
|
||||
XDPRINTF((2,"NW_OPEN_DIR_2: completition = 0x%x\n",
|
||||
XDPRINTF((5,0,"NW_OPEN_DIR_2: completition = 0x%x",
|
||||
(int)completition));
|
||||
} else {
|
||||
XDPRINTF((2,"NW_OPEN_DIR failed: completition = 0x%x\n", (int)completition));
|
||||
XDPRINTF((4,0,"NW_OPEN_DIR failed: completition = 0x%x", (int)completition));
|
||||
}
|
||||
return(completition);
|
||||
}
|
||||
@ -1445,7 +1524,7 @@ int nw_set_dir_handle(int targetdir, int dir_handle,
|
||||
if (inode > -1){
|
||||
if (targetdir > 0 && --targetdir < used_dirs
|
||||
&& dirs[targetdir].is_temp != 2) { /* not a spez. temphandle */
|
||||
XDPRINTF((2,"Change dhandle:%d -> `%s`\n", targetdir+1, get_nwpath_name(&nwpath)));
|
||||
XDPRINTF((5,0,"Change dhandle:%d -> `%s`", targetdir+1, get_nwpath_name(&nwpath)));
|
||||
return(change_dir_entry(&dirs[targetdir], nwpath.volume, nwpath.path, inode, -1, -1, 0, task));
|
||||
/* here the existing handle is only modified */
|
||||
} else return(-0x9b); /* BAD DIR Handle */
|
||||
@ -1464,7 +1543,7 @@ int nw_get_directory_path(int dir_handle, uint8 *name)
|
||||
if (name[result-1] == '/') name[--result] = '\0';
|
||||
} else result = -0x98;
|
||||
}
|
||||
XDPRINTF((2,"nw_get_directory_path:%s: Handle=%d, result=0x%x\n", name, dir_handle+1, result));
|
||||
XDPRINTF((5,0,"nw_get_directory_path:%s: Handle=%d, result=0x%x", name, dir_handle+1, result));
|
||||
return(result);
|
||||
}
|
||||
|
||||
@ -1476,7 +1555,7 @@ int nw_get_vol_number(int dir_handle)
|
||||
result = dirs[dir_handle].volume;
|
||||
if (result >= used_vols) result = -0x98; /* Falsches Volume */
|
||||
}
|
||||
XDPRINTF((2,"nw_get_vol_number:0x%x: von Handle=%d\n", result, dir_handle+1));
|
||||
XDPRINTF((5,0,"nw_get_vol_number:0x%x: von Handle=%d", result, dir_handle+1));
|
||||
return(result);
|
||||
}
|
||||
|
||||
@ -1495,7 +1574,7 @@ int nw_get_volume_number(uint8 *volname, int namelen)
|
||||
break;
|
||||
}
|
||||
}
|
||||
XDPRINTF((2,"GET_VOLUME_NUMBER of:%s: result = 0x%x\n", vname, result));
|
||||
XDPRINTF((5,0,"GET_VOLUME_NUMBER of:%s: result = 0x%x", vname, result));
|
||||
return(result);
|
||||
}
|
||||
|
||||
@ -1507,7 +1586,7 @@ int nw_get_volume_name(int volnr, uint8 *volname)
|
||||
strcpy(volname, vols[volnr].sysname);
|
||||
result = strlen(volname);
|
||||
} else volname[0] = '\0';
|
||||
XDPRINTF((2,"GET_VOLUME_NAME von:%d = %s: ,result=0x%x\n", volnr, volname, result));
|
||||
XDPRINTF((5,0,"GET_VOLUME_NAME von:%d = %s: ,result=0x%x", volnr, volname, result));
|
||||
return(result);
|
||||
}
|
||||
|
||||
@ -1563,7 +1642,7 @@ static int s_nw_scan_dir_info(int dir_handle,
|
||||
if (!dirsequenz) dirsequenz++;
|
||||
|
||||
strcpy(dirname, wild);
|
||||
XDPRINTF((2,"SCAN_DIR: rights = 0x%x, subnr = %d\n",
|
||||
XDPRINTF((5,0,"SCAN_DIR: rights = 0x%x, subnr = %d",
|
||||
(int)rights, (int)GET_BE16(subnr)));
|
||||
|
||||
if (*dirname) {
|
||||
@ -1573,7 +1652,7 @@ static int s_nw_scan_dir_info(int dir_handle,
|
||||
0x10,
|
||||
&stbuff) ) {
|
||||
|
||||
XDPRINTF((2,"SCAN_DIR: von %s, found %s:\n", dh->unixname, dirname));
|
||||
XDPRINTF((5,0,"SCAN_DIR: von %s, found %s:", dh->unixname, dirname));
|
||||
if (++aktsequenz == dirsequenz) { /* actual found */
|
||||
U16_TO_BE16(aktsequenz, subnr);
|
||||
strncpy(subname, dirname, 16);
|
||||
@ -1736,7 +1815,7 @@ int nw_scan_a_directory(uint8 *rdata,
|
||||
{
|
||||
NW_PATH nwpath;
|
||||
int completition = get_kpl_path(&nwpath, dirhandle, data, len, 0);
|
||||
XDPRINTF((2,"nw_scan_a_directory path:%s:, fn:%s:, completition:0x%x\n",
|
||||
XDPRINTF((5,0,"nw_scan_a_directory path:%s:, fn:%s:, completition:0x%x",
|
||||
nwpath.path, nwpath.fn, completition));
|
||||
if (completition > -1) {
|
||||
struct stat stbuff;
|
||||
@ -1768,7 +1847,7 @@ int nw_scan_a_root_dir(uint8 *rdata,
|
||||
NW_PATH nwpath;
|
||||
uint8 data[2];
|
||||
int completition = get_kpl_path(&nwpath, dirhandle, data, 0, 1);
|
||||
XDPRINTF((2,"nw_scan_a_directory_2 path:%s:, fn:%s:, completition:0x%x\n",
|
||||
XDPRINTF((5,0,"nw_scan_a_directory_2 path:%s:, fn:%s:, completition:0x%x",
|
||||
nwpath.path, nwpath.fn, completition));
|
||||
if (completition > -1) {
|
||||
struct stat stbuff;
|
||||
@ -1874,7 +1953,7 @@ static int create_queue_file(char *job_file_name,
|
||||
(int) *job_file_name,
|
||||
&fnfo, 0x6, 0x6, 1);
|
||||
|
||||
XDPRINTF((2,"creat queue file bez=`%s` handle=%d\n",
|
||||
XDPRINTF((5,0,"creat queue file bez=`%s` handle=%d",
|
||||
job_bez, result));
|
||||
return(result);
|
||||
}
|
||||
@ -1887,7 +1966,7 @@ int nw_creat_queue(int connection, uint8 *queue_id, uint8 *queue_job,
|
||||
INT_QUEUE_JOB *jo = give_new_queue_job(old_call);
|
||||
uint32 q_id = GET_BE32(queue_id);
|
||||
int result = -0xff;
|
||||
XDPRINTF((2,"NW_CREAT_Q:dlen=%d, dirname=%s\n", dir_nam_len, dirname));
|
||||
XDPRINTF((5,0,"NW_CREAT_Q:dlen=%d, dirname=%s", dir_nam_len, dirname));
|
||||
|
||||
if (NULL != jo) {
|
||||
int jo_id = 0;
|
||||
@ -1968,11 +2047,11 @@ int nw_close_file_queue(uint8 *queue_id,
|
||||
{
|
||||
int result = -0xff;
|
||||
int jo_id = (int) *job_id; /* ever only the first byte */
|
||||
XDPRINTF((2,"nw_close_file_queue JOB=%d\n", jo_id));
|
||||
XDPRINTF((5,0,"nw_close_file_queue JOB=%d", jo_id));
|
||||
if (jo_id > 0 && jo_id <= anz_jobs){
|
||||
INT_QUEUE_JOB *jo=queue_jobs[jo_id-1];
|
||||
int fhandle = (int)jo->fhandle;
|
||||
XDPRINTF((2,"nw_close_file_queue fhandle=%d\n", fhandle));
|
||||
XDPRINTF((5,0,"nw_close_file_queue fhandle=%d", fhandle));
|
||||
if (fhandle > 0 && fhandle <= anz_fhandles) {
|
||||
FILE_HANDLE *fh=&(file_handles[fhandle-1]);
|
||||
char unixname[300];
|
||||
@ -1994,16 +2073,16 @@ int nw_close_file_queue(uint8 *queue_id,
|
||||
}
|
||||
pclose(fout);
|
||||
} else
|
||||
XDPRINTF((1,"Cannot open pipe `%s`\n", "lpr"));
|
||||
XDPRINTF((1,0,"Cannot open pipe `%s`", "lpr"));
|
||||
|
||||
fclose(f);
|
||||
if (is_ok) {
|
||||
unlink(unixname);
|
||||
result=0;
|
||||
}
|
||||
} else XDPRINTF((1,"Cannot open queue-file `%s`\n", unixname));
|
||||
} else XDPRINTF((1,0,"Cannot open queue-file `%s`", unixname));
|
||||
} else
|
||||
XDPRINTF((2,"nw_close_file_queue fhandle=%d\n", fhandle));
|
||||
XDPRINTF((2,0,"nw_close_file_queue fhandle=%d", fhandle));
|
||||
free_queue_job(jo_id);
|
||||
}
|
||||
return(result);
|
||||
|
46
emutli.c
46
emutli.c
@ -1,4 +1,4 @@
|
||||
/* emutli.c 18-Dec-95 */
|
||||
/* emutli.c 24-Dec-95 */
|
||||
/*
|
||||
* One short try to emulate TLI with SOCKETS.
|
||||
*/
|
||||
@ -104,14 +104,43 @@ static void del_special_net(int special, char *devname, int frame)
|
||||
struct sockaddr_ipx *sipx = (struct sockaddr_ipx *)&id.ifr_addr;
|
||||
memset(&id, 0, sizeof(struct ifreq));
|
||||
|
||||
if (special != IPX_INTERNAL) {
|
||||
if (devname && *devname) strcpy(id.ifr_name, devname);
|
||||
sipx->sipx_type = frame;
|
||||
}
|
||||
|
||||
sipx->sipx_network = 0L;
|
||||
sipx->sipx_special = special;
|
||||
sipx->sipx_family = AF_IPX;
|
||||
if (special == IPX_PRIMARY) {
|
||||
FILE *f=fopen("/proc/net/ipx_interface", "r");
|
||||
if (f) {
|
||||
char buff[200];
|
||||
char buff1[200];
|
||||
char buff2[200];
|
||||
char buff3[200];
|
||||
char buff4[200];
|
||||
char buff5[200];
|
||||
while (fgets((char*)buff, sizeof(buff), f) != NULL){
|
||||
if (sscanf(buff, "%s %s %s %s %s",
|
||||
buff1, buff2, buff3, buff4, buff5) == 5) {
|
||||
int len = strlen(buff5);
|
||||
if (!len) continue;
|
||||
switch (*(buff5+len-1)) {
|
||||
case '2' : sipx->sipx_type = IPX_FRAME_8022; break;
|
||||
case '3' : sipx->sipx_type = IPX_FRAME_8023; break;
|
||||
case 'P' : sipx->sipx_type = IPX_FRAME_SNAP; break;
|
||||
case 'I' : sipx->sipx_type = IPX_FRAME_ETHERII; break;
|
||||
default : continue;
|
||||
}
|
||||
upstr(buff3);
|
||||
if (!strcmp(buff3, "YES")) { /* primary */
|
||||
strcpy(id.ifr_name, buff4);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
fclose(f);
|
||||
}
|
||||
} else if (special != IPX_INTERNAL) {
|
||||
if (devname && *devname) strcpy(id.ifr_name, devname);
|
||||
sipx->sipx_type = frame;
|
||||
}
|
||||
sipx->sipx_action = IPX_DLTITF;
|
||||
x_ioctl(sock, SIOCSIFADDR, &id);
|
||||
close(sock);
|
||||
@ -122,6 +151,8 @@ static void del_special_net(int special, char *devname, int frame)
|
||||
del_special_net(IPX_INTERNAL, NULL, 0)
|
||||
#define del_interface(devname, frame) \
|
||||
del_special_net(IPX_SPECIAL_NONE, (devname), (frame))
|
||||
#define del_primary_net() \
|
||||
del_special_net(IPX_PRIMARY, NULL, 0)
|
||||
|
||||
static void add_special_net(int special,
|
||||
char *devname, int frame, uint32 netnum, uint32 node)
|
||||
@ -194,6 +225,7 @@ int init_dev(char *devname, int frame, uint32 network)
|
||||
del_interface(devname, frame);
|
||||
if (!have_ipx_started) {
|
||||
have_ipx_started++;
|
||||
del_primary_net();
|
||||
add_primary_net(devname, frame, network);
|
||||
} else
|
||||
add_device_net(devname, frame, network);
|
||||
@ -333,7 +365,7 @@ int t_bind(int sock, struct t_bind *a_in, struct t_bind *a_out)
|
||||
return(-1);
|
||||
}
|
||||
sock2ipxadr((ipxAddr_t*) (a_out->addr.buf), &ipxs);
|
||||
XDPRINTF((2,"T_BIND ADR=%s\n", visable_ipx_adr((ipxAddr_t *) a_out->addr.buf ) ));
|
||||
XDPRINTF((2,0,"T_BIND ADR=%s", visable_ipx_adr((ipxAddr_t *) a_out->addr.buf ) ));
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
@ -8,4 +8,5 @@
|
||||
#define MAX_NW_VOLS 10 /* max. Volumes */
|
||||
|
||||
#define MAX_NET_DEVICES 1 /* max. Netdevices, frames */
|
||||
#define IPX_DATA_GR_546 1 /* allow ipx packets > 546+30 Byte */
|
||||
|
||||
|
22
makefile.unx
22
makefile.unx
@ -1,4 +1,4 @@
|
||||
# makefile.unx 20-Dec-95
|
||||
# makefile.unx 25-Dec-95
|
||||
VPATH=..
|
||||
O=.o
|
||||
C=.c
|
||||
@ -6,10 +6,17 @@ C=.c
|
||||
DEBUG=-DDB
|
||||
V_H=0
|
||||
V_L=96
|
||||
P_L=0
|
||||
P_L=2
|
||||
#define D_P_L 1
|
||||
DISTRIB=mars_nwe
|
||||
#if D_P_L
|
||||
DISTRIBF=$(DISTRIB)-$(V_H).$(V_L).pl$(P_L)
|
||||
PATCHF=$(DISTRIBF)
|
||||
#else
|
||||
P_L=0
|
||||
DISTRIBF=$(DISTRIB)-$(V_H).$(V_L)
|
||||
PATCHF=$(DISTRIBF).pl$(P_L)
|
||||
#endif
|
||||
STERN=*
|
||||
|
||||
#if 0
|
||||
@ -108,7 +115,8 @@ $(PROG5): $(PROG5)$(O) $(OBJ5)
|
||||
$(OBJS): net.h config.h
|
||||
|
||||
$(C)$(O):
|
||||
$(CC) -c $(CFLAGS) $(HOSTCFLAGS) $(DEBUG) -D_VERSION_H_=$(V_H) -D_VERSION_L_=$(V_L) $<
|
||||
$(CC) -c $(CFLAGS) $(HOSTCFLAGS) $(DEBUG)\
|
||||
-D_VERS_H_=$(V_H) -D_VERS_L_=$(V_L) -D_VERS_P_=$(P_L) $<
|
||||
|
||||
n_all: $(PROGS)
|
||||
|
||||
@ -148,7 +156,7 @@ n_clean: n_clean1
|
||||
n_distclean: n_clean
|
||||
cd .. && (rm -f *.dir *.pag; cd obj)
|
||||
|
||||
n_diff: n_clean1
|
||||
n_make_dir: n_clean1
|
||||
cd .. && (rm -rf obj/../$(DISTRIB) \
|
||||
; mkdir $(DISTRIB) \
|
||||
; mkdir $(DISTRIB)/examples \
|
||||
@ -168,7 +176,11 @@ n_diff: n_clean1
|
||||
; ln -f \
|
||||
examples/$(STERN) \
|
||||
$(DISTRIB)/examples/. \
|
||||
; makepatch $(DISTRIB).org $(DISTRIB) > $(PATCHF) \
|
||||
; cd obj )
|
||||
|
||||
n_diff: n_make_dir
|
||||
cd .. && ( \
|
||||
makepatch $(DISTRIB).org $(DISTRIB) > $(PATCHF) \
|
||||
; gzip -9 -f $(PATCHF) \
|
||||
; cd obj )
|
||||
|
||||
|
10
mars_nwe.lsm
10
mars_nwe.lsm
@ -2,15 +2,15 @@ Begin3
|
||||
Title: mars_nwe
|
||||
Version: 0.96
|
||||
Entered-date: 20-Dec-95
|
||||
Description: simple novell-server-emulator (src),beta
|
||||
needs no kernelchanges, usefull for testing ipx
|
||||
Description: full novell-server-emulator (src),beta
|
||||
file-services, bindery-services, printing-services
|
||||
Keywords: novell, netware, unixware, server, ipx, ncp, tli
|
||||
needs no kernelchanges, usefull for testing ipx
|
||||
Keywords: novell, netware, server, ipx, ncp, tli
|
||||
Author: mstover@freeway.de (Martin Stover)
|
||||
Maintained-by: mstover@freeway.de (Martin Stover)
|
||||
Primary-site: linux01.gwdg.de /pub/ncpfs
|
||||
80kB mars_nwe-0.96.tgz
|
||||
90kB mars_nwe-0.96.tgz
|
||||
Alternate-site: ftp.uni-duisburg.de /pub/linux/ipxware
|
||||
Platforms: Linux (1.2.xx, 1.3.32 testet, others should work)
|
||||
Platforms: Linux (1.2.xx, 1.3.32 tested, others should work)
|
||||
Copying-policy: GNU
|
||||
End
|
||||
|
@ -19,6 +19,13 @@
|
||||
|
||||
#include "net.h"
|
||||
|
||||
typedef struct {
|
||||
int x;
|
||||
|
||||
} 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 */
|
||||
|
86
ncpserv.c
86
ncpserv.c
@ -1,4 +1,4 @@
|
||||
/* ncpserv.c, 19-Dec-95 */
|
||||
/* ncpserv.c, 24-Dec-95 */
|
||||
|
||||
/* (C)opyright (C) 1993,1995 Martin Stover, Marburg, Germany
|
||||
*
|
||||
@ -250,7 +250,7 @@ int find_get_conn_nr(ipxAddr_t *addr)
|
||||
c->pid = pid;
|
||||
c->fd = fds[1];
|
||||
close(fds[0]); /* no need to read */
|
||||
XDPRINTF((5, "AFTER FORK new PROCESS =%d, connection=%d\n", pid, connection));
|
||||
XDPRINTF((5,0, "AFTER FORK new PROCESS =%d, connection=%d", pid, connection));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -304,16 +304,16 @@ static int handle_fxx(CONNECTION *c, int gelen, int func)
|
||||
if (nw_debug > 1){
|
||||
int j = gelen - sizeof(NCPREQUEST);
|
||||
if (nw_debug){
|
||||
DPRINTF(("NCP 0x%x REQUEST:ufunc:0x%x\n", func, ufunc));
|
||||
XDPRINTF((1, 0, "NCP 0x%x REQUEST:ufunc:0x%x", func, ufunc));
|
||||
if (j > 0){
|
||||
uint8 *p=requestdata;
|
||||
DPRINTF(("len %d, DATA:", j));
|
||||
XDPRINTF((1, 2, "len %d, DATA:", j));
|
||||
while (j--) {
|
||||
int c = *p++;
|
||||
if (c > 32 && c < 127) DPRINTF((",\'%c\'", (char) c));
|
||||
else DPRINTF((",0x%x", c));
|
||||
if (c > 32 && c < 127) XDPRINTF((1, 3, ",\'%c\'", (char) c));
|
||||
else XDPRINTF((1, 3, ",0x%x", c));
|
||||
}
|
||||
DPRINTF(("\n"));
|
||||
XDPRINTF((1, 1, NULL));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -358,7 +358,7 @@ static int handle_fxx(CONNECTION *c, int gelen, int func)
|
||||
|
||||
case 0x03: { /* Enable Broadcasts */
|
||||
;;;
|
||||
DPRINTF(("TODO: enable Broadcasts\n"));
|
||||
XDPRINTF((2, 0, "TODO: enable Broadcasts"));
|
||||
}
|
||||
break;
|
||||
|
||||
@ -414,6 +414,7 @@ static int handle_fxx(CONNECTION *c, int gelen, int func)
|
||||
int k, i;
|
||||
memset(xdata, 0, sizeof(struct XDATA));
|
||||
strcpy(xdata->servername, my_nwname);
|
||||
|
||||
if (!tells_server_version) {
|
||||
xdata->version = 2;
|
||||
xdata->subversion = 15;
|
||||
@ -421,6 +422,7 @@ static int handle_fxx(CONNECTION *c, int gelen, int func)
|
||||
xdata->version = 3;
|
||||
xdata->subversion = 11;
|
||||
}
|
||||
|
||||
i=0;
|
||||
for (k=0; k < anz_connect; k++) {
|
||||
if (connections[k].fd > -1) i++;
|
||||
@ -466,7 +468,7 @@ static int handle_fxx(CONNECTION *c, int gelen, int func)
|
||||
upstr(obj.name);
|
||||
strmaxcpy(password, (char*)(p1+1),
|
||||
max(sizeof(password)-1, (int) *p1));
|
||||
DPRINTF(("TODO:LOGIN unencrypted PW NAME='%s', PASSW='%s'\n",
|
||||
XDPRINTF((1, 0, "TODO:LOGIN unencrypted PW NAME='%s', PASSW='%s'",
|
||||
obj.name, password));
|
||||
if (0 == (result = find_obj_id(&obj, 0))) {
|
||||
/* TODO: check password !!!!!!! */
|
||||
@ -532,7 +534,7 @@ static int handle_fxx(CONNECTION *c, int gelen, int func)
|
||||
obj.type = GET_BE16(p);
|
||||
strmaxcpy((char*)obj.name, (char*)(p+3), *(p+2));
|
||||
upstr(obj.name);
|
||||
XDPRINTF((2, "LOGIN CRYPTED PW NAME='%s'\n",obj.name));
|
||||
XDPRINTF((2, 0, "LOGIN CRYPTED PW NAME='%s'",obj.name));
|
||||
if (0 == (result = find_obj_id(&obj, 0)))
|
||||
result=nw_test_passwd(obj.id, c->crypt_key, rdata);
|
||||
if (result > -1) {
|
||||
@ -824,7 +826,7 @@ static int handle_fxx(CONNECTION *c, int gelen, int func)
|
||||
;;
|
||||
}
|
||||
if (result < 0) completition = (uint8) -result;
|
||||
DPRINTF(("TODO: Change Obj PW from OBJECT='%s', result=%d\n",
|
||||
XDPRINTF((1, 0, "TODO: Change Obj PW from OBJECT='%s', result=%d",
|
||||
obj.name, result));
|
||||
completition=0xff;
|
||||
} break;
|
||||
@ -910,7 +912,7 @@ static int handle_fxx(CONNECTION *c, int gelen, int func)
|
||||
if (!result) {
|
||||
*xdata = obj.security;
|
||||
U32_TO_BE32(obj.id, (xdata+1));
|
||||
XDPRINTF((2, "ACCESS LEVEL:=0x%x, obj=0x%lx\n",
|
||||
XDPRINTF((2,0, "ACCESS LEVEL:=0x%x, obj=0x%lx",
|
||||
(int) obj.security, obj.id));
|
||||
data_len = 5;
|
||||
} else completition = (uint8)-result;
|
||||
@ -964,7 +966,7 @@ static int handle_fxx(CONNECTION *c, int gelen, int func)
|
||||
if (0 == (result = find_obj_id(&obj, 0)))
|
||||
result=nw_test_passwd(obj.id, c->crypt_key, rdata);
|
||||
if (result < 0) completition = (uint8) -result;
|
||||
XDPRINTF((2, "Keyed Verify PW from OBJECT='%s', result=%d\n",
|
||||
XDPRINTF((2,0, "Keyed Verify PW from OBJECT='%s', result=%d",
|
||||
obj.name, result));
|
||||
}
|
||||
break;
|
||||
@ -987,26 +989,26 @@ static int handle_fxx(CONNECTION *c, int gelen, int func)
|
||||
result=nw_set_enpasswd(obj.id, p+1);
|
||||
|
||||
if (result< 0) completition = (uint8) -result;
|
||||
DPRINTF(("Keyed Change PW from OBJECT='%s', result=0x%x\n",
|
||||
XDPRINTF((1, 0, "Keyed Change PW from OBJECT='%s', result=0x%x",
|
||||
obj.name, result));
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
case 0x4c : { /* List Relations of an Object */
|
||||
DPRINTF(("TODO:List Relations of an Object\n"));
|
||||
XDPRINTF((1, 0, "TODO:List Relations of an Object"));
|
||||
completition=0xfb;
|
||||
} break;
|
||||
|
||||
case 0x64 : { /* Create Queue */
|
||||
DPRINTF(("TODO:Create QUEUE ??\n"));
|
||||
XDPRINTF((1, 0, "TODO:Create QUEUE ??"));
|
||||
} break;
|
||||
|
||||
case 0x66 : { /* Read Queue Current Status */
|
||||
/* !!!!!! TO DO */
|
||||
NETOBJ obj;
|
||||
obj.id = GET_BE32(rdata);
|
||||
DPRINTF(("TODO:READ QUEUE STATUS von Q=0x%lx\n", obj.id));
|
||||
XDPRINTF((1, 0, "TODO:READ QUEUE STATUS von Q=0x%lx", obj.id));
|
||||
completition=0xd5; /* no Queue Job */
|
||||
}break;
|
||||
|
||||
@ -1014,7 +1016,7 @@ static int handle_fxx(CONNECTION *c, int gelen, int func)
|
||||
/* !!!!!! TO DO */
|
||||
NETOBJ obj;
|
||||
obj.id = GET_BE32(rdata);
|
||||
DPRINTF(("TODO:GET QUEUE JOB LIST von Q=0x%lx\n", obj.id));
|
||||
XDPRINTF((1, 0, "TODO:GET QUEUE JOB LIST von Q=0x%lx", obj.id));
|
||||
completition=0xd5; /* no Queue Job */
|
||||
}break;
|
||||
|
||||
@ -1022,7 +1024,7 @@ static int handle_fxx(CONNECTION *c, int gelen, int func)
|
||||
/* !!!!!! TODO */
|
||||
NETOBJ obj;
|
||||
obj.id = GET_BE32(rdata);
|
||||
DPRINTF(("TODO: GET QUEUE JOB ENTRY von Q=0x%lx\n", obj.id));
|
||||
XDPRINTF((1, 0, "TODO: GET QUEUE JOB ENTRY von Q=0x%lx", obj.id));
|
||||
completition=0xd5; /* no Queue Job */
|
||||
}break;
|
||||
|
||||
@ -1054,21 +1056,21 @@ static int handle_fxx(CONNECTION *c, int gelen, int func)
|
||||
break;
|
||||
|
||||
case 0xc8 : { /* CHECK CONSOLE PRIVILEGES */
|
||||
DPRINTF(("TODO: CHECK CONSOLE PRIV \n"));
|
||||
XDPRINTF((1, 0, "TODO: CHECK CONSOLE PRIV"));
|
||||
/* !!!!!! TODO completition=0xc6 (no rights) */
|
||||
} break;
|
||||
|
||||
case 0xc9 : { /* GET FILE SERVER DESCRIPTION STRINGs */
|
||||
char *company = "Mars :-)";
|
||||
char *revision = "Version %d.%d";
|
||||
char *revision_date= "20-Dec-95";
|
||||
char *revision_date= "24-Dec-95";
|
||||
char *copyright = "(C)opyright Martin Stover";
|
||||
int k=strlen(company)+1;
|
||||
|
||||
memset(responsedata, 0, 512);
|
||||
strcpy(responsedata, company);
|
||||
k += (1+sprintf(responsedata+k, revision,
|
||||
_VERSION_H_, _VERSION_L_ ));
|
||||
_VERS_H_, _VERS_L_ ));
|
||||
strcpy(responsedata+k, revision_date);
|
||||
k += (strlen(revision_date)+1);
|
||||
strcpy(responsedata+k, copyright);
|
||||
@ -1139,7 +1141,7 @@ static int handle_fxx(CONNECTION *c, int gelen, int func)
|
||||
ncpresponse->connect_status = connect_status;
|
||||
data_len=write(c->fd, (char*)ncpresponse,
|
||||
sizeof(NCPRESPONSE) + data_len);
|
||||
XDPRINTF((2, "0x%x 0x%x compl:0x%x, write to %d, anz = %d\n",
|
||||
XDPRINTF((2, 0, "0x%x 0x%x compl:0x%x, write to %d, anz = %d",
|
||||
func, (int)ufunc, (int) completition, c->fd, data_len));
|
||||
return(0); /* ok */
|
||||
}
|
||||
@ -1194,7 +1196,7 @@ static void close_all(void)
|
||||
if (ncp_fd > -1) {
|
||||
t_unbind(ncp_fd);
|
||||
t_close(ncp_fd);
|
||||
XDPRINTF((2, "LEAVE ncpserv\n"));
|
||||
XDPRINTF((2,0, "LEAVE ncpserv"));
|
||||
ncp_fd = -1;
|
||||
}
|
||||
}
|
||||
@ -1256,7 +1258,7 @@ static int handle_ctrl(void)
|
||||
int result = 0;
|
||||
int data_len = read(0, (char*)&what, sizeof(what));
|
||||
if (data_len == sizeof(what)) {
|
||||
XDPRINTF((2, "NCPSERV:GOT CTRL what=0x%x\n", what));
|
||||
XDPRINTF((2, 0, "GOT CTRL what=0x%x", what));
|
||||
switch (what) {
|
||||
case 0x5555 : /* clear_connection */
|
||||
data_len = read(0, (char*)&conn, sizeof(conn));
|
||||
@ -1266,11 +1268,11 @@ static int handle_ctrl(void)
|
||||
case 0x3333 : /* 'bindery' calls */
|
||||
if (sizeof(conn) == read(0, (char*)&conn, sizeof(conn))) {
|
||||
uint8 *buff = xmalloc(conn+10);
|
||||
XDPRINTF((2, "0x3333 len=%d\n", conn));
|
||||
XDPRINTF((2,0, "0x3333 len=%d", conn));
|
||||
if (conn == read(0, (char*)buff, conn))
|
||||
handle_bind_calls(buff);
|
||||
else
|
||||
DPRINTF(("0x3333 protokoll error:len=%d\n", conn));
|
||||
XDPRINTF((1, 1, "0x3333 protokoll error:len=%d", conn));
|
||||
xfree(buff);
|
||||
}
|
||||
break;
|
||||
@ -1289,7 +1291,7 @@ static int handle_ctrl(void)
|
||||
default : break;
|
||||
} /* switch */
|
||||
result++;
|
||||
} else XDPRINTF((2, "NCPSERV:GOT CTRL size=%d\n", data_len));
|
||||
} else XDPRINTF((2, 0, "GOT CTRL size=%d", data_len));
|
||||
return(result);
|
||||
}
|
||||
|
||||
@ -1337,16 +1339,16 @@ int main(int argc, char *argv[])
|
||||
|
||||
if (p->revents){
|
||||
if (!j) { /* ncp-socket */
|
||||
XDPRINTF((99,"POLL %d\n", p->revents));
|
||||
XDPRINTF((99,0, "POLL revents=%d", p->revents));
|
||||
if (p->revents & ~POLLIN)
|
||||
errorp(0, "STREAM error", "revents=0x%x", p->revents );
|
||||
else {
|
||||
if ((result = t_rcvudata(ncp_fd, &ud, &rcv_flags)) > -1){
|
||||
in_len = ud.udata.len;
|
||||
XDPRINTF((10, "NCPSERV-LOOP von %s\n", visable_ipx_adr(&from_addr)));
|
||||
XDPRINTF((10, 0, "NCPSERV-LOOP von %s", visable_ipx_adr(&from_addr)));
|
||||
if ((type = GET_BE16(ncprequest->type)) == 0x2222 || type == 0x5555) {
|
||||
int connection = (int)ncprequest->connection;
|
||||
XDPRINTF((10, "GOT 0x%x in NCPSERV connection=%d\n", type, connection));
|
||||
XDPRINTF((10,0, "GOT 0x%x in NCPSERV connection=%d", type, connection));
|
||||
if ( connection > 0 && connection <= anz_connect) {
|
||||
CONNECTION *c = &(connections[connection-1]);
|
||||
if (!memcmp(&from_addr, &(c->client_adr), sizeof(ipxAddr_t))) {
|
||||
@ -1365,7 +1367,7 @@ int main(int argc, char *argv[])
|
||||
/* perhaps nwconn is busy */
|
||||
ncp_response(0x9999, ncprequest->sequence,
|
||||
connection, 0, 0x0, 0, 0);
|
||||
XDPRINTF((2, "Send Request being serviced to connection:%d\n", connection));
|
||||
XDPRINTF((2, 0, "Send Request being serviced to connection:%d", connection));
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -1379,7 +1381,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
if (sent_here) {
|
||||
int anz=write(c->fd, (char*)ncprequest, in_len);
|
||||
XDPRINTF((10, "write to %d, anz = %d\n", c->fd, anz));
|
||||
XDPRINTF((10,0, "write to %d, anz = %d", c->fd, anz));
|
||||
if (func == 0x19) { /* logout */
|
||||
c->object_id = 0; /* not LOGGED */
|
||||
}
|
||||
@ -1398,19 +1400,21 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
}
|
||||
XDPRINTF((10, "c->fd = %d\n", c->fd));
|
||||
XDPRINTF((10,0, "c->fd = %d", c->fd));
|
||||
}
|
||||
}
|
||||
/* here someting is wrong */
|
||||
XDPRINTF((1, "GOT 0x%x connection=%d of %d conns not OK in NCPSERV\n",
|
||||
XDPRINTF((1,0, "GOT 0x%x connection=%d of %d conns not OK",
|
||||
type, ncprequest->connection, anz_connect));
|
||||
|
||||
ncp_response(0x3333, ncprequest->sequence,
|
||||
ncprequest->connection,
|
||||
0, 0xf9, 0, 0);
|
||||
0, 0xff, 0x08, 0);
|
||||
|
||||
} else if (type == 0x1111) {
|
||||
/* GIVE CONNECTION Nr connection */
|
||||
int connection = (server_goes_down) ? 0 : find_get_conn_nr(&from_addr);
|
||||
XDPRINTF((2, "GIVE CONNECTION NR=%d in NCPSERV\n", connection));
|
||||
XDPRINTF((2, 0, "GIVE CONNECTION NR=%d", connection));
|
||||
if (connection) {
|
||||
CONNECTION *c = &(connections[connection-1]);
|
||||
int anz;
|
||||
@ -1418,20 +1422,20 @@ int main(int argc, char *argv[])
|
||||
c->object_id = 0; /* firsttime set 0 for NOT LOGGED */
|
||||
c->sequence = 0;
|
||||
anz=write(c->fd, (char*)ncprequest, in_len);
|
||||
XDPRINTF((10, "write to oldconn %d, anz = %d\n", c->fd, anz));
|
||||
XDPRINTF((10, 0, "write to oldconn %d, anz = %d", c->fd, anz));
|
||||
} else /* no free connection */
|
||||
ncp_response(0x3333, 0, 0, 0, 0xf9, 0, 0);
|
||||
} else {
|
||||
int connection = (int)ncprequest->connection;
|
||||
int sequence = (int)ncprequest->sequence;
|
||||
XDPRINTF((1, "NCPSERV:Got UNKNOWN TYPE: 0x%x\n", type));
|
||||
XDPRINTF((1,0, "Got UNKNOWN TYPE: 0x%x", type));
|
||||
ncp_response(0x3333, sequence, connection,
|
||||
1, 0xfb, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (p->fd==0) { /* fd_ncpserv_in */
|
||||
XDPRINTF((2,"POLL %d, fh=%d\n", p->revents, p->fd));
|
||||
XDPRINTF((2,0,"POLL %d, fh=%d", p->revents, p->fd));
|
||||
if (p->revents & ~POLLIN)
|
||||
errorp(0, "STREAM error", "revents=0x%x", p->revents );
|
||||
else handle_ctrl();
|
||||
@ -1441,7 +1445,7 @@ int main(int argc, char *argv[])
|
||||
p++;
|
||||
} /* while */
|
||||
} else {
|
||||
XDPRINTF((3,"NCPSERV:POLLING ...\n"));
|
||||
XDPRINTF((3,0,"POLLING ..."));
|
||||
}
|
||||
}
|
||||
close_all();
|
||||
|
62
net.h
62
net.h
@ -1,4 +1,4 @@
|
||||
/* net.h 20-Nov-95 */
|
||||
/* net.h 02-Jan-96 */
|
||||
|
||||
/* (C)opyright (C) 1993,1995 Martin Stover, Marburg, Germany
|
||||
*
|
||||
@ -17,7 +17,6 @@
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _M_NET_H_
|
||||
#define _M_NET_H_
|
||||
#include <stdio.h>
|
||||
@ -79,7 +78,41 @@
|
||||
#define MAX_U32 ((uint32)0xffffffffL)
|
||||
#define MAX_U16 ((uint16)0xffff)
|
||||
|
||||
#define IPX_MAX_DATA /* 1058 */ 546
|
||||
|
||||
/* ===================> config.h <======================= */
|
||||
#include "config.h"
|
||||
|
||||
#ifndef MAX_CONNECTIONS
|
||||
# define MAX_CONNECTIONS 5 /* maximum Number of Connections */
|
||||
#endif
|
||||
|
||||
#ifndef MAX_NW_VOLS
|
||||
# define MAX_NW_VOLS 10
|
||||
#endif
|
||||
|
||||
#ifndef MAX_NET_DEVICES
|
||||
# define MAX_NET_DEVICES 5
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef FILENAME_NW_INI
|
||||
# define FILENAME_NW_INI "./nw.ini" /* location of ini (conf) file */
|
||||
#endif
|
||||
|
||||
#ifndef PATHNAME_BINDERY
|
||||
# define PATHNAME_BINDERY "." /* location of bindery files */
|
||||
#endif
|
||||
|
||||
#ifndef IPX_DATA_GR_546
|
||||
# define IPX_DATA_GR_546 1
|
||||
#endif
|
||||
|
||||
#if IPX_DATA_GR_546
|
||||
# define IPX_MAX_DATA 1058
|
||||
#else
|
||||
# define IPX_MAX_DATA 546
|
||||
#endif
|
||||
|
||||
#define MAX_SERVER_NAME 48
|
||||
|
||||
typedef union {
|
||||
@ -220,29 +253,6 @@ typedef struct S_NCPREQUEST NCPREQUEST;
|
||||
#define FD_NWSERV 3 /* one after stderr */
|
||||
|
||||
|
||||
/* ===================> config.h <======================= */
|
||||
#include "config.h"
|
||||
|
||||
#ifndef MAX_CONNECTIONS
|
||||
# define MAX_CONNECTIONS 5 /* maximum Number of Connections */
|
||||
#endif
|
||||
|
||||
#ifndef MAX_NW_VOLS
|
||||
# define MAX_NW_VOLS 10
|
||||
#endif
|
||||
|
||||
#ifndef MAX_NET_DEVICES
|
||||
# define MAX_NET_DEVICES 5
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef FILENAME_NW_INI
|
||||
# define FILENAME_NW_INI "./nw.ini" /* location of ini (conf) file */
|
||||
#endif
|
||||
|
||||
#ifndef PATHNAME_BINDERY
|
||||
# define PATHNAME_BINDERY "." /* location of bindery files */
|
||||
#endif
|
||||
|
||||
#include "net1.h"
|
||||
/* connect.c */
|
||||
|
23
net1.c
23
net1.c
@ -1,4 +1,4 @@
|
||||
/* net1.c, 10-Dec-95 */
|
||||
/* net1.c, 24-Dec-95 */
|
||||
|
||||
/* (C)opyright (C) 1993,1995 Martin Stover, Marburg, Germany
|
||||
*
|
||||
@ -22,9 +22,9 @@
|
||||
#if HAVE_TLI
|
||||
void print_t_info(struct t_info *t)
|
||||
{
|
||||
XDPRINTF((2,"T_INFO:addr %ld, options %ld, tsdu %ld, etsdu %ld\n",
|
||||
XDPRINTF((2,0, "T_INFO:addr %ld, options %ld, tsdu %ld, etsdu %ld",
|
||||
t->addr, t->options,t->tsdu, t->etsdu));
|
||||
XDPRINTF((2,"connect %ld, discon %ld, servtype %ld\n",
|
||||
XDPRINTF((2,0, "connect %ld, discon %ld, servtype %ld",
|
||||
t->connect, t->discon,t->servtype));
|
||||
#if 0
|
||||
struct t_info {
|
||||
@ -55,7 +55,7 @@ static char str[200];
|
||||
|
||||
void print_ipx_addr(ipxAddr_t *p)
|
||||
{
|
||||
XDPRINTF((2,"%s\n", visable_ipx_adr(p)));
|
||||
XDPRINTF((2,0,"%s", visable_ipx_adr(p)));
|
||||
}
|
||||
|
||||
void print_ud_data(struct t_unitdata *ud)
|
||||
@ -63,21 +63,20 @@ void print_ud_data(struct t_unitdata *ud)
|
||||
int packet_typ = *(int*)(ud->opt.buf);
|
||||
int data_len = ud->udata.len;
|
||||
IPX_DATA *ipxdata = (IPX_DATA *)(ud->udata.buf);
|
||||
XDPRINTF((2,"DATA-LEN %d, PACKET-TYPE %d von:",
|
||||
data_len, packet_typ));
|
||||
XDPRINTF((2,0,"DATA-LEN %d, PACKET-TYPE %d von: %s",
|
||||
data_len, packet_typ, visable_ipx_adr((ipxAddr_t *)(ud->addr.buf))));
|
||||
/* hierin steht nun Addresse u. Node des Senders */
|
||||
print_ipx_addr((ipxAddr_t *)(ud->addr.buf));
|
||||
if (packet_typ == PACKT_CORE) {
|
||||
XDPRINTF((2,"Query Type 0x%x, Server Type 0x%xd\n",
|
||||
XDPRINTF((2,0, "Query Type 0x%x, Server Type 0x%xd",
|
||||
GET_BE16(ipxdata->sqp.query_type),
|
||||
GET_BE16(ipxdata->sqp.server_type)));
|
||||
} else if (data_len > sizeof(SIP)){
|
||||
SAP *sap = &(ipxdata->sap);
|
||||
SAPS *saps = &(ipxdata->sap.saps);
|
||||
int sap_operation = GET_BE16(sap->sap_operation);
|
||||
XDPRINTF((2,"SAP-OPERATION %d\n", sap_operation));
|
||||
XDPRINTF((2,0, "SAP-OPERATION %d", sap_operation));
|
||||
while (data_len >= sizeof(SAPS)){
|
||||
XDPRINTF((2,"Name:%s:, typ:0x%x\n",saps->server_name,
|
||||
XDPRINTF((2,0, "Name:%s:, typ:0x%x",saps->server_name,
|
||||
GET_BE16(saps->server_type)));
|
||||
print_ipx_addr(&(saps->server_adr));
|
||||
saps++;
|
||||
@ -93,7 +92,7 @@ void print_ipx_data(IPX_DATA *p)
|
||||
|
||||
void print_sip_data(SIP *sip)
|
||||
{
|
||||
XDPRINTF((2,"Name:%s:,response_type:0x%x,server_typ:0x%x\n",sip->server_name,
|
||||
XDPRINTF((2,0,"Name:%s:,response_type:0x%x,server_typ:0x%x",sip->server_name,
|
||||
GET_BE16(sip->response_type), GET_BE16(sip->server_type)));
|
||||
print_ipx_addr(&(sip->server_adr));
|
||||
}
|
||||
@ -155,7 +154,7 @@ int send_ipx_data(int fd, int pack_typ,
|
||||
ud.udata.len = data_len;
|
||||
ud.udata.maxlen = data_len;
|
||||
ud.addr.buf = (char*)to_addr;
|
||||
if (comment != NULL) XDPRINTF((2,"%s TO: ", comment));
|
||||
if (comment != NULL) XDPRINTF((2,0,"%s TO: ", comment));
|
||||
if (nw_debug > 1) print_ipx_addr(to_addr);
|
||||
if (t_sndudata(fd, &ud) < 0){
|
||||
if (nw_debug > 1) t_error("t_sndudata !OK");
|
||||
|
52
nwclient.c
52
nwclient.c
@ -1,4 +1,4 @@
|
||||
/* nwclient.c: 12-Nov-95 */
|
||||
/* nwclient.c: 24-Dec-95 */
|
||||
/*
|
||||
* Einfacher Testclient, wird von nwserv (im Client Modus) gestartet
|
||||
* Dieses Modul hilft dabei, NCP Responses eines
|
||||
@ -49,7 +49,7 @@ static int open_socket()
|
||||
t_close(ipx_fd);
|
||||
return(-1);
|
||||
}
|
||||
XDPRINTF((0,"socket bound TO %s\n", visable_ipx_adr(&my_addr) ));
|
||||
XDPRINTF((1,0, "socket bound TO %s", visable_ipx_adr(&my_addr) ));
|
||||
return(ipx_fd);
|
||||
}
|
||||
|
||||
@ -78,17 +78,17 @@ static void ncp_request(int type, int sequence,
|
||||
ncprequest->function = (uint8) function;
|
||||
{
|
||||
int j = data_len;
|
||||
DPRINTF(("NCP REQUEST: type:0x%x, seq:%d, conn:%d, task:%d, reserved:0x%x, func:0x%x\n",
|
||||
XDPRINTF((1, 0, "NCP REQUEST: type:0x%x, seq:%d, conn:%d, task:%d, reserved:0x%x, func:0x%x",
|
||||
type, sequence, connection, task, reserved, function));
|
||||
if (j > 0){
|
||||
uint8 *p=requestdata;
|
||||
DPRINTF(("len %d, DATA:", j));
|
||||
XDPRINTF((1, 2, "len %d, DATA:", j));
|
||||
while (j--) {
|
||||
int c = *p++;
|
||||
if (c > 32 && c < 127) DPRINTF((",\'%c\'", (char) c));
|
||||
else DPRINTF((",0x%x", c));
|
||||
if (c > 32 && c < 127) XDPRINTF((1, 3,",\'%c\'", (char) c));
|
||||
else XDPRINTF((1, 3, ",0x%x", c));
|
||||
}
|
||||
DPRINTF(("\n"));
|
||||
XDPRINTF((1, 1, NULL));
|
||||
}
|
||||
}
|
||||
send_ipx_data(fd_ipx, 17, sizeof(NCPREQUEST) + data_len,
|
||||
@ -137,8 +137,8 @@ static int handle_event(void)
|
||||
uderr.opt.buf = (char*)&err_pack_typ; /* bekommt aktuellen Typ */
|
||||
ud.addr.buf = (char*)&source_adr;
|
||||
t_rcvuderr(fd_ipx, &uderr);
|
||||
DPRINTF(("Error from %s, Code = 0x%lx\n", visable_ipx_adr(&erradr), uderr.error));
|
||||
t_error("t_rcvudata !OK");
|
||||
XDPRINTF((1, 0, "Error from %s, Code = 0x%lx", visable_ipx_adr(&erradr), uderr.error));
|
||||
if (nw_debug) t_error("t_rcvudata !OK");
|
||||
return(-1);
|
||||
} else {
|
||||
int responselen = ud.udata.len - sizeof(NCPRESPONSE);
|
||||
@ -152,19 +152,19 @@ static int handle_event(void)
|
||||
int connect_status = (int)ncpresponse->connect_status;
|
||||
int type = GET_BE16(ncpresponse->type);
|
||||
|
||||
DPRINTF(("Ptyp:%d von: %s, len=%d\n", (int)ipx_pack_typ, visable_ipx_adr(&source_adr), responselen));
|
||||
DPRINTF(("RESPONSE:t:0x%x, seq:%d, conn:%d, task:%d, res:0x%x, complet.:0x%x, connect:0x%x\n",
|
||||
XDPRINTF((1,0, "Ptyp:%d von: %s, len=%d", (int)ipx_pack_typ, visable_ipx_adr(&source_adr), responselen));
|
||||
XDPRINTF((1,0, "RESPONSE:t:0x%x, seq:%d, conn:%d, task:%d, res:0x%x, complet.:0x%x, connect:0x%x",
|
||||
type, sequence, connection, task, reserved, completition, connect_status));
|
||||
|
||||
if (j > 0){
|
||||
uint8 *p=responsedata;
|
||||
DPRINTF(("len %d, DATA:", j));
|
||||
XDPRINTF((1, 2, "len %d, DATA:", j));
|
||||
while (j--) {
|
||||
int c = *p++;
|
||||
if (c > 32 && c < 127) DPRINTF((",\'%c\'", (char) c));
|
||||
else DPRINTF((",0x%x", c));
|
||||
if (c > 32 && c < 127) XDPRINTF((1, 3, ",\'%c\'", (char) c));
|
||||
else XDPRINTF((1, 3, ",0x%x", c));
|
||||
}
|
||||
DPRINTF(("\n"));
|
||||
XDPRINTF((1, 1, NULL));
|
||||
}
|
||||
}
|
||||
|
||||
@ -198,7 +198,7 @@ static int get_conn_nr(void)
|
||||
0, "Get Connection Nr.");
|
||||
if (!handle_event()) {
|
||||
connection = ncpresponse->connection;
|
||||
DPRINTF(("NWCLIENT GOT CONNECTION NR:%d\n", connection));
|
||||
XDPRINTF((1, 0, "NWCLIENT GOT CONNECTION NR:%d", connection));
|
||||
return(0);
|
||||
}
|
||||
return(-1);
|
||||
@ -209,7 +209,7 @@ static int get_pkt_size(void)
|
||||
uint8 data[] = {0x4, 0}; /* wanted ?? SIZE */
|
||||
RDATA(data, 0x21, "Get Pktsize");
|
||||
if (!handle_event()) {
|
||||
DPRINTF(("NWCLIENT GOT PACKET SIZE =:%d\n", (int)GET_BE16(responsedata)));
|
||||
XDPRINTF((1,0, "NWCLIENT GOT PACKET SIZE =:%d", (int)GET_BE16(responsedata)));
|
||||
return(0);
|
||||
}
|
||||
return(-1);
|
||||
@ -220,7 +220,7 @@ static int get_server_info(void)
|
||||
uint8 data[] = {0, 1, 0x11};
|
||||
RDATA(data, 0x17, "Get FileServer Info");
|
||||
if (!handle_event()) {
|
||||
DPRINTF(("NWCLIENT GOT SERVER INFO von=:%s\n", responsedata ));
|
||||
XDPRINTF((1,0, "NWCLIENT GOT SERVER INFO von=:%s", responsedata ));
|
||||
return(0);
|
||||
}
|
||||
return(-1);
|
||||
@ -278,7 +278,7 @@ static int file_search_init(DIR_IDS *di, int dirhandle, char *path)
|
||||
VDATA(0x3e, pathlen+2, "FILE SEARCH INIT");
|
||||
if (!handle_event()) {
|
||||
if (di) memcpy(di, responsedata, 3);
|
||||
DPRINTF(("NWCLIENT GOT FILES SEARCH INIT HANDLE=:%d\n",
|
||||
XDPRINTF((1,0, "NWCLIENT GOT FILES SEARCH INIT HANDLE=:%d",
|
||||
(int)GET_BE16(responsedata+1) ));
|
||||
return( (int) *(responsedata+3) ); /* access */
|
||||
}
|
||||
@ -301,7 +301,7 @@ static int file_search_cont(DIR_IDS *di, int seq,
|
||||
if (!handle_event()) {
|
||||
int dir_id = GET_BE16(responsedata+2);
|
||||
seq = GET_BE16(responsedata);
|
||||
DPRINTF(("GOT SEARCH CONT dir_id=%d, seq=%d\n", dir_id, seq));
|
||||
XDPRINTF((1, 0, "GOT SEARCH CONT dir_id=%d, seq=%d", dir_id, seq));
|
||||
return(seq);
|
||||
}
|
||||
return(-1);
|
||||
@ -472,7 +472,7 @@ static int get_bindery_object_id(int type, char *name)
|
||||
memcpy(p, name, namlen);
|
||||
VDATA(0x17, namlen+6, "GET BINDERY OBJECT ID");
|
||||
if (!handle_event()) {
|
||||
DPRINTF(("GOT BIND OBJ ID=0x%lx\n", GET_BE32(responsedata)));
|
||||
XDPRINTF((1, 0, "GOT BIND OBJ ID=0x%lx", GET_BE32(responsedata)));
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
@ -624,7 +624,7 @@ static void teste_reads(void)
|
||||
size = read_datei(fh, offs, 0x200);
|
||||
}
|
||||
}
|
||||
DPRINTF(("%d Bytes readed\n", gelesen));
|
||||
XDPRINTF((1,0, "%d Bytes readed", gelesen));
|
||||
}
|
||||
|
||||
static void test_wdog(void)
|
||||
@ -660,11 +660,11 @@ static void test_wdog(void)
|
||||
uderr.opt.buf = (char*)&err_pack_typ; /* bekommt aktuellen Typ */
|
||||
ud.addr.buf = (char*)&source_adr;
|
||||
t_rcvuderr(fd_ipx, &uderr);
|
||||
DPRINTF(("Error from %s, Code = 0x%lx\n", visable_ipx_adr(&erradr), uderr.error));
|
||||
t_error("t_rcvudata !OK");
|
||||
XDPRINTF((1,0, "Error from %s, Code = 0x%lx", visable_ipx_adr(&erradr), uderr.error));
|
||||
if (nw_debug) t_error("t_rcvudata !OK");
|
||||
return;
|
||||
} else {
|
||||
DPRINTF(("WDOG Packet von:%s, len=%d connid=%d, status=%d\n",
|
||||
XDPRINTF((1,0, "WDOG Packet von:%s, len=%d connid=%d, status=%d",
|
||||
visable_ipx_adr(&source_adr),
|
||||
(int)ud.udata.len, (int) ipx_data_buff.wdog.connid,
|
||||
(int)ipx_data_buff.wdog.status));
|
||||
@ -688,7 +688,7 @@ int main(int argc, char **argv)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
DPRINTF(("NWCLIENT MYADDR=%s, SERVER=%s \n", *(argv+1), *(argv+2) ));
|
||||
XDPRINTF((1, 0, "NWCLIENT MYADDR=%s, SERVER=%s", *(argv+1), *(argv+2) ));
|
||||
|
||||
adr_to_ipx_addr(&my_addr, *(argv+1));
|
||||
adr_to_ipx_addr(&serv_addr, *(argv+2));
|
||||
|
163
nwconn.c
163
nwconn.c
@ -1,4 +1,4 @@
|
||||
/* nwconn.c 04-Dec-95 */
|
||||
/* nwconn.c 02-Jan-96 */
|
||||
/* one process / connection */
|
||||
|
||||
/* (C)opyright (C) 1993,1995 Martin Stover, Marburg, Germany
|
||||
@ -57,11 +57,14 @@ static int open_ipx_socket()
|
||||
close(ipx_fd);
|
||||
return(-1);
|
||||
}
|
||||
XDPRINTF((2, "NWCONN OpenSocket: %s\n",
|
||||
XDPRINTF((5, 0, "NWCONN OpenSocket: %s",
|
||||
visable_ipx_adr((ipxAddr_t *) bind.addr.buf)));
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
static int req_printed=0;
|
||||
|
||||
static int ncp_response(int sequence,
|
||||
int completition, int data_len)
|
||||
|
||||
@ -69,9 +72,11 @@ static int ncp_response(int sequence,
|
||||
ncpresponse->sequence = (uint8) sequence;
|
||||
ncpresponse->completition = (uint8) completition;
|
||||
last_sequence = sequence;
|
||||
XDPRINTF((2,"NWCONN NCP_RESP seq:%d, conn:%d, compl=0x%x TO %s\n",
|
||||
if (req_printed) {
|
||||
XDPRINTF((0,0, "NWCONN NCP_RESP seq:%d, conn:%d, compl=0x%x TO %s",
|
||||
(int)ncpresponse->sequence, (int) ncpresponse->connection, (int)completition,
|
||||
visable_ipx_adr((ipxAddr_t *) ud.addr.buf)));
|
||||
}
|
||||
|
||||
ud.udata.len = ud.udata.maxlen = sizeof(NCPRESPONSE) + data_len;
|
||||
if (t_sndudata(ipx_fd, &ud) < 0){
|
||||
@ -81,65 +86,58 @@ static int ncp_response(int sequence,
|
||||
return(0);
|
||||
}
|
||||
|
||||
static void pr_debug_request()
|
||||
{
|
||||
if (req_printed++) return;
|
||||
XDPRINTF((0, 0, "NCP REQUEST:type:0x%x, seq:%d, task:%d, reserved:0x%x, func:0x%x",
|
||||
ncp_type,
|
||||
(int)ncprequest->sequence,
|
||||
(int)ncprequest->task,
|
||||
(int)ncprequest->reserved,
|
||||
(int)ncprequest->function));
|
||||
if (requestlen > 0){
|
||||
int j = requestlen;
|
||||
uint8 *p=requestdata;
|
||||
XDPRINTF((0, 2, "len %d, DATA:", j));
|
||||
while (j--) {
|
||||
int c = *p++;
|
||||
if (c > 32 && c < 127) XDPRINTF((0, 3,",\'%c\'", (char) c));
|
||||
else XDPRINTF((0,3, ",0x%x", c));
|
||||
}
|
||||
XDPRINTF((0,1,NULL));
|
||||
}
|
||||
}
|
||||
|
||||
static int test_handle = -1;
|
||||
static void handle_ncp_serv()
|
||||
{
|
||||
int data_len = 0;
|
||||
int sequence = (int)ncprequest->sequence;
|
||||
int task = (int)ncprequest->task;
|
||||
int reserved = (int)ncprequest->reserved;
|
||||
int function = (int)ncprequest->function;
|
||||
int completition = 0; /* first set */
|
||||
int org_nw_debug = nw_debug;
|
||||
int do_druck = 0;
|
||||
int data_len = 0;
|
||||
|
||||
if (last_sequence == sequence && ncp_type != 0x1111){ /* send the same again */
|
||||
if (last_sequence == (int)ncprequest->sequence
|
||||
&& ncp_type != 0x1111){ /* send the same again */
|
||||
if (t_sndudata(ipx_fd, &ud) < 0){
|
||||
if (nw_debug) t_error("t_sndudata !OK");
|
||||
}
|
||||
XDPRINTF((2,"Sequence %d is written twice\n", sequence));
|
||||
XDPRINTF((2,0, "Sequence %d is written twice", (int)ncprequest->sequence));
|
||||
return;
|
||||
}
|
||||
req_printed=0;
|
||||
|
||||
#if 0
|
||||
if (!nw_debug && (
|
||||
/*
|
||||
function == 0x43 ||
|
||||
function == 0x4c ||
|
||||
function == 0x4d ||
|
||||
function == 0x4a ||
|
||||
*/
|
||||
function == 0x11
|
||||
) ) nw_debug=1;
|
||||
#endif
|
||||
|
||||
if (nw_debug){
|
||||
int j = requestlen;
|
||||
if (nw_debug > 1){
|
||||
if (nw_debug < 10
|
||||
&& (function==0x48 || function == 0x49)) /* read or write */
|
||||
nw_debug=0;
|
||||
nw_debug=1;
|
||||
if (nw_debug < 15
|
||||
&& (function==0x48)) /* read */
|
||||
nw_debug=0;
|
||||
|
||||
if (nw_debug > 1){
|
||||
do_druck=2;
|
||||
XDPRINTF((2,"NCP REQUEST:type:0x%x, seq:%d, task:%d, reserved:0x%x, func:0x%x\n",
|
||||
ncp_type, sequence, task, reserved, function));
|
||||
if (j > 0){
|
||||
uint8 *p=requestdata;
|
||||
XDPRINTF((2,"len %d, DATA:", j));
|
||||
while (j--) {
|
||||
int c = *p++;
|
||||
if (c > 32 && c < 127) XDPRINTF((2,",\'%c\'", (char) c));
|
||||
else XDPRINTF((2,",0x%x", c));
|
||||
}
|
||||
XDPRINTF((2,"\n"));
|
||||
}
|
||||
}
|
||||
nw_debug=1;
|
||||
}
|
||||
|
||||
if (nw_debug > 5) pr_debug_request();
|
||||
|
||||
if (ncp_type == 0x2222) {
|
||||
switch (function) {
|
||||
case 0x12 : { /* Get Volume Info with Number */
|
||||
@ -213,7 +211,8 @@ static void handle_ncp_serv()
|
||||
(uint8)-nw_set_dir_handle((int)input->target_dir_handle,
|
||||
(int)input->source_dir_handle,
|
||||
input->path,
|
||||
(int)input->pathlen, task);
|
||||
(int)input->pathlen,
|
||||
(int)(ncprequest->task));
|
||||
|
||||
} else if (1 == *p){ /* liefert Verzeichnis Namen */
|
||||
/* Dir_handles */
|
||||
@ -232,7 +231,7 @@ static void handle_ncp_serv()
|
||||
xdata->len = (uint8) result;
|
||||
data_len = result + 1;
|
||||
xdata->name[result] = '\0';
|
||||
XDPRINTF((2,"GetDirektoryPATH=%s\n", xdata->name));
|
||||
XDPRINTF((5,0, "GetDirektoryPATH=%s", xdata->name));
|
||||
} else completition = (uint8)-result;
|
||||
} else if (2 == *p){ /* Scan Direktory Information */
|
||||
/******** Scan Dir Info ****************/
|
||||
@ -261,7 +260,7 @@ static void handle_ncp_serv()
|
||||
if (result > -1){
|
||||
xdata->max_right_mask = (uint8)result;
|
||||
data_len = sizeof(struct XDATA);
|
||||
XDPRINTF((2,"Scan Dir Info max_right_mask=%d\n", (int)result));
|
||||
XDPRINTF((5,0,"Scan Dir Info max_right_mask=%d", (int)result));
|
||||
} else completition = (uint8)-result;
|
||||
} else if (*p == 0x3){ /* Get Direktory Rights */
|
||||
/******** Get Eff Dir Rights ****************/
|
||||
@ -275,7 +274,7 @@ static void handle_ncp_serv()
|
||||
if (result > -1) {
|
||||
xdata->eff_right_mask = (uint8) result;
|
||||
data_len = 1;
|
||||
XDPRINTF((2,"Got eff Dir Rights=%d\n", (int)result));
|
||||
XDPRINTF((5,0,"Got eff Dir Rights=%d", (int)result));
|
||||
} else completition = (uint8) -result;
|
||||
} else if (*p == 0x4){ /* Modify Max Right MAsk */
|
||||
/******** MODIFY MAX RIGHT MASK ****************/
|
||||
@ -350,7 +349,8 @@ static void handle_ncp_serv()
|
||||
(int)*(p+3),
|
||||
(int)*(p+2),
|
||||
(*p==0x12) ? 0
|
||||
: ((*p==0x13) ? 1 : 2), task);
|
||||
: ((*p==0x13) ? 1 : 2),
|
||||
(int)(ncprequest->task));
|
||||
if (dirhandle > -1){
|
||||
xdata->dirhandle = (uint8) dirhandle;
|
||||
xdata->right_mask = 0xff;
|
||||
@ -388,7 +388,7 @@ static void handle_ncp_serv()
|
||||
U16_TO_BE16(0, xdata->removable);
|
||||
}
|
||||
data_len = sizeof(struct XDATA);
|
||||
XDPRINTF((2,"GIVE VOLUME INFO von :%s:\n", xdata->name));
|
||||
XDPRINTF((5,0,"GIVE VOLUME INFO von :%s:", xdata->name));
|
||||
result = 0;
|
||||
}
|
||||
}
|
||||
@ -468,18 +468,19 @@ static void handle_ncp_serv()
|
||||
uint8 volnr = *(p+1);
|
||||
uint32 id = GET_BE32(p+2);
|
||||
uint32 blocks = GET_BE32(p+6);
|
||||
XDPRINTF((2,"TODO:Change vol restriction vol=%d, id=0x%lx, Blocks=0x%lx",
|
||||
XDPRINTF((2,0,"TODO:Change vol restriction vol=%d, id=0x%lx, Blocks=0x%lx",
|
||||
(int)volnr, id, blocks));
|
||||
} else if (*p == 0x22) {
|
||||
/* remove Vol restrictions for Obj */
|
||||
uint8 volnr = *(p+1);
|
||||
uint32 id = GET_BE32(p+2);
|
||||
XDPRINTF((2,"Renmove vol restriction vol=%d, id=0x%lx",
|
||||
XDPRINTF((2,0, "TODO:Remove vol restriction vol=%d, id=0x%lx",
|
||||
(int)volnr, id));
|
||||
|
||||
} else if (*p == 0x25){ /* setting FILE INFO ??*/
|
||||
/* TODO !!!!!!!!!!!!!!!!!!!! */
|
||||
do_druck++;
|
||||
|
||||
} else if (*p == 0x26) { /* Scan file or Dir for ext trustees */
|
||||
int sequenz = (int)*(p+2); /* trustee sequenz */
|
||||
struct XDATA {
|
||||
@ -521,7 +522,7 @@ static void handle_ncp_serv()
|
||||
struct XDATA {
|
||||
uint8 weisnicht[8]; /* ?????? */
|
||||
} *xdata = (struct XDATA*) responsedata;
|
||||
XDPRINTF((2,"Get vol restriction vol=%d, id=0x%lx",
|
||||
XDPRINTF((5,0, "Get vol restriction vol=%d, id=0x%lx",
|
||||
(int)volnr, id));
|
||||
memset(xdata, 0, sizeof(struct XDATA));
|
||||
data_len=sizeof(struct XDATA);
|
||||
@ -724,13 +725,13 @@ static void handle_ncp_serv()
|
||||
break;
|
||||
|
||||
case 0xf3: { /* Map Direktory Number TO PATH */
|
||||
XDPRINTF((1,"TODO: Map Direktory Number TO PATH\n"));
|
||||
XDPRINTF((2,0, "TODO: Map Direktory Number TO PATH"));
|
||||
completition = 0xff;
|
||||
}
|
||||
break;
|
||||
|
||||
case 0xf4: { /* Map PATH TO Dir Entry */
|
||||
XDPRINTF((1,"TODO: Map PATH TO Dir Entry\n"));
|
||||
XDPRINTF((2,0, "TODO: Map PATH TO Dir Entry"));
|
||||
completition = 0xff;
|
||||
}
|
||||
break;
|
||||
@ -743,7 +744,8 @@ static void handle_ncp_serv()
|
||||
#endif
|
||||
|
||||
case 0x18 : /* End of Job */
|
||||
nw_free_handles((task > 0) ? task : 1);
|
||||
nw_free_handles((ncprequest->task > 0) ?
|
||||
(int) (ncprequest->task) : 1);
|
||||
break;
|
||||
|
||||
case 0x19 : /* logout, some of this call is handled in ncpserv. */
|
||||
@ -775,8 +777,16 @@ static void handle_ncp_serv()
|
||||
case 0x21 : { /* Negotiate Buffer Size, Packetsize */
|
||||
int wantsize = GET_BE16((uint8*)ncprequest);
|
||||
uint8 *getsize=responsedata;
|
||||
U16_TO_BE16(min(0x200, wantsize), getsize);
|
||||
|
||||
#if IPX_DATA_GR_546
|
||||
wantsize = min(0x400, wantsize);
|
||||
#else
|
||||
wantsize = min(0x200, wantsize);
|
||||
#endif
|
||||
U16_TO_BE16(wantsize, getsize);
|
||||
data_len = 2;
|
||||
XDPRINTF((5,0, "Negotiate Buffer size = 0x%04x,(%d)",
|
||||
(int) wantsize, (int) wantsize));
|
||||
}
|
||||
break;
|
||||
|
||||
@ -819,7 +829,7 @@ static void handle_ncp_serv()
|
||||
uint8 ext_fhandle[2]; /* all zero */
|
||||
} *input = (struct INPUT *)ncprequest;
|
||||
uint32 fhandle = GET_BE32(input->fhandle);
|
||||
XDPRINTF((1,"TODO: COMMIT FILE:fhandle=%ld\n", fhandle));
|
||||
XDPRINTF((2,0, "TODO: COMMIT FILE:fhandle=%ld", fhandle));
|
||||
/* TODO */
|
||||
;
|
||||
} break;
|
||||
@ -1196,7 +1206,8 @@ static void handle_ncp_serv()
|
||||
|
||||
#if 0
|
||||
case 0x61 : { /* Negotiate Buffer Size, Packetsize new ??? */
|
||||
/* same request as 0x21 */
|
||||
/* > 3.11 */
|
||||
/* similar request as 0x21 */
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -1213,41 +1224,23 @@ static void handle_ncp_serv()
|
||||
}
|
||||
|
||||
if (nw_debug && (completition == 0xfb || (do_druck == 1))) { /* UNKWON FUNCTION od. TYPE */
|
||||
int x_nw_debug = nw_debug;
|
||||
if (nw_debug == 1 || do_druck == 1) {
|
||||
int j = requestlen;
|
||||
nw_debug = 2;
|
||||
XDPRINTF((2,"NCP REQUEST: seq:%d, task:%d, reserved:0x%x, func:0x%x\n",
|
||||
sequence, task, reserved, function));
|
||||
if (j > 0){
|
||||
uint8 *p=requestdata;
|
||||
XDPRINTF((2,"len %d, DATA:", j));
|
||||
while (j--) {
|
||||
int c = *p++;
|
||||
if (c > 32 && c < 127) XDPRINTF((2,",\'%c\'", (char) c));
|
||||
else XDPRINTF((2,",0x%x", c));
|
||||
}
|
||||
XDPRINTF((2,"\n"));
|
||||
}
|
||||
}
|
||||
pr_debug_request();
|
||||
if (completition == 0xfb)
|
||||
XDPRINTF((1,"UNKNOWN FUNCTION od. TYPE: 0x%x\n", function));
|
||||
XDPRINTF((0,0, "UNKNOWN FUNCTION od. TYPE: 0x%x", function));
|
||||
else if (data_len){
|
||||
int j = data_len;
|
||||
uint8 *p = responsedata;
|
||||
XDPRINTF((2,"RSPONSE: len %d, DATA:", data_len));
|
||||
XDPRINTF((0,2, "RSPONSE: len %d, DATA:", data_len));
|
||||
while (j--) {
|
||||
int c = *p++;
|
||||
if (c > 32 && c < 127) XDPRINTF((2,",\'%c\'", (char) c));
|
||||
else XDPRINTF((2,",0x%x", c));
|
||||
if (c > 32 && c < 127) XDPRINTF((0,3,",\'%c\'", (char) c));
|
||||
else XDPRINTF((0,3,",0x%x", c));
|
||||
}
|
||||
XDPRINTF((2,"\n"));
|
||||
XDPRINTF((0,1, NULL));
|
||||
}
|
||||
nw_debug = x_nw_debug;
|
||||
}
|
||||
ncp_response(sequence, completition, data_len);
|
||||
if (nw_debug != 99 && nw_debug != -99) nw_debug = org_nw_debug;
|
||||
else if (nw_debug == -99) nw_debug = 0;
|
||||
ncp_response(ncprequest->sequence, completition, data_len);
|
||||
nw_debug = org_nw_debug;
|
||||
}
|
||||
|
||||
extern int t_errno;
|
||||
@ -1305,7 +1298,7 @@ int main(int argc, char **argv)
|
||||
|
||||
init_tools(NWCONN);
|
||||
|
||||
DPRINTF(("FATHER PID=%d, ADDR=%s CON:%s\n", 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));
|
||||
|
||||
if (nw_init_connect()) exit(1);
|
||||
@ -1339,12 +1332,12 @@ int main(int argc, char **argv)
|
||||
ncpresponse->connect_status = (uint8) 0;
|
||||
if (data_len > 0) {
|
||||
if (fl_get_debug) get_new_debug();
|
||||
XDPRINTF((99, "NWCONN GOT DATA len = %d\n",data_len));
|
||||
XDPRINTF((99, 0, "NWCONN GOT DATA len = %d",data_len));
|
||||
|
||||
if ((ncp_type = (int)GET_BE16(ncprequest->type)) == 0x3333) {
|
||||
/* OK for direct sending */
|
||||
data_len -= sizeof(NCPRESPONSE);
|
||||
XDPRINTF((99, "NWCONN:direct sending:type 0x3333, completition=0x%x, len=%d\n",
|
||||
XDPRINTF((99,0, "NWCONN:direct sending:type 0x3333, completition=0x%x, len=%d",
|
||||
(int)(ncprequest->function), data_len));
|
||||
if (data_len) memcpy(responsedata, readbuff+sizeof(NCPRESPONSE), data_len);
|
||||
ncpresponse->connect_status = ((NCPRESPONSE*)readbuff)->connect_status;
|
||||
|
68
nwdbm.c
68
nwdbm.c
@ -1,4 +1,4 @@
|
||||
/* nwdbm.c 05-Dec-95 data base for mars_nwe */
|
||||
/* nwdbm.c 24-Dec-95 data base for mars_nwe */
|
||||
/* (C)opyright (C) 1993,1995 Martin Stover, Marburg, Germany
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -89,7 +89,7 @@ static int name_match(uint8 *s, uint8 *p)
|
||||
int find_obj_id(NETOBJ *o, uint32 last_obj_id)
|
||||
{
|
||||
int result = -0xfc; /* no Object */
|
||||
XDPRINTF((2, "findobj_id OBJ=%s, type=0x%x, lastid=0x%lx \n",
|
||||
XDPRINTF((2, 0,"findobj_id OBJ=%s, type=0x%x, lastid=0x%lx",
|
||||
o->name, (int)o->type, last_obj_id));
|
||||
|
||||
if (!dbminit(fnobj)){
|
||||
@ -109,11 +109,11 @@ int find_obj_id(NETOBJ *o, uint32 last_obj_id)
|
||||
NETOBJ *obj = (NETOBJ*)data.dptr;
|
||||
if ( ( ((int)obj->type == (int)o->type) || o->type == MAX_U16) &&
|
||||
name_match(obj->name, o->name)) {
|
||||
XDPRINTF((2, "found OBJ=%s, id=0x%lx\n", obj->name, obj->id));
|
||||
XDPRINTF((2, 0, "found OBJ=%s, id=0x%lx", obj->name, obj->id));
|
||||
result = 0;
|
||||
memcpy((char *)o, (char*)obj, sizeof(NETOBJ));
|
||||
} else {
|
||||
XDPRINTF((3,"not found,but NAME=%s, type=0x%x, id=0x%lx \n",
|
||||
XDPRINTF((3,0,"not found,but NAME=%s, type=0x%x, id=0x%lx",
|
||||
obj->name, (int)obj->type, obj->id));
|
||||
}
|
||||
}
|
||||
@ -133,7 +133,7 @@ static int loc_delete_property(uint32 obj_id, uint8 *prop_name, uint8 prop_id)
|
||||
int result = -0xfb; /* no property */
|
||||
memset(xset, 0, sizeof(xset));
|
||||
if (!prop_id) {
|
||||
XDPRINTF((2, "loc_delete_property obj_id=%d, prop=%s\n", obj_id, prop_name));
|
||||
XDPRINTF((2,0, "loc_delete_property obj_id=%d, prop=%s", obj_id, prop_name));
|
||||
if (!dbminit(fnprop)){
|
||||
for (key = firstkey(); key.dptr != NULL; key = nextkey(key)) {
|
||||
NETPROP *p=(NETPROP*)key.dptr;
|
||||
@ -141,7 +141,7 @@ static int loc_delete_property(uint32 obj_id, uint8 *prop_name, uint8 prop_id)
|
||||
data = fetch(key);
|
||||
p = (NETPROP*)data.dptr;
|
||||
if (p != NULL && name_match(p->name, prop_name)){
|
||||
XDPRINTF((2, "found prop: %s, id=%d for deleting\n", p->name, (int)p->id));
|
||||
XDPRINTF((2,0, "found prop: %s, id=%d for deleting", p->name, (int)p->id));
|
||||
if ((int)(p->id) > result) result = (int)(p->id);
|
||||
xset[p->id]++;
|
||||
}
|
||||
@ -150,7 +150,7 @@ static int loc_delete_property(uint32 obj_id, uint8 *prop_name, uint8 prop_id)
|
||||
} else result = -0xff;
|
||||
dbmclose();
|
||||
} else {
|
||||
XDPRINTF((2, "loc_delete_property obj_id=%d, prop_id=%d\n", obj_id, (int)prop_id));
|
||||
XDPRINTF((2,0, "loc_delete_property obj_id=%d, prop_id=%d", obj_id, (int)prop_id));
|
||||
xset[prop_id]++;
|
||||
result = prop_id;
|
||||
}
|
||||
@ -213,7 +213,7 @@ static int loc_delete_obj(uint32 objid)
|
||||
int nw_delete_obj(NETOBJ *obj)
|
||||
{
|
||||
int result = find_obj_id(obj, 0);
|
||||
XDPRINTF((2, "nw_delete_obj obj_id=%d, obj_name=%s\n", obj->id, obj->name));
|
||||
XDPRINTF((2,0, "nw_delete_obj obj_id=%d, obj_name=%s", obj->id, obj->name));
|
||||
if (!result) result=loc_delete_obj(obj->id);
|
||||
return(result);
|
||||
}
|
||||
@ -230,7 +230,7 @@ int nw_rename_obj(NETOBJ *o, uint8 *newname)
|
||||
data = fetch(key);
|
||||
if (data.dptr != NULL){
|
||||
NETOBJ *obj=(NETOBJ*)data.dptr;
|
||||
XDPRINTF((2, "rename_obj:got OBJ name=%s, id = 0x%x,\n", obj->name, (int)obj->id));
|
||||
XDPRINTF((2,0, "rename_obj:got OBJ name=%s, id = 0x%x", obj->name, (int)obj->id));
|
||||
strncpy(obj->name, newname, 48);
|
||||
if (!store(key, data)) result=0;
|
||||
}
|
||||
@ -252,7 +252,7 @@ int nw_change_obj_security(NETOBJ *o, int newsecurity)
|
||||
data = fetch(key);
|
||||
if (data.dptr != NULL){
|
||||
NETOBJ *obj=(NETOBJ*)data.dptr;
|
||||
XDPRINTF((2, "change_obj_security:got OBJ name=%s, id = 0x%x,\n", obj->name, (int)obj->id));
|
||||
XDPRINTF((2,0, "change_obj_security:got OBJ name=%s, id = 0x%x", obj->name, (int)obj->id));
|
||||
obj->security = (uint8) newsecurity;
|
||||
if (!store(key, data)) result=0;
|
||||
}
|
||||
@ -265,14 +265,14 @@ int nw_change_obj_security(NETOBJ *o, int newsecurity)
|
||||
int nw_get_obj(NETOBJ *o)
|
||||
{
|
||||
int result = -0xfc; /* no Object */
|
||||
XDPRINTF((2, "nw_get_obj von OBJ id = 0x%x,\n", (int)o->id));
|
||||
XDPRINTF((2,0, "nw_get_obj von OBJ id = 0x%x", (int)o->id));
|
||||
if (!dbminit(fnobj)){
|
||||
key.dsize = NETOBJ_KEY_SIZE;
|
||||
key.dptr = (char*)o;
|
||||
data = fetch(key);
|
||||
if (data.dptr != NULL){
|
||||
NETOBJ *obj=(NETOBJ*)data.dptr;
|
||||
XDPRINTF((2, "got OBJ name=%s, id = 0x%x,\n", obj->name, (int)obj->id));
|
||||
XDPRINTF((2,0, "got OBJ name=%s, id = 0x%x", obj->name, (int)obj->id));
|
||||
memcpy(o, data.dptr, sizeof(NETOBJ));
|
||||
result = 0;
|
||||
}
|
||||
@ -284,7 +284,7 @@ int nw_get_obj(NETOBJ *o)
|
||||
static int find_prop_id(NETPROP *p, uint32 obj_id, int last_prop_id)
|
||||
{
|
||||
int result = -0xfb; /* no Property */
|
||||
XDPRINTF((2, "find Prop id von name=0x%x:%s, lastid=%d\n",
|
||||
XDPRINTF((2,0, "find Prop id von name=0x%x:%s, lastid=%d",
|
||||
obj_id, p->name, last_prop_id));
|
||||
if (!dbminit(fnprop)){
|
||||
int flag = (last_prop_id) ? 0 : 1;
|
||||
@ -296,7 +296,7 @@ static int find_prop_id(NETPROP *p, uint32 obj_id, int last_prop_id)
|
||||
data = fetch(key);
|
||||
prop = (NETPROP*)data.dptr;
|
||||
if (data.dptr != NULL && name_match(prop->name, p->name) ) {
|
||||
XDPRINTF((2, "found PROP %s, id=0x%x\n", prop->name, (int) prop->id));
|
||||
XDPRINTF((2,0, "found PROP %s, id=0x%x", prop->name, (int) prop->id));
|
||||
result = 0;
|
||||
memcpy(p, prop, sizeof(NETPROP));
|
||||
break;
|
||||
@ -316,7 +316,7 @@ static int find_prop_id(NETPROP *p, uint32 obj_id, int last_prop_id)
|
||||
static int loc_change_prop_security(NETPROP *p, uint32 obj_id)
|
||||
{
|
||||
int result = -0xfb; /* no Property */
|
||||
XDPRINTF((2, "loc_change_prop_security Prop id von name=0x%x:%s\n", obj_id, p->name));
|
||||
XDPRINTF((2,0, "loc_change_prop_security Prop id von name=0x%x:%s", obj_id, p->name));
|
||||
if (!dbminit(fnprop)){
|
||||
for (key = firstkey(); key.dptr != NULL; key = nextkey(key)) {
|
||||
NETPROP *prop=(NETPROP*)key.dptr;
|
||||
@ -325,7 +325,7 @@ static int loc_change_prop_security(NETPROP *p, uint32 obj_id)
|
||||
prop = (NETPROP*)data.dptr;
|
||||
if (data.dptr != NULL && name_match(prop->name, p->name) ) {
|
||||
uint8 security = p->security;
|
||||
XDPRINTF((2, "found PROP %s, id=0x%x\n", prop->name, (int) prop->id));
|
||||
XDPRINTF((2,0, "found PROP %s, id=0x%x", prop->name, (int) prop->id));
|
||||
result = 0;
|
||||
memcpy(p, prop, sizeof(NETPROP));
|
||||
p->security = security;
|
||||
@ -359,7 +359,7 @@ static int loc_get_prop_val(uint32 obj_id, int prop_id, int segment,
|
||||
if (data.dptr != NULL){
|
||||
NETVAL *v = (NETVAL*)data.dptr;
|
||||
if (NULL != property_value) memcpy(property_value, v->value, 128);
|
||||
XDPRINTF((2, "found VAL 0x%x, %d, %d\n", obj_id, prop_id, segment));
|
||||
XDPRINTF((2,0, "found VAL 0x%x, %d, %d", obj_id, prop_id, segment));
|
||||
result = 0;
|
||||
val.segment++;
|
||||
data = fetch(key);
|
||||
@ -387,7 +387,7 @@ int prop_find_member(uint32 obj_id, int prop_id, uint32 member_id)
|
||||
NETVAL *v = (NETVAL*)data.dptr;
|
||||
uint8 *p=v->value;
|
||||
int k=0;
|
||||
XDPRINTF((2, "found VAL 0x%x, %d\n", obj_id, prop_id));
|
||||
XDPRINTF((2,0, "found VAL 0x%x, %d", obj_id, prop_id));
|
||||
while (k++ < 32){
|
||||
uint32 id = GET_BE32(p);
|
||||
if (id == member_id) {
|
||||
@ -524,7 +524,7 @@ int nw_get_prop_val_by_obj_id(uint32 obj_id,
|
||||
NETPROP prop;
|
||||
int result=-0xff;
|
||||
strmaxcpy((char*)prop.name, (char*)prop_name, prop_namlen);
|
||||
XDPRINTF((2, "nw_get_prop_val_by_obj_id,id=0x%x, prop=%s, segment=%d\n",
|
||||
XDPRINTF((2,0, "nw_get_prop_val_by_obj_id,id=0x%x, prop=%s, segment=%d",
|
||||
obj_id, prop.name, segment_nr));
|
||||
|
||||
if ((result=find_first_prop_id(&prop, obj_id))==0){
|
||||
@ -568,7 +568,7 @@ int nw_delete_property(int object_type,
|
||||
int result=-0xff;
|
||||
strmaxcpy((char*)obj.name, (char*)object_name, object_namlen);
|
||||
strmaxcpy((char*)prop_name_x, (char*)prop_name, prop_namlen);
|
||||
XDPRINTF((2, "nw_delete_property obj=%s, prop=%s, type=0x%x\n",
|
||||
XDPRINTF((2,0, "nw_delete_property obj=%s, prop=%s, type=0x%x",
|
||||
obj.name, prop_name_x, object_type));
|
||||
obj.type = (uint16) object_type;
|
||||
if ((result = find_obj_id(&obj, 0)) == 0){
|
||||
@ -590,7 +590,7 @@ int nw_is_obj_in_set(int object_type,
|
||||
strmaxcpy((char*)obj.name, (char*)object_name, object_namlen);
|
||||
strmaxcpy((char*)mobj.name, (char*)member_name, member_namlen);
|
||||
strmaxcpy((char*)prop.name, (char*)prop_name, prop_namlen);
|
||||
XDPRINTF((2, "nw_is_obj_in_set obj=%s,0x%x, member=%s,0x%x, prop=%s\n",
|
||||
XDPRINTF((2,0, "nw_is_obj_in_set obj=%s,0x%x, member=%s,0x%x, prop=%s",
|
||||
obj.name, object_type, mobj.name, member_type, prop.name));
|
||||
obj.type = (uint16) object_type;
|
||||
mobj.type = (uint16) member_type;
|
||||
@ -617,7 +617,7 @@ int nw_add_obj_to_set(int object_type,
|
||||
strmaxcpy((char*)obj.name, (char*)object_name, object_namlen);
|
||||
strmaxcpy((char*)mobj.name, (char*)member_name, member_namlen);
|
||||
strmaxcpy((char*)prop.name, (char*)prop_name, prop_namlen);
|
||||
XDPRINTF((2, "nw_add_obj_to_set obj=%s,0x%x, member=%s,0x%x, prop=%s\n",
|
||||
XDPRINTF((2,0, "nw_add_obj_to_set obj=%s,0x%x, member=%s,0x%x, prop=%s",
|
||||
obj.name, object_type, mobj.name, member_type, prop.name));
|
||||
obj.type = (uint16) object_type;
|
||||
mobj.type = (uint16) member_type;
|
||||
@ -644,7 +644,7 @@ int nw_delete_obj_from_set(int object_type,
|
||||
strmaxcpy((char*)obj.name, (char*)object_name, object_namlen);
|
||||
strmaxcpy((char*)mobj.name, (char*)member_name, member_namlen);
|
||||
strmaxcpy((char*)prop.name, (char*)prop_name, prop_namlen);
|
||||
XDPRINTF((2, "nw_delete_obj_from_set obj=%s,0x%x, member=%s,0x%x, prop=%s\n",
|
||||
XDPRINTF((2,0, "nw_delete_obj_from_set obj=%s,0x%x, member=%s,0x%x, prop=%s",
|
||||
obj.name, object_type, mobj.name, member_type, prop.name));
|
||||
obj.type = (uint16) object_type;
|
||||
mobj.type = (uint16) member_type;
|
||||
@ -670,7 +670,7 @@ int nw_write_prop_value(int object_type,
|
||||
int result=-0xff;
|
||||
strmaxcpy((char*)obj.name, (char*)object_name, object_namlen);
|
||||
strmaxcpy((char*)prop.name, (char*)prop_name, prop_namlen);
|
||||
XDPRINTF((2, "nw_write_prop_value obj=%s, prop=%s, type=0x%x, segment=%d\n",
|
||||
XDPRINTF((2,0, "nw_write_prop_value obj=%s, prop=%s, type=0x%x, segment=%d",
|
||||
obj.name, prop.name, object_type, segment_nr));
|
||||
obj.type = (uint16) object_type;
|
||||
|
||||
@ -696,7 +696,7 @@ int nw_change_prop_security(int object_type,
|
||||
strmaxcpy((char*)obj.name, (char*)object_name, object_namlen);
|
||||
strmaxcpy((char*)prop.name, (char*)prop_name, prop_namlen);
|
||||
prop.security = (uint8)prop_security;
|
||||
XDPRINTF((2, "nw_change_prop_security obj=%s,0x%x, prop=%s\n",
|
||||
XDPRINTF((2,0, "nw_change_prop_security obj=%s,0x%x, prop=%s",
|
||||
obj.name, object_type, prop.name));
|
||||
obj.type = (uint16) object_type;
|
||||
if ((result = find_obj_id(&obj, 0)) == 0){
|
||||
@ -717,7 +717,7 @@ int nw_scan_property(NETPROP *prop,
|
||||
int result;
|
||||
strmaxcpy((char*)obj.name, (char*)object_name, object_namlen);
|
||||
strmaxcpy((char*)prop->name, (char*)prop_name, prop_namlen);
|
||||
XDPRINTF((2, "nw_scan_property obj=%s, prop=%s, type=0x%x, last_scan=0x%lx\n",
|
||||
XDPRINTF((2,0, "nw_scan_property obj=%s, prop=%s, type=0x%x, last_scan=0x%lx",
|
||||
obj.name, prop->name, object_type, *last_scan));
|
||||
obj.type = (uint16) object_type;
|
||||
|
||||
@ -744,9 +744,9 @@ int nw_get_prop_val_str(uint32 q_id, char *propname, uint8 *buff)
|
||||
buff, &more_segments, &property_flags);
|
||||
if (result > -1) {
|
||||
result=strlen(buff);
|
||||
XDPRINTF((2, "nw_get_prop_val_str:%s strlen=%d\n", propname, result));
|
||||
XDPRINTF((2,0, "nw_get_prop_val_str:%s strlen=%d", propname, result));
|
||||
} else
|
||||
XDPRINTF((2, "nw_get_prop_val_str:%s, result=0x%x\n", propname, result));
|
||||
XDPRINTF((2,0, "nw_get_prop_val_str:%s, result=0x%x", propname, result));
|
||||
return(result);
|
||||
}
|
||||
|
||||
@ -759,7 +759,7 @@ int nw_create_obj(NETOBJ *obj, uint32 wanted_id)
|
||||
*/
|
||||
{
|
||||
int result = 0; /* OK */
|
||||
XDPRINTF((2, "creat OBJ=%s,type=0x%x\n", obj->name, (int)obj->type));
|
||||
XDPRINTF((2,0, "creat OBJ=%s,type=0x%x", obj->name, (int)obj->type));
|
||||
if (!dbminit(fnobj)){
|
||||
for (key = firstkey(); key.dptr != NULL; key = nextkey(key)) {
|
||||
data = fetch(key);
|
||||
@ -857,7 +857,7 @@ int nw_create_prop(int object_type,
|
||||
int result=-0xff;
|
||||
strmaxcpy((char*)obj.name, (char*)object_name, object_namlen);
|
||||
strmaxcpy((char*)prop.name, (char*)prop_name, prop_namlen);
|
||||
XDPRINTF((2, "nw_create_prop obj=%s, prop=%s, type=0x%x\n",
|
||||
XDPRINTF((2,0, "nw_create_prop obj=%s, prop=%s, type=0x%x",
|
||||
obj.name, prop.name, object_type));
|
||||
obj.type = (uint16) object_type;
|
||||
if ((result = find_obj_id(&obj, 0)) == 0){
|
||||
@ -909,14 +909,14 @@ struct passwd *nw_getpwnam(uint32 obj_id)
|
||||
struct passwd *pw = getpwnam(buff);
|
||||
if (NULL != pw) {
|
||||
memcpy(&pwstat, pw, sizeof(struct passwd));
|
||||
XDPRINTF((2, "FOUND obj_id=0x%x, pwnam=%s, gid=%d, uid=%d\n",
|
||||
XDPRINTF((2,0, "FOUND obj_id=0x%x, pwnam=%s, gid=%d, uid=%d",
|
||||
obj_id, buff, pw->pw_gid, pw->pw_uid));
|
||||
endpwent ();
|
||||
return(&pwstat);
|
||||
}
|
||||
endpwent ();
|
||||
}
|
||||
XDPRINTF((2, "NOT FOUND PWNAM of obj_id=0x%x\n", obj_id));
|
||||
XDPRINTF((2,0, "NOT FOUND PWNAM of obj_id=0x%x", obj_id));
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
@ -962,7 +962,7 @@ int nw_set_passwd(uint32 obj_id, char *password)
|
||||
U32_TO_BE32(obj_id, s_uid);
|
||||
shuffle(s_uid, password, strlen(password), passwd);
|
||||
#if 0
|
||||
XDPRINTF((2, "password %s->0x%x,0x%x,0x%x,0x%x,0x%x,0x%x,0x%x,0x%x,0x%x,0x%x,0x%x,0x%x,0x%x,0x%x,0x%x,0x%x\n",
|
||||
XDPRINTF((2,0, "password %s->0x%x,0x%x,0x%x,0x%x,0x%x,0x%x,0x%x,0x%x,0x%x,0x%x,0x%x,0x%x,0x%x,0x%x,0x%x,0x%x",
|
||||
password,
|
||||
(int)passwd[0],
|
||||
(int)passwd[1],
|
||||
@ -1031,7 +1031,7 @@ static void add_pr_queue(uint32 q_id,
|
||||
uint32 su_id, uint32 ge_id)
|
||||
{
|
||||
uint8 buff[12];
|
||||
XDPRINTF((2, "ADD Q=%s, V=%s, C=%s\n", q_name, q_directory, q_command));
|
||||
XDPRINTF((2,0, "ADD Q=%s, V=%s, C=%s", q_name, q_directory, q_command));
|
||||
U32_TO_BE32(su_id, buff);
|
||||
q_id =
|
||||
nw_new_create_prop(q_id, q_name, 0x3, O_FL_DYNA, 0x31,
|
||||
|
22
nwroute.c
22
nwroute.c
@ -1,4 +1,4 @@
|
||||
/* nwroute.c 20-Dec-95 */
|
||||
/* nwroute.c 24-Dec-95 */
|
||||
/* (C)opyright (C) 1993,1995 Martin Stover, Marburg, Germany
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -44,7 +44,7 @@ static void insert_delete_net(uint32 destnet,
|
||||
int freeslot=-1;
|
||||
NW_ROUTES *nr=NULL;
|
||||
|
||||
XDPRINTF((3,"%s net:0x%X, over 0x%X, 0x%02x:%02x:%02x:%02x:%02x:%02x\n",
|
||||
XDPRINTF((3,0,"%s net:0x%X, over 0x%X, 0x%02x:%02x:%02x:%02x:%02x:%02x",
|
||||
(do_delete) ? "DEL" : "INS", destnet, rnet,
|
||||
(int)rnode[0], (int)rnode[1], (int)rnode[2],
|
||||
(int)rnode[3], (int)rnode[4], (int)rnode[5]));
|
||||
@ -58,7 +58,7 @@ static void insert_delete_net(uint32 destnet,
|
||||
|
||||
k=-1;
|
||||
while (++k < anz_routes && nw_routes[k]->net != destnet) {
|
||||
XDPRINTF((3,"NET 0x%X is routed\n", nw_routes[k]->net));
|
||||
XDPRINTF((3,0, "NET 0x%X is routed", nw_routes[k]->net));
|
||||
if (freeslot < 0 && !nw_routes[k]->net) freeslot=k;
|
||||
}
|
||||
|
||||
@ -79,12 +79,12 @@ static void insert_delete_net(uint32 destnet,
|
||||
if (nr->rnet == rnet &&
|
||||
IPXCMPNODE(nr->rnode, rnode) ) {
|
||||
/* only delete the routes, which we have inserted */
|
||||
XDPRINTF((2,"ROUTE DEL NET=0x%X over Router NET 0x%X\n",
|
||||
XDPRINTF((2,0,"ROUTE DEL NET=0x%X over Router NET 0x%X",
|
||||
nr->net, rnet));
|
||||
ipx_route_del(nr->net);
|
||||
nr->net = 0L;
|
||||
} else {
|
||||
XDPRINTF((3,"ROUTE NOT deleted NET=0x%X, RNET=0X%X\n",
|
||||
XDPRINTF((3,0,"ROUTE NOT deleted NET=0x%X, RNET=0X%X",
|
||||
nr->net, rnet));
|
||||
}
|
||||
return;
|
||||
@ -96,7 +96,7 @@ static void insert_delete_net(uint32 destnet,
|
||||
nr->ticks = ticks;
|
||||
nr->rnet = rnet;
|
||||
memcpy(nr->rnode, rnode, IPX_NODE_SIZE);
|
||||
XDPRINTF((2,"ADD ROUTE NET=0x%X, over 0x%X, 0x%02x:%02x:%02x:%02x:%02x:%02x\n",
|
||||
XDPRINTF((2,0,"ADD ROUTE NET=0x%X, over 0x%X, 0x%02x:%02x:%02x:%02x:%02x:%02x",
|
||||
nr->net, nr->rnet,
|
||||
(int)nr->rnode[0], (int)nr->rnode[1], (int)nr->rnode[2],
|
||||
(int)nr->rnode[3], (int)nr->rnode[4], (int)nr->rnode[5]));
|
||||
@ -174,14 +174,14 @@ static void send_rip_buff(ipxAddr_t *from_addr)
|
||||
if (nw_debug) {
|
||||
uint8 *p = rip_buff;
|
||||
int operation = GET_BE16(p);
|
||||
XDPRINTF((2,"Send Rip %s entries=%d\n",
|
||||
XDPRINTF((2,0, "Send Rip %s entries=%d",
|
||||
(operation==1) ? "Request" : "Response", rentries));
|
||||
p+=2;
|
||||
while (rentries--) {
|
||||
uint32 net = GET_BE32(p);
|
||||
uint16 hops = GET_BE16(p+4);
|
||||
uint16 ticks = GET_BE16(p+6);
|
||||
XDPRINTF((2,"hops=%3d, ticks %3d, network:%02x.%02x.%02x.%02x\n",
|
||||
XDPRINTF((2,0, "hops=%3d, ticks %3d, network:%02x.%02x.%02x.%02x",
|
||||
(int)hops, (int)ticks, (int)*(p), (int)*(p+1), (int)*(p+2), (int)*(p+3)));
|
||||
p+=8;
|
||||
}
|
||||
@ -233,13 +233,13 @@ void handle_rip(int fd, int ipx_pack_typ,
|
||||
uint8 *p = ((uint8*)ipxdata)+2;
|
||||
int is_response = operation==2;
|
||||
|
||||
XDPRINTF((2,"Got Rip %s entries=%d from: %s\n",
|
||||
XDPRINTF((2,0, "Got Rip %s entries=%d from: %s",
|
||||
(!is_response) ? "Request" : "Response", entries,
|
||||
visable_ipx_adr(from_addr)));
|
||||
|
||||
if (!is_response) {
|
||||
if (operation != 1) {
|
||||
XDPRINTF((1,"UNKNOWN RIP operation %d\n", operation));
|
||||
XDPRINTF((1,0, "UNKNOWN RIP operation %d", operation));
|
||||
return;
|
||||
}
|
||||
init_rip_buff(GET_BE32(from_addr->net), 0);
|
||||
@ -249,7 +249,7 @@ void handle_rip(int fd, int ipx_pack_typ,
|
||||
uint32 net = GET_BE32(p);
|
||||
uint16 hops = GET_BE16(p+4);
|
||||
uint16 ticks = GET_BE16(p+6);
|
||||
XDPRINTF((2,"hops=%3d, ticks %3d, network:%02x.%02x.%02x.%02x\n",
|
||||
XDPRINTF((2,0,"hops=%3d, ticks %3d, network:%02x.%02x.%02x.%02x",
|
||||
(int)hops, (int)ticks, (int)*(p), (int)*(p+1), (int)*(p+2), (int)*(p+3)));
|
||||
|
||||
if (is_response) {
|
||||
|
54
nwserv.c
54
nwserv.c
@ -69,7 +69,7 @@ static void inform_ncpserv(void)
|
||||
{
|
||||
if (bytes_to_write_to_ncpserv && pid_ncpserv > -1) {
|
||||
#if 0
|
||||
XDPRINTF((2, "inform_ncpserv bytes=%d\n", bytes_to_write_to_ncpserv));
|
||||
XDPRINTF((2, 0,"inform_ncpserv bytes=%d", bytes_to_write_to_ncpserv));
|
||||
kill(pid_ncpserv, SIGHUP); /* tell ncpserv to read input */
|
||||
#endif
|
||||
bytes_to_write_to_ncpserv=0;
|
||||
@ -79,7 +79,7 @@ static void inform_ncpserv(void)
|
||||
static void write_to_ncpserv(int what, int connection,
|
||||
char *data, int data_size)
|
||||
{
|
||||
XDPRINTF((2, "write_to_ncpserv what=0x%x, conn=%d, data_size=%d\n",
|
||||
XDPRINTF((2, 0, "write_to_ncpserv what=0x%x, conn=%d, data_size=%d",
|
||||
what, connection, data_size));
|
||||
|
||||
switch (what) {
|
||||
@ -392,7 +392,7 @@ void get_server_data(char *name,
|
||||
client_mode = 0; /* only start once */
|
||||
}
|
||||
}
|
||||
XDPRINTF((2,"NW386 %s found at:%s\n", name, visable_ipx_adr(adr)));
|
||||
XDPRINTF((2,0,"NW386 %s found at:%s", name, visable_ipx_adr(adr)));
|
||||
ins_del_bind_net_addr(name, adr);
|
||||
}
|
||||
|
||||
@ -405,14 +405,14 @@ static void handle_sap(int fd,
|
||||
int query_type = GET_BE16(ipxdata->sqp.query_type);
|
||||
int server_type = GET_BE16(ipxdata->sqp.server_type);
|
||||
if (query_type == 3) {
|
||||
XDPRINTF((2,"SAP NEAREST SERVER request typ=%d von %s\n",
|
||||
XDPRINTF((2,0,"SAP NEAREST SERVER request typ=%d von %s",
|
||||
server_type, visable_ipx_adr(from_addr)));
|
||||
if (server_type == 4) {
|
||||
/* Get Nearest File Server */
|
||||
send_server_respons(fd, ipx_pack_typ, 4, server_type, from_addr);
|
||||
}
|
||||
} else if (query_type == 1) { /* general Request */
|
||||
XDPRINTF((2,"SAP GENERAL request server_type =%d\n", server_type));
|
||||
XDPRINTF((2,0, "SAP GENERAL request server_type =%d", server_type));
|
||||
if (server_type == 4) {
|
||||
/* Get General File Server Request */
|
||||
send_server_respons(fd, ipx_pack_typ, 4, server_type, from_addr);
|
||||
@ -423,19 +423,19 @@ static void handle_sap(int fd,
|
||||
*/
|
||||
int entries = (data_len-2) / sizeof(SAPS);
|
||||
uint8 *p = ((uint8*)ipxdata)+2;
|
||||
XDPRINTF((2,"SAP PERIODIC (entries=%d) from %s\n", entries, visable_ipx_adr(from_addr)));
|
||||
XDPRINTF((2,0,"SAP PERIODIC (entries=%d) from %s", entries, visable_ipx_adr(from_addr)));
|
||||
while (entries--) {
|
||||
int type = GET_BE16(p);
|
||||
uint8 *name = p+2;
|
||||
ipxAddr_t *ad = (ipxAddr_t*) (p+50);
|
||||
int hops = GET_BE16(p+ sizeof(SAPS) -2);
|
||||
XDPRINTF((2,"TYP=%2d,hops=%2d, Addr=%s, Name=%s\n", type, hops,
|
||||
XDPRINTF((2,0, "TYP=%2d,hops=%2d, Addr=%s, Name=%s", type, hops,
|
||||
visable_ipx_adr(ad), name));
|
||||
|
||||
if (type == 4 && strcmp(name, my_nwname)) { /* from Fileserver */
|
||||
if (16 == hops) {
|
||||
/* shutdown */
|
||||
XDPRINTF((2,"SERVER %s IS GOING DOWN\n", name));
|
||||
XDPRINTF((2,0, "SERVER %s IS GOING DOWN", name));
|
||||
ins_del_bind_net_addr(name, NULL);
|
||||
} else {
|
||||
get_server_data(name, ad, from_addr);
|
||||
@ -444,7 +444,7 @@ static void handle_sap(int fd,
|
||||
p+=sizeof(SAPS);
|
||||
} /* while */
|
||||
} else {
|
||||
XDPRINTF((1,"UNKNOWN SAP query %x, server %x\n", query_type, server_type));
|
||||
XDPRINTF((1,0, "UNKNOWN SAP query %x, server %x", query_type, server_type));
|
||||
}
|
||||
}
|
||||
|
||||
@ -523,12 +523,12 @@ static void handle_diag(int fd, int ipx_pack_typ,
|
||||
uint8 *exnodes = conf->ex_node;
|
||||
while (j--) {
|
||||
if IPXCMPNODE(exnodes, my_server_adr.node) {
|
||||
DPRINTF(("NO RESPONSE TO DIAG\n"));
|
||||
XDPRINTF((2, 0, "NO RESPONSE TO DIAG"));
|
||||
return;
|
||||
}
|
||||
exnodes += IPX_NODE_SIZE;
|
||||
}
|
||||
XDPRINTF((2,"DIAG Request, ipx_pack_typ %d, data_len %d, count %d\n",
|
||||
XDPRINTF((2,0,"DIAG Request, ipx_pack_typ %d, data_len %d, count %d",
|
||||
(int)ipx_pack_typ, data_len, count));
|
||||
response_ipx_diag(fd, ipx_pack_typ, from_addr);
|
||||
}
|
||||
@ -565,12 +565,12 @@ static void handle_event(int fd, uint16 socknr, int slot)
|
||||
uderr.opt.buf = (char*)&err_pack_typ; /* get actual typ */
|
||||
ud.addr.buf = (char*)&source_adr;
|
||||
t_rcvuderr(fd, &uderr);
|
||||
DPRINTF(("Error from %s, Code = 0x%lx\n", visable_ipx_adr(&erradr), uderr.error));
|
||||
XDPRINTF((2, 0, "Error from %s, Code = 0x%lx", visable_ipx_adr(&erradr), uderr.error));
|
||||
if (nw_debug) t_error("t_rcvudata !OK");
|
||||
return;
|
||||
}
|
||||
|
||||
XDPRINTF((3,"Ptyp:%d from: %s\n", (int)ipx_pack_typ, visable_ipx_adr(&source_adr) ));
|
||||
XDPRINTF((3,0,"Ptyp:%d from: %s", (int)ipx_pack_typ, visable_ipx_adr(&source_adr) ));
|
||||
|
||||
if (server_down_stamp) return; /* no more interests */
|
||||
|
||||
@ -582,12 +582,12 @@ static void handle_event(int fd, uint16 socknr, int slot)
|
||||
|| source_sock == sock_nummern[WDOG_SLOT]
|
||||
|| source_sock == SOCK_SAP
|
||||
|| source_sock == SOCK_RIP) {
|
||||
XDPRINTF((2,"OWN Packet from sock:0x%04x, ignored\n", source_sock));
|
||||
XDPRINTF((2,0,"OWN Packet from sock:0x%04x, ignored", source_sock));
|
||||
return;
|
||||
}
|
||||
|
||||
/* it also can be Packets from DOSEMU OR ncpfs on this machine */
|
||||
XDPRINTF((2,"Packet from OWN maschine:sock=0x%x\n", source_sock));
|
||||
XDPRINTF((2,0,"Packet from OWN maschine:sock=0x%x", source_sock));
|
||||
}
|
||||
|
||||
switch (socknr) {
|
||||
@ -597,7 +597,7 @@ static void handle_event(int fd, uint16 socknr, int slot)
|
||||
|
||||
default :
|
||||
if (WDOG_SLOT == slot) { /* this is a watchdog packet */
|
||||
XDPRINTF((2,"WDOG Packet len=%d connid=%d, status=%d\n",
|
||||
XDPRINTF((2,0, "WDOG Packet len=%d connid=%d, status=%d",
|
||||
(int)ud.udata.len, (int) ipx_data_buff.wdog.connid,
|
||||
(int)ipx_data_buff.wdog.status));
|
||||
if (2 == ud.udata.len) {
|
||||
@ -607,11 +607,11 @@ static void handle_event(int fd, uint16 socknr, int slot)
|
||||
} else {
|
||||
uint8 *p = (uint8*)&ipx_data_buff;
|
||||
int k = 0;
|
||||
DPRINTF(("UNKNOWN"));
|
||||
XDPRINTF((1, 2, "UNKNOWN"));
|
||||
while (k++ < ud.udata.len){
|
||||
DPRINTF((" %x", (int) *p++));
|
||||
XDPRINTF((1, 3, " %x", (int) *p++));
|
||||
}
|
||||
DPRINTF(("\n"));
|
||||
XDPRINTF((1, 1, NULL));
|
||||
/*
|
||||
print_ud_data(&ud);
|
||||
*/
|
||||
@ -727,7 +727,7 @@ static void get_ini(int full)
|
||||
case IPX_FRAME_ETHERII : frname = "ETHERNET_II";break;
|
||||
default : break;
|
||||
} /* switch */
|
||||
DPRINTF(("DEVICE=%s, FRAME=%s, NETWORK=0x%lx\n",
|
||||
XDPRINTF((1, 0, "DEVICE=%s, FRAME=%s, NETWORK=0x%lx",
|
||||
nd->devname, frname, nd->net));
|
||||
init_dev(nd->devname, nd->frame, nd->net);
|
||||
}
|
||||
@ -735,7 +735,7 @@ static void get_ini(int full)
|
||||
if (!get_ipx_addr(&my_server_adr)) {
|
||||
internal_net = GET_BE32(my_server_adr.net);
|
||||
} else exit(1);
|
||||
DPRINTF(("Servername='%s', INTERNAL NET=0x%lx, NODE=0x%02x:%02x:%02x:%02x:%02x:%02x\n",
|
||||
XDPRINTF((1, 0, "Servername='%s', INTERNAL NET=0x%lx, NODE=0x%02x:%02x:%02x:%02x:%02x:%02x",
|
||||
my_nwname, internal_net,
|
||||
(int)my_server_adr.node[0],
|
||||
(int)my_server_adr.node[1],
|
||||
@ -780,7 +780,7 @@ static void close_all(void)
|
||||
if (!save_ipx_routes) {
|
||||
for (j=0; j<anz_net_devices;j++) {
|
||||
NW_NET_DEVICE *nd=net_devices[j];
|
||||
DPRINTF(("Close Device=%s, frame=%d\n",
|
||||
XDPRINTF((1, 0, "Close Device=%s, frame=%d",
|
||||
nd->devname, nd->frame));
|
||||
exit_dev(nd->devname, nd->frame);
|
||||
}
|
||||
@ -820,7 +820,7 @@ static void sig_quit(int rsig)
|
||||
static void handle_hup_reqest(void)
|
||||
{
|
||||
get_ini_debug(NWSERV);
|
||||
XDPRINTF((2, "NWSERV:Got HUP, reading ini.\n"));
|
||||
XDPRINTF((2,0, "Got HUP, reading ini."));
|
||||
get_ini(0);
|
||||
write_to_ncpserv(0xeeee, 0, NULL, 0); /* inform ncpserv */
|
||||
fl_get_int=0;
|
||||
@ -891,12 +891,12 @@ int main(int argc, char **argv)
|
||||
while (++j < NEEDED_POLLS) {
|
||||
if (p->revents){
|
||||
if (j < NEEDED_SOCKETS) { /* socket */
|
||||
XDPRINTF((99,"POLL %d, SOCKET %x, ", p->revents, sock_nummern[j]));
|
||||
XDPRINTF((99, 0,"POLL %d, SOCKET %x", p->revents, sock_nummern[j]));
|
||||
if (p->revents & ~POLLIN)
|
||||
errorp(0, "STREAM error", "revents=0x%x", p->revents );
|
||||
else handle_event(p->fd, sock_nummern[j], j);
|
||||
} else { /* fd_ncpserv_in */
|
||||
XDPRINTF((2,"POLL %d, fh=%d\n", p->revents, p->fd));
|
||||
XDPRINTF((2, 0, "POLL %d, fh=%d", p->revents, p->fd));
|
||||
if (p->revents & ~POLLIN)
|
||||
errorp(0, "STREAM error", "revents=0x%x", p->revents );
|
||||
else {
|
||||
@ -907,7 +907,7 @@ int main(int argc, char **argv)
|
||||
ipxAddr_t adr;
|
||||
if (sizeof(int) == read(fd_ncpserv_in,
|
||||
(char*)&what, sizeof(int))) {
|
||||
XDPRINTF((2,"GOT ncpserv_in what=0x%x\n", what));
|
||||
XDPRINTF((2, 0, "GOT ncpserv_in what=0x%x", what));
|
||||
switch (what) {
|
||||
case 0x2222 : /* insert wdog connection */
|
||||
if (sizeof(int) == read(fd_ncpserv_in,
|
||||
@ -955,7 +955,7 @@ int main(int argc, char **argv)
|
||||
p++;
|
||||
} /* while */
|
||||
} else {
|
||||
XDPRINTF((99,"POLLING ...\n"));
|
||||
XDPRINTF((99,0,"POLLING ..."));
|
||||
}
|
||||
if (server_down_stamp) {
|
||||
if (akttime_stamp - server_down_stamp > server_goes_down_secs) break;
|
||||
|
41
tools.c
41
tools.c
@ -1,4 +1,4 @@
|
||||
/* tools.c 06-Dec-95 */
|
||||
/* tools.c 24-Dec-95 */
|
||||
/* (C)opyright (C) 1993,1995 Martin Stover, Marburg, Germany
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -23,6 +23,18 @@
|
||||
int nw_debug=0;
|
||||
FILE *logfile=stdout;
|
||||
|
||||
static int in_module=0; /* in which process i am ? */
|
||||
static char *modnames[] =
|
||||
{ "???????",
|
||||
"NWSERV ",
|
||||
"NCPSERV",
|
||||
"NWCONN " };
|
||||
|
||||
static char *get_modstr(void)
|
||||
{
|
||||
return(modnames[in_module]);
|
||||
}
|
||||
|
||||
char *xmalloc(uint size)
|
||||
{
|
||||
char *p = (size) ? (char *)malloc(size) : (char*)NULL;
|
||||
@ -63,20 +75,26 @@ void dprintf(char *p, ...)
|
||||
{
|
||||
va_list ap;
|
||||
if (nw_debug){
|
||||
fprintf(logfile, "%s:", get_modstr());
|
||||
va_start(ap, p);
|
||||
vfprintf(logfile, p, ap);
|
||||
va_end(ap);
|
||||
fprintf(logfile, "\n");
|
||||
fflush(logfile);
|
||||
}
|
||||
}
|
||||
|
||||
void xdprintf(int dlevel, char *p, ...)
|
||||
void xdprintf(int dlevel, int mode, char *p, ...)
|
||||
{
|
||||
va_list ap;
|
||||
if (nw_debug >= dlevel) {
|
||||
va_start(ap, p);
|
||||
vfprintf(logfile, p, ap);
|
||||
va_end(ap);
|
||||
if (!(mode & 1)) fprintf(logfile, "%s:", get_modstr());
|
||||
if (p) {
|
||||
va_start(ap, p);
|
||||
vfprintf(logfile, p, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
if (!(mode & 2)) fprintf(logfile, "\n");
|
||||
fflush(logfile);
|
||||
}
|
||||
}
|
||||
@ -84,11 +102,11 @@ void xdprintf(int dlevel, char *p, ...)
|
||||
void errorp(int mode, char *what, char *p, ...)
|
||||
{
|
||||
va_list ap;
|
||||
int errnum = errno;
|
||||
int errnum = errno;
|
||||
if (errnum >= 0 && errnum < _sys_nerr)
|
||||
fprintf(logfile, "%s:%s\n", what, _sys_errlist[errnum]);
|
||||
fprintf(logfile, "%s:%s:%s\n", get_modstr(), what, _sys_errlist[errnum]);
|
||||
else
|
||||
fprintf(logfile, "%s:errno=%d\n", what, errnum);
|
||||
fprintf(logfile, "%s:%s:errno=%d\n", get_modstr(), what, errnum);
|
||||
if (p) {
|
||||
va_start(ap, p);
|
||||
vfprintf(logfile, p, ap);
|
||||
@ -184,6 +202,7 @@ void init_tools(int module)
|
||||
int withlog=0;
|
||||
int dodaemon=0;
|
||||
int new_log=0;
|
||||
in_module = module;
|
||||
if (f) {
|
||||
int what;
|
||||
while (0 != (what=get_ini_entry(f, 0, buff, sizeof(buff)))) { /* daemonize */
|
||||
@ -214,6 +233,10 @@ void init_tools(int module)
|
||||
}
|
||||
if (NWSERV == module) setsid();
|
||||
}
|
||||
if (NWSERV == module || NCPSERV == module) {
|
||||
XDPRINTF((1, 0, "Starting Version: %d.%02dpl%d",
|
||||
_VERS_H_, _VERS_L_, _VERS_P_ ));
|
||||
}
|
||||
}
|
||||
|
||||
void exit_tools(int what)
|
||||
@ -277,7 +300,7 @@ int get_fs_usage(char *path, struct fs_usage *fsp)
|
||||
{
|
||||
struct statfs fsd;
|
||||
if (statfs (path, &fsd) < 0) return (-1);
|
||||
XDPRINTF((2,
|
||||
XDPRINTF((3, 0,
|
||||
"blocks=%d, bfree=%d, bavail=%d, files=%d, ffree=%d, bsize=%d\n",
|
||||
fsd.f_blocks, fsd.f_bfree, fsd.f_bavail,
|
||||
fsd.f_files, fsd.f_ffree, fsd.f_bsize));
|
||||
|
2
tools.h
2
tools.h
@ -32,7 +32,7 @@ extern int x_x_xnewstr(uint8 **p, uint8 *s);
|
||||
extern char *xmalloc(uint size);
|
||||
extern int strmaxcpy(char *dest, char *source, int len);
|
||||
extern void dprintf(char *p, ...);
|
||||
extern void xdprintf(int dlevel, char *p, ...);
|
||||
extern void xdprintf(int dlevel, int mode, char *p, ...);
|
||||
extern void errorp(int mode, char *what, char *p, ...);
|
||||
extern FILE *open_nw_ini(void);
|
||||
extern int get_ini_entry(FILE *f, int entry, char *str, int strsize);
|
||||
|
Loading…
Reference in New Issue
Block a user