mars_nwe-0.97.pl09
This commit is contained in:
parent
07843f212b
commit
6331687e52
4
Makefile
4
Makefile
@ -32,6 +32,10 @@ routed:
|
|||||||
install:
|
install:
|
||||||
./mk.li $@
|
./mk.li $@
|
||||||
|
|
||||||
|
reboot:
|
||||||
|
./mk.li $@
|
||||||
|
|
||||||
|
|
||||||
install_ini: nw.ini
|
install_ini: nw.ini
|
||||||
./mk.li $@
|
./mk.li $@
|
||||||
|
|
||||||
|
285
connect.c
285
connect.c
@ -28,12 +28,15 @@
|
|||||||
static int test_handle=-1;
|
static int test_handle=-1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define DONT_KNOW_IF_OK 1
|
#define DONT_KNOW_IF_OK 0
|
||||||
|
|
||||||
|
|
||||||
static int default_uid=-1;
|
static int default_uid=-1;
|
||||||
static int default_gid=-1;
|
static int default_gid=-1;
|
||||||
|
|
||||||
|
static int act_uid=-1;
|
||||||
|
static int act_gid=-1;
|
||||||
|
|
||||||
#include "nwvolume.h"
|
#include "nwvolume.h"
|
||||||
#include "nwfile.h"
|
#include "nwfile.h"
|
||||||
#include "connect.h"
|
#include "connect.h"
|
||||||
@ -175,6 +178,8 @@ void set_default_guid(void)
|
|||||||
"Cannot set default gid=%d and uid=%d" , default_gid, default_uid);
|
"Cannot set default gid=%d and uid=%d" , default_gid, default_uid);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
act_gid = default_gid;
|
||||||
|
act_uid = default_uid;
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_guid(int gid, int uid)
|
void set_guid(int gid, int uid)
|
||||||
@ -197,6 +202,8 @@ void set_guid(int gid, int uid)
|
|||||||
if (seteuid(uid) == -1) set_default_guid();
|
if (seteuid(uid) == -1) set_default_guid();
|
||||||
}
|
}
|
||||||
XDPRINTF((5,0,"SET GID=%d, UID=%d OK", gid, uid));
|
XDPRINTF((5,0,"SET GID=%d, UID=%d OK", gid, uid));
|
||||||
|
act_gid = gid;
|
||||||
|
act_uid = uid;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -231,12 +238,16 @@ static int x_str_match(uint8 *s, uint8 *p)
|
|||||||
if (*p++ != *s++) return(0);
|
if (*p++ != *s++) return(0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '?' : if ((sc = *s++) == '.') {
|
case '?' : if ( (sc = *s++) == '.' || sc == '\0' ) {
|
||||||
uint8 *pp=p;
|
uint8 *pp=p;
|
||||||
while (*pp) {
|
while (*pp=='?' || *pp=='*') ++pp;
|
||||||
if (*pp++ == '.') p=pp;
|
if (*pp=='.') p=++pp;
|
||||||
|
else if (*pp || sc) return(0);
|
||||||
|
if (!sc) {
|
||||||
|
while (*pp=='?' || *pp=='*') ++pp;
|
||||||
|
return((*pp) ? 0 : 1);
|
||||||
}
|
}
|
||||||
} else if (!sc) return(1); /* one character */
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '.' :
|
case '.' :
|
||||||
@ -306,6 +317,7 @@ int fn_match(uint8 *s, uint8 *p, int options)
|
|||||||
if (pf++) return(0); /* no 2. pouint */
|
if (pf++) return(0); /* no 2. pouint */
|
||||||
len=0;
|
len=0;
|
||||||
} else {
|
} else {
|
||||||
|
++len;
|
||||||
if ((pf && len > 3) || len > 8) return(0);
|
if ((pf && len > 3) || len > 8) return(0);
|
||||||
if (options & VOL_OPTION_DOWNSHIFT){ /* only downshift chars */
|
if (options & VOL_OPTION_DOWNSHIFT){ /* only downshift chars */
|
||||||
if (*ss >= 'A' && *ss <= 'Z') return(0);
|
if (*ss >= 'A' && *ss <= 'Z') return(0);
|
||||||
@ -547,7 +559,7 @@ static int get_dh_entry(DIR_HANDLE *dh,
|
|||||||
return(okflag);
|
return(okflag);
|
||||||
}
|
}
|
||||||
|
|
||||||
void conn_build_path_fn( uint8 *vol,
|
static void conn_build_path_fn( uint8 *vol,
|
||||||
uint8 *path,
|
uint8 *path,
|
||||||
uint8 *fn,
|
uint8 *fn,
|
||||||
int *has_wild,
|
int *has_wild,
|
||||||
@ -737,7 +749,9 @@ static int build_verz_name(NW_PATH *nwpath, /* gets complete path */
|
|||||||
return(completition);
|
return(completition);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if DONT_KNOW_IF_OK
|
||||||
static int lastdirhandle=0;
|
static int lastdirhandle=0;
|
||||||
|
#endif
|
||||||
int conn_get_kpl_path(NW_PATH *nwpath, int dirhandle,
|
int conn_get_kpl_path(NW_PATH *nwpath, int dirhandle,
|
||||||
uint8 *data, int len, int only_dir)
|
uint8 *data, int len, int only_dir)
|
||||||
/*
|
/*
|
||||||
@ -759,7 +773,7 @@ int conn_get_kpl_path(NW_PATH *nwpath, int dirhandle,
|
|||||||
return(completition);
|
return(completition);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16 un_date_2_nw(time_t time, uint8 *d)
|
void un_date_2_nw(time_t time, uint8 *d, int high_low)
|
||||||
{
|
{
|
||||||
struct tm *s_tm=localtime(&time);
|
struct tm *s_tm=localtime(&time);
|
||||||
uint16 xdate=s_tm->tm_year - 80;
|
uint16 xdate=s_tm->tm_year - 80;
|
||||||
@ -767,8 +781,26 @@ uint16 un_date_2_nw(time_t time, uint8 *d)
|
|||||||
xdate |= s_tm->tm_mon+1;
|
xdate |= s_tm->tm_mon+1;
|
||||||
xdate <<= 5;
|
xdate <<= 5;
|
||||||
xdate |= s_tm->tm_mday;
|
xdate |= s_tm->tm_mday;
|
||||||
if (d) U16_TO_BE16(xdate, d);
|
if (high_low) {
|
||||||
return(xdate);
|
U16_TO_BE16(xdate, d);
|
||||||
|
} else {
|
||||||
|
U16_TO_16(xdate, d);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void un_time_2_nw(time_t time, uint8 *d, int high_low)
|
||||||
|
{
|
||||||
|
struct tm *s_tm=localtime(&time);
|
||||||
|
uint16 xdate=s_tm->tm_hour;
|
||||||
|
xdate <<= 6;
|
||||||
|
xdate |= s_tm->tm_min;
|
||||||
|
xdate <<= 5;
|
||||||
|
xdate |= (s_tm->tm_sec / 2);
|
||||||
|
if (high_low) {
|
||||||
|
U16_TO_BE16(xdate, d);
|
||||||
|
} else {
|
||||||
|
U16_TO_16(xdate, d);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
time_t nw_2_un_time(uint8 *d, uint8 *t)
|
time_t nw_2_un_time(uint8 *d, uint8 *t)
|
||||||
@ -792,37 +824,83 @@ time_t nw_2_un_time(uint8 *d, uint8 *t)
|
|||||||
return(mktime(&s_tm));
|
return(mktime(&s_tm));
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16 un_time_2_nw(time_t time, uint8 *d)
|
static int un_nw_attrib(struct stat *stb, int attrib, int mode)
|
||||||
|
/* mode: 0 = un2nw , 1 = nw2un */
|
||||||
{
|
{
|
||||||
struct tm *s_tm=localtime(&time);
|
/* Attribute */
|
||||||
uint16 xdate=s_tm->tm_hour;
|
/* 0x01 readonly */
|
||||||
xdate <<= 6;
|
/* 0x02 hidden */
|
||||||
xdate |= s_tm->tm_min;
|
/* 0x04 System */
|
||||||
xdate <<= 5;
|
/* 0x20 Archive Flag */
|
||||||
xdate |= (s_tm->tm_sec / 2);
|
/* 0x80 Sharable */ /* TLINK (TCC 2.0) don't like it ???? */
|
||||||
if (d) U16_TO_BE16(xdate, d);
|
|
||||||
return(xdate);
|
if (!mode) {
|
||||||
|
/* UNIX access -> NW access */
|
||||||
|
attrib = 0x20;
|
||||||
|
if (act_uid == stb->st_uid) {
|
||||||
|
if (!(stb->st_mode & S_IWUSR)) {
|
||||||
|
attrib |= 0x1; /* RO */
|
||||||
|
}
|
||||||
|
if (!(stb->st_mode & S_IRUSR)) {
|
||||||
|
attrib |= 0x2; /* Hidden */
|
||||||
|
}
|
||||||
|
} else if (act_gid == stb->st_gid) {
|
||||||
|
if (!(stb->st_mode & S_IWGRP)) {
|
||||||
|
attrib |= 0x1; /* RO */
|
||||||
|
}
|
||||||
|
if (!(stb->st_mode & S_IRGRP)) {
|
||||||
|
attrib |= 0x2; /* Hidden */
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!(stb->st_mode & S_IWOTH)) {
|
||||||
|
attrib |= 0x1; /* RO */
|
||||||
|
}
|
||||||
|
if (!(stb->st_mode & S_IROTH)) {
|
||||||
|
attrib |= 0x2; /* Hidden */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* only shared if gid == gid && x Flag */
|
||||||
|
|
||||||
|
if ((act_gid == stb->st_gid) && (stb->st_mode & S_IXGRP))
|
||||||
|
attrib |= 0x80; /* shared flag */
|
||||||
|
|
||||||
|
return(attrib);
|
||||||
|
} else {
|
||||||
|
/* NW access -> UNIX access */
|
||||||
|
|
||||||
|
int mode = S_IRUSR | S_IRGRP;
|
||||||
|
if (attrib & 0x2) /* hidden */
|
||||||
|
stb->st_mode &= ~mode;
|
||||||
|
else
|
||||||
|
stb->st_mode |= mode;
|
||||||
|
|
||||||
|
mode = S_IWUSR | S_IWGRP;
|
||||||
|
if (attrib & 0x1) /* R/O */
|
||||||
|
stb->st_mode &= ~mode;
|
||||||
|
else
|
||||||
|
stb->st_mode |= mode;
|
||||||
|
|
||||||
|
if (attrib & 0x80) /* Shared */
|
||||||
|
stb->st_mode |= S_IXGRP;
|
||||||
|
else
|
||||||
|
stb->st_mode &= ~S_IXGRP;
|
||||||
|
return(stb->st_mode);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int get_file_attrib(NW_FILE_INFO *f, struct stat *stb,
|
static int get_file_attrib(NW_FILE_INFO *f, struct stat *stb,
|
||||||
NW_PATH *nwpath)
|
NW_PATH *nwpath)
|
||||||
{
|
{
|
||||||
XDPRINTF((5,0, "get_file_attrib of %s", conn_get_nwpath_name(nwpath) ));
|
|
||||||
strncpy((char*)f->name, (char*)nwpath->fn, sizeof(f->name));
|
strncpy((char*)f->name, (char*)nwpath->fn, sizeof(f->name));
|
||||||
/* Attribute */
|
f->attrib = (uint8) un_nw_attrib(stb, 0, 0);
|
||||||
/* 0x20 Archive Flag */
|
XDPRINTF((5,0, "get_file_attrib = 0x%x of ,%s, uid=%d, gid=%d",
|
||||||
/* 0x80 Sharable */ /* TLINK (TCC 2.0) don't like it ???? */
|
(int)f->attrib, conn_get_nwpath_name(nwpath),
|
||||||
#if 1
|
stb->st_uid, stb->st_gid));
|
||||||
if (!strcmp((char*)nwpath->fn, "TURBOC.$LN")) f->attrib = 0x20;
|
|
||||||
else f->attrib = 0x80;
|
|
||||||
#else
|
|
||||||
f->attrib = 0x20;
|
|
||||||
#endif
|
|
||||||
f->ext_attrib = 0;
|
f->ext_attrib = 0;
|
||||||
un_date_2_nw(stb->st_mtime, f->create_date);
|
un_date_2_nw(stb->st_mtime, f->create_date, 1);
|
||||||
un_date_2_nw(stb->st_atime, f->acces_date );
|
un_date_2_nw(stb->st_atime, f->acces_date, 1);
|
||||||
un_date_2_nw(stb->st_mtime, f->modify_date);
|
un_date_2_nw(stb->st_mtime, f->modify_date, 1);
|
||||||
un_time_2_nw(stb->st_mtime, f->modify_time);
|
un_time_2_nw(stb->st_mtime, f->modify_time, 1);
|
||||||
U32_TO_BE32(stb->st_size, f->size);
|
U32_TO_BE32(stb->st_size, f->size);
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
@ -835,9 +913,8 @@ static int get_dir_attrib(NW_DIR_INFO *d, struct stat *stb,
|
|||||||
|
|
||||||
d->attrib = 0x10; /* Verzeichnis */
|
d->attrib = 0x10; /* Verzeichnis */
|
||||||
d->ext_attrib = 0xff; /* effektive rights ?? */
|
d->ext_attrib = 0xff; /* effektive rights ?? */
|
||||||
|
un_date_2_nw(stb->st_mtime, d->create_date, 1);
|
||||||
un_date_2_nw(stb->st_mtime, d->create_date);
|
un_time_2_nw(stb->st_mtime, d->create_time, 1);
|
||||||
un_time_2_nw(stb->st_mtime, d->create_time);
|
|
||||||
|
|
||||||
U32_TO_BE32(1L, d->owner_id);
|
U32_TO_BE32(1L, d->owner_id);
|
||||||
d->access_right_mask = 0;
|
d->access_right_mask = 0;
|
||||||
@ -879,13 +956,19 @@ static int do_set_file_info(NW_PATH *nwpath, FUNC_SEARCH *fs)
|
|||||||
strcpy(unname, build_unix_name(nwpath, 0));
|
strcpy(unname, build_unix_name(nwpath, 0));
|
||||||
XDPRINTF((5,0,"set_file_info unname:%s:", unname));
|
XDPRINTF((5,0,"set_file_info unname:%s:", unname));
|
||||||
if ((voloption = get_volume_options(nwpath->volume, 1)) & VOL_OPTION_IS_PIPE)
|
if ((voloption = get_volume_options(nwpath->volume, 1)) & VOL_OPTION_IS_PIPE)
|
||||||
return(0); /* don't change 'pipe commands' */
|
return(0); /* don't change 'pipe commands' */
|
||||||
else if (voloption & VOL_OPTION_READONLY)
|
else if (voloption & VOL_OPTION_READONLY)
|
||||||
return(-0x8c); /* no modify rights */
|
return(-0x8c); /* no modify rights */
|
||||||
else {
|
else {
|
||||||
struct utimbuf ut;
|
struct utimbuf ut;
|
||||||
|
struct stat statb;
|
||||||
|
int result=0;
|
||||||
ut.actime = ut.modtime = nw_2_un_time(f->modify_date, f->modify_time);
|
ut.actime = ut.modtime = nw_2_un_time(f->modify_date, f->modify_time);
|
||||||
if (!utime(unname, &ut)) return(0);
|
if ( 0 == (result=stat(unname, &statb)) &&
|
||||||
|
0 == (result=utime(unname, &ut))){
|
||||||
|
result = chmod(unname, un_nw_attrib(&statb, (int)f->attrib, 1));
|
||||||
|
}
|
||||||
|
return( (result != 0) ? -0x8c : 0); /* no modify rights */
|
||||||
}
|
}
|
||||||
return(-0x85); /* NO Privileges */
|
return(-0x85); /* NO Privileges */
|
||||||
}
|
}
|
||||||
@ -906,7 +989,9 @@ int nw_set_file_information(int dir_handle, uint8 *data, int len,
|
|||||||
return(completition);
|
return(completition);
|
||||||
}
|
}
|
||||||
|
|
||||||
int nw_chmod_datei(int dir_handle, uint8 *data, int len, int modus)
|
int nw_chmod_datei(int dir_handle, uint8 *data, int len,
|
||||||
|
int attrib, int access)
|
||||||
|
|
||||||
{
|
{
|
||||||
char unname[256];
|
char unname[256];
|
||||||
struct stat stbuff;
|
struct stat stbuff;
|
||||||
@ -925,9 +1010,10 @@ int nw_chmod_datei(int dir_handle, uint8 *data, int len, int modus)
|
|||||||
}
|
}
|
||||||
if (completition < 0) return(completition);
|
if (completition < 0) return(completition);
|
||||||
strcpy(unname, build_unix_name(&nwpath, 2));
|
strcpy(unname, build_unix_name(&nwpath, 2));
|
||||||
XDPRINTF((5,0,"CHMOD DATEI unname:%s:", unname));
|
XDPRINTF((5,0,"set file attrib 0x%x, unname:%s:", unname));
|
||||||
if (!stat(unname, &stbuff)){
|
if (!stat(unname, &stbuff)){
|
||||||
return(0);
|
int result = chmod(unname, un_nw_attrib(&stbuff, access, 1));
|
||||||
|
return( (result != 0) ? -0x8c : 0); /* no modify rights */
|
||||||
}
|
}
|
||||||
return(-0x9c); /* wrong path */
|
return(-0x9c); /* wrong path */
|
||||||
}
|
}
|
||||||
@ -1068,12 +1154,14 @@ static int change_dir_entry( NW_DIR *dir, int volume,
|
|||||||
dir->inode = inode;
|
dir->inode = inode;
|
||||||
dir->volume = (uint8) volume;
|
dir->volume = (uint8) volume;
|
||||||
dir->timestamp = time(NULL);
|
dir->timestamp = time(NULL);
|
||||||
|
|
||||||
if (driveletter > -1) {
|
if (driveletter > -1) {
|
||||||
dir->drive = (uint8) driveletter;
|
dir->drive = (uint8) driveletter;
|
||||||
dir->task = (uint8)task;
|
dir->task = (uint8)task;
|
||||||
} else {
|
} else {
|
||||||
if (task < (int)dir->task) dir->task = (uint8) task;
|
if (task < (int)dir->task) dir->task = (uint8) task;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_temp > -1) dir->is_temp = (uint8) is_temp;
|
if (is_temp > -1) dir->is_temp = (uint8) is_temp;
|
||||||
return(0);
|
return(0);
|
||||||
} else {
|
} else {
|
||||||
@ -1145,7 +1233,6 @@ int nw_init_connect(void)
|
|||||||
"UnixPath=`%s`", build_unix_name(&nwlogin, 0));
|
"UnixPath=`%s`", build_unix_name(&nwlogin, 0));
|
||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
(void)change_dir_entry(&(dirs[0]), 0, nwlogin.path, stbuff.st_ino,
|
(void)change_dir_entry(&(dirs[0]), 0, nwlogin.path, stbuff.st_ino,
|
||||||
0, 0, 1, 0);
|
0, 0, 1, 0);
|
||||||
/* first Handle must be known und must not be temp */
|
/* first Handle must be known und must not be temp */
|
||||||
@ -1158,17 +1245,22 @@ int nw_init_connect(void)
|
|||||||
|
|
||||||
int nw_free_handles(int task)
|
int nw_free_handles(int task)
|
||||||
/*
|
/*
|
||||||
* if task==0 then all is initialized
|
* if task== -1 then all is initialized
|
||||||
* else the temp handles of the actuell task and greater
|
* else the temp handles of the actual task ( and greater )
|
||||||
* are deleted. I hope it is right. !??
|
* are deleted. I hope this is right. !??
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
if (!task) return(nw_init_connect());
|
if (task == -1) return(nw_init_connect());
|
||||||
else {
|
else {
|
||||||
NW_DIR *d = &(dirs[0]);
|
NW_DIR *d = &(dirs[0]);
|
||||||
int k = used_dirs;
|
int k = used_dirs;
|
||||||
while (k--) {
|
while (k--) {
|
||||||
|
#if 0
|
||||||
if (d->is_temp && d->task >= task) {
|
if (d->is_temp && d->task >= task) {
|
||||||
|
#else
|
||||||
|
if (d->is_temp && d->task == task) {
|
||||||
|
/* only actual task */
|
||||||
|
#endif
|
||||||
xfree(d->path);
|
xfree(d->path);
|
||||||
d->volume = 0;
|
d->volume = 0;
|
||||||
d->inode = 0;
|
d->inode = 0;
|
||||||
@ -1191,7 +1283,13 @@ int xinsert_new_dir(int volume, uint8 *path, int inode, int drive, int is_temp,
|
|||||||
/* first look, whether drive is allready in use */
|
/* first look, whether drive is allready in use */
|
||||||
for (j = 0; j < (int)used_dirs; j++) {
|
for (j = 0; j < (int)used_dirs; j++) {
|
||||||
NW_DIR *d = &(dirs[j]);
|
NW_DIR *d = &(dirs[j]);
|
||||||
if (d->inode && !is_temp && !d->is_temp && (int)d->drive == drive) {
|
if (!d->inode) freehandle = j+1;
|
||||||
|
else if (!is_temp && !d->is_temp
|
||||||
|
&& (int)d->drive == drive
|
||||||
|
#if 0
|
||||||
|
&& (int)d->task == task
|
||||||
|
#endif
|
||||||
|
) {
|
||||||
(void)change_dir_entry(d, volume, path, inode, drive, is_temp, 1, task);
|
(void)change_dir_entry(d, volume, path, inode, drive, is_temp, 1, task);
|
||||||
return(++j);
|
return(++j);
|
||||||
} else if (!d->inode) freehandle = j+1;
|
} else if (!d->inode) freehandle = j+1;
|
||||||
@ -1233,11 +1331,7 @@ int nw_search(uint8 *info,
|
|||||||
&searchsequence,
|
&searchsequence,
|
||||||
search_attrib,
|
search_attrib,
|
||||||
&stbuff)){
|
&stbuff)){
|
||||||
#if 1
|
if ( S_ISDIR(stbuff.st_mode) ) {
|
||||||
if ( (stbuff.st_mode & S_IFMT) == S_IFDIR) {
|
|
||||||
#else
|
|
||||||
if (search_attrib & 0x10) {
|
|
||||||
#endif
|
|
||||||
get_dir_attrib((NW_DIR_INFO*)info, &stbuff,
|
get_dir_attrib((NW_DIR_INFO*)info, &stbuff,
|
||||||
&nwpath);
|
&nwpath);
|
||||||
} else {
|
} else {
|
||||||
@ -1265,12 +1359,7 @@ int nw_dir_search(uint8 *info,
|
|||||||
&searchsequence,
|
&searchsequence,
|
||||||
search_attrib,
|
search_attrib,
|
||||||
&stbuff)){
|
&stbuff)){
|
||||||
|
if ( S_ISDIR(stbuff.st_mode) ) {
|
||||||
#if 1
|
|
||||||
if ( (stbuff.st_mode & S_IFMT) == S_IFDIR) {
|
|
||||||
#else
|
|
||||||
if (search_attrib & 0x10) {
|
|
||||||
#endif
|
|
||||||
get_dir_attrib((NW_DIR_INFO*)info, &stbuff,
|
get_dir_attrib((NW_DIR_INFO*)info, &stbuff,
|
||||||
&nwpath);
|
&nwpath);
|
||||||
} else {
|
} else {
|
||||||
@ -1282,21 +1371,21 @@ int nw_dir_search(uint8 *info,
|
|||||||
} else return(completition); /* wrong path */
|
} else return(completition); /* wrong path */
|
||||||
}
|
}
|
||||||
|
|
||||||
int nw_alloc_dir_handle( int dir_handle, /* Suche ab Pfad dirhandle */
|
int nw_alloc_dir_handle( int dir_handle, /* source directory handle */
|
||||||
uint8 *data, /* zusaetzl. Pfad */
|
uint8 *data, /* source path */
|
||||||
int len, /* L„nge DATA */
|
int len, /* pathlen */
|
||||||
int driveletter, /* A .. Z normal */
|
int driveletter, /* A .. Z normal */
|
||||||
int is_temphandle, /* temporaeres Handle 1 */
|
int is_temphandle, /* temp handle = 1 */
|
||||||
/* spez. temp Handle 2 */
|
/* special temp handle = 2 */
|
||||||
int task) /* Prozess Task */
|
int task) /* Prozess Task */
|
||||||
{
|
{
|
||||||
NW_PATH nwpath;
|
NW_PATH nwpath;
|
||||||
int inode=conn_get_kpl_path(&nwpath, dir_handle, data, len, 1);
|
int inode=conn_get_kpl_path(&nwpath, dir_handle, data, len, 1);
|
||||||
if (inode > -1)
|
if (inode > -1)
|
||||||
inode = insert_new_dir(&nwpath, inode, driveletter, is_temphandle, task);
|
inode = insert_new_dir(&nwpath, inode, driveletter, is_temphandle, task);
|
||||||
XDPRINTF((5,0,"Allocate %shandle:%s, Handle=%d, drive=%d, result=0x%x",
|
XDPRINTF((2,0,"Allocate %shandle:%s, Qhandle=%d, drive=%d, Task=%d, result=0x%x",
|
||||||
(is_temphandle) ? "Temp" : "Perm", conn_get_nwpath_name(&nwpath),
|
(is_temphandle) ? "Temp" : "Perm", conn_get_nwpath_name(&nwpath),
|
||||||
dir_handle, driveletter, inode));
|
dir_handle, driveletter, task, inode));
|
||||||
return(inode);
|
return(inode);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1336,11 +1425,17 @@ int nw_open_dir_handle( int dir_handle,
|
|||||||
return(completition);
|
return(completition);
|
||||||
}
|
}
|
||||||
|
|
||||||
int nw_free_dir_handle(int dir_handle)
|
int nw_free_dir_handle(int dir_handle, int task)
|
||||||
{
|
{
|
||||||
if (dir_handle && --dir_handle < (int)used_dirs) {
|
if (dir_handle && --dir_handle < (int)used_dirs) {
|
||||||
NW_DIR *d=&(dirs[dir_handle]);
|
NW_DIR *d=&(dirs[dir_handle]);
|
||||||
if (!d->inode) return(-0x9b); /* wrong handle */
|
XDPRINTF((2,0,"free dhandle:%d, task=%d, d->inode=0x%x, used_dirs=%d",
|
||||||
|
dir_handle+1, task, d->inode, used_dirs));
|
||||||
|
if (!d->inode
|
||||||
|
#if 0
|
||||||
|
|| d->task != task
|
||||||
|
#endif
|
||||||
|
) return(-0x9b); /* wrong handle */
|
||||||
else {
|
else {
|
||||||
d->inode = 0;
|
d->inode = 0;
|
||||||
xfree(d->path);
|
xfree(d->path);
|
||||||
@ -1357,9 +1452,13 @@ int nw_set_dir_handle(int targetdir, int dir_handle,
|
|||||||
int inode = conn_get_kpl_path(&nwpath, dir_handle, data, len, 1);
|
int inode = conn_get_kpl_path(&nwpath, dir_handle, data, len, 1);
|
||||||
if (inode > -1){
|
if (inode > -1){
|
||||||
if (targetdir > 0 && --targetdir < used_dirs
|
if (targetdir > 0 && --targetdir < used_dirs
|
||||||
&& dirs[targetdir].is_temp != 2) { /* not a spez. temphandle */
|
&& dirs[targetdir].is_temp != 2) {
|
||||||
XDPRINTF((5,0,"Change dhandle:%d -> `%s`", targetdir+1, conn_get_nwpath_name(&nwpath)));
|
/* do not change special temphandles */
|
||||||
return(change_dir_entry(&dirs[targetdir], nwpath.volume, nwpath.path, inode, -1, -1, 0, task));
|
XDPRINTF((2,0,"Change dhandle:%d(%d) -> `%s`", targetdir+1, task,
|
||||||
|
conn_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 */
|
/* here the existing handle is only modified */
|
||||||
} else return(-0x9b); /* BAD DIR Handle */
|
} else return(-0x9b); /* BAD DIR Handle */
|
||||||
}
|
}
|
||||||
@ -1385,7 +1484,8 @@ int nw_get_vol_number(int dir_handle)
|
|||||||
/* Get Volume Nummmer with Handle */
|
/* Get Volume Nummmer with Handle */
|
||||||
{
|
{
|
||||||
int result = -0x9b; /* wrong handle */
|
int result = -0x9b; /* wrong handle */
|
||||||
if (dir_handle > 0 && --dir_handle < (int)used_dirs) {
|
if (dir_handle > 0 && --dir_handle < (int)used_dirs
|
||||||
|
&& dirs[dir_handle].inode ) {
|
||||||
result = dirs[dir_handle].volume;
|
result = dirs[dir_handle].volume;
|
||||||
if (result < 0 || result >= used_nw_volumes) result = -0x98; /* wrong volume */
|
if (result < 0 || result >= used_nw_volumes) result = -0x98; /* wrong volume */
|
||||||
}
|
}
|
||||||
@ -1467,8 +1567,8 @@ static int s_nw_scan_dir_info(int dir_handle,
|
|||||||
U16_TO_BE16(aktsequenz, subnr);
|
U16_TO_BE16(aktsequenz, subnr);
|
||||||
strncpy((char*)subname, (char*)dirname, 16);
|
strncpy((char*)subname, (char*)dirname, 16);
|
||||||
U32_TO_BE32(1L, owner); /* erstmal */
|
U32_TO_BE32(1L, owner); /* erstmal */
|
||||||
un_date_2_nw(stbuff.st_mtime, subdatetime);
|
un_date_2_nw(stbuff.st_mtime, subdatetime, 1);
|
||||||
un_time_2_nw(stbuff.st_mtime, subdatetime+2);
|
un_time_2_nw(stbuff.st_mtime, subdatetime+2, 1);
|
||||||
return(0xff);
|
return(0xff);
|
||||||
}
|
}
|
||||||
strcpy((char*)dirname, (char*)wild);
|
strcpy((char*)dirname, (char*)wild);
|
||||||
@ -1479,8 +1579,8 @@ static int s_nw_scan_dir_info(int dir_handle,
|
|||||||
U16_TO_BE16(1, subnr);
|
U16_TO_BE16(1, subnr);
|
||||||
memset(subname, 0, 16);
|
memset(subname, 0, 16);
|
||||||
U32_TO_BE32(1L, owner);
|
U32_TO_BE32(1L, owner);
|
||||||
un_date_2_nw(stbuff.st_mtime, subdatetime);
|
un_date_2_nw(stbuff.st_mtime, subdatetime, 1);
|
||||||
un_time_2_nw(stbuff.st_mtime, subdatetime+2);
|
un_time_2_nw(stbuff.st_mtime, subdatetime+2, 1);
|
||||||
return(0xff);
|
return(0xff);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1539,18 +1639,6 @@ typedef struct {
|
|||||||
uint8 reserved_2[28];
|
uint8 reserved_2[28];
|
||||||
} NW_DOS_FILE_INFO;
|
} NW_DOS_FILE_INFO;
|
||||||
|
|
||||||
void xun_date_2_nw(time_t time, uint8 *d)
|
|
||||||
{
|
|
||||||
uint16 i = un_date_2_nw(time, NULL);
|
|
||||||
memcpy(d, &i, 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
void xun_time_2_nw(time_t time, uint8 *d)
|
|
||||||
{
|
|
||||||
uint16 i = un_time_2_nw(time, NULL);
|
|
||||||
memcpy(d, &i, 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void get_dos_file_attrib(NW_DOS_FILE_INFO *f,
|
static void get_dos_file_attrib(NW_DOS_FILE_INFO *f,
|
||||||
struct stat *stb,
|
struct stat *stb,
|
||||||
NW_PATH *nwpath)
|
NW_PATH *nwpath)
|
||||||
@ -1560,13 +1648,16 @@ static void get_dos_file_attrib(NW_DOS_FILE_INFO *f,
|
|||||||
/* Attribute */
|
/* Attribute */
|
||||||
/* 0x20 Archive Flag */
|
/* 0x20 Archive Flag */
|
||||||
/* 0x80 Sharable */
|
/* 0x80 Sharable */
|
||||||
f->attributes[0] = 0x20;
|
f->attributes[0] = (uint8) un_nw_attrib(stb, 0, 0);
|
||||||
xun_date_2_nw(stb->st_mtime, f->created.date);
|
XDPRINTF((5,0, "get_dos_file_attrib = 0x%x of ,%s, uid=%d, gid=%d",
|
||||||
xun_time_2_nw(stb->st_mtime, f->created.time);
|
(int)f->attributes[0], conn_get_nwpath_name(nwpath),
|
||||||
|
stb->st_uid, stb->st_gid));
|
||||||
|
un_date_2_nw(stb->st_mtime, f->created.date, 0);
|
||||||
|
un_time_2_nw(stb->st_mtime, f->created.time, 0);
|
||||||
U32_TO_BE32(1, f->created.id);
|
U32_TO_BE32(1, f->created.id);
|
||||||
memcpy(&(f->updated), &(f->created), sizeof(NW_DOS_FILE_INFO));
|
memcpy(&(f->updated), &(f->created), sizeof(NW_DOS_FILE_INFO));
|
||||||
xun_date_2_nw(stb->st_atime, f->last_access_date);
|
un_date_2_nw(stb->st_atime, f->last_access_date, 0);
|
||||||
memcpy(f->size, &(stb->st_size), 4);
|
U32_TO_32(stb->st_size, f->size);
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@ -1596,11 +1687,11 @@ static void get_dos_dir_attrib(NW_DOS_DIR_INFO *f,
|
|||||||
f->namlen=min(strlen((char*)nwpath->fn), 12);
|
f->namlen=min(strlen((char*)nwpath->fn), 12);
|
||||||
strncpy((char*)f->name, (char*)nwpath->fn, f->namlen);
|
strncpy((char*)f->name, (char*)nwpath->fn, f->namlen);
|
||||||
f->attributes[0] = 0x10; /* Dir */
|
f->attributes[0] = 0x10; /* Dir */
|
||||||
xun_date_2_nw(stb->st_mtime, f->created.date);
|
un_date_2_nw(stb->st_mtime, f->created.date,0);
|
||||||
xun_time_2_nw(stb->st_mtime, f->created.time);
|
un_time_2_nw(stb->st_mtime, f->created.time,0);
|
||||||
U32_TO_BE32(1, f->created.id);
|
U32_TO_BE32(1, f->created.id);
|
||||||
xun_date_2_nw(stb->st_mtime, f->modify_date);
|
un_date_2_nw(stb->st_mtime, f->modify_date, 0);
|
||||||
xun_time_2_nw(stb->st_mtime, f->modify_time);
|
un_time_2_nw(stb->st_mtime, f->modify_time, 0);
|
||||||
U32_TO_BE32(MAX_U32, f->max_space);
|
U32_TO_BE32(MAX_U32, f->max_space);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1653,7 +1744,7 @@ int nw_scan_a_root_dir(uint8 *rdata,
|
|||||||
NW_PATH nwpath;
|
NW_PATH nwpath;
|
||||||
uint8 data[2];
|
uint8 data[2];
|
||||||
int completition = conn_get_kpl_path(&nwpath, dirhandle, data, 0, 1);
|
int completition = conn_get_kpl_path(&nwpath, dirhandle, data, 0, 1);
|
||||||
XDPRINTF((5,0,"nw_scan_a_directory_2 path:%s:, fn:%s:, completition:0x%x",
|
XDPRINTF((5,0,"nw_scan_a_root_directory_2 path:%s:, fn:%s:, completition:0x%x",
|
||||||
nwpath.path, nwpath.fn, completition));
|
nwpath.path, nwpath.fn, completition));
|
||||||
if (completition > -1) {
|
if (completition > -1) {
|
||||||
struct stat stbuff;
|
struct stat stbuff;
|
||||||
|
12
connect.h
12
connect.h
@ -67,7 +67,8 @@ extern int nw_delete_datei(int dir_handle, uint8 *data, int len);
|
|||||||
extern int nw_set_file_information(int dir_handle, uint8 *data, int len,
|
extern int nw_set_file_information(int dir_handle, uint8 *data, int len,
|
||||||
int searchattrib, NW_FILE_INFO *f);
|
int searchattrib, NW_FILE_INFO *f);
|
||||||
|
|
||||||
extern int nw_chmod_datei(int dir_handle, uint8 *data, int len, int modus);
|
extern int nw_chmod_datei(int dir_handle, uint8 *data, int len,
|
||||||
|
int attrib, int access);
|
||||||
|
|
||||||
extern int mv_file(int qdirhandle, uint8 *q, int qlen,
|
extern int mv_file(int qdirhandle, uint8 *q, int qlen,
|
||||||
int zdirhandle, uint8 *z, int zlen);
|
int zdirhandle, uint8 *z, int zlen);
|
||||||
@ -111,7 +112,7 @@ extern int nw_open_dir_handle( int dir_handle,
|
|||||||
int *searchsequence);
|
int *searchsequence);
|
||||||
|
|
||||||
|
|
||||||
extern int nw_free_dir_handle(int dir_handle);
|
extern int nw_free_dir_handle(int dir_handle, int task);
|
||||||
|
|
||||||
extern int nw_set_dir_handle(int targetdir, int dir_handle,
|
extern int nw_set_dir_handle(int targetdir, int dir_handle,
|
||||||
uint8 *data, int len, int task);
|
uint8 *data, int len, int task);
|
||||||
@ -154,12 +155,9 @@ extern int nw_scan_a_root_dir(uint8 *rdata,
|
|||||||
|
|
||||||
extern int fn_match(uint8 *s, uint8 *p, int options);
|
extern int fn_match(uint8 *s, uint8 *p, int options);
|
||||||
|
|
||||||
|
extern void un_date_2_nw(time_t time, uint8 *d, int high_low);
|
||||||
extern uint16 un_date_2_nw(time_t time, uint8 *d);
|
|
||||||
extern time_t nw_2_un_time(uint8 *d, uint8 *t);
|
extern time_t nw_2_un_time(uint8 *d, uint8 *t);
|
||||||
extern uint16 un_time_2_nw(time_t time, uint8 *d);
|
|
||||||
|
|
||||||
extern void xun_date_2_nw(time_t time, uint8 *d);
|
extern void un_time_2_nw(time_t time, uint8 *d, int high_low);
|
||||||
extern void xun_time_2_nw(time_t time, uint8 *d);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
21
doc/CHANGES
21
doc/CHANGES
@ -1,5 +1,5 @@
|
|||||||
Sorry, this is in German only.
|
Sorry, this is in German only.
|
||||||
Aenderungen in mars_nwe bis zum : 20-Jun-96
|
Aenderungen in mars_nwe bis zum : 24-Jun-96
|
||||||
--------------------------------
|
--------------------------------
|
||||||
Erste 'oeffentliche' Version
|
Erste 'oeffentliche' Version
|
||||||
^^^^^^^^^^ VERSION 0.94 ^^^^^^^^
|
^^^^^^^^^^ VERSION 0.94 ^^^^^^^^
|
||||||
@ -138,10 +138,21 @@ Erste 'oeffentliche' Version
|
|||||||
- Bug beim Listen von grossen Direktories korrigiert. (Fritz Elfert)
|
- Bug beim Listen von grossen Direktories korrigiert. (Fritz Elfert)
|
||||||
- CRYPTED CHANGE PASSWORD Routine implementiert. (Guntram Blohm)
|
- CRYPTED CHANGE PASSWORD Routine implementiert. (Guntram Blohm)
|
||||||
<----- ^^^^^^^^^^ pl7 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
<----- ^^^^^^^^^^ pl7 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
- automatische Registrierung von extern angelegten IPX-Interfaces
|
||||||
|
bzw. Loeschung eines Interfaces. (z.B. fuer ppp )
|
||||||
|
- nw.routes nun mit Uhrzeitangabe
|
||||||
|
- Code fuer Linux/Sparc bereinigt und macros angepasst. (Ruedi Kneubuehler)
|
||||||
|
- Locking Code erweitert / korrigiert.
|
||||||
|
- watchdog BUG beseitigt. ( > MAX_CONNECTIONS )
|
||||||
|
- workaround fuer sendto haenger eingebaut.
|
||||||
|
- pipe files nun mit connnection und pid parameter.
|
||||||
|
- Accesshandling erweitert.
|
||||||
|
<----- ^^^^^^^^^^ pl8 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
- Problem ( 0 byte free ) bei grosen Volumes korrigiert. (Botond K. Szabo)
|
||||||
|
- Wildcard Handling veraendert/korrigiert ?
|
||||||
|
- Dateien werden nun mittels mmap gelesen.
|
||||||
|
neuer config.h Schalter USE_MMAP
|
||||||
|
<----- ^^^^^^^^^^ pl9 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -19,6 +19,9 @@ Ales Dryak <A.Dryak@sh.cvut.cz>
|
|||||||
Fritz Elfert <fritz@wuemaus.franken.de>
|
Fritz Elfert <fritz@wuemaus.franken.de>
|
||||||
gives Bugreport and Patches
|
gives Bugreport and Patches
|
||||||
|
|
||||||
|
Ruedi Kneubuehler <pingu@satu.baboon.ch>
|
||||||
|
helping and testing for linux/sparc
|
||||||
|
|
||||||
Volker Lendecke <lendecke@math.uni-goettingen.de>
|
Volker Lendecke <lendecke@math.uni-goettingen.de>
|
||||||
helps distributing
|
helps distributing
|
||||||
|
|
||||||
|
11
doc/NEWS
11
doc/NEWS
@ -1,4 +1,15 @@
|
|||||||
# in this files are important notes for user of mars_nwe.
|
# in this files are important notes for user of mars_nwe.
|
||||||
|
------12-Jul-96--- 0.97.pl9 ----------
|
||||||
|
automatic adding and removing of ipx-interfaces. (internal router)
|
||||||
|
now running under linux/sparc.
|
||||||
|
better file locking/sharing.
|
||||||
|
some unix->dos attribute handling now.
|
||||||
|
better read performance (mmap(ing))
|
||||||
|
A not yet assigned mars_nwe user is now automatic assigned
|
||||||
|
to a Linux user with same name when the password is changed and the
|
||||||
|
new password is not null.
|
||||||
|
------------------ 0.97.pl7 ----------
|
||||||
|
Crypted Change password call implemented.
|
||||||
------05-May-96--- 0.97.pl3 ----------
|
------05-May-96--- 0.97.pl3 ----------
|
||||||
Now nwserv can be called with parameter '-h' to send SIGHUP
|
Now nwserv can be called with parameter '-h' to send SIGHUP
|
||||||
to the main nwserv program or with '-k' to send SIGTERM
|
to the main nwserv program or with '-k' to send SIGTERM
|
||||||
|
@ -68,7 +68,7 @@ nwbind:
|
|||||||
Have luck with trying. :)
|
Have luck with trying. :)
|
||||||
|
|
||||||
|
|
||||||
Martin Stover <mstover@freeway.de>
|
Martin Stover <mstover@stover.f.eunet.de>
|
||||||
|
|
||||||
BTW: The kick to make mars_nwe public was the publication of
|
BTW: The kick to make mars_nwe public was the publication of
|
||||||
linware ( lwared ), the NetWare-Emulator from
|
linware ( lwared ), the NetWare-Emulator from
|
||||||
|
@ -70,7 +70,7 @@ der fehlenden bzw. fehlerhaften NCP-Calls wuerde ich mich freuen.
|
|||||||
|
|
||||||
|
|
||||||
Martin
|
Martin
|
||||||
(mstover@freeway.de)
|
<mstover@stover.f.eunet.de>
|
||||||
|
|
||||||
PS: Den Anstoss, mars_nwe zu veroeffentlichen, gab die
|
PS: Den Anstoss, mars_nwe zu veroeffentlichen, gab die
|
||||||
Veroeffentlichung von linware ( lwared ), dem Novell-Server-Emulator
|
Veroeffentlichung von linware ( lwared ), dem Novell-Server-Emulator
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
Begin3
|
Begin3
|
||||||
Title: mars_nwe
|
Title: mars_nwe
|
||||||
Version: 0.97.pl7
|
Version: 0.97.pl9
|
||||||
Entered-date: 20-Jun-96
|
Entered-date: 12-Jul-96
|
||||||
Description: Full netware-emulator (src), beta.
|
Description: Full netware-emulator (src), beta.
|
||||||
Supports file-services, bindery-services,
|
Supports file-services, bindery-services,
|
||||||
printing-services, routing-services.
|
printing-services, routing-services.
|
||||||
@ -9,8 +9,8 @@ Keywords: novell, netware, server, ipx, ncp, tli
|
|||||||
Author: mstover@freeway.de (Martin Stover)
|
Author: mstover@freeway.de (Martin Stover)
|
||||||
Maintained-by: mstover@freeway.de (Martin Stover)
|
Maintained-by: mstover@freeway.de (Martin Stover)
|
||||||
Primary-site: ftp.gwdg.de:/pub/linux/misc/ncpfs
|
Primary-site: ftp.gwdg.de:/pub/linux/misc/ncpfs
|
||||||
160kB mars_nwe-0.97.pl7.tgz
|
160kB mars_nwe-0.97.pl9.tgz
|
||||||
Alternate-site: ftp.uni-duisburg.de /pub/linux/ipxware
|
Alternate-site: ftp.uni-duisburg.de /pub/linux/ipxware
|
||||||
Platforms: Linux (1.2.xx, 1.3.xx), UnixWare 2.0x
|
Platforms: Linux (1.2.xx, 1.3.xx, 2.xx), UnixWare (2.xx)
|
||||||
Copying-policy: GNU
|
Copying-policy: GNU
|
||||||
End
|
End
|
||||||
|
45
emutli.c
45
emutli.c
@ -1,3 +1,4 @@
|
|||||||
|
#define DO_IPX_SEND_TEST 1
|
||||||
/* emutli.c 28-Apr-96 */
|
/* emutli.c 28-Apr-96 */
|
||||||
/*
|
/*
|
||||||
* One short try to emulate TLI with SOCKETS.
|
* One short try to emulate TLI with SOCKETS.
|
||||||
@ -204,36 +205,19 @@ int t_rcvudata(int fd, struct t_unitdata *ud, int *flags)
|
|||||||
ud->addr.len = sizeof(ipxAddr_t);
|
ud->addr.len = sizeof(ipxAddr_t);
|
||||||
return(result);
|
return(result);
|
||||||
}
|
}
|
||||||
#define HAVE_IPX_SEND_BUG 0
|
|
||||||
#if HAVE_IPX_SEND_BUG
|
|
||||||
static int last_fd;
|
#if DO_IPX_SEND_TEST
|
||||||
static int new_try;
|
static int new_try;
|
||||||
|
static int anz_tries;
|
||||||
|
static struct t_unitdata *test_ud;
|
||||||
|
|
||||||
static void sig_alarm(int rsig)
|
static void sig_alarm(int rsig)
|
||||||
{
|
{
|
||||||
struct sockaddr_ipx ipxs;
|
|
||||||
int maxplen=sizeof(struct sockaddr_ipx);
|
|
||||||
signal(rsig, SIG_IGN);
|
signal(rsig, SIG_IGN);
|
||||||
XDPRINTF((1, 0, "GOT ALARM SIGNAL in sendto"));
|
XDPRINTF((0, 0,"GOT ALARM try=%d, sendto=%s",
|
||||||
memset((char*)&ipxs, 0, sizeof(struct sockaddr_ipx));
|
anz_tries+1, visable_ipx_adr((ipxAddr_t *) test_ud->addr.buf) ));
|
||||||
ipxs.sipx_family=AF_IPX;
|
if (anz_tries++ < 3) new_try++;
|
||||||
if (getsockname(last_fd, (struct sockaddr*)&ipxs, &maxplen) != -1){
|
|
||||||
int sock;
|
|
||||||
int i = 5;
|
|
||||||
while (close(last_fd) == -1 && i--) sleep(1);
|
|
||||||
sleep(2);
|
|
||||||
sock = socket(AF_IPX, SOCK_DGRAM, AF_IPX);
|
|
||||||
if (bind(sock, (struct sockaddr*)&ipxs, sizeof(struct sockaddr_ipx))==-1) {
|
|
||||||
errorp(0, "TLI-BIND", "socket Nr:0x%x", (int)GET_BE16(&(ipxs.sipx_port)));
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
if (sock != last_fd) {
|
|
||||||
dup2(sock, last_fd);
|
|
||||||
close(sock);
|
|
||||||
}
|
|
||||||
new_try++;
|
|
||||||
} else
|
|
||||||
errorp(0, "getsockname", NULL);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -244,16 +228,15 @@ int t_sndudata(int fd, struct t_unitdata *ud)
|
|||||||
struct sockaddr_ipx ipxs;
|
struct sockaddr_ipx ipxs;
|
||||||
if (ud->addr.len != sizeof(ipxAddr_t)) return(-1);
|
if (ud->addr.len != sizeof(ipxAddr_t)) return(-1);
|
||||||
|
|
||||||
#if HAVE_IPX_SEND_BUG
|
#if DO_IPX_SEND_TEST
|
||||||
{
|
{
|
||||||
int anz_tries=3;
|
anz_tries=0;
|
||||||
|
test_ud =ud;
|
||||||
do {
|
do {
|
||||||
void (*old_sig)(int rsig) = signal(SIGALRM, sig_alarm);
|
void (*old_sig)(int rsig) = signal(SIGALRM, sig_alarm);
|
||||||
new_try = 0;
|
new_try = 0;
|
||||||
alarm(2);
|
alarm(2);
|
||||||
last_fd = fd;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
memset(&ipxs, 0, sizeof(struct sockaddr_ipx));
|
memset(&ipxs, 0, sizeof(struct sockaddr_ipx));
|
||||||
ipxs.sipx_family=AF_IPX;
|
ipxs.sipx_family=AF_IPX;
|
||||||
ipx2sockadr(&ipxs, (ipxAddr_t*) (ud->addr.buf));
|
ipx2sockadr(&ipxs, (ipxAddr_t*) (ud->addr.buf));
|
||||||
@ -262,10 +245,10 @@ int t_sndudata(int fd, struct t_unitdata *ud)
|
|||||||
result = sendto(fd,(void *)ud->udata.buf,
|
result = sendto(fd,(void *)ud->udata.buf,
|
||||||
ud->udata.len, 0, (struct sockaddr *) &ipxs, sizeof(ipxs));
|
ud->udata.len, 0, (struct sockaddr *) &ipxs, sizeof(ipxs));
|
||||||
|
|
||||||
#if HAVE_IPX_SEND_BUG
|
#if DO_IPX_SEND_TEST
|
||||||
alarm(0);
|
alarm(0);
|
||||||
signal(SIGALRM, old_sig);
|
signal(SIGALRM, old_sig);
|
||||||
} while (new_try && anz_tries--);
|
} while (new_try);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* emutli1.c 28-Apr-96 */
|
/* emutli1.c 24-Jun-96 */
|
||||||
/*
|
/*
|
||||||
* One short try to emulate TLI with SOCKETS.
|
* One short try to emulate TLI with SOCKETS.
|
||||||
*/
|
*/
|
||||||
@ -58,7 +58,7 @@ static int x_ioctl(int sock, int mode, void *id)
|
|||||||
return(result);
|
return(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int interface_data(uint8* data, uint32 *rnet, uint8 *node,
|
int read_interface_data(uint8* data, uint32 *rnet, uint8 *node,
|
||||||
int *flags, uint8 *name)
|
int *flags, uint8 *name)
|
||||||
|
|
||||||
/* returns frame or if error < 0 */
|
/* returns frame or if error < 0 */
|
||||||
@ -112,7 +112,7 @@ int get_interface_frame_name(char *name, uint32 net)
|
|||||||
while (fgets((char*)buff, sizeof(buff), f) != NULL){
|
while (fgets((char*)buff, sizeof(buff), f) != NULL){
|
||||||
uint32 rnet;
|
uint32 rnet;
|
||||||
uint8 dname[25];
|
uint8 dname[25];
|
||||||
int fframe = interface_data((uint8*) buff, &rnet, NULL, NULL, dname);
|
int fframe = read_interface_data((uint8*) buff, &rnet, NULL, NULL, dname);
|
||||||
if (fframe < 0) continue;
|
if (fframe < 0) continue;
|
||||||
if (rnet == net) {
|
if (rnet == net) {
|
||||||
if (name) strcpy(name, dname);
|
if (name) strcpy(name, dname);
|
||||||
@ -148,7 +148,7 @@ static void del_special_net(int special, char *devname, int frame)
|
|||||||
uint8 name[25];
|
uint8 name[25];
|
||||||
while (fgets((char*)buff, sizeof(buff), f) != NULL){
|
while (fgets((char*)buff, sizeof(buff), f) != NULL){
|
||||||
int flags = 0;
|
int flags = 0;
|
||||||
int frame = interface_data((uint8*) buff, NULL, NULL,
|
int frame = read_interface_data((uint8*) buff, NULL, NULL,
|
||||||
&flags, name);
|
&flags, name);
|
||||||
if (frame < 0) continue;
|
if (frame < 0) continue;
|
||||||
sipx->sipx_type = frame;
|
sipx->sipx_type = frame;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* emutli1.h 28-Apr-96 */
|
/* emutli1.h 24-Jun-96 */
|
||||||
|
|
||||||
/* (C)opyright (C) 1993,1995 Martin Stover, Marburg, Germany
|
/* (C)opyright (C) 1993,1995 Martin Stover, Marburg, Germany
|
||||||
*
|
*
|
||||||
@ -21,7 +21,12 @@
|
|||||||
#define _EMUTLI1_H_
|
#define _EMUTLI1_H_
|
||||||
|
|
||||||
extern void set_locipxdebug(int debug);
|
extern void set_locipxdebug(int debug);
|
||||||
|
|
||||||
|
extern int read_interface_data(uint8* data, uint32 *rnet, uint8 *node,
|
||||||
|
int *flags, uint8 *name);
|
||||||
|
|
||||||
extern int get_interface_frame_name(char *name, uint32 net);
|
extern int get_interface_frame_name(char *name, uint32 net);
|
||||||
|
|
||||||
extern int get_frame_name(uint8 *framename, int frame);
|
extern int get_frame_name(uint8 *framename, int frame);
|
||||||
extern int init_ipx(uint32 network, uint32 node, int ipx_debug);
|
extern int init_ipx(uint32 network, uint32 node, int ipx_debug);
|
||||||
extern void exit_ipx(int full);
|
extern void exit_ipx(int full);
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
|
|
||||||
#define IPX_DATA_GR_546 1 /* allow ipx packets > 546+30 Byte */
|
#define IPX_DATA_GR_546 1 /* allow ipx packets > 546+30 Byte */
|
||||||
|
|
||||||
|
#define USE_MMAP 1 /* use mmap systen call */
|
||||||
/* <--------------------------------------------------------------------> */
|
/* <--------------------------------------------------------------------> */
|
||||||
#define MAX_NW_VOLS 10 /* max. number of mars_nwe-volumes */
|
#define MAX_NW_VOLS 10 /* max. number of mars_nwe-volumes */
|
||||||
#define MAX_FILE_HANDLES_CONN 80 /* max. number of open files per */
|
#define MAX_FILE_HANDLES_CONN 80 /* max. number of open files per */
|
||||||
|
64
examples/kpatch2.0.1
Normal file
64
examples/kpatch2.0.1
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
--- linux.org/include/linux/ipx.h Mon May 13 22:39:28 1996
|
||||||
|
+++ linux/include/linux/ipx.h Thu Jul 4 00:09:54 1996
|
||||||
|
@@ -75,5 +75,6 @@
|
||||||
|
#define SIOCAIPXITFCRT (SIOCPROTOPRIVATE)
|
||||||
|
#define SIOCAIPXPRISLT (SIOCPROTOPRIVATE+1)
|
||||||
|
#define SIOCIPXCFGDATA (SIOCPROTOPRIVATE+2)
|
||||||
|
+#define SIOCIPXNCPCONN (SIOCPROTOPRIVATE+3)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
--- linux.org/include/net/sock.h Wed Jun 12 23:08:41 1996
|
||||||
|
+++ linux/include/net/sock.h Thu Jul 4 00:09:12 1996
|
||||||
|
@@ -112,6 +112,10 @@
|
||||||
|
* know the connection this socket belongs to.
|
||||||
|
*/
|
||||||
|
struct ncp_server *ncp_server;
|
||||||
|
+/*
|
||||||
|
+ * To handle special NCP-Sockets for mars_nwe
|
||||||
|
+ */
|
||||||
|
+ unsigned short ipx_ncp_conn;
|
||||||
|
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
--- linux.org/net/ipx/af_ipx.c Wed Jun 12 22:55:00 1996
|
||||||
|
+++ linux/net/ipx/af_ipx.c Thu Jul 4 00:09:46 1996
|
||||||
|
@@ -468,6 +468,20 @@
|
||||||
|
ipx_socket *sock1 = NULL, *sock2 = NULL;
|
||||||
|
struct sk_buff *skb1 = NULL, *skb2 = NULL;
|
||||||
|
|
||||||
|
+ if (intrfc == ipx_primary_net
|
||||||
|
+ && ntohs(ipx->ipx_dest.sock) == 0x451
|
||||||
|
+ && *((char*)(ipx+1)) == 0x22
|
||||||
|
+ && *((char*)(ipx+1)+1) == 0x22) {
|
||||||
|
+ int connection = (int) *((char*)(ipx+1)+3);
|
||||||
|
+ /* 255 connections are enough ;) */
|
||||||
|
+ if (connection) {
|
||||||
|
+ for (sock1=intrfc->if_sklist;
|
||||||
|
+ (sock1 != NULL) &&
|
||||||
|
+ (sock1->protinfo.af_ipx.ipx_ncp_conn != connection);
|
||||||
|
+ sock1=sock1->next);;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ if (sock1 == NULL)
|
||||||
|
sock1 = ipxitf_find_socket(intrfc, ipx->ipx_dest.sock);
|
||||||
|
|
||||||
|
/*
|
||||||
|
@@ -2243,6 +2257,17 @@
|
||||||
|
if(err) return err;
|
||||||
|
return(ipxcfg_get_config_data((void *)arg));
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+ case SIOCIPXNCPCONN:
|
||||||
|
+ {
|
||||||
|
+ if (!suser()) return(-EPERM);
|
||||||
|
+ err = verify_area(VERIFY_READ, (void *)arg,
|
||||||
|
+ sizeof(unsigned short));
|
||||||
|
+ if (err) return err;
|
||||||
|
+ sk->protinfo.af_ipx.ipx_ncp_conn = get_fs_word(arg);
|
||||||
|
+ return 0;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
case SIOCGSTAMP:
|
||||||
|
if (sk)
|
||||||
|
{
|
@ -1,5 +1,5 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# mk.li 27-Apr-96 ###
|
# mk.li 10-Jul-96 ###
|
||||||
# please edit this file !
|
# please edit this file !
|
||||||
|
|
||||||
mk()
|
mk()
|
||||||
@ -20,6 +20,7 @@ mk()
|
|||||||
|
|
||||||
TOLOWER='tr "[A-Z]" "[a-z]"'
|
TOLOWER='tr "[A-Z]" "[a-z]"'
|
||||||
UNX=`uname -s | $TOLOWER`
|
UNX=`uname -s | $TOLOWER`
|
||||||
|
MASCHINE=`uname -m`
|
||||||
MK_PPID=$$
|
MK_PPID=$$
|
||||||
export MK_PPID
|
export MK_PPID
|
||||||
trap 'echo "Error: Try again :)" && exit 1' 1
|
trap 'echo "Error: Try again :)" && exit 1' 1
|
||||||
@ -33,8 +34,21 @@ case $UNX in
|
|||||||
# CFLAGS="-pipe -O2 -fomit-frame-pointer"
|
# CFLAGS="-pipe -O2 -fomit-frame-pointer"
|
||||||
# problems gcc2.5.8 ^^^^^^^^^^^^^^^^^^^^^
|
# problems gcc2.5.8 ^^^^^^^^^^^^^^^^^^^^^
|
||||||
CFLAGS="-pipe -Wall"
|
CFLAGS="-pipe -Wall"
|
||||||
HOSTCFLAGS="-DLINUX"
|
|
||||||
|
case $MASCHINE in
|
||||||
|
sparc)
|
||||||
|
HOSTCFLAGS="-DLINUX -DSPARC"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
HOSTCFLAGS="-DLINUX"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [ -f /usr/lib/libgdbm.a ] || [ -f /usr/lib/libgdbm.so ] ; then
|
||||||
|
NDBMLIB="-lgdbm"
|
||||||
|
else
|
||||||
NDBMLIB="-ldbm"
|
NDBMLIB="-ldbm"
|
||||||
|
fi
|
||||||
CRYPTLIB=""
|
CRYPTLIB=""
|
||||||
NSLLIB=""
|
NSLLIB=""
|
||||||
MAKE=make
|
MAKE=make
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
|
|
||||||
# Syntax of this config-file:
|
# Syntax of this config-file:
|
||||||
# - everything after a "#" is not treated as a comment (particularly
|
# - everything after a "#" is treated as a comment (particularly
|
||||||
# it does never belong to the values themselves)
|
# it does never belong to the values themselves)
|
||||||
# - entries _must_ begin with a number, indicating the section
|
# - entries _must_ begin with a number, indicating the section
|
||||||
# they belong to
|
# they belong to
|
||||||
@ -160,7 +160,7 @@
|
|||||||
# Section 4: IPX-devices (strongly recommended)
|
# Section 4: IPX-devices (strongly recommended)
|
||||||
#
|
#
|
||||||
# This section contains information for the ipx-router built into mars_nwe
|
# This section contains information for the ipx-router built into mars_nwe
|
||||||
# and/or the external program "ipxrouted".
|
# and/or the external program "nwrouted".
|
||||||
# Both processes exchange the ipx-packets between your machine and the rest
|
# Both processes exchange the ipx-packets between your machine and the rest
|
||||||
# of the world (in other words: their functionallity is essential). Of
|
# of the world (in other words: their functionallity is essential). Of
|
||||||
# course, to use one of both is already sufficient.
|
# course, to use one of both is already sufficient.
|
||||||
@ -272,9 +272,9 @@
|
|||||||
#
|
#
|
||||||
# FLAG:
|
# FLAG:
|
||||||
# 0 enforce encryption of _all_ passwords by the DOS-client
|
# 0 enforce encryption of _all_ passwords by the DOS-client
|
||||||
# (disables changing of password from the clients)
|
# (default)
|
||||||
# 1 as "0", but allow the non-encrypted version of the
|
# 1 as "0", but allow the non-encrypted version of the
|
||||||
# "change password"-routine. (default)
|
# "change password"-routine.
|
||||||
# 7 allow all non-encrypted stuff but no empty nwe passwords.
|
# 7 allow all non-encrypted stuff but no empty nwe passwords.
|
||||||
# 8 allow all non-encrypted stuff and also allow empty
|
# 8 allow all non-encrypted stuff and also allow empty
|
||||||
# nwe-passwords.
|
# nwe-passwords.
|
||||||
@ -283,7 +283,7 @@
|
|||||||
# this will *not* work with all clients !! (OS2/client)
|
# this will *not* work with all clients !! (OS2/client)
|
||||||
# -------------------------------------------------------------------------
|
# -------------------------------------------------------------------------
|
||||||
|
|
||||||
7 1
|
7 0
|
||||||
|
|
||||||
|
|
||||||
# Section 8: currently not used
|
# Section 8: currently not used
|
||||||
|
14
makefile.unx
14
makefile.unx
@ -1,5 +1,5 @@
|
|||||||
#if 0
|
#if 0
|
||||||
#makefile.unx 20-May-96
|
#makefile.unx 10-Jul-96
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
VPATH=$(V_VPATH)
|
VPATH=$(V_VPATH)
|
||||||
@ -9,7 +9,7 @@ C=.c
|
|||||||
|
|
||||||
V_H=0
|
V_H=0
|
||||||
V_L=97
|
V_L=97
|
||||||
P_L=7
|
P_L=9
|
||||||
|
|
||||||
#define D_P_L 1
|
#define D_P_L 1
|
||||||
DISTRIB=mars_nwe
|
DISTRIB=mars_nwe
|
||||||
@ -40,6 +40,9 @@ distclean: $(DESTMAKEFILE)
|
|||||||
install: $(DESTMAKEFILE)
|
install: $(DESTMAKEFILE)
|
||||||
$(MAKE) -f $(DESTMAKEFILE) n_$@
|
$(MAKE) -f $(DESTMAKEFILE) n_$@
|
||||||
|
|
||||||
|
reboot: $(DESTMAKEFILE)
|
||||||
|
$(MAKE) -f $(DESTMAKEFILE) n_$@
|
||||||
|
|
||||||
install_ini: $(DESTMAKEFILE)
|
install_ini: $(DESTMAKEFILE)
|
||||||
$(MAKE) -f $(DESTMAKEFILE) n_$@
|
$(MAKE) -f $(DESTMAKEFILE) n_$@
|
||||||
|
|
||||||
@ -184,6 +187,11 @@ echo "********************************************************"; \
|
|||||||
echo ""; \
|
echo ""; \
|
||||||
fi; cd $(OBJDIR) )
|
fi; cd $(OBJDIR) )
|
||||||
|
|
||||||
|
n_reboot: n_install
|
||||||
|
-nwserv -k
|
||||||
|
sleep 5
|
||||||
|
nwserv
|
||||||
|
|
||||||
clean_d:
|
clean_d:
|
||||||
cd $(VPATH) && (\
|
cd $(VPATH) && (\
|
||||||
find $(DISTRIB) \( -name .e.pck -o -name '~*' -o -name '*~' -o -name core \) \
|
find $(DISTRIB) \( -name .e.pck -o -name '~*' -o -name '*~' -o -name core \) \
|
||||||
@ -220,7 +228,7 @@ make_dir:
|
|||||||
|
|
||||||
n_diff: make_dir clean_d
|
n_diff: make_dir clean_d
|
||||||
cd $(VPATH) && ( \
|
cd $(VPATH) && ( \
|
||||||
makepatch $(DISTRIB).org $(DISTRIB) > $(PATCHF) \
|
makepatch org/$(DISTRIB) $(DISTRIB) > $(PATCHF) \
|
||||||
; gzip -9 -f $(PATCHF) \
|
; gzip -9 -f $(PATCHF) \
|
||||||
; cd $(OBJDIR) )
|
; cd $(OBJDIR) )
|
||||||
|
|
||||||
|
14
namspace.c
14
namspace.c
@ -567,27 +567,27 @@ static int build_dir_info(DIR_BASE_ENTRY *dbe, uint32 infomask, uint8 *p)
|
|||||||
p +=2;
|
p +=2;
|
||||||
} else p+=6;
|
} else p+=6;
|
||||||
if (infomask & INFO_MSK_CREAT_INFO) {
|
if (infomask & INFO_MSK_CREAT_INFO) {
|
||||||
xun_time_2_nw(stb->st_mtime, p);
|
un_time_2_nw(stb->st_mtime, p, 0);
|
||||||
p +=2;
|
p +=2;
|
||||||
xun_date_2_nw(stb->st_mtime, p);
|
un_date_2_nw(stb->st_mtime, p, 0);
|
||||||
p +=2;
|
p +=2;
|
||||||
U32_TO_32(1, p);
|
U32_TO_32(1, p);
|
||||||
p +=4;
|
p +=4;
|
||||||
} else p+=8;
|
} else p+=8;
|
||||||
if (infomask & INFO_MSK_MODIFY_INFO) {
|
if (infomask & INFO_MSK_MODIFY_INFO) {
|
||||||
xun_time_2_nw(stb->st_mtime, p);
|
un_time_2_nw(stb->st_mtime, p, 0);
|
||||||
p +=2;
|
p +=2;
|
||||||
xun_date_2_nw(stb->st_mtime, p);
|
un_date_2_nw(stb->st_mtime, p, 0);
|
||||||
p +=2;
|
p +=2;
|
||||||
U32_TO_32(1, p);
|
U32_TO_32(1, p);
|
||||||
p +=4;
|
p +=4;
|
||||||
xun_date_2_nw(stb->st_atime, p); /* access date */
|
un_date_2_nw(stb->st_atime, p, 0); /* access date */
|
||||||
p +=2;
|
p +=2;
|
||||||
} else p+=10;
|
} else p+=10;
|
||||||
if (infomask & INFO_MSK_ARCHIVE_INFO) {
|
if (infomask & INFO_MSK_ARCHIVE_INFO) {
|
||||||
xun_time_2_nw(0, p);
|
un_time_2_nw(0, p, 0);
|
||||||
p +=2;
|
p +=2;
|
||||||
xun_date_2_nw(0, p);
|
un_date_2_nw(0, p, 0);
|
||||||
p +=2;
|
p +=2;
|
||||||
U32_TO_32(0, p);
|
U32_TO_32(0, p);
|
||||||
p +=4;
|
p +=4;
|
||||||
|
43
ncpserv.c
43
ncpserv.c
@ -67,8 +67,7 @@ static void write_to_nwserv(int what, int connection, int mode,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x4444 : /* tell the wdog there's no need to look 0 */
|
case 0x4444 : /* tell the wdog there's no need to look 0 */
|
||||||
/* fast activate wdog to free connection 1 */
|
/* activate wdogs to free connection 1 */
|
||||||
/* slow activate wdog to free connection 2 */
|
|
||||||
/* the connection ist closed 99 */
|
/* the connection ist closed 99 */
|
||||||
write(FD_NWSERV, &what, sizeof(int));
|
write(FD_NWSERV, &what, sizeof(int));
|
||||||
write(FD_NWSERV, &connection, sizeof(int));
|
write(FD_NWSERV, &connection, sizeof(int));
|
||||||
@ -93,8 +92,8 @@ static void write_to_nwserv(int what, int connection, int mode,
|
|||||||
#define nwserv_insert_conn(connection, adr, size) \
|
#define nwserv_insert_conn(connection, adr, size) \
|
||||||
write_to_nwserv(0x2222, (connection), 0, (adr), (size))
|
write_to_nwserv(0x2222, (connection), 0, (adr), (size))
|
||||||
|
|
||||||
#define nwserv_handle_wdog(connection, mode) \
|
#define nwserv_activate_wdogs() \
|
||||||
write_to_nwserv(0x4444, (connection), (mode), NULL, 0)
|
write_to_nwserv(0x4444, 0, 1, NULL, 0)
|
||||||
|
|
||||||
#define nwserv_reset_wdog(connection) \
|
#define nwserv_reset_wdog(connection) \
|
||||||
write_to_nwserv(0x4444, (connection), 0, NULL, 0)
|
write_to_nwserv(0x4444, (connection), 0, NULL, 0)
|
||||||
@ -156,11 +155,13 @@ typedef struct {
|
|||||||
static CONNECTION connections[MAX_CONNECTIONS];
|
static CONNECTION connections[MAX_CONNECTIONS];
|
||||||
static int anz_connect=0; /* actual count connections */
|
static int anz_connect=0; /* actual count connections */
|
||||||
|
|
||||||
|
#define L_MAX_CONNECTIONS MAX_CONNECTIONS
|
||||||
|
|
||||||
static int new_conn_nr(void)
|
static int new_conn_nr(void)
|
||||||
{
|
{
|
||||||
int j = -1;
|
int j = -1;
|
||||||
if (!anz_connect){ /* init all */
|
if (!anz_connect){ /* init all */
|
||||||
j = MAX_CONNECTIONS;
|
j = L_MAX_CONNECTIONS;
|
||||||
while (j--) {
|
while (j--) {
|
||||||
connections[j].fd = -1;
|
connections[j].fd = -1;
|
||||||
connections[j].pid = -1;
|
connections[j].pid = -1;
|
||||||
@ -169,7 +170,7 @@ static int new_conn_nr(void)
|
|||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
j = -1;
|
j = -1;
|
||||||
while (++j < MAX_CONNECTIONS) {
|
while (++j < L_MAX_CONNECTIONS) {
|
||||||
CONNECTION *c=&(connections[j]);
|
CONNECTION *c=&(connections[j]);
|
||||||
if (c->fd < 0 && c->pid < 0) {
|
if (c->fd < 0 && c->pid < 0) {
|
||||||
if (++j > anz_connect) anz_connect=j;
|
if (++j > anz_connect) anz_connect=j;
|
||||||
@ -177,9 +178,7 @@ static int new_conn_nr(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* nothing free */
|
/* nothing free */
|
||||||
j=0;
|
nwserv_activate_wdogs();
|
||||||
while (j++ < MAX_CONNECTIONS)
|
|
||||||
nwserv_handle_wdog(j, 2); /* slow activate wdog */
|
|
||||||
return(0); /* nothing free */
|
return(0); /* nothing free */
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -347,7 +346,7 @@ static int find_get_conn_nr(ipxAddr_t *addr)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (connection) {
|
if (connection>0) {
|
||||||
uint8 buff[sizeof(ipxAddr_t)+sizeof(uint16)+sizeof(uint32)];
|
uint8 buff[sizeof(ipxAddr_t)+sizeof(uint16)+sizeof(uint32)];
|
||||||
memcpy(buff, addr, sizeof(ipxAddr_t));
|
memcpy(buff, addr, sizeof(ipxAddr_t));
|
||||||
#if CALL_NWCONN_OVER_SOCKET
|
#if CALL_NWCONN_OVER_SOCKET
|
||||||
@ -557,7 +556,7 @@ static void handle_ncp_request(void)
|
|||||||
ncp_response(0x3333,
|
ncp_response(0x3333,
|
||||||
ncprequest->sequence,
|
ncprequest->sequence,
|
||||||
connection,
|
connection,
|
||||||
1, /* task */
|
0, /* task here is 0 !? */
|
||||||
0x0, /* completition */
|
0x0, /* completition */
|
||||||
0, /* conn status */
|
0, /* conn status */
|
||||||
0);
|
0);
|
||||||
@ -565,13 +564,20 @@ static void handle_ncp_request(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
XDPRINTF((10,0, "c->fd = %d", c->fd));
|
|
||||||
}
|
}
|
||||||
|
/* here someting is wrong */
|
||||||
|
XDPRINTF((1,0, "Not ok:0x%x,%s,fd=%d,conn=%d of %d",
|
||||||
|
type,
|
||||||
|
visable_ipx_adr(&from_addr),
|
||||||
|
c->fd,
|
||||||
|
ncprequest->connection,
|
||||||
|
anz_connect));
|
||||||
|
} else {
|
||||||
|
/* here the connection number is wrong */
|
||||||
|
XDPRINTF((1,0, "Not ok:0x%x conn=%d of %d conns",
|
||||||
|
type, ncprequest->connection,
|
||||||
|
anz_connect));
|
||||||
}
|
}
|
||||||
/* here someting is wrong */
|
|
||||||
XDPRINTF((1,0, "GOT 0x%x connection=%d of %d conns not OK",
|
|
||||||
type, ncprequest->connection, anz_connect));
|
|
||||||
|
|
||||||
if (type == 0x5555 || (type == 0x2222 && ncprequest->function == 0x19)) {
|
if (type == 0x5555 || (type == 0x2222 && ncprequest->function == 0x19)) {
|
||||||
compl = 0;
|
compl = 0;
|
||||||
cstat = 0;
|
cstat = 0;
|
||||||
@ -579,16 +585,13 @@ static void handle_ncp_request(void)
|
|||||||
compl = 0;
|
compl = 0;
|
||||||
cstat = 1;
|
cstat = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ncp_response(0x3333, ncprequest->sequence,
|
ncp_response(0x3333, ncprequest->sequence,
|
||||||
ncprequest->connection,
|
ncprequest->connection,
|
||||||
1, /* task */
|
(type== 0x5555) ? 0 : 1, /* task */
|
||||||
compl, /* completition */
|
compl, /* completition */
|
||||||
cstat, /* conn status */
|
cstat, /* conn status */
|
||||||
0);
|
0);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#if !CALL_NWCONN_OVER_SOCKET
|
#if !CALL_NWCONN_OVER_SOCKET
|
||||||
/* here comes a call from nwbind */
|
/* here comes a call from nwbind */
|
||||||
} else if (type == 0x3333
|
} else if (type == 0x3333
|
||||||
|
35
net.h
35
net.h
@ -65,19 +65,39 @@ extern int errno;
|
|||||||
#define min(a,b) (((a) < (b)) ? (a) : (b))
|
#define min(a,b) (((a) < (b)) ? (a) : (b))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define U16_TO_BE16(u, b) { uint16 a=(u); \
|
#ifdef SPARC
|
||||||
|
# define U16_TO_BE16 X_U16_TO_16
|
||||||
|
# define U32_TO_BE32 X_U32_TO_32
|
||||||
|
# define U16_TO_16 X_U16_TO_BE16
|
||||||
|
# define U32_TO_32 X_U32_TO_BE32
|
||||||
|
#else
|
||||||
|
# define U16_TO_BE16 X_U16_TO_BE16
|
||||||
|
# define U32_TO_BE32 X_U32_TO_BE32
|
||||||
|
# define U16_TO_16 X_U16_TO_16
|
||||||
|
# define U32_TO_32 X_U32_TO_32
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define X_U16_TO_BE16(u, b) { uint16 a=(uint16)(u); \
|
||||||
*( (uint8*) (b) ) = *( ((uint8*) (&a)) +1); \
|
*( (uint8*) (b) ) = *( ((uint8*) (&a)) +1); \
|
||||||
*( ((uint8*) (b)) +1) = *( (uint8*) (&a)); }
|
*( ((uint8*) (b)) +1) = *( (uint8*) (&a)); }
|
||||||
|
|
||||||
|
#if 0
|
||||||
#define U32_TO_BE32(u, ar) { uint32 a= (u); uint8 *b= ((uint8*)(ar))+3; \
|
/* I don't know anymore why I did coded it in this form */
|
||||||
|
#define X_U32_TO_BE32(u, ar) { uint32 a= (uint32)(u); uint8 *b= ((uint8*)(ar))+3; \
|
||||||
*b-- = (uint8)a; a >>= 8; \
|
*b-- = (uint8)a; a >>= 8; \
|
||||||
*b-- = (uint8)a; a >>= 8; \
|
*b-- = (uint8)a; a >>= 8; \
|
||||||
*b-- = (uint8)a; a >>= 8; \
|
*b-- = (uint8)a; a >>= 8; \
|
||||||
*b = (uint8)a; }
|
*b = (uint8)a; }
|
||||||
|
#else
|
||||||
|
#define X_U32_TO_BE32(u, b) { uint32 a=(uint32)(u); \
|
||||||
|
*( (uint8*) (b)) = *( ((uint8*) (&a))+3); \
|
||||||
|
*( ((uint8*) (b)) +1) = *( ((uint8*) (&a))+2); \
|
||||||
|
*( ((uint8*) (b)) +2) = *( ((uint8*) (&a))+1); \
|
||||||
|
*( ((uint8*) (b)) +3) = *( (uint8*) (&a)); }
|
||||||
|
#endif
|
||||||
|
|
||||||
#define U16_TO_16(u, b) { uint16 a=(u); memcpy(b, &a, 2); }
|
#define X_U16_TO_16(u, b) { uint16 a=(uint16)(u); memcpy(b, &a, 2); }
|
||||||
#define U32_TO_32(u, b) { uint32 a=(u); memcpy(b, &a, 4); }
|
#define X_U32_TO_32(u, b) { uint32 a=(uint32)(u); memcpy(b, &a, 4); }
|
||||||
|
|
||||||
#define GET_BE16(b) ( (int) *(((uint8*)(b))+1) \
|
#define GET_BE16(b) ( (int) *(((uint8*)(b))+1) \
|
||||||
| ( ( (int) *( (uint8*)(b) ) << 8) ) )
|
| ( ( (int) *( (uint8*)(b) ) << 8) ) )
|
||||||
@ -96,6 +116,7 @@ extern int errno;
|
|||||||
| ( ((uint32) *(((uint8*)(b))+2) ) << 16) \
|
| ( ((uint32) *(((uint8*)(b))+2) ) << 16) \
|
||||||
| ( ((uint32) *(((uint8*)(b))+3) ) << 24) )
|
| ( ((uint32) *(((uint8*)(b))+3) ) << 24) )
|
||||||
|
|
||||||
|
|
||||||
#define MAX_U32 ((uint32)0xffffffffL)
|
#define MAX_U32 ((uint32)0xffffffffL)
|
||||||
#define MAX_U16 ((uint16)0xffff)
|
#define MAX_U16 ((uint16)0xffff)
|
||||||
|
|
||||||
@ -181,6 +202,10 @@ extern int errno;
|
|||||||
# define IPX_DATA_GR_546 1
|
# define IPX_DATA_GR_546 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef USE_MMAP
|
||||||
|
# define USE_MMAP 1
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef WITH_NAME_SPACE_CALLS
|
#ifndef WITH_NAME_SPACE_CALLS
|
||||||
# define WITH_NAME_SPACE_CALLS 0
|
# define WITH_NAME_SPACE_CALLS 0
|
||||||
#endif
|
#endif
|
||||||
|
19
nwbind.c
19
nwbind.c
@ -1,5 +1,5 @@
|
|||||||
/* nwbind.c */
|
/* nwbind.c */
|
||||||
#define REVISION_DATE "19-Jun-96"
|
#define REVISION_DATE "12-Jul-96"
|
||||||
/* NCP Bindery SUB-SERVER */
|
/* NCP Bindery SUB-SERVER */
|
||||||
/* authentification and some message handling */
|
/* authentification and some message handling */
|
||||||
|
|
||||||
@ -44,22 +44,6 @@ static void write_to_nwserv(int what, int connection, int mode,
|
|||||||
char *data, int size)
|
char *data, int size)
|
||||||
{
|
{
|
||||||
switch (what) {
|
switch (what) {
|
||||||
case 0x2222 : /* insert wdog connection */
|
|
||||||
write(FD_NWSERV, &what, sizeof(int));
|
|
||||||
write(FD_NWSERV, &connection, sizeof(int));
|
|
||||||
write(FD_NWSERV, &size, sizeof(int));
|
|
||||||
write(FD_NWSERV, data, size); /* ipxAddr_t */
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 0x4444 : /* tell the wdog there's no need to look 0 */
|
|
||||||
/* fast activate wdog to free connection 1 */
|
|
||||||
/* slow activate wdog to free connection 2 */
|
|
||||||
/* the connection ist closed 99 */
|
|
||||||
write(FD_NWSERV, &what, sizeof(int));
|
|
||||||
write(FD_NWSERV, &connection, sizeof(int));
|
|
||||||
write(FD_NWSERV, &mode, sizeof(int));
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 0x6666 : /* send to client that server holds message */
|
case 0x6666 : /* send to client that server holds message */
|
||||||
write(FD_NWSERV, &what, sizeof(int));
|
write(FD_NWSERV, &what, sizeof(int));
|
||||||
write(FD_NWSERV, &connection, sizeof(int));
|
write(FD_NWSERV, &connection, sizeof(int));
|
||||||
@ -1058,6 +1042,7 @@ static void handle_fxx(int gelen, int func)
|
|||||||
internal_act=1;
|
internal_act=1;
|
||||||
result=nw_keychange_passwd(obj.id, act_c->crypt_key,
|
result=nw_keychange_passwd(obj.id, act_c->crypt_key,
|
||||||
rdata, (int)*p, p+1, act_c->object_id);
|
rdata, (int)*p, p+1, act_c->object_id);
|
||||||
|
if (!result) test_ins_unx_user(obj.id);
|
||||||
internal_act = 0;
|
internal_act = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
51
nwconn.c
51
nwconn.c
@ -26,6 +26,8 @@
|
|||||||
#include "nwqueue.h"
|
#include "nwqueue.h"
|
||||||
#include "namspace.h"
|
#include "namspace.h"
|
||||||
|
|
||||||
|
int act_connection = 0;
|
||||||
|
int act_pid = 0;
|
||||||
|
|
||||||
#define FD_NCP_OUT 3
|
#define FD_NCP_OUT 3
|
||||||
|
|
||||||
@ -179,7 +181,7 @@ static int handle_ncp_serv(void)
|
|||||||
if (!nw_get_fs_usage(xdata->name, &fsp)) {
|
if (!nw_get_fs_usage(xdata->name, &fsp)) {
|
||||||
int sector_scale=1;
|
int sector_scale=1;
|
||||||
while (fsp.fsu_blocks/sector_scale > 0xffff)
|
while (fsp.fsu_blocks/sector_scale > 0xffff)
|
||||||
sector_scale*=2;
|
sector_scale+=2;
|
||||||
U16_TO_BE16(sector_scale, xdata->sec_per_block);
|
U16_TO_BE16(sector_scale, xdata->sec_per_block);
|
||||||
U16_TO_BE16(fsp.fsu_blocks/sector_scale, xdata->total_blocks);
|
U16_TO_BE16(fsp.fsu_blocks/sector_scale, xdata->total_blocks);
|
||||||
U16_TO_BE16(fsp.fsu_bavail/sector_scale, xdata->avail_blocks);
|
U16_TO_BE16(fsp.fsu_bavail/sector_scale, xdata->avail_blocks);
|
||||||
@ -384,7 +386,7 @@ static int handle_ncp_serv(void)
|
|||||||
/******** Allocate Permanent DIR Handle **/
|
/******** Allocate Permanent DIR Handle **/
|
||||||
|| *p == 0x13 /* Allocate Temp Dir Handle */
|
|| *p == 0x13 /* Allocate Temp Dir Handle */
|
||||||
/******** Allocate Temp DIR Handle **/
|
/******** Allocate Temp DIR Handle **/
|
||||||
|| *p == 0x16) { /* Allocate spez Temp Dir Handle */
|
|| *p == 0x16) { /* Allocate Special Temp Dir Handle */
|
||||||
/******** Allocate spez temp DIR Handle **/
|
/******** Allocate spez temp DIR Handle **/
|
||||||
struct XDATA {
|
struct XDATA {
|
||||||
uint8 dirhandle; /* new Dir Handle */
|
uint8 dirhandle; /* new Dir Handle */
|
||||||
@ -406,7 +408,8 @@ static int handle_ncp_serv(void)
|
|||||||
|
|
||||||
} else if (*p == 0x14){ /* deallocate Dir Handle */
|
} else if (*p == 0x14){ /* deallocate Dir Handle */
|
||||||
/******** Free DIR Handle ****************/
|
/******** Free DIR Handle ****************/
|
||||||
int err_code = nw_free_dir_handle((int)*(p+1));
|
int err_code = nw_free_dir_handle((int)*(p+1),
|
||||||
|
(int)(ncprequest->task));
|
||||||
if (err_code) completition = (uint8) -err_code;
|
if (err_code) completition = (uint8) -err_code;
|
||||||
} else if (*p == 0x15){ /* liefert Volume Information */
|
} else if (*p == 0x15){ /* liefert Volume Information */
|
||||||
/******** Get Volume Info with Handle ****/
|
/******** Get Volume Info with Handle ****/
|
||||||
@ -429,7 +432,7 @@ static int handle_ncp_serv(void)
|
|||||||
if (!nw_get_fs_usage(xdata->name, &fsp)) {
|
if (!nw_get_fs_usage(xdata->name, &fsp)) {
|
||||||
int sector_scale=1;
|
int sector_scale=1;
|
||||||
while (fsp.fsu_blocks/sector_scale > 0xffff)
|
while (fsp.fsu_blocks/sector_scale > 0xffff)
|
||||||
sector_scale*=2;
|
sector_scale+=2;
|
||||||
U16_TO_BE16(sector_scale, xdata->sectors);
|
U16_TO_BE16(sector_scale, xdata->sectors);
|
||||||
U16_TO_BE16(fsp.fsu_blocks/sector_scale, xdata->total_blocks);
|
U16_TO_BE16(fsp.fsu_blocks/sector_scale, xdata->total_blocks);
|
||||||
U16_TO_BE16(fsp.fsu_bavail/sector_scale, xdata->avail_blocks);
|
U16_TO_BE16(fsp.fsu_bavail/sector_scale, xdata->avail_blocks);
|
||||||
@ -537,6 +540,8 @@ static int handle_ncp_serv(void)
|
|||||||
|
|
||||||
} else if (*p == 0x25){ /* setting FILE INFO ??*/
|
} else if (*p == 0x25){ /* setting FILE INFO ??*/
|
||||||
/* TODO !!!!!!!!!!!!!!!!!!!! */
|
/* TODO !!!!!!!!!!!!!!!!!!!! */
|
||||||
|
|
||||||
|
|
||||||
do_druck++;
|
do_druck++;
|
||||||
|
|
||||||
} else if (*p == 0x26) { /* Scan file or Dir for ext trustees */
|
} else if (*p == 0x26) { /* Scan file or Dir for ext trustees */
|
||||||
@ -798,13 +803,11 @@ static int handle_ncp_serv(void)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x18 : /* End of Job */
|
case 0x18 : /* End of Job */
|
||||||
nw_free_handles((ncprequest->task > 0) ?
|
nw_free_handles(ncprequest->task);
|
||||||
(int) (ncprequest->task) : 1);
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x19 : /* logout, some of this call is handled in ncpserv. */
|
case 0x19 : /* logout, some of this call is handled in ncpserv. */
|
||||||
nw_free_handles(0);
|
nw_free_handles(-1);
|
||||||
set_default_guid();
|
set_default_guid();
|
||||||
nw_setup_home_vol(-1, NULL);
|
nw_setup_home_vol(-1, NULL);
|
||||||
return(-1); /* nwbind must do rest */
|
return(-1); /* nwbind must do rest */
|
||||||
@ -1095,21 +1098,22 @@ static int handle_ncp_serv(void)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x46 : /* chmod file ??? */
|
case 0x46 : /* set file attributes */
|
||||||
{
|
{
|
||||||
struct INPUT {
|
struct INPUT {
|
||||||
uint8 header[7]; /* Requestheader */
|
uint8 header[7]; /* Requestheader */
|
||||||
uint8 attrib; /* 0x80, od 0x0 */
|
uint8 access; /* 0x80, od 0x0 */
|
||||||
/* 0x80 for example for sharable */
|
/* 0x80 for example is shared */
|
||||||
uint8 dir_handle; /* ??? z.B.0x1 */
|
uint8 dir_handle;
|
||||||
uint8 modus; /* z.B.0x6 */
|
uint8 attrib; /* search attrib */
|
||||||
uint8 len;
|
uint8 len;
|
||||||
uint8 data[2]; /* Name */
|
uint8 data[2]; /* filename */
|
||||||
} *input = (struct INPUT *)ncprequest;
|
} *input = (struct INPUT *)ncprequest;
|
||||||
completition =
|
completition =
|
||||||
(uint8) (-nw_chmod_datei((int)input->dir_handle,
|
(uint8) (-nw_chmod_datei((int)input->dir_handle,
|
||||||
input->data, (int)input->len,
|
input->data, (int)input->len,
|
||||||
(int)input->modus));
|
(int)input->attrib,
|
||||||
|
(int)input->access));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1454,7 +1458,7 @@ static int fl_get_int=0;
|
|||||||
static void sig_quit(int rsig)
|
static void sig_quit(int rsig)
|
||||||
{
|
{
|
||||||
XDPRINTF((2, 0, "Got Signal=%d", rsig));
|
XDPRINTF((2, 0, "Got Signal=%d", rsig));
|
||||||
fl_get_int=2;
|
fl_get_int=-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sig_pipe(int rsig)
|
static void sig_pipe(int rsig)
|
||||||
@ -1465,14 +1469,14 @@ static void sig_pipe(int rsig)
|
|||||||
|
|
||||||
static void sig_hup(int rsig)
|
static void sig_hup(int rsig)
|
||||||
{
|
{
|
||||||
fl_get_int=1;
|
if (!fl_get_int) fl_get_int=1;
|
||||||
signal(SIGHUP, sig_hup);
|
signal(SIGHUP, sig_hup);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void get_new_debug(void)
|
static void get_new_debug(void)
|
||||||
{
|
{
|
||||||
get_ini_debug(3);
|
get_ini_debug(3);
|
||||||
fl_get_int=0;
|
if (fl_get_int > 0) fl_get_int=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void set_sig(void)
|
static void set_sig(void)
|
||||||
@ -1500,8 +1504,9 @@ int main(int argc, char **argv)
|
|||||||
father_pid, *(argv+2), *(argv+3)));
|
father_pid, *(argv+2), *(argv+3)));
|
||||||
|
|
||||||
adr_to_ipx_addr(&from_addr, *(argv+2));
|
adr_to_ipx_addr(&from_addr, *(argv+2));
|
||||||
|
act_connection = atoi(*(argv+3));
|
||||||
if (nw_init_connect()) exit(1);
|
if (nw_init_connect()) exit(1);
|
||||||
|
act_pid = getpid();
|
||||||
|
|
||||||
sscanf(argv[4], "%x", &sock_nwbind);
|
sscanf(argv[4], "%x", &sock_nwbind);
|
||||||
|
|
||||||
@ -1537,11 +1542,11 @@ int main(int argc, char **argv)
|
|||||||
U16_TO_BE16(0x3333, ncpresponse->type);
|
U16_TO_BE16(0x3333, ncpresponse->type);
|
||||||
ncpresponse->task = (uint8) 1; /* allways 1 */
|
ncpresponse->task = (uint8) 1; /* allways 1 */
|
||||||
ncpresponse->reserved = (uint8) 0; /* allways 0 */
|
ncpresponse->reserved = (uint8) 0; /* allways 0 */
|
||||||
ncpresponse->connection = (uint8) atoi(*(argv+3));
|
ncpresponse->connection = (uint8)act_connection;
|
||||||
|
|
||||||
set_sig();
|
set_sig();
|
||||||
|
|
||||||
while (1) {
|
while (fl_get_int >= 0) {
|
||||||
int data_len = read(0, readbuff, sizeof(readbuff));
|
int data_len = read(0, readbuff, sizeof(readbuff));
|
||||||
/* this read is a pipe or a socket read,
|
/* this read is a pipe or a socket read,
|
||||||
* depending on CALL_NWCONN_OVER_SOCKET
|
* depending on CALL_NWCONN_OVER_SOCKET
|
||||||
@ -1549,8 +1554,8 @@ int main(int argc, char **argv)
|
|||||||
ncpresponse->connect_status = (uint8) 0;
|
ncpresponse->connect_status = (uint8) 0;
|
||||||
|
|
||||||
if (fl_get_int) {
|
if (fl_get_int) {
|
||||||
if (fl_get_int == 1) get_new_debug();
|
if (fl_get_int == 1) get_new_debug();
|
||||||
else if (fl_get_int == 2) break;
|
else if (fl_get_int < 0) break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data_len > 0) {
|
if (data_len > 0) {
|
||||||
|
6
nwconn.h
Normal file
6
nwconn.h
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#ifndef _NWCONN_H_
|
||||||
|
#define _NWCONN_H_
|
||||||
|
extern int act_connection;
|
||||||
|
extern int act_pid;
|
||||||
|
#endif
|
||||||
|
|
44
nwcrypt.c
44
nwcrypt.c
@ -212,7 +212,7 @@ nw_encrypt(unsigned char *fra,unsigned char *buf,unsigned char *til)
|
|||||||
|
|
||||||
|
|
||||||
/* =========== next is from Guntram Blohm ! =============== */
|
/* =========== next is from Guntram Blohm ! =============== */
|
||||||
char newshuffle[256+16] = {
|
static char newshuffle[256+16] = {
|
||||||
0x0f, 0x08, 0x05, 0x07, 0x0c, 0x02, 0x0e, 0x09,
|
0x0f, 0x08, 0x05, 0x07, 0x0c, 0x02, 0x0e, 0x09,
|
||||||
0x00, 0x01, 0x06, 0x0d, 0x03, 0x04, 0x0b, 0x0a,
|
0x00, 0x01, 0x06, 0x0d, 0x03, 0x04, 0x0b, 0x0a,
|
||||||
0x02, 0x0c, 0x0e, 0x06, 0x0f, 0x00, 0x01, 0x08,
|
0x02, 0x0c, 0x0e, 0x06, 0x0f, 0x00, 0x01, 0x08,
|
||||||
@ -258,7 +258,7 @@ char newshuffle[256+16] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
int nw_decrypt_newpass(char *oldpwd, char *newpwd, char *undecr)
|
void nw_decrypt_newpass(char *oldpwd, char *newpwd, char *undecr)
|
||||||
{
|
{
|
||||||
int i, j, n;
|
int i, j, n;
|
||||||
unsigned char ch, cl;
|
unsigned char ch, cl;
|
||||||
@ -297,3 +297,43 @@ int nw_decrypt_newpass(char *oldpwd, char *newpwd, char *undecr)
|
|||||||
memcpy(undecr, copy, 8);
|
memcpy(undecr, copy, 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void newpassencrypt(char *old, char *new, char *out)
|
||||||
|
{
|
||||||
|
char *p, *bx;
|
||||||
|
char copy[8];
|
||||||
|
int i, di, ax;
|
||||||
|
char cl, dl, ch;
|
||||||
|
|
||||||
|
memcpy(copy, new, 8);
|
||||||
|
|
||||||
|
for (i=0; i<16; i++)
|
||||||
|
{
|
||||||
|
for (di=0, ax=0, p=old; di<8; di++, ax+=0x20, p++)
|
||||||
|
{
|
||||||
|
cl=newshuffle[(((copy[di]^*p)>>4)&0x0f)+ax+0x10]<<4;
|
||||||
|
dl=newshuffle[((copy[di]^*p)&0xf)+ax];
|
||||||
|
copy[di]=cl|dl;
|
||||||
|
}
|
||||||
|
|
||||||
|
ch=old[7];
|
||||||
|
for (bx=old+7; bx>old; bx--)
|
||||||
|
{
|
||||||
|
*bx=((bx[-1]>>4)&0x0f)|((*bx)<<4);
|
||||||
|
}
|
||||||
|
*old=((ch>>4)&0x0f)|(*old)<<4;
|
||||||
|
|
||||||
|
memset(out, '\0', 8);
|
||||||
|
|
||||||
|
for (di=0; di<16; di++)
|
||||||
|
{
|
||||||
|
if (newshuffle[di+0x100]&1)
|
||||||
|
ch=((copy[newshuffle[di+0x100]/2]>>4)&0x0f);
|
||||||
|
else
|
||||||
|
ch=copy[newshuffle[di+0x100]/2]&0x0f;
|
||||||
|
out[di/2]|=((di&1) ? ch<<4 : ch);
|
||||||
|
}
|
||||||
|
memcpy(copy, out, 8);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* nwcrypt.h 19-Jun-96 */
|
/* nwcrypt.h 22-Jun-96 */
|
||||||
extern void shuffle(unsigned char *lon,
|
extern void shuffle(unsigned char *lon,
|
||||||
const unsigned char *buf, int buflen,
|
const unsigned char *buf, int buflen,
|
||||||
unsigned char *target);
|
unsigned char *target);
|
||||||
@ -7,5 +7,6 @@ extern void nw_encrypt(unsigned char *fra,
|
|||||||
unsigned char *buf,unsigned char *til);
|
unsigned char *buf,unsigned char *til);
|
||||||
|
|
||||||
|
|
||||||
extern int nw_decrypt_newpass(char *oldpwd, char *newpwd, char *undecr);
|
extern void nw_decrypt_newpass(char *oldpwd, char *newpwd, char *undecr);
|
||||||
|
extern void newpassencrypt(char *old, char *new, char *out);
|
||||||
|
|
||||||
|
52
nwdbm.c
52
nwdbm.c
@ -1,4 +1,4 @@
|
|||||||
/* nwdbm.c 20-Jun-96 data base for mars_nwe */
|
/* nwdbm.c 12-Jul-96 data base for mars_nwe */
|
||||||
/* (C)opyright (C) 1993,1995 Martin Stover, Marburg, Germany
|
/* (C)opyright (C) 1993,1995 Martin Stover, Marburg, Germany
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -42,7 +42,7 @@
|
|||||||
#define DBM_REMAINS_OPEN 1
|
#define DBM_REMAINS_OPEN 1
|
||||||
|
|
||||||
int tells_server_version=0;
|
int tells_server_version=0;
|
||||||
int password_scheme=PW_SCHEME_CHANGE_PW;
|
int password_scheme=0; /* PW_SCHEME_CHANGE_PW; */
|
||||||
|
|
||||||
static datum key;
|
static datum key;
|
||||||
static datum data;
|
static datum data;
|
||||||
@ -1185,10 +1185,13 @@ int nw_set_passwd(uint32 obj_id, char *password, int dont_ch)
|
|||||||
*/
|
*/
|
||||||
int nw_keychange_passwd(uint32 obj_id, uint8 *cryptkey, uint8 *oldpass,
|
int nw_keychange_passwd(uint32 obj_id, uint8 *cryptkey, uint8 *oldpass,
|
||||||
int cryptedlen, uint8 *newpass, uint32 act_id)
|
int cryptedlen, uint8 *newpass, uint32 act_id)
|
||||||
|
/* returns 1 if new password is zero */
|
||||||
{
|
{
|
||||||
uint8 storedpass[200];
|
uint8 storedpass[200];
|
||||||
uint8 keybuff[8];
|
uint8 keybuff[8];
|
||||||
char buf[100];
|
char buf[100];
|
||||||
|
uint8 s_uid[4];
|
||||||
|
|
||||||
int len;
|
int len;
|
||||||
int result = loc_nw_test_passwd(keybuff, storedpass,
|
int result = loc_nw_test_passwd(keybuff, storedpass,
|
||||||
obj_id, cryptkey, oldpass);
|
obj_id, cryptkey, oldpass);
|
||||||
@ -1205,8 +1208,6 @@ int nw_keychange_passwd(uint32 obj_id, uint8 *cryptkey, uint8 *oldpass,
|
|||||||
|
|
||||||
if (result < 0) { /* wrong passwd */
|
if (result < 0) { /* wrong passwd */
|
||||||
if (1 == act_id) { /* supervisor is changing passwd */
|
if (1 == act_id) { /* supervisor is changing passwd */
|
||||||
uint8 buf[8];
|
|
||||||
uint8 s_uid[4];
|
|
||||||
U32_TO_BE32(obj_id, s_uid);
|
U32_TO_BE32(obj_id, s_uid);
|
||||||
shuffle(s_uid, buf, 0, storedpass);
|
shuffle(s_uid, buf, 0, storedpass);
|
||||||
nw_encrypt(cryptkey, storedpass, keybuff);
|
nw_encrypt(cryptkey, storedpass, keybuff);
|
||||||
@ -1223,7 +1224,10 @@ int nw_keychange_passwd(uint32 obj_id, uint8 *cryptkey, uint8 *oldpass,
|
|||||||
nw_decrypt_newpass(storedpass+8, newpass+8, newpass+8);
|
nw_decrypt_newpass(storedpass+8, newpass+8, newpass+8);
|
||||||
XDPRINTF((5, 0, "realnew: %s", hex_str(buf,newpass, 16)));
|
XDPRINTF((5, 0, "realnew: %s", hex_str(buf,newpass, 16)));
|
||||||
nw_set_enpasswd(obj_id, newpass, 0);
|
nw_set_enpasswd(obj_id, newpass, 0);
|
||||||
return(0);
|
/* testing for zero password */
|
||||||
|
U32_TO_BE32(obj_id, s_uid);
|
||||||
|
shuffle(s_uid, buf, 0, storedpass);
|
||||||
|
return(memcmp(newpass, storedpass, 16) ? 0 : 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int prop_add_new_member(uint32 obj_id, int prop_id, uint32 member_id)
|
int prop_add_new_member(uint32 obj_id, int prop_id, uint32 member_id)
|
||||||
@ -1321,7 +1325,15 @@ static void add_user_to_group(uint32 u_id, uint32 g_id)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void add_user(uint32 u_id, uint32 g_id,
|
static void add_user_2_unx(uint32 u_id, char *unname)
|
||||||
|
{
|
||||||
|
if (unname && *unname)
|
||||||
|
nw_new_obj_prop(u_id, NULL, 0 , 0 , 0 ,
|
||||||
|
"UNIX_USER", P_FL_ITEM, 0x33,
|
||||||
|
(char*)unname, strlen(unname));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void add_user_g(uint32 u_id, uint32 g_id,
|
||||||
char *name, char *unname,
|
char *name, char *unname,
|
||||||
char *password, int dont_ch)
|
char *password, int dont_ch)
|
||||||
{
|
{
|
||||||
@ -1331,11 +1343,7 @@ static void add_user(uint32 u_id, uint32 g_id,
|
|||||||
XDPRINTF((1, 0, "Add/Change User='%s', UnixUser='%s'",
|
XDPRINTF((1, 0, "Add/Change User='%s', UnixUser='%s'",
|
||||||
name, unname));
|
name, unname));
|
||||||
add_user_to_group(u_id, g_id);
|
add_user_to_group(u_id, g_id);
|
||||||
if (unname && *unname)
|
add_user_2_unx(u_id, unname);
|
||||||
nw_new_obj_prop(u_id, NULL, 0 , 0 , 0 ,
|
|
||||||
"UNIX_USER", P_FL_ITEM, 0x33,
|
|
||||||
(char*)unname, strlen(unname));
|
|
||||||
|
|
||||||
if (password && *password) {
|
if (password && *password) {
|
||||||
if (*password == '-') *password='\0';
|
if (*password == '-') *password='\0';
|
||||||
nw_set_passwd(u_id, password, dont_ch);
|
nw_set_passwd(u_id, password, dont_ch);
|
||||||
@ -1408,6 +1416,20 @@ static uint8 *test_add_dir(uint8 *unixname, uint8 *pp, int shorten,
|
|||||||
return(pp);
|
return(pp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void test_ins_unx_user(uint32 id)
|
||||||
|
{
|
||||||
|
NETOBJ obj;
|
||||||
|
obj.id = id;
|
||||||
|
if ((MYPASSWD*)NULL == nw_getpwnam(id) && !nw_get_obj(&obj)){
|
||||||
|
struct passwd *pw;
|
||||||
|
uint8 unxname[50];
|
||||||
|
xstrcpy(unxname, obj.name);
|
||||||
|
downstr(unxname);
|
||||||
|
pw = getpwnam(unxname);
|
||||||
|
if (NULL != pw && pw->pw_uid) /* only non root user */
|
||||||
|
add_user_2_unx(id, unxname);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int nw_fill_standard(char *servername, ipxAddr_t *adr)
|
int nw_fill_standard(char *servername, ipxAddr_t *adr)
|
||||||
/* fills the standardproperties */
|
/* fills the standardproperties */
|
||||||
@ -1416,13 +1438,15 @@ int nw_fill_standard(char *servername, ipxAddr_t *adr)
|
|||||||
uint32 su_id = 0x00000001;
|
uint32 su_id = 0x00000001;
|
||||||
uint32 ge_id = 0x01000001;
|
uint32 ge_id = 0x01000001;
|
||||||
uint32 serv_id = 0x03000001;
|
uint32 serv_id = 0x03000001;
|
||||||
uint32 pserv_id = 0L;
|
|
||||||
uint32 q1_id = 0x0E000001;
|
uint32 q1_id = 0x0E000001;
|
||||||
#if 0
|
#if 0
|
||||||
uint32 guest_id = 0x02000001;
|
uint32 guest_id = 0x02000001;
|
||||||
uint32 nbo_id = 0x0B000001;
|
uint32 nbo_id = 0x0B000001;
|
||||||
uint32 ngr_id = 0x0C000001;
|
uint32 ngr_id = 0x0C000001;
|
||||||
uint32 ps1_id = 0x0D000001;
|
uint32 ps1_id = 0x0D000001;
|
||||||
|
#endif
|
||||||
|
#if _MAR_TESTS_
|
||||||
|
uint32 pserv_id = 0L;
|
||||||
#endif
|
#endif
|
||||||
FILE *f = open_nw_ini();
|
FILE *f = open_nw_ini();
|
||||||
int auto_ins_user = 0;
|
int auto_ins_user = 0;
|
||||||
@ -1500,7 +1524,7 @@ int nw_fill_standard(char *servername, ipxAddr_t *adr)
|
|||||||
if (what == 14)
|
if (what == 14)
|
||||||
add_group(nname, uname, password);
|
add_group(nname, uname, password);
|
||||||
else
|
else
|
||||||
add_user((12 == what) ? su_id : 0L, ge_id, nname,
|
add_user_g((12 == what) ? su_id : 0L, ge_id, nname,
|
||||||
uname, password, 0);
|
uname, password, 0);
|
||||||
}
|
}
|
||||||
} else if (15 == what) {
|
} else if (15 == what) {
|
||||||
@ -1539,7 +1563,7 @@ int nw_fill_standard(char *servername, ipxAddr_t *adr)
|
|||||||
char nname[100];
|
char nname[100];
|
||||||
xstrcpy(nname, pw->pw_name);
|
xstrcpy(nname, pw->pw_name);
|
||||||
upstr(nname);
|
upstr(nname);
|
||||||
add_user(0L, ge_id, nname, pw->pw_name, auto_ins_passwd,
|
add_user_g(0L, ge_id, nname, pw->pw_name, auto_ins_passwd,
|
||||||
(auto_ins_user == 99) ? 0 : 99);
|
(auto_ins_user == 99) ? 0 : 99);
|
||||||
} else {
|
} else {
|
||||||
XDPRINTF((1,0, "Unix User:'%s' not added because passwd='%s'",
|
XDPRINTF((1,0, "Unix User:'%s' not added because passwd='%s'",
|
||||||
|
2
nwdbm.h
2
nwdbm.h
@ -188,6 +188,8 @@ extern int nw_keychange_passwd(uint32 obj_id,
|
|||||||
extern int nw_get_q_dirname(uint32 q_id, uint8 *buff);
|
extern int nw_get_q_dirname(uint32 q_id, uint8 *buff);
|
||||||
extern int nw_get_q_prcommand(uint32 q_id, uint8 *buff);
|
extern int nw_get_q_prcommand(uint32 q_id, uint8 *buff);
|
||||||
|
|
||||||
|
extern void test_ins_unx_user(uint32 id);
|
||||||
|
|
||||||
extern int nw_fill_standard(char *servername, ipxAddr_t *adr);
|
extern int nw_fill_standard(char *servername, ipxAddr_t *adr);
|
||||||
extern int nw_init_dbm(char *servername, ipxAddr_t *adr);
|
extern int nw_init_dbm(char *servername, ipxAddr_t *adr);
|
||||||
#endif
|
#endif
|
||||||
|
124
nwfile.c
124
nwfile.c
@ -26,6 +26,10 @@
|
|||||||
#include "nwvolume.h"
|
#include "nwvolume.h"
|
||||||
#include "nwfile.h"
|
#include "nwfile.h"
|
||||||
#include "connect.h"
|
#include "connect.h"
|
||||||
|
#include "nwconn.h"
|
||||||
|
#if USE_MMAP
|
||||||
|
# include <sys/mman.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
static FILE_HANDLE file_handles[MAX_FILE_HANDLES_CONN];
|
static FILE_HANDLE file_handles[MAX_FILE_HANDLES_CONN];
|
||||||
static int anz_fhandles=0;
|
static int anz_fhandles=0;
|
||||||
@ -68,7 +72,16 @@ static int free_file_handle(int fhandle)
|
|||||||
if (fh->fh_flags & FH_IS_PIPE_COMMAND) {
|
if (fh->fh_flags & FH_IS_PIPE_COMMAND) {
|
||||||
if (fh->f) ext_pclose(fh->f);
|
if (fh->f) ext_pclose(fh->f);
|
||||||
fh->f = NULL;
|
fh->f = NULL;
|
||||||
} else close(fh->fd);
|
} else {
|
||||||
|
#if USE_MMAP
|
||||||
|
if (fh->p_mmap) {
|
||||||
|
munmap(fh->p_mmap, fh->size_mmap);
|
||||||
|
fh->p_mmap = NULL;
|
||||||
|
fh->size_mmap = 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
close(fh->fd);
|
||||||
|
}
|
||||||
if (fh->tmodi > 0L && !(FH_IS_PIPE_COMMAND & fh->fh_flags)
|
if (fh->tmodi > 0L && !(FH_IS_PIPE_COMMAND & fh->fh_flags)
|
||||||
&& !(FH_IS_READONLY & fh->fh_flags) ) {
|
&& !(FH_IS_READONLY & fh->fh_flags) ) {
|
||||||
/* now set date and time */
|
/* now set date and time */
|
||||||
@ -105,15 +118,29 @@ int file_creat_open(int volume, uint8 *unixname, struct stat *stbuff,
|
|||||||
/*
|
/*
|
||||||
* creatmode: 0 = open | 1 = creat | 2 = creatnew & 4 == save handle
|
* creatmode: 0 = open | 1 = creat | 2 = creatnew & 4 == save handle
|
||||||
* attrib ??
|
* attrib ??
|
||||||
* access: 0x1=readonly, 0x2=writeonly, 0x4=deny read, 0x5=deny write
|
*
|
||||||
|
* access: 0x1=read,
|
||||||
|
* 0x2=write,
|
||||||
|
* 0x4=deny read, -> F_WRLCK
|
||||||
|
* 0x8=deny write -> F_RDLCK
|
||||||
|
* 0x10=SH_COMPAT
|
||||||
|
*
|
||||||
|
* 0x09 (O_RDONLY | O_DENYWRITE);
|
||||||
|
* 0x05 (O_RDONLY | O_DENYREAD);
|
||||||
|
*
|
||||||
|
* 0x0b (O_RDWR | O_DENYWRITE);
|
||||||
|
* 0x07 (O_RDWR | O_DENYREAD);
|
||||||
|
*
|
||||||
|
* 0x05 (O_RDONLY | O_DENYREAD | O_DENYWRITE);
|
||||||
|
* 0x07 (O_RDWR | O_DENYREAD | O_DENYWRITE);
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
int fhandle=new_file_handle(unixname);
|
int fhandle=new_file_handle(unixname);
|
||||||
|
int dowrite = (access & 2) || creatmode ;
|
||||||
if (fhandle > 0){
|
if (fhandle > 0){
|
||||||
FILE_HANDLE *fh=&(file_handles[fhandle-1]);
|
FILE_HANDLE *fh=&(file_handles[fhandle-1]);
|
||||||
int completition = -0xff; /* no File Found */
|
int completition = -0xff; /* no File Found */
|
||||||
int dowrite = (access & 2) || creatmode ;
|
|
||||||
int voloptions = get_volume_options(volume, 1);
|
int voloptions = get_volume_options(volume, 1);
|
||||||
if (dowrite && (voloptions & VOL_OPTION_READONLY)) {
|
if (dowrite && (voloptions & VOL_OPTION_READONLY)) {
|
||||||
completition = (creatmode) ? -0x84 : -0x94;
|
completition = (creatmode) ? -0x84 : -0x94;
|
||||||
@ -125,7 +152,9 @@ int file_creat_open(int volume, uint8 *unixname, struct stat *stbuff,
|
|||||||
char *topipe = "READ";
|
char *topipe = "READ";
|
||||||
if (creatmode) topipe = "CREAT";
|
if (creatmode) topipe = "CREAT";
|
||||||
else if (dowrite) topipe = "WRITE";
|
else if (dowrite) topipe = "WRITE";
|
||||||
sprintf(pipecommand, "%s %s", fh->fname, topipe);
|
sprintf(pipecommand, "%s %s %d %d",
|
||||||
|
fh->fname, topipe,
|
||||||
|
act_connection, act_pid);
|
||||||
fh->f = ext_popen(pipecommand, geteuid(), getegid());
|
fh->f = ext_popen(pipecommand, geteuid(), getegid());
|
||||||
fh->fd = (fh->f) ? fileno(fh->f->fildes[1]) : -1;
|
fh->fd = (fh->f) ? fileno(fh->f->fildes[1]) : -1;
|
||||||
if (fh->fd > -1) {
|
if (fh->fd > -1) {
|
||||||
@ -178,6 +207,43 @@ int file_creat_open(int volume, uint8 *unixname, struct stat *stbuff,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (fh->fd > -1) {
|
if (fh->fd > -1) {
|
||||||
|
if (!(fh->fh_flags & FH_IS_PIPE)) {
|
||||||
|
/* Not a PIPE */
|
||||||
|
if ((access & 0x4) || (access & 0x8)) {
|
||||||
|
struct flock flockd;
|
||||||
|
int result;
|
||||||
|
flockd.l_type = (access & 0x8) ? F_RDLCK : F_WRLCK;
|
||||||
|
flockd.l_whence = SEEK_SET;
|
||||||
|
flockd.l_start = 0;
|
||||||
|
flockd.l_len = 0;
|
||||||
|
result = fcntl(fh->fd, F_SETLK, &flockd);
|
||||||
|
XDPRINTF((5, 0, "open shared lock:result=%d", result));
|
||||||
|
if (result == -1) {
|
||||||
|
close(fh->fd);
|
||||||
|
fh->fd = -1;
|
||||||
|
completition=-0xfe;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#if USE_MMAP
|
||||||
|
if (fh->fd > -1 && !dowrite) {
|
||||||
|
fh->size_mmap = fh->offd=lseek(fh->fd, 0L, SEEK_END);
|
||||||
|
if (fh->size_mmap > 0) {
|
||||||
|
fh->p_mmap = mmap(NULL,
|
||||||
|
fh->size_mmap,
|
||||||
|
PROT_READ,
|
||||||
|
MAP_SHARED,
|
||||||
|
fh->fd, 0);
|
||||||
|
if (fh->p_mmap == (uint8*) -1) {
|
||||||
|
fh->p_mmap = NULL;
|
||||||
|
fh->size_mmap=0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (fh->fd > -1) {
|
||||||
|
if (!dowrite) fh->fh_flags |= FH_IS_READONLY;
|
||||||
if (creatmode & 4) fh->fh_flags |= FH_DO_NOT_REUSE;
|
if (creatmode & 4) fh->fh_flags |= FH_DO_NOT_REUSE;
|
||||||
return(fhandle);
|
return(fhandle);
|
||||||
}
|
}
|
||||||
@ -218,7 +284,16 @@ int nw_close_datei(int fhandle, int reset_reuse)
|
|||||||
if (result > 0) result = 0;
|
if (result > 0) result = 0;
|
||||||
}
|
}
|
||||||
fh->f = NULL;
|
fh->f = NULL;
|
||||||
} else result=close(fh->fd);
|
} else {
|
||||||
|
#if USE_MMAP
|
||||||
|
if (fh->p_mmap) {
|
||||||
|
munmap(fh->p_mmap, fh->size_mmap);
|
||||||
|
fh->p_mmap = NULL;
|
||||||
|
fh->size_mmap = 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
result=close(fh->fd);
|
||||||
|
}
|
||||||
fh->fd = -1;
|
fh->fd = -1;
|
||||||
if (fh->tmodi > 0L && !(fh->fh_flags & FH_IS_PIPE)
|
if (fh->tmodi > 0L && !(fh->fh_flags & FH_IS_PIPE)
|
||||||
&& !(fh->fh_flags & FH_IS_READONLY)) {
|
&& !(fh->fh_flags & FH_IS_READONLY)) {
|
||||||
@ -265,19 +340,31 @@ int nw_read_datei(int fhandle, uint8 *data, int size, uint32 offset)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (fh->offd != (long)offset) {
|
#if USE_MMAP
|
||||||
fh->offd=lseek(fh->fd, offset, SEEK_SET);
|
if (fh->p_mmap) {
|
||||||
if (fh->offd < 0) {
|
if (offset < fh->size_mmap) {
|
||||||
XDPRINTF((5,0,"read-file failed in lseek"));
|
if (size + offset > fh->size_mmap)
|
||||||
|
size = fh->size_mmap - offset;
|
||||||
|
memcpy(data, fh->p_mmap+offset, size);
|
||||||
|
} else size=-1;
|
||||||
|
} else {
|
||||||
|
#endif
|
||||||
|
if (fh->offd != (long)offset) {
|
||||||
|
fh->offd=lseek(fh->fd, offset, SEEK_SET);
|
||||||
|
if (fh->offd < 0) {
|
||||||
|
XDPRINTF((5,0,"read-file failed in lseek"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
if (fh->offd > -1L) {
|
||||||
|
if ((size = read(fh->fd, data, size)) > -1)
|
||||||
|
fh->offd+=(long)size;
|
||||||
|
else {
|
||||||
|
XDPRINTF((5,0,"read-file failed in read"));
|
||||||
|
}
|
||||||
|
} else size = -1;
|
||||||
|
#if USE_MMAP
|
||||||
}
|
}
|
||||||
if (fh->offd > -1L) {
|
#endif
|
||||||
if ((size = read(fh->fd, data, size)) > -1)
|
|
||||||
fh->offd+=(long)size;
|
|
||||||
else {
|
|
||||||
XDPRINTF((5,0,"read-file failed in read"));
|
|
||||||
}
|
|
||||||
} else size = -1;
|
|
||||||
}
|
}
|
||||||
if (size == -1) size=0;
|
if (size == -1) size=0;
|
||||||
return(size);
|
return(size);
|
||||||
@ -402,7 +489,10 @@ int nw_lock_datei(int fhandle, int offset, int size, int do_lock)
|
|||||||
struct flock flockd;
|
struct flock flockd;
|
||||||
int result;
|
int result;
|
||||||
if (fh->fh_flags & FH_IS_PIPE) return(0);
|
if (fh->fh_flags & FH_IS_PIPE) return(0);
|
||||||
flockd.l_type = (do_lock) ? F_WRLCK : F_UNLCK;
|
flockd.l_type = (do_lock)
|
||||||
|
? ((fh->fh_flags & FH_IS_READONLY) ? F_RDLCK
|
||||||
|
: F_WRLCK)
|
||||||
|
: F_UNLCK;
|
||||||
flockd.l_whence = SEEK_SET;
|
flockd.l_whence = SEEK_SET;
|
||||||
flockd.l_start = offset;
|
flockd.l_start = offset;
|
||||||
flockd.l_len = size;
|
flockd.l_len = size;
|
||||||
|
4
nwfile.h
4
nwfile.h
@ -6,6 +6,10 @@
|
|||||||
typedef struct {
|
typedef struct {
|
||||||
int fd; /* filehandle from system open/creat */
|
int fd; /* filehandle from system open/creat */
|
||||||
long offd; /* actual file offset */
|
long offd; /* actual file offset */
|
||||||
|
#if USE_MMAP
|
||||||
|
uint8 *p_mmap; /* for use with mmap */
|
||||||
|
int size_mmap;
|
||||||
|
#endif
|
||||||
time_t tmodi; /* modification TIME */
|
time_t tmodi; /* modification TIME */
|
||||||
FILE_PIPE *f; /* for PIPE */
|
FILE_PIPE *f; /* for PIPE */
|
||||||
int fh_flags; /* 2 = PIPE */
|
int fh_flags; /* 2 = PIPE */
|
||||||
|
67
nwroute.c
67
nwroute.c
@ -529,12 +529,12 @@ static void send_sap_broadcast(int mode)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static FILE *open_route_info_fn(void)
|
static FILE *open_route_info_fn(int force)
|
||||||
{
|
{
|
||||||
static int tacs=0;
|
static int tacs=0;
|
||||||
FILE *f=NULL;
|
FILE *f=NULL;
|
||||||
if (print_route_tac > 0) {
|
if (print_route_tac > 0) {
|
||||||
if (!tacs) {
|
if (!tacs || force) {
|
||||||
if (NULL != (f=fopen(pr_route_info_fn,
|
if (NULL != (f=fopen(pr_route_info_fn,
|
||||||
(print_route_mode) ? "w" : "a"))) {
|
(print_route_mode) ? "w" : "a"))) {
|
||||||
tacs = print_route_tac-1;
|
tacs = print_route_tac-1;
|
||||||
@ -544,11 +544,14 @@ static FILE *open_route_info_fn(void)
|
|||||||
return(f);
|
return(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
void print_routing_info(void)
|
void print_routing_info(int force)
|
||||||
{
|
{
|
||||||
FILE *f= open_route_info_fn();
|
FILE *f= open_route_info_fn(force);
|
||||||
if (f) {
|
if (f) {
|
||||||
int k=-1;
|
int k=-1;
|
||||||
|
time_t xtime;
|
||||||
|
time(&xtime);
|
||||||
|
fprintf(f, "%s", ctime(&xtime) );
|
||||||
fprintf(f, "<--------- Devices ---------------->\n");
|
fprintf(f, "<--------- Devices ---------------->\n");
|
||||||
fprintf(f, "%-15s %-15s %5s Network Status\n", "DevName", "Frame", "Ticks");
|
fprintf(f, "%-15s %-15s %5s Network Status\n", "DevName", "Frame", "Ticks");
|
||||||
while (++k < anz_net_devices) {
|
while (++k < anz_net_devices) {
|
||||||
@ -589,12 +592,18 @@ void print_routing_info(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int look_for_interfaces(void);
|
||||||
|
|
||||||
|
|
||||||
void send_sap_rip_broadcast(int mode)
|
void send_sap_rip_broadcast(int mode)
|
||||||
/* mode=0, standard broadcast */
|
/* mode=0, standard broadcast */
|
||||||
/* mode=1, first trie */
|
/* mode=1, first trie */
|
||||||
/* mode=2, shutdown */
|
/* mode=2, shutdown */
|
||||||
{
|
{
|
||||||
static int flipflop=1;
|
static int flipflop=1;
|
||||||
|
int force_print_routes=(mode == 1);
|
||||||
|
if (auto_creat_interfaces)
|
||||||
|
force_print_routes = look_for_interfaces();
|
||||||
if (mode) {
|
if (mode) {
|
||||||
send_rip_broadcast(mode);
|
send_rip_broadcast(mode);
|
||||||
send_sap_broadcast(mode);
|
send_sap_broadcast(mode);
|
||||||
@ -607,7 +616,8 @@ static int flipflop=1;
|
|||||||
flipflop=1;
|
flipflop=1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (flipflop) print_routing_info(); /* every second time */
|
if (flipflop || force_print_routes)
|
||||||
|
print_routing_info(force_print_routes); /* every second time */
|
||||||
}
|
}
|
||||||
|
|
||||||
static void query_sap_on_net(uint32 net)
|
static void query_sap_on_net(uint32 net)
|
||||||
@ -667,6 +677,7 @@ int test_ins_device_net(uint32 rnet)
|
|||||||
foundfree = k;
|
foundfree = k;
|
||||||
} else if (nd->net == rnet) return(0);
|
} else if (nd->net == rnet) return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((rnetframe=get_interface_frame_name(rnetdevname, rnet)) < 0)
|
if ((rnetframe=get_interface_frame_name(rnetdevname, rnet)) < 0)
|
||||||
return(0);
|
return(0);
|
||||||
|
|
||||||
@ -737,3 +748,49 @@ int test_ins_device_net(uint32 rnet)
|
|||||||
}
|
}
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int look_for_interfaces(void)
|
||||||
|
{
|
||||||
|
FILE *f=fopen("/proc/net/ipx_interface", "r");
|
||||||
|
int find_diffs=0;
|
||||||
|
if (f) {
|
||||||
|
char buff[200];
|
||||||
|
NW_NET_DEVICE *nd;
|
||||||
|
int k = -1;
|
||||||
|
|
||||||
|
while (++k < anz_net_devices) {
|
||||||
|
nd=net_devices[k];
|
||||||
|
if (nd->is_up == 2) nd->is_up = -2; /* this will be put DOWN */
|
||||||
|
}
|
||||||
|
|
||||||
|
while (fgets((char*)buff, sizeof(buff), f) != NULL){
|
||||||
|
uint32 rnet;
|
||||||
|
uint8 dname[25];
|
||||||
|
int flags;
|
||||||
|
int fframe = read_interface_data((uint8*) buff, &rnet, NULL, &flags, dname);
|
||||||
|
if (fframe < 0) continue;
|
||||||
|
if (rnet > 0L && !(flags & 2)) {
|
||||||
|
int found=0;
|
||||||
|
k=-1;
|
||||||
|
while (++k < anz_net_devices) {
|
||||||
|
nd=net_devices[k];
|
||||||
|
if (nd->net == rnet) {
|
||||||
|
found++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (found && nd->is_up) {
|
||||||
|
if (nd->is_up == -2) nd->is_up=2; /* reset */
|
||||||
|
} else find_diffs=test_ins_device_net(rnet);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fclose(f);
|
||||||
|
|
||||||
|
k = -1;
|
||||||
|
while (++k < anz_net_devices) {
|
||||||
|
nd=net_devices[k];
|
||||||
|
if (nd->is_up < 0) nd->is_up = 0; /* this will be put DOWN */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return(find_diffs);
|
||||||
|
}
|
||||||
|
@ -125,7 +125,7 @@ void get_servers(void)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void print_routing_info(void)
|
void print_routing_info(int force)
|
||||||
{
|
{
|
||||||
;; /* DUMMY */
|
;; /* DUMMY */
|
||||||
}
|
}
|
||||||
|
39
nwserv.c
39
nwserv.c
@ -406,9 +406,9 @@ static void send_bcast_packet(ipxAddr_t *addr, int conn, int signature)
|
|||||||
}
|
}
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
ipxAddr_t addr; /* address of client */
|
ipxAddr_t addr; /* address of client */
|
||||||
time_t last_time; /* last wdog packet sent */
|
time_t last_time; /* time of last wdog packet sent */
|
||||||
int counter; /* max. 11 packets */
|
int counter; /* max. 11 packets */
|
||||||
} CONN;
|
} CONN;
|
||||||
|
|
||||||
static CONN conns[MAX_CONNECTIONS];
|
static CONN conns[MAX_CONNECTIONS];
|
||||||
@ -422,7 +422,7 @@ static void insert_wdog_conn(int conn, ipxAddr_t *adr)
|
|||||||
c=&(conns[hi_conn++]);
|
c=&(conns[hi_conn++]);
|
||||||
memset(c, 0, sizeof(CONN));
|
memset(c, 0, sizeof(CONN));
|
||||||
}
|
}
|
||||||
c=&(conns[--conn]);
|
c=&(conns[conn-1]);
|
||||||
c->last_time = akttime_stamp;
|
c->last_time = akttime_stamp;
|
||||||
c->counter = 0;
|
c->counter = 0;
|
||||||
if (NULL != adr) memcpy(&(c->addr), adr, sizeof(ipxAddr_t));
|
if (NULL != adr) memcpy(&(c->addr), adr, sizeof(ipxAddr_t));
|
||||||
@ -431,22 +431,21 @@ static void insert_wdog_conn(int conn, ipxAddr_t *adr)
|
|||||||
|
|
||||||
static void modify_wdog_conn(int conn, int mode)
|
static void modify_wdog_conn(int conn, int mode)
|
||||||
/* mode = 0 : reset */
|
/* mode = 0 : reset */
|
||||||
/* mode = 1 : force test 1 */
|
/* mode = 1 : activate */
|
||||||
/* mode = 2 : force test 2 */
|
|
||||||
/* mode = 99 : remove wdog */
|
/* mode = 99 : remove wdog */
|
||||||
{
|
{
|
||||||
if (conn > 0 && --conn < hi_conn) {
|
if (conn > 0 && --conn < hi_conn) {
|
||||||
CONN *c=&(conns[conn]);
|
CONN *c=&(conns[conn]);
|
||||||
if (mode < 99) {
|
if (mode < 99) {
|
||||||
c->last_time = akttime_stamp;
|
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case 1 : c->counter = MAX_WDOG_TRIES; /* quick test */
|
case 1 : /* activate Wdog */
|
||||||
break;
|
if (!c->counter) c->counter=1;
|
||||||
|
c->counter = max(c->counter, MAX_WDOG_TRIES-1);
|
||||||
case 2 : c->counter = max(2, MAX_WDOG_TRIES); /* slow test (activate)*/
|
c->last_time = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default : c->counter = 0; /* reset */
|
default : c->counter = 0; /* reset */
|
||||||
|
c->last_time = akttime_stamp;
|
||||||
break;
|
break;
|
||||||
} /* switch */
|
} /* switch */
|
||||||
} else if (mode == 99) { /* remove */
|
} else if (mode == 99) { /* remove */
|
||||||
@ -462,14 +461,14 @@ static void modify_wdog_conn(int conn, int mode)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void send_wdogs(int force)
|
static void send_wdogs()
|
||||||
{
|
{
|
||||||
int k = hi_conn;
|
int k = hi_conn;
|
||||||
while (k--) {
|
while (k--) {
|
||||||
CONN *c = &(conns[k]);
|
CONN *c = &(conns[k]);
|
||||||
if (c->last_time) {
|
if (c->last_time) {
|
||||||
time_t t_diff = akttime_stamp - c->last_time;
|
time_t t_diff = akttime_stamp - c->last_time;
|
||||||
if ( (c->counter && (t_diff > 50 || force))
|
if ( (c->counter && t_diff > 50)
|
||||||
|| t_diff > WDOG_TRIE_AFTER_SEC) { /* max. 5 minutes */
|
|| t_diff > WDOG_TRIE_AFTER_SEC) { /* max. 5 minutes */
|
||||||
if (c->counter > MAX_WDOG_TRIES) {
|
if (c->counter > MAX_WDOG_TRIES) {
|
||||||
/* now its enough with trying */
|
/* now its enough with trying */
|
||||||
@ -1016,7 +1015,7 @@ static void get_ini(int full)
|
|||||||
} else if (!anz_net_devices) {
|
} else if (!anz_net_devices) {
|
||||||
errorp(10, "WARNING:No external devices specified", NULL);
|
errorp(10, "WARNING:No external devices specified", NULL);
|
||||||
}
|
}
|
||||||
print_routing_info();
|
print_routing_info(1);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
XDPRINTF((1, 0, "%s name='%s', INTERNAL NET=0x%lx, NODE=0x%02x:%02x:%02x:%02x:%02x:%02x",
|
XDPRINTF((1, 0, "%s name='%s', INTERNAL NET=0x%lx, NODE=0x%02x:%02x:%02x:%02x:%02x:%02x",
|
||||||
@ -1119,6 +1118,7 @@ static void handle_hup_reqest(void)
|
|||||||
get_ini(0);
|
get_ini(0);
|
||||||
write_to_ncpserv(0xeeee, 0, NULL, 0); /* inform ncpserv */
|
write_to_ncpserv(0xeeee, 0, NULL, 0); /* inform ncpserv */
|
||||||
write_to_nwbind( 0xeeee, 0, NULL, 0); /* inform nwbind */
|
write_to_nwbind( 0xeeee, 0, NULL, 0); /* inform nwbind */
|
||||||
|
send_sap_rip_broadcast(1); /* firsttime broadcast */
|
||||||
fl_get_int=0;
|
fl_get_int=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1268,15 +1268,18 @@ int main(int argc, char **argv)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x4444 : /* reset wdog connection = 0 */
|
case 0x4444 : /* reset wdog connection = 0 */
|
||||||
/* force test wdog conn 1 = 1 */
|
/* activate wdogs = 1 */
|
||||||
/* force test wdog conn 2 = 2 */
|
|
||||||
/* remove wdog = 99 */
|
/* remove wdog = 99 */
|
||||||
if (sizeof(int) == read(p->fd,
|
if (sizeof(int) == read(p->fd,
|
||||||
(char*)&conn, sizeof(int))
|
(char*)&conn, sizeof(int))
|
||||||
&& sizeof(int) == read(p->fd,
|
&& sizeof(int) == read(p->fd,
|
||||||
(char*)&what, sizeof(what)))
|
(char*)&what, sizeof(what)))
|
||||||
|
if (what == 1) {
|
||||||
|
while (conn++ < hi_conn) {
|
||||||
modify_wdog_conn(conn, what);
|
modify_wdog_conn(conn, what);
|
||||||
if (what > 0 && what < 99) call_wdog++;
|
}
|
||||||
|
call_wdog++;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x5555 : /* close connection */
|
case 0x5555 : /* close connection */
|
||||||
@ -1330,7 +1333,7 @@ int main(int argc, char **argv)
|
|||||||
bsecs=server_broadcast_secs;
|
bsecs=server_broadcast_secs;
|
||||||
broadmillisecs = bsecs*1000+10;
|
broadmillisecs = bsecs*1000+10;
|
||||||
}
|
}
|
||||||
send_wdogs(call_wdog);
|
send_wdogs();
|
||||||
broadtime = akttime_stamp;
|
broadtime = akttime_stamp;
|
||||||
} else {
|
} else {
|
||||||
if (call_wdog) send_wdogs(1);
|
if (call_wdog) send_wdogs(1);
|
||||||
|
2
nwserv.h
2
nwserv.h
@ -59,7 +59,7 @@ extern void ins_del_bind_net_addr(uint8 *name, int styp, ipxAddr_t *adr);
|
|||||||
extern void send_server_response(int respond_typ,
|
extern void send_server_response(int respond_typ,
|
||||||
int styp, ipxAddr_t *to_addr);
|
int styp, ipxAddr_t *to_addr);
|
||||||
|
|
||||||
extern void print_routing_info(void);
|
extern void print_routing_info(int force);
|
||||||
extern void send_sap_rip_broadcast(int mode);
|
extern void send_sap_rip_broadcast(int mode);
|
||||||
extern void rip_for_net(uint32 net);
|
extern void rip_for_net(uint32 net);
|
||||||
extern void get_servers(void);
|
extern void get_servers(void);
|
||||||
|
10
nwvolume.c
10
nwvolume.c
@ -260,6 +260,15 @@ static int get_fs_usage(char *path, struct fs_usage *fsp)
|
|||||||
{
|
{
|
||||||
struct statfs fsd;
|
struct statfs fsd;
|
||||||
if (statfs (path, &fsd) < 0) return (-1);
|
if (statfs (path, &fsd) < 0) return (-1);
|
||||||
|
#if 0
|
||||||
|
/* test for a 'big' volume */
|
||||||
|
fsd.f_blocks = 3733075;
|
||||||
|
fsd.f_bfree = 1531638;
|
||||||
|
fsd.f_bavail = 1338518;
|
||||||
|
fsd.f_files = 966656;
|
||||||
|
fsd.f_ffree = 916066;
|
||||||
|
fsd.f_bsize = 1024;
|
||||||
|
#endif
|
||||||
XDPRINTF((3, 0,
|
XDPRINTF((3, 0,
|
||||||
"blocks=%d, bfree=%d, bavail=%d, files=%d, ffree=%d, bsize=%d",
|
"blocks=%d, bfree=%d, bavail=%d, files=%d, ffree=%d, bsize=%d",
|
||||||
fsd.f_blocks, fsd.f_bfree, fsd.f_bavail,
|
fsd.f_blocks, fsd.f_bfree, fsd.f_bavail,
|
||||||
@ -270,6 +279,7 @@ static int get_fs_usage(char *path, struct fs_usage *fsp)
|
|||||||
fsp->fsu_bavail = convert_blocks (fsd.f_bavail);
|
fsp->fsu_bavail = convert_blocks (fsd.f_bavail);
|
||||||
fsp->fsu_files = fsd.f_files;
|
fsp->fsu_files = fsd.f_files;
|
||||||
fsp->fsu_ffree = fsd.f_ffree;
|
fsp->fsu_ffree = fsd.f_ffree;
|
||||||
|
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user