mars_nwe-0.98.pl00
This commit is contained in:
parent
6331687e52
commit
79edfdd7a3
3
Makefile
3
Makefile
@ -45,6 +45,9 @@ clean: mk.li nw.ini
|
|||||||
distrib: mk.li nw.ini
|
distrib: mk.li nw.ini
|
||||||
./mk.li $@
|
./mk.li $@
|
||||||
|
|
||||||
|
distrib_bin: mk.li nw.ini
|
||||||
|
./mk.li $@
|
||||||
|
|
||||||
diff:
|
diff:
|
||||||
./mk.li $@
|
./mk.li $@
|
||||||
|
|
||||||
|
99
connect.c
99
connect.c
@ -1,4 +1,4 @@
|
|||||||
/* connect.c 04-May-96 */
|
/* connect.c 13-Jul-96 */
|
||||||
/* (C)opyright (C) 1993,1996 Martin Stover, Marburg, Germany
|
/* (C)opyright (C) 1993,1996 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
|
||||||
@ -34,15 +34,14 @@
|
|||||||
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"
|
||||||
|
|
||||||
NW_DIR dirs[MAX_NW_DIRS];
|
NW_DIR dirs[MAX_NW_DIRS];
|
||||||
int used_dirs=0;
|
int used_dirs=0;
|
||||||
|
int act_uid=-1;
|
||||||
|
int act_gid=-1;
|
||||||
|
|
||||||
static int connect_is_init = 0;
|
static int connect_is_init = 0;
|
||||||
|
|
||||||
@ -227,48 +226,48 @@ static int x_str_match(uint8 *s, uint8 *p)
|
|||||||
int not = 0;
|
int not = 0;
|
||||||
uint found = 0;
|
uint found = 0;
|
||||||
while ( (pc = *p++) != 0) {
|
while ( (pc = *p++) != 0) {
|
||||||
|
|
||||||
|
if (state != 100) {
|
||||||
|
if (pc == 255 && (*p == '*' || *p == '?'
|
||||||
|
|| *p==0xaa || *p==0xae || *p==0xbf || *p=='.')) {
|
||||||
|
pc=*p++;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (pc) {
|
||||||
|
case 0xaa: pc='*'; break;
|
||||||
|
case 0xae: pc='.'; break;
|
||||||
|
case 0xbf: pc='?'; break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch (state){
|
switch (state){
|
||||||
case 0 :
|
case 0 :
|
||||||
switch (pc) {
|
switch (pc) {
|
||||||
case 255: if (*p == '*' || *p == '?'
|
|
||||||
|| *p==0xaa || *p==0xae || *p=='.') continue;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case '\\': /* any following char */
|
case '\\': /* any following char */
|
||||||
if (*p++ != *s++) return(0);
|
if (*p++ != *s++) return(0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '?' : if ( (sc = *s++) == '.' || sc == '\0' ) {
|
case '?' : if (!*s || (sc = *s++) == '.')
|
||||||
uint8 *pp=p;
|
state = 10;
|
||||||
while (*pp=='?' || *pp=='*') ++pp;
|
|
||||||
if (*pp=='.') p=++pp;
|
|
||||||
else if (*pp || sc) return(0);
|
|
||||||
if (!sc) {
|
|
||||||
while (*pp=='?' || *pp=='*') ++pp;
|
|
||||||
return((*pp) ? 0 : 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '.' :
|
case '.' : if (*s && pc != *s++) return(0);
|
||||||
if (!*s && (!*p || *p == '*' || *p == '?')) return(1);
|
|
||||||
if (pc != *s++) return(0);
|
|
||||||
if (*p == '*') return(1);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '*' :
|
case '*' : if (!*p) return(1); /* last star */
|
||||||
if (!*p) return(1);
|
|
||||||
while (*s) {
|
while (*s) {
|
||||||
if (x_str_match(s, p) == 1) return(1);
|
if (x_str_match(s, p) == 1) return(1);
|
||||||
|
else if (*s == '.') return(0);
|
||||||
++s;
|
++s;
|
||||||
}
|
}
|
||||||
return((*p == '.' && *(p+1) == '*') ? 1 : 0);
|
state = 30;
|
||||||
|
break;
|
||||||
|
|
||||||
case '[' : if ( (*p == '!') || (*p == '^') ){
|
case '[' : if ( (*p == '!') || (*p == '^') ){
|
||||||
++p;
|
++p;
|
||||||
not = 1;
|
not = 1;
|
||||||
}
|
}
|
||||||
state = 1;
|
state = 100;
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
default : if (pc != *s++) return(0); /* normal char */
|
default : if (pc != *s++) return(0); /* normal char */
|
||||||
@ -277,7 +276,21 @@ static int x_str_match(uint8 *s, uint8 *p)
|
|||||||
} /* switch */
|
} /* switch */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1 : /* Bereich von Zeichen */
|
case 10 : if (pc != '*' && pc != '?' ) {
|
||||||
|
if (pc == '.')
|
||||||
|
state = 0;
|
||||||
|
else return(0);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 30: if (pc != '.') return(0);
|
||||||
|
state = 31;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 31: if (pc != '*' ) return(0);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 100 : /* Bereich von Zeichen */
|
||||||
sc = *s++;
|
sc = *s++;
|
||||||
found = not;
|
found = not;
|
||||||
if (!sc) return(0);
|
if (!sc) return(0);
|
||||||
@ -314,7 +327,7 @@ int fn_match(uint8 *s, uint8 *p, int options)
|
|||||||
int pf=0;
|
int pf=0;
|
||||||
for (; *ss; ss++){
|
for (; *ss; ss++){
|
||||||
if (*ss == '.') {
|
if (*ss == '.') {
|
||||||
if (pf++) return(0); /* no 2. pouint */
|
if (pf++) return(0); /* no 2. point */
|
||||||
len=0;
|
len=0;
|
||||||
} else {
|
} else {
|
||||||
++len;
|
++len;
|
||||||
@ -1246,7 +1259,7 @@ int nw_init_connect(void)
|
|||||||
int nw_free_handles(int task)
|
int nw_free_handles(int task)
|
||||||
/*
|
/*
|
||||||
* if task== -1 then all is initialized
|
* if task== -1 then all is initialized
|
||||||
* else the temp handles of the actual task ( and greater )
|
* else the temp handles of the actual task
|
||||||
* are deleted. I hope this is right. !??
|
* are deleted. I hope this is right. !??
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
@ -1255,12 +1268,8 @@ int nw_free_handles(int task)
|
|||||||
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) {
|
|
||||||
#else
|
|
||||||
if (d->is_temp && d->task == task) {
|
if (d->is_temp && d->task == task) {
|
||||||
/* only actual task */
|
/* only actual task */
|
||||||
#endif
|
|
||||||
xfree(d->path);
|
xfree(d->path);
|
||||||
d->volume = 0;
|
d->volume = 0;
|
||||||
d->inode = 0;
|
d->inode = 0;
|
||||||
@ -1276,30 +1285,27 @@ int nw_free_handles(int task)
|
|||||||
int xinsert_new_dir(int volume, uint8 *path, int inode, int drive, int is_temp, int task)
|
int xinsert_new_dir(int volume, uint8 *path, int inode, int drive, int is_temp, int task)
|
||||||
{
|
{
|
||||||
int j = 0;
|
int j = 0;
|
||||||
time_t lowtime = time(NULL);
|
|
||||||
int freehandle = 0;
|
int freehandle = 0;
|
||||||
|
#if 0
|
||||||
|
time_t lowtime = time(NULL);
|
||||||
int timedhandle = 0;
|
int timedhandle = 0;
|
||||||
|
#endif
|
||||||
/* 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) freehandle = j+1;
|
if (!d->inode)
|
||||||
else if (!is_temp && !d->is_temp
|
freehandle = j+1;
|
||||||
&& (int)d->drive == drive
|
|
||||||
#if 0
|
#if 0
|
||||||
&& (int)d->task == task
|
} else if (d->is_temp && d->timestamp < lowtime) {
|
||||||
#endif
|
|
||||||
) {
|
|
||||||
(void)change_dir_entry(d, volume, path, inode, drive, is_temp, 1, task);
|
|
||||||
return(++j);
|
|
||||||
} else if (!d->inode) freehandle = j+1;
|
|
||||||
else if (d->is_temp && d->timestamp < lowtime) {
|
|
||||||
timedhandle = j+1;
|
timedhandle = j+1;
|
||||||
lowtime = d->timestamp;
|
lowtime = d->timestamp;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
if (!freehandle && used_dirs < MAX_NW_DIRS) freehandle = ++used_dirs;
|
if (!freehandle && used_dirs < MAX_NW_DIRS) freehandle = ++used_dirs;
|
||||||
|
#if 0
|
||||||
if (!freehandle) freehandle = timedhandle;
|
if (!freehandle) freehandle = timedhandle;
|
||||||
|
#endif
|
||||||
if (freehandle){
|
if (freehandle){
|
||||||
(void)change_dir_entry(&(dirs[freehandle-1]),
|
(void)change_dir_entry(&(dirs[freehandle-1]),
|
||||||
volume, path, inode,
|
volume, path, inode,
|
||||||
@ -1469,7 +1475,8 @@ int nw_get_directory_path(int dir_handle, uint8 *name)
|
|||||||
{
|
{
|
||||||
int result = -0x9b;
|
int result = -0x9b;
|
||||||
name[0] = '\0';
|
name[0] = '\0';
|
||||||
if (dir_handle > 0 && --dir_handle < (int)used_dirs) {
|
if (dir_handle > 0 && --dir_handle < (int)used_dirs
|
||||||
|
&& dirs[dir_handle].inode) {
|
||||||
int volume = dirs[dir_handle].volume;
|
int volume = dirs[dir_handle].volume;
|
||||||
if (volume > -1 && volume < used_nw_volumes){
|
if (volume > -1 && volume < used_nw_volumes){
|
||||||
result=sprintf((char*)name, "%s:%s", nw_volumes[volume].sysname, dirs[dir_handle].path);
|
result=sprintf((char*)name, "%s:%s", nw_volumes[volume].sysname, dirs[dir_handle].path);
|
||||||
|
@ -133,7 +133,8 @@ extern int nw_scan_dir_info(int dir_handle, uint8 *data, int len,
|
|||||||
#define MAX_NW_DIRS 255
|
#define MAX_NW_DIRS 255
|
||||||
extern NW_DIR dirs[MAX_NW_DIRS];
|
extern NW_DIR dirs[MAX_NW_DIRS];
|
||||||
extern int used_dirs;
|
extern int used_dirs;
|
||||||
|
extern int act_uid;
|
||||||
|
extern int act_gid;
|
||||||
|
|
||||||
extern int conn_get_kpl_path(NW_PATH *nwpath, int dirhandle,
|
extern int conn_get_kpl_path(NW_PATH *nwpath, int dirhandle,
|
||||||
uint8 *data, int len, int only_dir) ;
|
uint8 *data, int len, int only_dir) ;
|
||||||
|
13
doc/CHANGES
13
doc/CHANGES
@ -1,5 +1,6 @@
|
|||||||
Sorry, this is in German only.
|
Sorry, this is in German only.
|
||||||
Aenderungen in mars_nwe bis zum : 24-Jun-96
|
User important notes are in the NEWS file.
|
||||||
|
Aenderungen in mars_nwe bis zum : 22-Jul-96
|
||||||
--------------------------------
|
--------------------------------
|
||||||
Erste 'oeffentliche' Version
|
Erste 'oeffentliche' Version
|
||||||
^^^^^^^^^^ VERSION 0.94 ^^^^^^^^
|
^^^^^^^^^^ VERSION 0.94 ^^^^^^^^
|
||||||
@ -153,7 +154,15 @@ Erste 'oeffentliche' Version
|
|||||||
- Dateien werden nun mittels mmap gelesen.
|
- Dateien werden nun mittels mmap gelesen.
|
||||||
neuer config.h Schalter USE_MMAP
|
neuer config.h Schalter USE_MMAP
|
||||||
<----- ^^^^^^^^^^ pl9 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
<----- ^^^^^^^^^^ pl9 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
^^^^^^^^^^ VERSION 0.97 ^^^^^^^^
|
||||||
|
- automatischen Ueberschreiben von bestimmten Directory Handles
|
||||||
|
entfernt. War von Anfang an falsch verstanden. :(
|
||||||
|
- namespace routinen verbessert/erweitert.
|
||||||
|
namespace OS/2 rudimentaer eingebaut.
|
||||||
|
- wildcardhandling wiederum geaendert.
|
||||||
|
- Dummy Routinen fuer OS/2 extended attributes eingebaut.
|
||||||
|
- NFS-namespace rudimentaer eingebaut.
|
||||||
|
<----- ^^^^^^^^^^ pl0 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -129,5 +129,5 @@ the mars_nwe-package.
|
|||||||
|
|
||||||
good luck :-)
|
good luck :-)
|
||||||
|
|
||||||
Martin Stover <mstover@freeway.de>
|
Martin Stover <mstover@stover.f.eunet.de>
|
||||||
|
|
||||||
|
19
doc/NEWS
19
doc/NEWS
@ -1,11 +1,18 @@
|
|||||||
# in this files are important notes for user of mars_nwe.
|
# in this files are important notes for user of mars_nwe.
|
||||||
|
------22-Jul-96--- 0.98.pl0 ----------
|
||||||
|
- problems with directory handles eliminated.
|
||||||
|
(missunderstood 'creat permanent directory handle' call :( )
|
||||||
|
- now poor OS/2 and NFS namespace added.
|
||||||
|
- dummy routine for OS/2 extended attributes.
|
||||||
|
(OS/2 WP needs it)
|
||||||
------12-Jul-96--- 0.97.pl9 ----------
|
------12-Jul-96--- 0.97.pl9 ----------
|
||||||
automatic adding and removing of ipx-interfaces. (internal router)
|
- better automatic handling of adding and removing
|
||||||
now running under linux/sparc.
|
of ipx-interfaces. (internal router)
|
||||||
better file locking/sharing.
|
- now running under linux/sparc.
|
||||||
some unix->dos attribute handling now.
|
- better file locking/sharing.
|
||||||
better read performance (mmap(ing))
|
- some unix->dos attribute handling now.
|
||||||
A not yet assigned mars_nwe user is now automatic assigned
|
- better read performance (mmap(ing)) config.h: USE_MMAP
|
||||||
|
- 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
|
to a Linux user with same name when the password is changed and the
|
||||||
new password is not null.
|
new password is not null.
|
||||||
------------------ 0.97.pl7 ----------
|
------------------ 0.97.pl7 ----------
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
Begin3
|
Begin3
|
||||||
Title: mars_nwe
|
Title: mars_nwe
|
||||||
Version: 0.97.pl9
|
Version: 0.98
|
||||||
Entered-date: 12-Jul-96
|
Entered-date: 22-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.
|
||||||
Keywords: novell, netware, server, ipx, ncp, tli
|
Keywords: novell, netware, server, ipx, ncp, tli
|
||||||
Author: mstover@freeway.de (Martin Stover)
|
Author: mstover@stover.f.eunet.de (Martin Stover)
|
||||||
Maintained-by: mstover@freeway.de (Martin Stover)
|
Maintained-by: mstover@stover.f.eunet.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.pl9.tgz
|
165kB mars_nwe-0.98.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, 2.xx), UnixWare (2.xx)
|
Platforms: Linux (1.2.xx, 1.3.xx, 2.xx), UnixWare (2.xx)
|
||||||
Copying-policy: GNU
|
Copying-policy: GNU
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* config.h: 21-May-96 */
|
/* config.h: 18-Jul-96 */
|
||||||
/* some of this config is needed by make, others by cc */
|
/* some of this config is needed by make, others by cc */
|
||||||
|
|
||||||
#define DO_DEBUG 1 /* compile in debug code */
|
#define DO_DEBUG 1 /* compile in debug code */
|
||||||
@ -35,6 +35,12 @@
|
|||||||
#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 USE_MMAP 1 /* use mmap systen call */
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
#define SOCK_EXTERN 0x8005 /* creat socket for external access */
|
||||||
|
/* i.e. Xmarsmon from H. Buchholz */
|
||||||
|
#endif
|
||||||
|
|
||||||
/* <--------------------------------------------------------------------> */
|
/* <--------------------------------------------------------------------> */
|
||||||
#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 */
|
||||||
@ -42,7 +48,7 @@
|
|||||||
/* <--------------- new namespace services call -----------------------> */
|
/* <--------------- new namespace services call -----------------------> */
|
||||||
#define MAX_DIR_BASE_ENTRIES 50 /* max. cached base entries per */
|
#define MAX_DIR_BASE_ENTRIES 50 /* max. cached base entries per */
|
||||||
/* connection */
|
/* connection */
|
||||||
#define WITH_NAME_SPACE_CALLS 0 /* Namespace Calls are only minimal */
|
#define WITH_NAME_SPACE_CALLS 1 /* Namespace Calls are only minimal */
|
||||||
/* supported so far. */
|
/* supported so far. */
|
||||||
/* To enable testing of them this */
|
/* To enable testing of them this */
|
||||||
/* entry must be changed to '1' and */
|
/* entry must be changed to '1' and */
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
# This is the configuration-file for "mars_nwe", a free netware-emulator
|
# This is the configuration-file for "mars_nwe", a free netware-emulator
|
||||||
# for Linux.
|
# for Linux.
|
||||||
#
|
#
|
||||||
# last change: 16-May-96
|
# last change: 17-Jul-96
|
||||||
|
|
||||||
# This file specifies which Linux-resources (printers, users, directories)
|
# This file specifies which Linux-resources (printers, users, directories)
|
||||||
# should be accessible to the DOS-clients via "mars_nwe". Furthermore
|
# should be accessible to the DOS-clients via "mars_nwe". Furthermore
|
||||||
@ -71,6 +71,9 @@
|
|||||||
# between several devices/namespaces for one volume.
|
# between several devices/namespaces for one volume.
|
||||||
# p "PIPE"-filesystem. All files are pipe commands.
|
# p "PIPE"-filesystem. All files are pipe commands.
|
||||||
# See `doc/PIPE-FS'.
|
# See `doc/PIPE-FS'.
|
||||||
|
#
|
||||||
|
# O + OS/2 namespace.
|
||||||
|
# N + NFS namespace.
|
||||||
# -------------------------------------------------------------------------
|
# -------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# Examples:
|
# Examples:
|
||||||
|
13
makefile.unx
13
makefile.unx
@ -1,5 +1,5 @@
|
|||||||
#if 0
|
#if 0
|
||||||
#makefile.unx 10-Jul-96
|
#makefile.unx 12-Jul-96
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
VPATH=$(V_VPATH)
|
VPATH=$(V_VPATH)
|
||||||
@ -8,10 +8,10 @@ O=.o
|
|||||||
C=.c
|
C=.c
|
||||||
|
|
||||||
V_H=0
|
V_H=0
|
||||||
V_L=97
|
V_L=98
|
||||||
P_L=9
|
P_L=0
|
||||||
|
|
||||||
#define D_P_L 1
|
#define D_P_L 0
|
||||||
DISTRIB=mars_nwe
|
DISTRIB=mars_nwe
|
||||||
#if D_P_L
|
#if D_P_L
|
||||||
DISTRIBF=$(DISTRIB)-$(V_H).$(V_L).pl$(P_L)
|
DISTRIBF=$(DISTRIB)-$(V_H).$(V_L).pl$(P_L)
|
||||||
@ -247,11 +247,10 @@ n_distrib: n_diff
|
|||||||
; cd $(OBJDIR) )
|
; cd $(OBJDIR) )
|
||||||
|
|
||||||
n_distrib_bin:
|
n_distrib_bin:
|
||||||
cd $(VPATH) && (tar cvzf /tmp/$(DISTRIB).bin.tgz \
|
cd $(VPATH) && (/usr/local/bin/cdar cb /tmp/mars_nwb.cda \
|
||||||
$(PROGS) \
|
$(PROGS) \
|
||||||
COPYING \
|
|
||||||
README \
|
|
||||||
examples \
|
examples \
|
||||||
doc \
|
doc \
|
||||||
; cd $(OBJDIR))
|
; cd $(OBJDIR))
|
||||||
|
|
||||||
|
|
||||||
|
337
namspace.c
337
namspace.c
@ -1,4 +1,4 @@
|
|||||||
/* namspace.c 13-May-96 : NameSpace Services, mars_nwe */
|
/* namspace.c 17-Jul-96 : NameSpace Services, mars_nwe */
|
||||||
|
|
||||||
/* !!!!!!!!!!!! NOTE !!!!!!!!!! */
|
/* !!!!!!!!!!!! NOTE !!!!!!!!!! */
|
||||||
/* Its very dirty till now. */
|
/* Its very dirty till now. */
|
||||||
@ -42,6 +42,7 @@
|
|||||||
typedef struct {
|
typedef struct {
|
||||||
int volume; /* Volume Number */
|
int volume; /* Volume Number */
|
||||||
int has_wild; /* fn has wildcards */
|
int has_wild; /* fn has wildcards */
|
||||||
|
int namespace; /* which namespace do we use here*/
|
||||||
struct stat statb; /* stat buff */
|
struct stat statb; /* stat buff */
|
||||||
uint8 *fn; /* points to last entry of path */
|
uint8 *fn; /* points to last entry of path */
|
||||||
uint8 path[512]; /* path + fn */
|
uint8 path[512]; /* path + fn */
|
||||||
@ -56,9 +57,9 @@ typedef struct {
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint32 basehandle;
|
uint32 basehandle;
|
||||||
int namespace; /* namespace of this entry */
|
|
||||||
int slot; /* act slot in table */
|
int slot; /* act slot in table */
|
||||||
int locked; /* if locked then do not remove */
|
int locked; /* if locked then do not remove */
|
||||||
|
/* and do not move till end */
|
||||||
DIR_SEARCH_STRUCT *dir; /* for dir searches */
|
DIR_SEARCH_STRUCT *dir; /* for dir searches */
|
||||||
N_NW_PATH nwpath;
|
N_NW_PATH nwpath;
|
||||||
} DIR_BASE_ENTRY;
|
} DIR_BASE_ENTRY;
|
||||||
@ -66,14 +67,22 @@ typedef struct {
|
|||||||
static DIR_BASE_ENTRY *dir_base[MAX_DIR_BASE_ENTRIES];
|
static DIR_BASE_ENTRY *dir_base[MAX_DIR_BASE_ENTRIES];
|
||||||
static int anz_dbe = 0;
|
static int anz_dbe = 0;
|
||||||
|
|
||||||
static void init_nwpath(N_NW_PATH *nwpath)
|
static void init_nwpath(N_NW_PATH *nwpath, int namespace)
|
||||||
{
|
{
|
||||||
nwpath->volume = -1;
|
nwpath->volume = -1;
|
||||||
|
nwpath->namespace = namespace;
|
||||||
nwpath->has_wild = 0;
|
nwpath->has_wild = 0;
|
||||||
nwpath->fn = nwpath->path;
|
nwpath->fn = nwpath->path;
|
||||||
*(nwpath->path) = '\0';
|
*(nwpath->path) = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void norm_nwpath_fn(N_NW_PATH *nwpath)
|
||||||
|
{
|
||||||
|
nwpath->fn = (uint8*)strrchr((char*)nwpath->path, '/');
|
||||||
|
if (nwpath->fn) nwpath->fn++;
|
||||||
|
else nwpath->fn=nwpath->path;
|
||||||
|
}
|
||||||
|
|
||||||
static char *xnwpath_2_unix(N_NW_PATH *nwpath, int modus,
|
static char *xnwpath_2_unix(N_NW_PATH *nwpath, int modus,
|
||||||
int allocate_extra, uint8 *extra_path)
|
int allocate_extra, uint8 *extra_path)
|
||||||
/*
|
/*
|
||||||
@ -127,7 +136,8 @@ static char *xnwpath_2_unix(N_NW_PATH *nwpath, int modus,
|
|||||||
len += len_extra;
|
len += len_extra;
|
||||||
}
|
}
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
if (nw_volumes[volume].options & VOL_OPTION_DOWNSHIFT)
|
if (nwpath->namespace == NAME_DOS
|
||||||
|
&& nw_volumes[volume].options & VOL_OPTION_DOWNSHIFT)
|
||||||
downstr((uint8*)pp);
|
downstr((uint8*)pp);
|
||||||
}
|
}
|
||||||
if (!allocate_extra) {
|
if (!allocate_extra) {
|
||||||
@ -182,8 +192,9 @@ static void free_dbe_ptr(DIR_BASE_ENTRY *dbe)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int base_open_seek_dir(DIR_BASE_ENTRY *dbe, uint32 offset)
|
static int base_open_seek_dir(DIR_BASE_ENTRY *dbe, uint32 offset)
|
||||||
|
/* opens a directory struct for searching */
|
||||||
{
|
{
|
||||||
int result = ((dbe->nwpath.statb.st_mode & S_IFMT) != S_IFDIR) ? -0xff : 0;
|
int result = S_ISDIR(dbe->nwpath.statb.st_mode) ? 0 : -0xff;
|
||||||
if (!result) {
|
if (!result) {
|
||||||
if (offset == MAX_U32) {
|
if (offset == MAX_U32) {
|
||||||
free_dbe_dir(dbe);
|
free_dbe_dir(dbe);
|
||||||
@ -204,10 +215,13 @@ static DIR_BASE_ENTRY *allocate_dbe_p(int namespace)
|
|||||||
int j=-1;
|
int j=-1;
|
||||||
int to_use=-1;
|
int to_use=-1;
|
||||||
DIR_BASE_ENTRY **pdbe=(DIR_BASE_ENTRY**) NULL;
|
DIR_BASE_ENTRY **pdbe=(DIR_BASE_ENTRY**) NULL;
|
||||||
if (namespace) return(NULL); /* TODO: more namespaces */
|
|
||||||
|
/* if (namespace) return(NULL); /* TODO: more namespaces */
|
||||||
|
|
||||||
while (++j < anz_dbe && NULL != *(pdbe = &(dir_base[j])) ){
|
while (++j < anz_dbe && NULL != *(pdbe = &(dir_base[j])) ){
|
||||||
if (to_use < 0 && !(*pdbe)->basehandle && !(*pdbe)->locked) to_use=j;
|
if (to_use < 0 && !(*pdbe)->basehandle && !(*pdbe)->locked) to_use=j;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (j == anz_dbe) {
|
if (j == anz_dbe) {
|
||||||
if (anz_dbe == MAX_DIR_BASE_ENTRIES) { /* return(-0xff); */
|
if (anz_dbe == MAX_DIR_BASE_ENTRIES) { /* return(-0xff); */
|
||||||
if (to_use > -1) j=to_use;
|
if (to_use > -1) j=to_use;
|
||||||
@ -218,10 +232,10 @@ static DIR_BASE_ENTRY *allocate_dbe_p(int namespace)
|
|||||||
free_dbe_ptr(*pdbe);
|
free_dbe_ptr(*pdbe);
|
||||||
} else pdbe = &(dir_base[anz_dbe++]);
|
} else pdbe = &(dir_base[anz_dbe++]);
|
||||||
}
|
}
|
||||||
|
|
||||||
*pdbe = (DIR_BASE_ENTRY*)xcmalloc(sizeof(DIR_BASE_ENTRY));
|
*pdbe = (DIR_BASE_ENTRY*)xcmalloc(sizeof(DIR_BASE_ENTRY));
|
||||||
(*pdbe)->namespace = namespace;
|
|
||||||
(*pdbe)->slot = j;
|
(*pdbe)->slot = j;
|
||||||
init_nwpath(&((*pdbe)->nwpath));
|
init_nwpath(&((*pdbe)->nwpath), namespace);
|
||||||
return(*pdbe);
|
return(*pdbe);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -249,14 +263,20 @@ static int touch_handle_entry_p(DIR_BASE_ENTRY *dbe)
|
|||||||
XDPRINTF((4, 0, "touch_handle_entry entry dbase=%d", dbase));
|
XDPRINTF((4, 0, "touch_handle_entry entry dbase=%d", dbase));
|
||||||
if (dbase > 2) {
|
if (dbase > 2) {
|
||||||
DIR_BASE_ENTRY **dbp=&(dir_base[dbase]);
|
DIR_BASE_ENTRY **dbp=&(dir_base[dbase]);
|
||||||
|
DIR_BASE_ENTRY **dbpq=dbp;
|
||||||
|
int aktbase=dbase;
|
||||||
while (dbase--) {
|
while (dbase--) {
|
||||||
*dbp = *(dbp-1);
|
--dbpq;
|
||||||
|
if ( dbase < (MAX_DIR_BASE_ENTRIES/2) || !(*dbpq) || !(*dbpq)->locked) {
|
||||||
|
*dbp = *dbpq;
|
||||||
if (*dbp) (*dbp)->slot = dbase+1;
|
if (*dbp) (*dbp)->slot = dbase+1;
|
||||||
--dbp;
|
dbp=dbpq;
|
||||||
|
aktbase=dbase;
|
||||||
}
|
}
|
||||||
dbase=0;
|
}
|
||||||
dir_base[0] = dbe;
|
dbase = aktbase;
|
||||||
dbe->slot = 0;
|
dir_base[dbase] = dbe;
|
||||||
|
dbe->slot = dbase;
|
||||||
}
|
}
|
||||||
XDPRINTF((4, 0, "touch_handle_entry return dbase=%d", dbase));
|
XDPRINTF((4, 0, "touch_handle_entry return dbase=%d", dbase));
|
||||||
return(dbase);
|
return(dbase);
|
||||||
@ -330,7 +350,7 @@ static int add_hpath_to_nwpath(N_NW_PATH *nwpath,
|
|||||||
}
|
}
|
||||||
while (i--) {
|
while (i--) {
|
||||||
if (*p == 0xae) *pp++ = '.';
|
if (*p == 0xae) *pp++ = '.';
|
||||||
else if (*p > 0x60 && *p < 0x7b) {
|
else if (*p > 0x60 && *p < 0x7b && nwpath->namespace == NAME_DOS) {
|
||||||
*pp++ = *p - 0x20; /* all is upshift */
|
*pp++ = *p - 0x20; /* all is upshift */
|
||||||
} else if (*p == 0xaa || *p == '*' ) {
|
} else if (*p == 0xaa || *p == '*' ) {
|
||||||
*pp++ = '*';
|
*pp++ = '*';
|
||||||
@ -380,12 +400,12 @@ static int nwp_stat(N_NW_PATH *nwpath, char *debstr)
|
|||||||
return(result);
|
return(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint32 build_base_handle(N_NW_PATH *nwpath, int namespace)
|
static uint32 name_2_base(N_NW_PATH *nwpath, int namespace, int no_stat)
|
||||||
/* returns basehandle of path, or 0 if not exist !! */
|
/* returns basehandle of path, or 0 if not exist !! */
|
||||||
/* nwpath must be filled, namespace must be specified */
|
/* nwpath must be filled, namespace must be specified */
|
||||||
{
|
{
|
||||||
uint32 basehandle=0L;
|
uint32 basehandle=0L;
|
||||||
if (!nwp_stat(nwpath, "build_base_handle")) {
|
if (no_stat || !nwp_stat(nwpath, "name_2_base")) {
|
||||||
DEV_NAMESPACE_MAP dnm;
|
DEV_NAMESPACE_MAP dnm;
|
||||||
dnm.dev = nwpath->statb.st_dev;
|
dnm.dev = nwpath->statb.st_dev;
|
||||||
dnm.namespace = namespace;
|
dnm.namespace = namespace;
|
||||||
@ -396,14 +416,39 @@ static uint32 build_base_handle(N_NW_PATH *nwpath, int namespace)
|
|||||||
return(basehandle);
|
return(basehandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int add_dbe_entry(int namspace, int volume,
|
||||||
|
uint32 basehandle, uint8 *path)
|
||||||
|
{
|
||||||
|
DIR_BASE_ENTRY *dbe=allocate_dbe_p(namspace);
|
||||||
|
if (dbe) {
|
||||||
|
dbe->nwpath.volume = volume;
|
||||||
|
dbe->basehandle = basehandle;
|
||||||
|
if (path) {
|
||||||
|
strcpy(dbe->nwpath.path, path);
|
||||||
|
norm_nwpath_fn(&(dbe->nwpath));
|
||||||
|
}
|
||||||
|
return(touch_handle_entry_p(dbe));
|
||||||
|
} else return(-0x9b);
|
||||||
|
}
|
||||||
|
|
||||||
static int find_base_entry(int volume, uint32 basehandle)
|
static int find_base_entry(int volume, uint32 basehandle)
|
||||||
{
|
{
|
||||||
int k=-1;
|
int k=-1;
|
||||||
|
DEV_NAMESPACE_MAP dnm;
|
||||||
|
ino_t ino = nw_vol_handle_to_inode(volume, basehandle, &dnm);
|
||||||
while (++k < anz_dbe) {
|
while (++k < anz_dbe) {
|
||||||
DIR_BASE_ENTRY *e=dir_base[k];
|
DIR_BASE_ENTRY *e=dir_base[k];
|
||||||
if ( (DIR_BASE_ENTRY*)NULL != e
|
if ( (DIR_BASE_ENTRY*)NULL != e
|
||||||
&& basehandle == e->basehandle
|
&& volume == e->nwpath.volume
|
||||||
&& volume == e->nwpath.volume) return(k);
|
&& ( (basehandle == e->basehandle)
|
||||||
|
|| (ino == e->nwpath.statb.st_ino)) )
|
||||||
|
return(k);
|
||||||
|
}
|
||||||
|
/* now we test whether it is the root of volume */
|
||||||
|
if (0 < (ino = nw_vol_handle_to_inode(volume, basehandle, &dnm))
|
||||||
|
&& ino == get_volume_inode(volume) ) {
|
||||||
|
/* its the handle of the volumes root */
|
||||||
|
return(add_dbe_entry(dnm.namespace, volume, basehandle, NULL));
|
||||||
}
|
}
|
||||||
return(-0x9b);
|
return(-0x9b);
|
||||||
}
|
}
|
||||||
@ -412,7 +457,7 @@ static int insert_get_base_entry(DIR_BASE_ENTRY *dbe,
|
|||||||
int namespace, int creatmode)
|
int namespace, int creatmode)
|
||||||
{
|
{
|
||||||
N_NW_PATH *nwpath = &(dbe->nwpath);
|
N_NW_PATH *nwpath = &(dbe->nwpath);
|
||||||
uint32 basehandle = build_base_handle(nwpath, namespace);
|
uint32 basehandle = name_2_base(nwpath, namespace, 0);
|
||||||
|
|
||||||
if (!basehandle && creatmode) { /* now creat the entry (file or dir) */
|
if (!basehandle && creatmode) { /* now creat the entry (file or dir) */
|
||||||
int result = 0;
|
int result = 0;
|
||||||
@ -431,7 +476,7 @@ static int insert_get_base_entry(DIR_BASE_ENTRY *dbe,
|
|||||||
} else result=-0x84;
|
} else result=-0x84;
|
||||||
}
|
}
|
||||||
if (result) return(result);
|
if (result) return(result);
|
||||||
basehandle = build_base_handle(nwpath, namespace);
|
basehandle = name_2_base(nwpath, namespace, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (basehandle) {
|
if (basehandle) {
|
||||||
@ -453,48 +498,51 @@ static int insert_get_base_entry(DIR_BASE_ENTRY *dbe,
|
|||||||
return(-0xff); /* invalid path = -0x9c, -0xff no matching files */
|
return(-0xff); /* invalid path = -0x9c, -0xff no matching files */
|
||||||
}
|
}
|
||||||
|
|
||||||
static int build_dos_base(NW_HPATH *nwp,
|
static int build_base(int namespace,
|
||||||
|
NW_HPATH *nwp,
|
||||||
uint8 *pathes,
|
uint8 *pathes,
|
||||||
DIR_BASE_ENTRY *dbe,
|
DIR_BASE_ENTRY *dbe,
|
||||||
int mode,
|
int mode,
|
||||||
uint8 *rets)
|
uint8 *rets)
|
||||||
|
|
||||||
/* routine returns the actual dbe entry offset or */
|
/* routine returns the actual dbe entry offset or */
|
||||||
/* < 0 if error */
|
/* < 0 if error */
|
||||||
/* if mode == 1, then last_path will be ignored and will be put */
|
/* if mode == 1, then last path element will be ignored and will be put */
|
||||||
/* into the rets variable */
|
/* into the rets variable */
|
||||||
{
|
{
|
||||||
N_NW_PATH *nwpath=&(dbe->nwpath);
|
N_NW_PATH *nwpath=&(dbe->nwpath);
|
||||||
int result=0;
|
int result=0;
|
||||||
if (!nwp->flag) { /* short handle */
|
if (!nwp->flag) { /* short handle */
|
||||||
int dir_handle = nwp->base[0];
|
int dir_handle = (int)nwp->base[0];
|
||||||
if (dir_handle > 0 && --dir_handle < (int)used_dirs
|
NW_DIR *dir = (dir_handle > 0 && dir_handle <= used_dirs)
|
||||||
&& dirs[dir_handle].inode) {
|
? &(dirs[dir_handle-1])
|
||||||
int llen = strlen(dirs[dir_handle].path);
|
: NULL;
|
||||||
nwpath->volume = dirs[dir_handle].volume;
|
if (dir && dir->inode) {
|
||||||
memcpy(nwpath->path, dirs[dir_handle].path, llen+1);
|
int llen = strlen(dir->path);
|
||||||
|
nwpath->volume = dir->volume;
|
||||||
|
memcpy(nwpath->path, dir->path, llen+1);
|
||||||
if (llen && *(nwpath->path + llen -1) == '/')
|
if (llen && *(nwpath->path + llen -1) == '/')
|
||||||
*(nwpath->path+llen-1) = '\0';
|
*(nwpath->path+llen-1) = '\0';
|
||||||
result = (nwpath->volume > -1) ? 0 : -0x98;
|
result = (nwpath->volume > -1) ? 0 : -0x98;
|
||||||
} else result = -0x9b;
|
} else result = -0x9b;
|
||||||
|
XDPRINTF((4, 0, "build_base with dir_handle=%d, result=x%x",
|
||||||
|
dir_handle, result));
|
||||||
} else if (nwp->flag == 1) { /* basehandle */
|
} else if (nwp->flag == 1) { /* basehandle */
|
||||||
uint32 basehandle = GET_32(nwp->base);
|
if (-1 < (result = find_base_entry(nwp->volume, GET_32(nwp->base)))) {
|
||||||
int k = -1;
|
DIR_BASE_ENTRY *e=dir_base[result];
|
||||||
result = -0x9b; /* here wrong dir_handle should mean wrong basehandle */
|
nwpath->volume = nwp->volume;
|
||||||
while (++k < anz_dbe) {
|
|
||||||
if (k != dbe->slot) {
|
|
||||||
DIR_BASE_ENTRY *e=dir_base[k];
|
|
||||||
if ( (DIR_BASE_ENTRY*)NULL != e
|
|
||||||
&& e->nwpath.volume == nwp->volume
|
|
||||||
&& e->basehandle == basehandle) {
|
|
||||||
nwpath->volume = e->nwpath.volume;
|
|
||||||
strcpy(nwpath->path, e->nwpath.path);
|
strcpy(nwpath->path, e->nwpath.path);
|
||||||
result = (nwpath->volume > -1) ? 0 : -0x98;
|
result = 0;
|
||||||
break;
|
} else if (!GET_32(nwp->base)) {
|
||||||
}
|
nwpath->volume = nwp->volume;
|
||||||
}
|
nwpath->path[0]='\0';
|
||||||
|
result = 0;
|
||||||
}
|
}
|
||||||
|
XDPRINTF((4, 0, "build_base with basehandle=%ld, result=x%x",
|
||||||
|
GET_32(nwp->base), result));
|
||||||
} else if (nwp->flag != 0xff) result=-0xff;
|
} else if (nwp->flag != 0xff) result=-0xff;
|
||||||
if (!result) {
|
if (!result) {
|
||||||
|
nwpath->namespace = namespace;
|
||||||
if ((result = add_hpath_to_nwpath(nwpath, nwp, pathes)) > -1) {
|
if ((result = add_hpath_to_nwpath(nwpath, nwp, pathes)) > -1) {
|
||||||
char *pp=strrchr((char*)nwpath->path, '/');
|
char *pp=strrchr((char*)nwpath->path, '/');
|
||||||
if (mode) {
|
if (mode) {
|
||||||
@ -508,7 +556,7 @@ static int build_dos_base(NW_HPATH *nwp,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
nwpath->fn = (pp) ? (uint8*)pp+1 : nwpath->path;
|
nwpath->fn = (pp) ? (uint8*)pp+1 : nwpath->path;
|
||||||
result = insert_get_base_entry(dbe, NAME_DOS, 0);
|
result = insert_get_base_entry(dbe, namespace, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return(result);
|
return(result);
|
||||||
@ -524,9 +572,13 @@ int nw_generate_dir_path(int namespace,
|
|||||||
DIR_BASE_ENTRY *dbe=allocate_dbe_p(namespace);
|
DIR_BASE_ENTRY *dbe=allocate_dbe_p(namespace);
|
||||||
int result = -0xfb;
|
int result = -0xfb;
|
||||||
if (NULL != dbe) {
|
if (NULL != dbe) {
|
||||||
if ((result = build_dos_base(nwp, nwp->pathes, dbe, 0, NULL)) > -1) {
|
if ((result = build_base(namespace, nwp, nwp->pathes, dbe, 0, NULL)) > -1) {
|
||||||
U32_TO_32(dbe->basehandle, ns_dir_base); /* LOW - HIGH */
|
U32_TO_32(dbe->basehandle, ns_dir_base); /* LOW - HIGH */
|
||||||
|
if (namespace != NAME_DOS) {
|
||||||
|
U32_TO_32(name_2_base(&(dbe->nwpath), NAME_DOS, 1), dos_dir_base);
|
||||||
|
} else {
|
||||||
U32_TO_32(dbe->basehandle, dos_dir_base);
|
U32_TO_32(dbe->basehandle, dos_dir_base);
|
||||||
|
}
|
||||||
XDPRINTF((3, 0, "nw_generate_dir_path path=%s, result=%d, basehandle=0x%x",
|
XDPRINTF((3, 0, "nw_generate_dir_path path=%s, result=%d, basehandle=0x%x",
|
||||||
debug_nwpath_name(&(dbe->nwpath)), result, dbe->basehandle));
|
debug_nwpath_name(&(dbe->nwpath)), result, dbe->basehandle));
|
||||||
result= dbe->nwpath.volume;
|
result= dbe->nwpath.volume;
|
||||||
@ -641,7 +693,7 @@ int nw_optain_file_dir_info(int namespace, NW_HPATH *nwp,
|
|||||||
DIR_BASE_ENTRY *dbe = allocate_dbe_p(namespace);
|
DIR_BASE_ENTRY *dbe = allocate_dbe_p(namespace);
|
||||||
int result = -0xfb;
|
int result = -0xfb;
|
||||||
if (NULL != dbe) {
|
if (NULL != dbe) {
|
||||||
if ((result = build_dos_base(nwp, nwp->pathes, dbe, 0, NULL)) > -1) {
|
if ((result = build_base(namespace, nwp, nwp->pathes, dbe, 0, NULL)) > -1) {
|
||||||
nwp_stat(&(dbe->nwpath), "nw_optain_file_dir_info");
|
nwp_stat(&(dbe->nwpath), "nw_optain_file_dir_info");
|
||||||
result = build_dir_info(dbe, infomask, responsedata);
|
result = build_dir_info(dbe, infomask, responsedata);
|
||||||
} else free_dbe_p(dbe);
|
} else free_dbe_p(dbe);
|
||||||
@ -654,12 +706,13 @@ int nw_optain_file_dir_info(int namespace, NW_HPATH *nwp,
|
|||||||
|
|
||||||
static int nw_init_search(int namespace,
|
static int nw_init_search(int namespace,
|
||||||
NW_HPATH *nwp,
|
NW_HPATH *nwp,
|
||||||
|
uint8 *pathes,
|
||||||
uint8 *responsedata)
|
uint8 *responsedata)
|
||||||
{
|
{
|
||||||
DIR_BASE_ENTRY *dbe=allocate_dbe_p(namespace);
|
DIR_BASE_ENTRY *dbe=allocate_dbe_p(namespace);
|
||||||
int result = -0xfb;
|
int result = -0xfb;
|
||||||
if (NULL != dbe) {
|
if (NULL != dbe) {
|
||||||
if ((result = build_dos_base(nwp, nwp->pathes, dbe, 0, NULL)) > -1) {
|
if ((result = build_base(namespace, nwp, pathes, dbe, 0, NULL)) > -1) {
|
||||||
result = base_open_seek_dir(dbe, 0L);
|
result = base_open_seek_dir(dbe, 0L);
|
||||||
if (result > -1) {
|
if (result > -1) {
|
||||||
*responsedata++ = dbe->nwpath.volume;
|
*responsedata++ = dbe->nwpath.volume;
|
||||||
@ -680,7 +733,7 @@ static int nw_init_search(int namespace,
|
|||||||
|
|
||||||
int get_add_new_entry(DIR_BASE_ENTRY *qbe, uint8 *path, int creatmode)
|
int get_add_new_entry(DIR_BASE_ENTRY *qbe, uint8 *path, int creatmode)
|
||||||
{
|
{
|
||||||
DIR_BASE_ENTRY *dbe=allocate_dbe_p(qbe->namespace);
|
DIR_BASE_ENTRY *dbe=allocate_dbe_p(qbe->nwpath.namespace);
|
||||||
if (NULL != dbe) {
|
if (NULL != dbe) {
|
||||||
N_NW_PATH *nwpath=&(dbe->nwpath);
|
N_NW_PATH *nwpath=&(dbe->nwpath);
|
||||||
int result = -0x9c;
|
int result = -0x9c;
|
||||||
@ -692,13 +745,103 @@ int get_add_new_entry(DIR_BASE_ENTRY *qbe, uint8 *path, int creatmode)
|
|||||||
*(++nwpath->fn) = '\0';
|
*(++nwpath->fn) = '\0';
|
||||||
}
|
}
|
||||||
strcpy(nwpath->fn, path);
|
strcpy(nwpath->fn, path);
|
||||||
result = insert_get_base_entry(dbe, qbe->namespace, creatmode);
|
result = insert_get_base_entry(dbe, qbe->nwpath.namespace, creatmode);
|
||||||
if (result < 0) free_dbe_p(dbe);
|
if (result < 0) free_dbe_p(dbe);
|
||||||
return(result);
|
return(result);
|
||||||
}
|
}
|
||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int namespace_fn_match(uint8 *s, uint8 *p, int namespace)
|
||||||
|
/* for other namespaces than DOS */
|
||||||
|
{
|
||||||
|
int pc, sc;
|
||||||
|
uint state = 0;
|
||||||
|
int anf, ende;
|
||||||
|
int not = 0;
|
||||||
|
uint found = 0;
|
||||||
|
while ( (pc = *p++) != 0) {
|
||||||
|
switch (state){
|
||||||
|
case 0 :
|
||||||
|
if (pc == 255) {
|
||||||
|
switch (pc=*p++) {
|
||||||
|
case 0xaa :
|
||||||
|
case '*' : pc=3000; break; /* star */
|
||||||
|
|
||||||
|
case 0xae :
|
||||||
|
case '.' : pc=1000; break; /* point */
|
||||||
|
|
||||||
|
case 0xbf :
|
||||||
|
case '?' : pc=2000; break; /* ? */
|
||||||
|
|
||||||
|
default : pc=*(--p);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else if (pc == '\\') continue;
|
||||||
|
|
||||||
|
switch (pc) {
|
||||||
|
case 1000: if ('.' != *s++) return(0);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2000: if (!*s++) return(0);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 3000 : if (!*p) return(1);
|
||||||
|
while (*s){
|
||||||
|
if (namespace_fn_match(s, p, namespace) == 1) return(1);
|
||||||
|
++s;
|
||||||
|
}
|
||||||
|
return(0);
|
||||||
|
|
||||||
|
case '[' : if ( (*p == '!') || (*p == '^') ){
|
||||||
|
++p;
|
||||||
|
not = 1;
|
||||||
|
}
|
||||||
|
state = 1;
|
||||||
|
continue;
|
||||||
|
|
||||||
|
default : if ( pc != *s &&
|
||||||
|
( namespace != NAME_OS2
|
||||||
|
|| (!isalpha(pc)) || (!isalpha(*s))
|
||||||
|
|| (pc | 0x20) != (*s | 0x20) ) )
|
||||||
|
return(0);
|
||||||
|
++s;
|
||||||
|
break;
|
||||||
|
|
||||||
|
} /* switch */
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 1 : /* Bereich von Zeichen */
|
||||||
|
sc = *s++;
|
||||||
|
found = not;
|
||||||
|
if (!sc) return(0);
|
||||||
|
do {
|
||||||
|
if (pc == '\\') pc = *(p++);
|
||||||
|
if (!pc) return(0);
|
||||||
|
anf = pc;
|
||||||
|
if (*p == '-' && *(p+1) != ']'){
|
||||||
|
ende = *(++p);
|
||||||
|
p++;
|
||||||
|
}
|
||||||
|
else ende = anf;
|
||||||
|
if (found == not) { /* only if not found */
|
||||||
|
if (anf == sc || (anf <= sc && sc <= ende))
|
||||||
|
found = !not;
|
||||||
|
}
|
||||||
|
} while ((pc = *(p++)) != ']');
|
||||||
|
if (! found ) return(0);
|
||||||
|
not = 0;
|
||||||
|
found = 0;
|
||||||
|
state = 0;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default : break;
|
||||||
|
} /* switch */
|
||||||
|
} /* while */
|
||||||
|
return ( (*s) ? 0 : 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int nw_search_file_dir(int namespace, int datastream,
|
int nw_search_file_dir(int namespace, int datastream,
|
||||||
uint32 searchattrib, uint32 infomask,
|
uint32 searchattrib, uint32 infomask,
|
||||||
int volume, uint32 basehandle, uint32 sequence,
|
int volume, uint32 basehandle, uint32 sequence,
|
||||||
@ -717,7 +860,8 @@ int nw_search_file_dir(int namespace, int datastream,
|
|||||||
int vol_options = get_volume_options(volume, 0);
|
int vol_options = get_volume_options(volume, 0);
|
||||||
dbe->locked++;
|
dbe->locked++;
|
||||||
strmaxcpy(entry, path, min(255, len));
|
strmaxcpy(entry, path, min(255, len));
|
||||||
if (vol_options & VOL_OPTION_DOWNSHIFT) downstr(entry);
|
if (namespace == NAME_DOS && (vol_options & VOL_OPTION_DOWNSHIFT))
|
||||||
|
downstr(entry);
|
||||||
XDPRINTF((5,0,"nw_search_file_dir searchpath=%s", entry));
|
XDPRINTF((5,0,"nw_search_file_dir searchpath=%s", entry));
|
||||||
while ((dirbuff = readdir(ds->fdir)) != (struct dirent*)NULL){
|
while ((dirbuff = readdir(ds->fdir)) != (struct dirent*)NULL){
|
||||||
if (dirbuff->d_ino) {
|
if (dirbuff->d_ino) {
|
||||||
@ -725,9 +869,11 @@ int nw_search_file_dir(int namespace, int datastream,
|
|||||||
XDPRINTF((10,0,"nw_search_file_dir Name=%s",
|
XDPRINTF((10,0,"nw_search_file_dir Name=%s",
|
||||||
name));
|
name));
|
||||||
if ( (name[0] != '.' && (
|
if ( (name[0] != '.' && (
|
||||||
(!strcmp(name, entry)) ||
|
(!strcmp(name, entry))
|
||||||
(entry[0] == '*' && entry[1] == '\0')
|
|| (entry[0] == '*' && entry[1] == '\0' && namespace != NAME_DOS)
|
||||||
|| fn_match(name, entry, vol_options)))) {
|
|| (namespace == NAME_DOS)
|
||||||
|
? fn_match(name, entry, vol_options)
|
||||||
|
: namespace_fn_match(name, entry, namespace) ))) {
|
||||||
strcpy(ds->kpath, name);
|
strcpy(ds->kpath, name);
|
||||||
XDPRINTF((5,0,"nw_search_file_dir Name found=%s unixname=%s",
|
XDPRINTF((5,0,"nw_search_file_dir Name found=%s unixname=%s",
|
||||||
name, ds->unixname));
|
name, ds->unixname));
|
||||||
@ -741,7 +887,8 @@ int nw_search_file_dir(int namespace, int datastream,
|
|||||||
}
|
}
|
||||||
if (flag) {
|
if (flag) {
|
||||||
strcpy(entry, name);
|
strcpy(entry, name);
|
||||||
if (vol_options & VOL_OPTION_DOWNSHIFT) upstr(entry);
|
if (namespace == NAME_DOS &&
|
||||||
|
(vol_options & VOL_OPTION_DOWNSHIFT)) upstr(entry);
|
||||||
if ((dest_entry = get_add_new_entry(dbe, entry, 0)) > -1)
|
if ((dest_entry = get_add_new_entry(dbe, entry, 0)) > -1)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -790,13 +937,18 @@ static int nw_open_creat_file_or_dir(int namespace,
|
|||||||
int exist=-1;
|
int exist=-1;
|
||||||
uint8 last_part[258];
|
uint8 last_part[258];
|
||||||
*last_part='\0';
|
*last_part='\0';
|
||||||
if ((result = build_dos_base(nwp, pathes, dbe, 0, NULL)) > -1) {
|
if ((result = build_base(namespace, nwp, pathes, dbe, 0, NULL)) > -1) {
|
||||||
exist = result;
|
exist = result;
|
||||||
} else if (opencreatmode & OPC_MODE_CREAT) {
|
} else if (opencreatmode & OPC_MODE_CREAT) {
|
||||||
result = build_dos_base(nwp, pathes, dbe, 1, last_part);
|
result = build_base(namespace, nwp, pathes, dbe, 1, last_part);
|
||||||
if (result > -1)
|
XDPRINTF((5, 0, "nw_open_c... result=%d, last_part='%s'",
|
||||||
|
result, last_part));
|
||||||
|
if (result > -1) {
|
||||||
result = get_add_new_entry(dbe, last_part,
|
result = get_add_new_entry(dbe, last_part,
|
||||||
(creatattrib & FILE_ATTR_DIR) ? FILE_ATTR_DIR : 1);
|
(creatattrib & FILE_ATTR_DIR) ? FILE_ATTR_DIR : 1);
|
||||||
|
if (result > -1)
|
||||||
|
dbe = dir_base[result];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (result > -1) {
|
if (result > -1) {
|
||||||
uint32 fhandle=0L;
|
uint32 fhandle=0L;
|
||||||
@ -844,7 +996,7 @@ static int nw_delete_file_dir(int namespace, int searchattrib,
|
|||||||
DIR_BASE_ENTRY *dbe = allocate_dbe_p(namespace);
|
DIR_BASE_ENTRY *dbe = allocate_dbe_p(namespace);
|
||||||
int result = -0xfb;
|
int result = -0xfb;
|
||||||
if (dbe != NULL) {
|
if (dbe != NULL) {
|
||||||
if ((result = build_dos_base(nwp, nwp->pathes, dbe, 0, NULL)) > -1) {
|
if ((result = build_base(namespace, nwp, nwp->pathes, dbe, 0, NULL)) > -1) {
|
||||||
uint8 *unname=(uint8*)nwpath_2_unix(&(dbe->nwpath), 2);
|
uint8 *unname=(uint8*)nwpath_2_unix(&(dbe->nwpath), 2);
|
||||||
if (get_volume_options(dbe->nwpath.volume, 1) &
|
if (get_volume_options(dbe->nwpath.volume, 1) &
|
||||||
VOL_OPTION_READONLY) result = -0x8a;
|
VOL_OPTION_READONLY) result = -0x8a;
|
||||||
@ -875,7 +1027,7 @@ static int nw_alloc_short_dir_handle(int namespace, int hmode,
|
|||||||
DIR_BASE_ENTRY *dbe=allocate_dbe_p(namespace);
|
DIR_BASE_ENTRY *dbe=allocate_dbe_p(namespace);
|
||||||
int result = -0xfb;
|
int result = -0xfb;
|
||||||
if (NULL != dbe) {
|
if (NULL != dbe) {
|
||||||
if ((result = build_dos_base(nwp, nwp->pathes, dbe, 0, NULL)) > -1) {
|
if ((result = build_base(namespace, nwp, nwp->pathes, dbe, 0, NULL)) > -1) {
|
||||||
if (S_ISDIR(dbe->nwpath.statb.st_mode)) {
|
if (S_ISDIR(dbe->nwpath.statb.st_mode)) {
|
||||||
result=xinsert_new_dir(dbe->nwpath.volume, dbe->nwpath.path,
|
result=xinsert_new_dir(dbe->nwpath.volume, dbe->nwpath.path,
|
||||||
dbe->nwpath.statb.st_ino, 300, hmode, task);
|
dbe->nwpath.statb.st_ino, 300, hmode, task);
|
||||||
@ -896,11 +1048,11 @@ static int nw_rename_file_dir(int namespace,
|
|||||||
DIR_BASE_ENTRY *dbe_d = (NULL != dbe_s) ? allocate_dbe_p(namespace) : NULL;
|
DIR_BASE_ENTRY *dbe_d = (NULL != dbe_s) ? allocate_dbe_p(namespace) : NULL;
|
||||||
int result = -0xfb;
|
int result = -0xfb;
|
||||||
if (dbe_d &&
|
if (dbe_d &&
|
||||||
(result = build_dos_base(nwps, pathes_s, dbe_s, 0, NULL)) > -1) {
|
(result = build_base(namespace, nwps, pathes_s, dbe_s, 0, NULL)) > -1) {
|
||||||
uint8 last_part[258];
|
uint8 last_part[258];
|
||||||
uint8 *unname_s=
|
uint8 *unname_s=
|
||||||
(uint8*)nwpath_2_unix1(&(dbe_s->nwpath), 2, 1);
|
(uint8*)nwpath_2_unix1(&(dbe_s->nwpath), 2, 1);
|
||||||
if ((result = build_dos_base(nwpd, pathes_d, dbe_d,
|
if ((result = build_base(namespace, nwpd, pathes_d, dbe_d,
|
||||||
1, last_part)) > -1) {
|
1, last_part)) > -1) {
|
||||||
uint8 *unname_d =
|
uint8 *unname_d =
|
||||||
(uint8*)nwpath_2_unix2(&(dbe_d->nwpath), 0, 1, last_part);
|
(uint8*)nwpath_2_unix2(&(dbe_d->nwpath), 0, 1, last_part);
|
||||||
@ -941,7 +1093,8 @@ static int nw_rename_file_dir(int namespace,
|
|||||||
int handle_func_0x57(uint8 *p, uint8 *responsedata, int task)
|
int handle_func_0x57(uint8 *p, uint8 *responsedata, int task)
|
||||||
{
|
{
|
||||||
int result = -0xfb; /* unknown request */
|
int result = -0xfb; /* unknown request */
|
||||||
int ufunc = (int) *p++; /* now p locates at 4 byte boundary */
|
int ufunc = (int) *p++;
|
||||||
|
/* now p locates at 4 byte boundary ! */
|
||||||
int namespace = (int) *p; /* for most calls */
|
int namespace = (int) *p; /* for most calls */
|
||||||
XDPRINTF((3, 0, "0x57 call ufunc=0x%x namespace=%d", ufunc, namespace));
|
XDPRINTF((3, 0, "0x57 call ufunc=0x%x namespace=%d", ufunc, namespace));
|
||||||
switch (ufunc) {
|
switch (ufunc) {
|
||||||
@ -965,8 +1118,12 @@ int handle_func_0x57(uint8 *p, uint8 *responsedata, int task)
|
|||||||
case 0x02 : /* Initialize Search */
|
case 0x02 : /* Initialize Search */
|
||||||
{
|
{
|
||||||
/* NW PATH STRUC */
|
/* NW PATH STRUC */
|
||||||
NW_HPATH *nwpathstruct = (NW_HPATH *) (p+2);
|
NW_HPATH nwpathstruct;
|
||||||
result = nw_init_search(namespace, nwpathstruct, responsedata);
|
memcpy(&nwpathstruct, p+2, sizeof(nwpathstruct));
|
||||||
|
result = nw_init_search(namespace,
|
||||||
|
&nwpathstruct,
|
||||||
|
p+9,
|
||||||
|
responsedata);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1099,8 +1256,16 @@ int handle_func_0x57(uint8 *p, uint8 *responsedata, int task)
|
|||||||
} *xdata= (struct OUTPUT*)responsedata;
|
} *xdata= (struct OUTPUT*)responsedata;
|
||||||
result=get_volume_options(volume, 0);
|
result=get_volume_options(volume, 0);
|
||||||
if (result >-1) {
|
if (result >-1) {
|
||||||
xdata->anz_name_spaces = (uint8) 1;
|
xdata->anz_name_spaces = (uint8) 0;
|
||||||
xdata->name_space_list[0] = (uint8) NAME_DOS;
|
if (result & VOL_NAMESPACE_DOS)
|
||||||
|
xdata->name_space_list[xdata->anz_name_spaces++]
|
||||||
|
= (uint8) NAME_DOS;
|
||||||
|
if (result & VOL_NAMESPACE_OS2)
|
||||||
|
xdata->name_space_list[xdata->anz_name_spaces++]
|
||||||
|
= (uint8) NAME_OS2;
|
||||||
|
if (result & VOL_NAMESPACE_NFS)
|
||||||
|
xdata->name_space_list[xdata->anz_name_spaces++]
|
||||||
|
= (uint8) NAME_NFS;
|
||||||
result=xdata->anz_name_spaces+1;
|
result=xdata->anz_name_spaces+1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1135,26 +1300,56 @@ int handle_func_0x56(uint8 *p, uint8 *responsedata, int task)
|
|||||||
int ufunc = (int) *p++; /* now p locates at 4 byte boundary */
|
int ufunc = (int) *p++; /* now p locates at 4 byte boundary */
|
||||||
XDPRINTF((3, 0, "0x56 call ufunc=0x%x", ufunc));
|
XDPRINTF((3, 0, "0x56 call ufunc=0x%x", ufunc));
|
||||||
switch (ufunc) {
|
switch (ufunc) {
|
||||||
#if 0
|
#if 1
|
||||||
|
case 0x01 : /* close extended attribute handle */
|
||||||
|
{
|
||||||
|
uint32 ea_handle=GET_BE32(p+2);
|
||||||
|
result=0; /* dummy */
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 0x02 : /* write extended attribute handle */
|
||||||
|
{
|
||||||
|
result=0; /* dummy */
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case 0x03 : /* read extended attribute */
|
case 0x03 : /* read extended attribute */
|
||||||
{
|
{
|
||||||
int flags = GET_BE16(p);
|
int flags = GET_16(p); /* LOW-HIGH */
|
||||||
/* next 2 entries only if flags bits 0-1 = 00 */
|
/* next 2 entries only if flags bits 0-1 = 00 */
|
||||||
|
/* (~(flags & 3)) volume + basehandle */
|
||||||
|
/* ( flag s & 2) eahandle + basehandle */
|
||||||
int volume = (int)GET_32(p+2);
|
int volume = (int)GET_32(p+2);
|
||||||
uint32 basehandle = (int)GET_32(p+6);
|
uint32 basehandle = (int)GET_32(p+6);
|
||||||
|
|
||||||
|
uint32 readpos = GET_32(p+10);
|
||||||
|
uint32 size = GET_32(p+14);
|
||||||
|
uint16 keylen = GET_16(p+18); /* LOW-HIGH */
|
||||||
struct OUTPUT {
|
struct OUTPUT {
|
||||||
uint8 errorcode[4]; /* ???? */
|
uint8 errorcode[4]; /* LOW-HIGH */
|
||||||
uint8 ttl_v_length[4]; /* ???? */
|
uint8 ttl_v_length[4]; /* LOW-HIGH */
|
||||||
uint8 ea_handle[4]; /* ???? */
|
uint8 ea_handle[4]; /* ???? */
|
||||||
uint8 access[4]; /* ???? */
|
uint8 access[4]; /* ???? */
|
||||||
uint8 value_length[2]; /* ???? */
|
uint8 value_length[2]; /* LOW-HIGH */
|
||||||
uint8 value[2];
|
uint8 value[2];
|
||||||
} *xdata= (struct OUTPUT*)responsedata;
|
} *xdata= (struct OUTPUT*)responsedata;
|
||||||
memset(xdata, 0, sizeof(struct OUTPUT));
|
memset(xdata, 0, sizeof(struct OUTPUT));
|
||||||
/* U32_TO_BE32(1, xdata->errorcode); */
|
U32_TO_32(0xc9, xdata->errorcode); /* NO extended Attributes */
|
||||||
result = sizeof(struct OUTPUT);
|
result = sizeof(struct OUTPUT);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 0x04 : /* enumerate extended attributes */
|
||||||
|
{
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 0x05 : /* duplicate extended attributes */
|
||||||
|
{
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
default : result = -0xfb; /* unknown request */
|
default : result = -0xfb; /* unknown request */
|
||||||
} /* switch */
|
} /* switch */
|
||||||
|
14
ncpserv.c
14
ncpserv.c
@ -34,6 +34,7 @@ static int ipx_out_fd=-1;
|
|||||||
|
|
||||||
static int tells_server_version=0;
|
static int tells_server_version=0;
|
||||||
static int sock_nwbind=-1;
|
static int sock_nwbind=-1;
|
||||||
|
static int sock_echo =-1;
|
||||||
|
|
||||||
|
|
||||||
static int get_ini(void)
|
static int get_ini(void)
|
||||||
@ -309,6 +310,7 @@ static int find_get_conn_nr(ipxAddr_t *addr)
|
|||||||
char connstr[20];
|
char connstr[20];
|
||||||
char addrstr[100];
|
char addrstr[100];
|
||||||
char nwbindsock[20];
|
char nwbindsock[20];
|
||||||
|
char echosock[20];
|
||||||
|
|
||||||
int j = 3;
|
int j = 3;
|
||||||
#if !CALL_NWCONN_OVER_SOCKET
|
#if !CALL_NWCONN_OVER_SOCKET
|
||||||
@ -327,9 +329,9 @@ static int find_get_conn_nr(ipxAddr_t *addr)
|
|||||||
sprintf(connstr, "%d", connection);
|
sprintf(connstr, "%d", connection);
|
||||||
ipx_addr_to_adr(addrstr, addr);
|
ipx_addr_to_adr(addrstr, addr);
|
||||||
sprintf(nwbindsock, "%04x", sock_nwbind);
|
sprintf(nwbindsock, "%04x", sock_nwbind);
|
||||||
|
sprintf(echosock, "%04x", sock_echo);
|
||||||
execl(get_exec_path(pathname, progname), progname,
|
execl(get_exec_path(pathname, progname), progname,
|
||||||
pidstr, addrstr, connstr, nwbindsock, NULL);
|
pidstr, addrstr, connstr, nwbindsock, echosock, NULL);
|
||||||
|
|
||||||
exit(1); /* normaly not reached */
|
exit(1); /* normaly not reached */
|
||||||
}
|
}
|
||||||
@ -632,7 +634,7 @@ static void handle_ncp_request(void)
|
|||||||
&& IPXCMPNET (from_addr.net, my_addr.net)) {
|
&& IPXCMPNET (from_addr.net, my_addr.net)) {
|
||||||
/* comes from nwserv */
|
/* comes from nwserv */
|
||||||
handle_ctrl();
|
handle_ctrl();
|
||||||
#if _MAR_TESTS_
|
#ifdef _MAR_TESTS_xx
|
||||||
} else if (type == 0xc000) {
|
} else if (type == 0xc000) {
|
||||||
/* rprinter */
|
/* rprinter */
|
||||||
int connection = (int)ncprequest->connection;
|
int connection = (int)ncprequest->connection;
|
||||||
@ -651,8 +653,8 @@ static void handle_ncp_request(void)
|
|||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
init_tools(NCPSERV, 0);
|
init_tools(NCPSERV, 0);
|
||||||
if (argc != 4) {
|
if (argc != 5) {
|
||||||
errorp(1, "Usage:", "ncpserv nwname address nwbindsock");
|
errorp(1, "Usage:", "%s: nwname address nwbindsock echosocket", argv[0]);
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
get_ini();
|
get_ini();
|
||||||
@ -660,6 +662,8 @@ int main(int argc, char *argv[])
|
|||||||
my_nwname[47] = '\0';
|
my_nwname[47] = '\0';
|
||||||
adr_to_ipx_addr(&my_addr, argv[2]);
|
adr_to_ipx_addr(&my_addr, argv[2]);
|
||||||
sscanf(argv[3], "%x", &sock_nwbind);
|
sscanf(argv[3], "%x", &sock_nwbind);
|
||||||
|
sscanf(argv[4], "%x", &sock_echo);
|
||||||
|
|
||||||
#ifdef LINUX
|
#ifdef LINUX
|
||||||
set_emu_tli();
|
set_emu_tli();
|
||||||
#endif
|
#endif
|
||||||
|
12
net.h
12
net.h
@ -237,17 +237,14 @@ extern int errno;
|
|||||||
# define IPX_MAX_DATA 546
|
# define IPX_MAX_DATA 546
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef SOCK_EXTERN
|
||||||
|
# define SOCK_EXTERN 0 /* no external SOCKET */
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef DO_TESTING
|
#ifndef DO_TESTING
|
||||||
# define DO_TESTING 0
|
# define DO_TESTING 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !DO_TESTING
|
|
||||||
# undef _MAR_TESTS_
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef _MAR_TESTS_
|
|
||||||
# define _MAR_TESTS_ 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef LINUX
|
#ifdef LINUX
|
||||||
# ifdef IN_NWROUTED
|
# ifdef IN_NWROUTED
|
||||||
@ -403,6 +400,7 @@ typedef struct S_OWN_DATA OWN_DATA;
|
|||||||
#define SOCK_PSERVER 0x8060 /* Print Server's Socket */
|
#define SOCK_PSERVER 0x8060 /* Print Server's Socket */
|
||||||
#define SOCK_NVT 0x8063 /* NVT (Network Virtual Terminal) */
|
#define SOCK_NVT 0x8063 /* NVT (Network Virtual Terminal) */
|
||||||
|
|
||||||
|
|
||||||
/* PACKET TYPES */
|
/* PACKET TYPES */
|
||||||
#define PACKT_0 0 /* unknown */
|
#define PACKT_0 0 /* unknown */
|
||||||
#define PACKT_ROUTE 1 /* Routing Information */
|
#define PACKT_ROUTE 1 /* Routing Information */
|
||||||
|
2
nwbind.c
2
nwbind.c
@ -1312,7 +1312,7 @@ static int xread(IPX_DATA *ipxd, int *offs, uint8 *data, int size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void handle_ctrl(void)
|
static void handle_ctrl(void)
|
||||||
/* reads stdin pipe or packets from nwserv/ncpserv */
|
/* reads packets from nwserv/ncpserv */
|
||||||
{
|
{
|
||||||
IPX_DATA ipxd;
|
IPX_DATA ipxd;
|
||||||
int what;
|
int what;
|
||||||
|
12
nwclient.c
12
nwclient.c
@ -356,7 +356,7 @@ static int allocate_dir_handle(int dirhandle,
|
|||||||
if (!handle_event()) return((int) *responsedata);
|
if (!handle_event()) return((int) *responsedata);
|
||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
|
#if 0
|
||||||
static void scan_irgendwas(int dirhandle, int attrib, char *name)
|
static void scan_irgendwas(int dirhandle, int attrib, char *name)
|
||||||
{
|
{
|
||||||
uint8 *p = requestdata;
|
uint8 *p = requestdata;
|
||||||
@ -409,7 +409,7 @@ static int get_dir_path(int dirhandle)
|
|||||||
}
|
}
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
static void get_connection_info(int conn)
|
static void get_connection_info(int conn)
|
||||||
/* liefert Connection INFO */
|
/* liefert Connection INFO */
|
||||||
{
|
{
|
||||||
@ -521,7 +521,7 @@ static void send_console_broadcast(char *message)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
|
||||||
static int get_bindery_object_name(uint32 id)
|
static int get_bindery_object_name(uint32 id)
|
||||||
{
|
{
|
||||||
@ -536,7 +536,7 @@ static int get_bindery_object_name(uint32 id)
|
|||||||
}
|
}
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static int get_volume_restriction_for_obj(uint32 id, int volnr)
|
static int get_volume_restriction_for_obj(uint32 id, int volnr)
|
||||||
{
|
{
|
||||||
@ -576,7 +576,7 @@ static int login_object(int type, char *name, char *password)
|
|||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
static void test_xx()
|
static void test_xx()
|
||||||
{
|
{
|
||||||
uint8 data[] = {0x0,0x1c,0xf,0xff,0xff,0x0,0x0,0x16,'S','Y','S',':','S','Y','S','T','E','M','\\','N','E','T','$','O','B','J','.','O','L','D'} ;
|
uint8 data[] = {0x0,0x1c,0xf,0xff,0xff,0x0,0x0,0x16,'S','Y','S',':','S','Y','S','T','E','M','\\','N','E','T','$','O','B','J','.','O','L','D'} ;
|
||||||
@ -585,7 +585,7 @@ static void test_xx()
|
|||||||
;
|
;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static int open_datei(int dirhandle, int attrib, int ext_attrib, char *name)
|
static int open_datei(int dirhandle, int attrib, int ext_attrib, char *name)
|
||||||
|
47
nwconn.c
47
nwconn.c
@ -1,4 +1,4 @@
|
|||||||
/* nwconn.c 04-May-96 */
|
/* nwconn.c 13-Jul-96 */
|
||||||
/* one process / connection */
|
/* one process / connection */
|
||||||
|
|
||||||
/* (C)opyright (C) 1993,1996 Martin Stover, Marburg, Germany
|
/* (C)opyright (C) 1993,1996 Martin Stover, Marburg, Germany
|
||||||
@ -52,6 +52,7 @@ static NCPREQUEST *ncprequest = (NCPREQUEST*)readbuff;
|
|||||||
static uint8 *requestdata = readbuff + sizeof(NCPREQUEST);
|
static uint8 *requestdata = readbuff + sizeof(NCPREQUEST);
|
||||||
static int ncp_type;
|
static int ncp_type;
|
||||||
static int sock_nwbind=-1;
|
static int sock_nwbind=-1;
|
||||||
|
static int sock_echo =-1;
|
||||||
|
|
||||||
static int req_printed=0;
|
static int req_printed=0;
|
||||||
|
|
||||||
@ -359,6 +360,7 @@ static int handle_ncp_serv(void)
|
|||||||
if (code) completition = (uint8) -code;
|
if (code) completition = (uint8) -code;
|
||||||
} else if (*p == 0xd){ /* Add Trustees to DIR */
|
} else if (*p == 0xd){ /* Add Trustees to DIR */
|
||||||
/******** AddTrustesstoDir ***************/
|
/******** AddTrustesstoDir ***************/
|
||||||
|
#if 0
|
||||||
struct INPUT {
|
struct INPUT {
|
||||||
uint8 header[7]; /* Requestheader */
|
uint8 header[7]; /* Requestheader */
|
||||||
uint8 div[3]; /* 0x0, dlen, typ */
|
uint8 div[3]; /* 0x0, dlen, typ */
|
||||||
@ -369,6 +371,7 @@ static int handle_ncp_serv(void)
|
|||||||
uint8 path;
|
uint8 path;
|
||||||
} *input = (struct INPUT *) (ncprequest);
|
} *input = (struct INPUT *) (ncprequest);
|
||||||
/* TODO !!!!!!!!!!!!!!!!!!!! */
|
/* TODO !!!!!!!!!!!!!!!!!!!! */
|
||||||
|
#endif
|
||||||
do_druck++;
|
do_druck++;
|
||||||
} else if (*p == 0xf){ /* rename dir */
|
} else if (*p == 0xf){ /* rename dir */
|
||||||
/******** Rename DIR *********************/
|
/******** Rename DIR *********************/
|
||||||
@ -451,6 +454,7 @@ static int handle_ncp_serv(void)
|
|||||||
}
|
}
|
||||||
completition = (uint8)-result;
|
completition = (uint8)-result;
|
||||||
} else if (*p == 0x19){ /* Set Directory Information */
|
} else if (*p == 0x19){ /* Set Directory Information */
|
||||||
|
#if 0
|
||||||
struct INPUT {
|
struct INPUT {
|
||||||
uint8 header[7]; /* Requestheader */
|
uint8 header[7]; /* Requestheader */
|
||||||
uint8 div[3]; /* 0x0, dlen, typ */
|
uint8 div[3]; /* 0x0, dlen, typ */
|
||||||
@ -460,9 +464,11 @@ static int handle_ncp_serv(void)
|
|||||||
uint8 pathlen;
|
uint8 pathlen;
|
||||||
uint8 path;
|
uint8 path;
|
||||||
} *input = (struct INPUT *) (ncprequest);
|
} *input = (struct INPUT *) (ncprequest);
|
||||||
|
#endif
|
||||||
/* No REPLY */
|
/* No REPLY */
|
||||||
completition = 0xfb; /* !!!!! TODO !!!! */
|
completition = 0xfb; /* !!!!! TODO !!!! */
|
||||||
} else if (*p == 0x1a){ /* Get Pathname of A Volume Dir Pair */
|
} else if (*p == 0x1a){ /* Get Pathname of A Volume Dir Pair */
|
||||||
|
#if 0
|
||||||
struct INPUT {
|
struct INPUT {
|
||||||
uint8 header[7]; /* Requestheader */
|
uint8 header[7]; /* Requestheader */
|
||||||
uint8 div[3]; /* 0x0, dlen, typ */
|
uint8 div[3]; /* 0x0, dlen, typ */
|
||||||
@ -473,6 +479,7 @@ static int handle_ncp_serv(void)
|
|||||||
uint8 pathlen;
|
uint8 pathlen;
|
||||||
uint8 pathname;
|
uint8 pathname;
|
||||||
} *xdata = (struct XDATA*)responsedata;
|
} *xdata = (struct XDATA*)responsedata;
|
||||||
|
#endif
|
||||||
completition = 0xfb; /* !!!!! TODO !!!! */
|
completition = 0xfb; /* !!!!! TODO !!!! */
|
||||||
} else if (*p == 0x1e){
|
} else if (*p == 0x1e){
|
||||||
/* SCAN a Directory */
|
/* SCAN a Directory */
|
||||||
@ -566,6 +573,7 @@ static int handle_ncp_serv(void)
|
|||||||
} else completition = 0x9c; /* no more trustees */
|
} else completition = 0x9c; /* no more trustees */
|
||||||
} else completition = (uint8) (-result);
|
} else completition = (uint8) (-result);
|
||||||
} else if (*p == 0x27) { /* Add Trustees to DIR ?? */
|
} else if (*p == 0x27) { /* Add Trustees to DIR ?? */
|
||||||
|
#if 0
|
||||||
struct INPUT {
|
struct INPUT {
|
||||||
uint8 header[7]; /* Requestheader */
|
uint8 header[7]; /* Requestheader */
|
||||||
uint8 div[3]; /* 0x0, dlen, typ */
|
uint8 div[3]; /* 0x0, dlen, typ */
|
||||||
@ -577,6 +585,7 @@ static int handle_ncp_serv(void)
|
|||||||
uint8 path;
|
uint8 path;
|
||||||
} *input = (struct INPUT *) (ncprequest);
|
} *input = (struct INPUT *) (ncprequest);
|
||||||
/* TODO !!!!!!!!!!!!!!!!!!!! */
|
/* TODO !!!!!!!!!!!!!!!!!!!! */
|
||||||
|
#endif
|
||||||
do_druck++;
|
do_druck++;
|
||||||
} else if (*p == 0x29){
|
} else if (*p == 0x29){
|
||||||
/* read volume restrictions for an object */
|
/* read volume restrictions for an object */
|
||||||
@ -895,14 +904,13 @@ static int handle_ncp_serv(void)
|
|||||||
} else completition = (uint8) -rights;
|
} else completition = (uint8) -rights;
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
|
|
||||||
case 0x3f : { /* file search continue */
|
case 0x3f : { /* file search continue */
|
||||||
/* Dir_id is from file search init */
|
/* Dir_id is from file search init */
|
||||||
struct INPUT {
|
struct INPUT {
|
||||||
uint8 header[7]; /* Requestheader */
|
uint8 header[7]; /* Requestheader */
|
||||||
uint8 volume; /* Volume ID */
|
uint8 volume; /* Volume ID */
|
||||||
uint8 dir_id[2]; /* von File Search Init */
|
uint8 dir_id[2]; /* von File Search Init */
|
||||||
uint8 searchsequence[2]; /* FRAGE Sequence FFFF ertster Eintrag */
|
uint8 searchsequence[2]; /* sequence FFFF = first entry */
|
||||||
uint8 search_attrib; /* Attribute */
|
uint8 search_attrib; /* Attribute */
|
||||||
/* 0 none,
|
/* 0 none,
|
||||||
2 HIDDEN,
|
2 HIDDEN,
|
||||||
@ -916,7 +924,7 @@ static int handle_ncp_serv(void)
|
|||||||
int len=input->len ; /* FN Length */
|
int len=input->len ; /* FN Length */
|
||||||
|
|
||||||
struct OUTPUT {
|
struct OUTPUT {
|
||||||
uint8 searchsequence[2]; /* FRAGE Sequence */
|
uint8 searchsequence[2]; /* same as request sequence */
|
||||||
uint8 dir_id[2]; /* Direktory ID */
|
uint8 dir_id[2]; /* Direktory ID */
|
||||||
/* is correct !! */
|
/* is correct !! */
|
||||||
union {
|
union {
|
||||||
@ -1318,12 +1326,26 @@ static int handle_ncp_serv(void)
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 0
|
#ifdef _MAR_TESTS_
|
||||||
case 0x61 : { /* Negotiate Buffer Size, Packetsize new ??? */
|
case 0x61 : { /* Negotiate Buffer Size, Packetsize new ? */
|
||||||
/* > 3.11 */
|
/* > 3.11 */
|
||||||
/* similar request as 0x21 */
|
int wantsize = GET_BE16((uint8*)ncprequest);
|
||||||
|
/* wantsize is here normally 1500 */
|
||||||
|
/* 1 byte unknown ( zero ) */
|
||||||
|
struct OUTPUT {
|
||||||
|
uint8 getsize[2];
|
||||||
|
uint8 socket[2]; /* socket for echo ?? */
|
||||||
|
uint8 unknown; /* zero */
|
||||||
|
} *xdata= (struct OUTPUT*)responsedata;
|
||||||
|
memset(xdata, 0, sizeof(*xdata));
|
||||||
|
wantsize = min(1500, wantsize);
|
||||||
|
U16_TO_BE16(wantsize, xdata->getsize);
|
||||||
|
U16_TO_BE16(sock_echo, xdata->socket);
|
||||||
|
data_len = sizeof(*xdata);
|
||||||
|
XDPRINTF((5,0, "Negotiate Buffer (new) =0x%04x,(%d)",
|
||||||
|
(int) wantsize, (int) wantsize));
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
@ -1376,7 +1398,6 @@ static void handle_after_bind()
|
|||||||
switch (ncprequest->function) {
|
switch (ncprequest->function) {
|
||||||
case 0x17 : { /* FILE SERVER ENVIRONMENT */
|
case 0x17 : { /* FILE SERVER ENVIRONMENT */
|
||||||
uint8 ufunc = *(requestdata+2);
|
uint8 ufunc = *(requestdata+2);
|
||||||
uint8 *rdata = requestdata+3;
|
|
||||||
switch (ufunc) {
|
switch (ufunc) {
|
||||||
case 0x14: /* Login Objekt, unencrypted passwords */
|
case 0x14: /* Login Objekt, unencrypted passwords */
|
||||||
case 0x18: { /* crypt_keyed LOGIN */
|
case 0x18: { /* crypt_keyed LOGIN */
|
||||||
@ -1486,12 +1507,15 @@ static void set_sig(void)
|
|||||||
signal(SIGINT, sig_quit);
|
signal(SIGINT, sig_quit);
|
||||||
signal(SIGPIPE, sig_pipe);
|
signal(SIGPIPE, sig_pipe);
|
||||||
signal(SIGHUP, sig_hup);
|
signal(SIGHUP, sig_hup);
|
||||||
|
#if USE_MMAP
|
||||||
|
signal(SIGBUS, sig_bus_mmap); /* in nwfile.c */
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
if (argc != 5) {
|
if (argc != 6) {
|
||||||
fprintf(stderr, "usage nwconn PID FROM_ADDR Connection nwbindsock\n");
|
fprintf(stderr, "usage nwconn PID FROM_ADDR Connection nwbindsock echosock\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
} else father_pid = atoi(*(argv+1));
|
} else father_pid = atoi(*(argv+1));
|
||||||
setuid(0);
|
setuid(0);
|
||||||
@ -1509,6 +1533,7 @@ int main(int argc, char **argv)
|
|||||||
act_pid = getpid();
|
act_pid = getpid();
|
||||||
|
|
||||||
sscanf(argv[4], "%x", &sock_nwbind);
|
sscanf(argv[4], "%x", &sock_nwbind);
|
||||||
|
sscanf(argv[5], "%x", &sock_echo);
|
||||||
|
|
||||||
#ifdef LINUX
|
#ifdef LINUX
|
||||||
set_emu_tli();
|
set_emu_tli();
|
||||||
|
@ -119,6 +119,9 @@ static buf32 encryptkeys =
|
|||||||
0xF4,0x47,0xDC,0xA7,0xEC,0xCF,0x50,0xC0};
|
0xF4,0x47,0xDC,0xA7,0xEC,0xCF,0x50,0xC0};
|
||||||
|
|
||||||
#include "nwcrypt.h"
|
#include "nwcrypt.h"
|
||||||
|
|
||||||
|
extern void memset(void* p, int c, int size);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
shuffle1(buf32 temp, unsigned char *target)
|
shuffle1(buf32 temp, unsigned char *target)
|
||||||
{
|
{
|
||||||
|
4
nwdbm.c
4
nwdbm.c
@ -1445,7 +1445,7 @@ int nw_fill_standard(char *servername, ipxAddr_t *adr)
|
|||||||
uint32 ngr_id = 0x0C000001;
|
uint32 ngr_id = 0x0C000001;
|
||||||
uint32 ps1_id = 0x0D000001;
|
uint32 ps1_id = 0x0D000001;
|
||||||
#endif
|
#endif
|
||||||
#if _MAR_TESTS_
|
#ifdef _MAR_TESTS_1
|
||||||
uint32 pserv_id = 0L;
|
uint32 pserv_id = 0L;
|
||||||
#endif
|
#endif
|
||||||
FILE *f = open_nw_ini();
|
FILE *f = open_nw_ini();
|
||||||
@ -1546,7 +1546,7 @@ int nw_fill_standard(char *servername, ipxAddr_t *adr)
|
|||||||
"NET_ADDRESS", P_FL_ITEM | P_FL_DYNA, 0x40,
|
"NET_ADDRESS", P_FL_ITEM | P_FL_DYNA, 0x40,
|
||||||
(char*)adr, sizeof(ipxAddr_t));
|
(char*)adr, sizeof(ipxAddr_t));
|
||||||
|
|
||||||
#if _MAR_TESTS_
|
#ifdef _MAR_TESTS_1
|
||||||
nw_new_obj_prop(pserv_id, serverna, 0x47, O_FL_DYNA, 0x31,
|
nw_new_obj_prop(pserv_id, serverna, 0x47, O_FL_DYNA, 0x31,
|
||||||
"NET_ADDRESS", P_FL_ITEM | P_FL_DYNA, 0x40,
|
"NET_ADDRESS", P_FL_ITEM | P_FL_DYNA, 0x40,
|
||||||
(char*)adr, sizeof(ipxAddr_t));
|
(char*)adr, sizeof(ipxAddr_t));
|
||||||
|
37
nwfile.c
37
nwfile.c
@ -1,4 +1,4 @@
|
|||||||
/* nwfile.c 11-May-96 */
|
/* nwfile.c 16-Jul-96 */
|
||||||
/* (C)opyright (C) 1993,1996 Martin Stover, Marburg, Germany
|
/* (C)opyright (C) 1993,1996 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
|
||||||
@ -29,6 +29,13 @@
|
|||||||
#include "nwconn.h"
|
#include "nwconn.h"
|
||||||
#if USE_MMAP
|
#if USE_MMAP
|
||||||
# include <sys/mman.h>
|
# include <sys/mman.h>
|
||||||
|
static got_sig_bus=0;
|
||||||
|
void sig_bus_mmap(int rsig)
|
||||||
|
{
|
||||||
|
got_sig_bus++;
|
||||||
|
XDPRINTF((2,0, "Got sig_bus"));
|
||||||
|
signal(SIGBUS, sig_bus_mmap);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static FILE_HANDLE file_handles[MAX_FILE_HANDLES_CONN];
|
static FILE_HANDLE file_handles[MAX_FILE_HANDLES_CONN];
|
||||||
@ -116,7 +123,9 @@ void init_file_module(void)
|
|||||||
int file_creat_open(int volume, uint8 *unixname, struct stat *stbuff,
|
int file_creat_open(int volume, uint8 *unixname, struct stat *stbuff,
|
||||||
int attrib, int access, int creatmode)
|
int attrib, int access, int creatmode)
|
||||||
/*
|
/*
|
||||||
* creatmode: 0 = open | 1 = creat | 2 = creatnew & 4 == save handle
|
* creatmode: 0 = open | 1 = creat (ever) | 2 = creatnew ( creat if not exist )
|
||||||
|
* & 4 == save handle (creat)
|
||||||
|
* & 8 == ignore rights (create ever)
|
||||||
* attrib ??
|
* attrib ??
|
||||||
*
|
*
|
||||||
* access: 0x1=read,
|
* access: 0x1=read,
|
||||||
@ -181,7 +190,17 @@ int file_creat_open(int volume, uint8 *unixname, struct stat *stbuff,
|
|||||||
XDPRINTF((5,0,"CREAT FILE, ever with attrib:0x%x, access:0x%x, fh->fname:%s: handle:%d",
|
XDPRINTF((5,0,"CREAT FILE, ever with attrib:0x%x, access:0x%x, fh->fname:%s: handle:%d",
|
||||||
attrib, access, fh->fname, fhandle));
|
attrib, access, fh->fname, fhandle));
|
||||||
fh->fd = open(fh->fname, O_CREAT|O_TRUNC|O_RDWR, 0777);
|
fh->fd = open(fh->fname, O_CREAT|O_TRUNC|O_RDWR, 0777);
|
||||||
if (fh->fd < 0) completition = -0x85; /* no delete /create Rights */
|
if (fh->fd < 0) {
|
||||||
|
if (creatmode & 0x8) {
|
||||||
|
if ( (!seteuid(0)) && (-1 < (fh->fd =
|
||||||
|
open(fh->fname, O_CREAT|O_TRUNC|O_RDWR, 0777)))) {
|
||||||
|
chown(fh->fname, act_uid, act_gid);
|
||||||
|
}
|
||||||
|
set_guid(act_gid, act_uid);
|
||||||
|
}
|
||||||
|
if (fh->fd < 0)
|
||||||
|
completition = -0x85; /* no delete /create Rights */
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (fh->fd > -1) {
|
if (fh->fd > -1) {
|
||||||
close(fh->fd);
|
close(fh->fd);
|
||||||
@ -342,11 +361,21 @@ int nw_read_datei(int fhandle, uint8 *data, int size, uint32 offset)
|
|||||||
} else {
|
} else {
|
||||||
#if USE_MMAP
|
#if USE_MMAP
|
||||||
if (fh->p_mmap) {
|
if (fh->p_mmap) {
|
||||||
|
while (1) {
|
||||||
if (offset < fh->size_mmap) {
|
if (offset < fh->size_mmap) {
|
||||||
if (size + offset > fh->size_mmap)
|
if (size + offset > fh->size_mmap)
|
||||||
size = fh->size_mmap - offset;
|
size = fh->size_mmap - offset;
|
||||||
memcpy(data, fh->p_mmap+offset, size);
|
memcpy(data, fh->p_mmap+offset, size);
|
||||||
} else size=-1;
|
if (got_sig_bus) {
|
||||||
|
fh->size_mmap = lseek(fh->fd, 0L, SEEK_END);
|
||||||
|
got_sig_bus = 0;
|
||||||
|
} else
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
size=-1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} /* while */
|
||||||
} else {
|
} else {
|
||||||
#endif
|
#endif
|
||||||
if (fh->offd != (long)offset) {
|
if (fh->offd != (long)offset) {
|
||||||
|
2
nwfile.h
2
nwfile.h
@ -24,6 +24,8 @@ typedef struct {
|
|||||||
#define FH_DO_NOT_REUSE 0x04
|
#define FH_DO_NOT_REUSE 0x04
|
||||||
#define FH_IS_READONLY 0x20
|
#define FH_IS_READONLY 0x20
|
||||||
|
|
||||||
|
extern void sig_bus_mmap(int rsig);
|
||||||
|
|
||||||
extern void init_file_module(void);
|
extern void init_file_module(void);
|
||||||
|
|
||||||
extern int file_creat_open(int volume, uint8 *unixname,
|
extern int file_creat_open(int volume, uint8 *unixname,
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* nwconn.c 04-May-96 */
|
/* nwconn.c 16-Jul-96 */
|
||||||
/* (C)opyright (C) 1993,1996 Martin Stover, Marburg, Germany
|
/* (C)opyright (C) 1993,1996 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
|
||||||
@ -273,7 +273,7 @@ static int create_queue_file(uint8 *job_file_name,
|
|||||||
if (result > -1)
|
if (result > -1)
|
||||||
result = nw_creat_open_file(result, job_file_name+1,
|
result = nw_creat_open_file(result, job_file_name+1,
|
||||||
(int) *job_file_name,
|
(int) *job_file_name,
|
||||||
&fnfo, 0x6, 0x6, 1 | 4);
|
&fnfo, 0x6, 0x6, 1 | 4 | 8);
|
||||||
|
|
||||||
XDPRINTF((5,0,"creat queue file bez=`%s` handle=%d",
|
XDPRINTF((5,0,"creat queue file bez=`%s` handle=%d",
|
||||||
job_bez, result));
|
job_bez, result));
|
||||||
|
83
nwserv.c
83
nwserv.c
@ -39,7 +39,12 @@ int wdogs_till_tics = 0; /* send wdogs to all */
|
|||||||
int anz_net_devices=0;
|
int anz_net_devices=0;
|
||||||
NW_NET_DEVICE *net_devices[MAX_NET_DEVICES];
|
NW_NET_DEVICE *net_devices[MAX_NET_DEVICES];
|
||||||
|
|
||||||
|
#if !IN_NWROUTED
|
||||||
uint16 ipx_sock_nummern[]={ SOCK_AUTO /* WDOG */
|
uint16 ipx_sock_nummern[]={ SOCK_AUTO /* WDOG */
|
||||||
|
# ifdef EXTERN_SLOT
|
||||||
|
,SOCK_EXTERN /* Xmarsmon */
|
||||||
|
# endif
|
||||||
|
|
||||||
# ifdef PSERVER_SLOT
|
# ifdef PSERVER_SLOT
|
||||||
,SOCK_PSERVER
|
,SOCK_PSERVER
|
||||||
# endif
|
# endif
|
||||||
@ -49,6 +54,9 @@ uint16 ipx_sock_nummern[]={ SOCK_AUTO /* WDOG */
|
|||||||
# else
|
# else
|
||||||
,SOCK_AUTO
|
,SOCK_AUTO
|
||||||
# endif
|
# endif
|
||||||
|
#else
|
||||||
|
uint16 ipx_sock_nummern[]={SOCK_SAP
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef RIP_SLOT
|
#ifdef RIP_SLOT
|
||||||
,SOCK_RIP
|
,SOCK_RIP
|
||||||
@ -70,6 +78,7 @@ uint16 ipx_sock_nummern[]={ SOCK_AUTO /* WDOG */
|
|||||||
};
|
};
|
||||||
|
|
||||||
#define NEEDED_SOCKETS (sizeof(ipx_sock_nummern) / sizeof(uint16))
|
#define NEEDED_SOCKETS (sizeof(ipx_sock_nummern) / sizeof(uint16))
|
||||||
|
|
||||||
#if IN_NWROUTED
|
#if IN_NWROUTED
|
||||||
# define NEEDED_POLLS (NEEDED_SOCKETS+1)
|
# define NEEDED_POLLS (NEEDED_SOCKETS+1)
|
||||||
#else
|
#else
|
||||||
@ -247,6 +256,7 @@ static int start_ncpserv(char *nwname, ipxAddr_t *addr)
|
|||||||
char addrstr[100];
|
char addrstr[100];
|
||||||
char pathname[300];
|
char pathname[300];
|
||||||
char nwbindsock[20];
|
char nwbindsock[20];
|
||||||
|
char echosock[20];
|
||||||
int j = FD_NWSERV;
|
int j = FD_NWSERV;
|
||||||
close(fds_in[0]); /* no need to read */
|
close(fds_in[0]); /* no need to read */
|
||||||
dup2(fds_in[1], FD_NWSERV); /* becommes fd FD_NWSERV */
|
dup2(fds_in[1], FD_NWSERV); /* becommes fd FD_NWSERV */
|
||||||
@ -255,8 +265,9 @@ static int start_ncpserv(char *nwname, ipxAddr_t *addr)
|
|||||||
U16_TO_BE16(SOCK_NCP, addr->sock);
|
U16_TO_BE16(SOCK_NCP, addr->sock);
|
||||||
ipx_addr_to_adr(addrstr, addr);
|
ipx_addr_to_adr(addrstr, addr);
|
||||||
sprintf(nwbindsock, "%04x", sock_nwbind);
|
sprintf(nwbindsock, "%04x", sock_nwbind);
|
||||||
|
sprintf(echosock, "%04x", sock_nummern[WDOG_SLOT]);
|
||||||
execl(get_exec_path(pathname, progname), progname,
|
execl(get_exec_path(pathname, progname), progname,
|
||||||
nwname, addrstr, nwbindsock, NULL);
|
nwname, addrstr, nwbindsock, echosock, NULL);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -322,7 +333,6 @@ static int start_nwbind(char *nwname, ipxAddr_t *addr)
|
|||||||
U16_TO_BE16(SOCK_NCP, addr->sock);
|
U16_TO_BE16(SOCK_NCP, addr->sock);
|
||||||
ipx_addr_to_adr(addrstr, addr);
|
ipx_addr_to_adr(addrstr, addr);
|
||||||
sprintf(nwbindsock, "%04x", sock_nwbind);
|
sprintf(nwbindsock, "%04x", sock_nwbind);
|
||||||
|
|
||||||
execl(get_exec_path(pathname, progname), progname,
|
execl(get_exec_path(pathname, progname), progname,
|
||||||
nwname, addrstr, nwbindsock, NULL);
|
nwname, addrstr, nwbindsock, NULL);
|
||||||
exit(1);
|
exit(1);
|
||||||
@ -363,7 +373,6 @@ static int start_nwclient(void)
|
|||||||
}
|
}
|
||||||
return(0); /* OK */
|
return(0); /* OK */
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/* =========================== WDOG =============================== */
|
/* =========================== WDOG =============================== */
|
||||||
#ifndef _WDOG_TESTING_
|
#ifndef _WDOG_TESTING_
|
||||||
@ -497,6 +506,8 @@ static void send_bcasts(int conn)
|
|||||||
send_bcast_packet(&adr, conn+1, '!'); /* notify */
|
send_bcast_packet(&adr, conn+1, '!'); /* notify */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
void get_server_data(char *name,
|
void get_server_data(char *name,
|
||||||
ipxAddr_t *adr,
|
ipxAddr_t *adr,
|
||||||
@ -720,6 +731,25 @@ static void handle_diag(int fd, int ipx_pack_typ,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef EXTERN_SLOT
|
||||||
|
ipxAddr_t auth_addr;
|
||||||
|
int is_auth=0;
|
||||||
|
|
||||||
|
static void handle_extern_call(int fd,
|
||||||
|
int ipx_pack_typ,
|
||||||
|
int data_len,
|
||||||
|
IPX_DATA *ipxdata,
|
||||||
|
ipxAddr_t *from_addr)
|
||||||
|
{
|
||||||
|
if (memcmp(&auth_addr, from_addr, sizeof(ipxAddr_t))){
|
||||||
|
memcpy(&auth_addr, from_addr, sizeof(ipxAddr_t));
|
||||||
|
is_auth=0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void handle_event(int fd, uint16 socknr, int slot)
|
static void handle_event(int fd, uint16 socknr, int slot)
|
||||||
{
|
{
|
||||||
struct t_unitdata ud;
|
struct t_unitdata ud;
|
||||||
@ -766,8 +796,11 @@ static void handle_event(int fd, uint16 socknr, int slot)
|
|||||||
IPXCMPNET (source_adr.net, my_server_adr.net)) {
|
IPXCMPNET (source_adr.net, my_server_adr.net)) {
|
||||||
|
|
||||||
int source_sock = (int) GET_BE16(source_adr.sock);
|
int source_sock = (int) GET_BE16(source_adr.sock);
|
||||||
if ( source_sock == sock_nummern[WDOG_SLOT]
|
if (
|
||||||
|| source_sock == SOCK_SAP
|
#if !IN_NWROUTED
|
||||||
|
source_sock == sock_nummern[WDOG_SLOT] ||
|
||||||
|
#endif
|
||||||
|
source_sock == SOCK_SAP
|
||||||
|| source_sock == SOCK_RIP) {
|
|| source_sock == SOCK_RIP) {
|
||||||
XDPRINTF((2,0,"OWN Packet from sock:0x%04x, ignored", source_sock));
|
XDPRINTF((2,0,"OWN Packet from sock:0x%04x, ignored", source_sock));
|
||||||
return;
|
return;
|
||||||
@ -781,6 +814,29 @@ static void handle_event(int fd, uint16 socknr, int slot)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
switch (slot) {
|
switch (slot) {
|
||||||
|
#ifdef WDOG_SLOT
|
||||||
|
case WDOG_SLOT :
|
||||||
|
|
||||||
|
if (2 == ud.udata.len) {
|
||||||
|
XDPRINTF((2,0, "WDOG Packet len=%d connid=%d, status=%d",
|
||||||
|
(int)ud.udata.len, (int) ipx_data_buff.wdog.connid,
|
||||||
|
(int)ipx_data_buff.wdog.status));
|
||||||
|
if ('Y' == ipx_data_buff.wdog.status)
|
||||||
|
modify_wdog_conn(ipx_data_buff.wdog.connid, 0);
|
||||||
|
} else if ( 2 < ud.udata.len
|
||||||
|
&& ipx_data_buff.data[0] == 0x11
|
||||||
|
&& ipx_data_buff.data[1] == 0x11 ) {
|
||||||
|
/* now we make an echo of this data */
|
||||||
|
send_ipx_data(sockfd[WDOG_SLOT],
|
||||||
|
17, ud.udata.len, ud.udata.buf, &source_adr, "ECHO");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef EXTERN_SLOT
|
||||||
|
case EXTERN_SLOT : handle_extern_call(fd, (int) ipx_pack_typ, ud.udata.len, &ipx_data_buff, &source_adr); break;
|
||||||
|
#endif
|
||||||
|
|
||||||
case SAP_SLOT : handle_sap( fd, (int) ipx_pack_typ, ud.udata.len, &ipx_data_buff, &source_adr); break;
|
case SAP_SLOT : handle_sap( fd, (int) ipx_pack_typ, ud.udata.len, &ipx_data_buff, &source_adr); break;
|
||||||
#ifdef RIP_SLOT
|
#ifdef RIP_SLOT
|
||||||
case RIP_SLOT : handle_rip( fd, (int) ipx_pack_typ, ud.udata.len, &ipx_data_buff, &source_adr); break;
|
case RIP_SLOT : handle_rip( fd, (int) ipx_pack_typ, ud.udata.len, &ipx_data_buff, &source_adr); break;
|
||||||
@ -790,16 +846,7 @@ static void handle_event(int fd, uint16 socknr, int slot)
|
|||||||
case DIAG_SLOT : handle_diag(fd, (int) ipx_pack_typ, ud.udata.len, &ipx_data_buff, &source_adr); break;
|
case DIAG_SLOT : handle_diag(fd, (int) ipx_pack_typ, ud.udata.len, &ipx_data_buff, &source_adr); break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
default :
|
default : {
|
||||||
if (WDOG_SLOT == slot) { /* this is a watchdog packet */
|
|
||||||
XDPRINTF((2,0, "WDOG Packet len=%d connid=%d, status=%d",
|
|
||||||
(int)ud.udata.len, (int) ipx_data_buff.wdog.connid,
|
|
||||||
(int)ipx_data_buff.wdog.status));
|
|
||||||
if (2 == ud.udata.len) {
|
|
||||||
if ('Y' == ipx_data_buff.wdog.status)
|
|
||||||
modify_wdog_conn(ipx_data_buff.wdog.connid, 0);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
uint8 *p = (uint8*)&ipx_data_buff;
|
uint8 *p = (uint8*)&ipx_data_buff;
|
||||||
int k = 0;
|
int k = 0;
|
||||||
XDPRINTF((1, 2, "UNKNOWN"));
|
XDPRINTF((1, 2, "UNKNOWN"));
|
||||||
@ -1241,6 +1288,7 @@ int main(int argc, char **argv)
|
|||||||
else handle_event(p->fd, sock_nummern[j], j);
|
else handle_event(p->fd, sock_nummern[j], j);
|
||||||
} else { /* fd_ncpserv_in */
|
} else { /* fd_ncpserv_in */
|
||||||
XDPRINTF((2, 0, "POLL %d, fh=%d", p->revents, p->fd));
|
XDPRINTF((2, 0, "POLL %d, fh=%d", p->revents, p->fd));
|
||||||
|
#if !IN_NWROUTED
|
||||||
if (p->revents & ~POLLIN)
|
if (p->revents & ~POLLIN)
|
||||||
errorp(0, "STREAM error", "revents=0x%x", p->revents );
|
errorp(0, "STREAM error", "revents=0x%x", p->revents );
|
||||||
else {
|
else {
|
||||||
@ -1308,6 +1356,7 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
if (! --anz_poll) break;
|
if (! --anz_poll) break;
|
||||||
} /* if */
|
} /* if */
|
||||||
@ -1333,10 +1382,14 @@ int main(int argc, char **argv)
|
|||||||
bsecs=server_broadcast_secs;
|
bsecs=server_broadcast_secs;
|
||||||
broadmillisecs = bsecs*1000+10;
|
broadmillisecs = bsecs*1000+10;
|
||||||
}
|
}
|
||||||
|
#if !IN_NWROUTED
|
||||||
send_wdogs();
|
send_wdogs();
|
||||||
|
#endif
|
||||||
broadtime = akttime_stamp;
|
broadtime = akttime_stamp;
|
||||||
} else {
|
} else {
|
||||||
|
#if !IN_NWROUTED
|
||||||
if (call_wdog) send_wdogs(1);
|
if (call_wdog) send_wdogs(1);
|
||||||
|
#endif
|
||||||
if (client_mode && difftime > 5) get_servers(); /* Here more often */
|
if (client_mode && difftime > 5) get_servers(); /* Here more often */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
24
nwserv.h
24
nwserv.h
@ -1,4 +1,4 @@
|
|||||||
/* nwserv.h 26-Apr-96 */
|
/* nwserv.h 16-Jul-96 */
|
||||||
/* (C)opyright (C) 1993,1995 Martin Stover, Marburg, Germany
|
/* (C)opyright (C) 1993,1995 Martin Stover, Marburg, Germany
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -40,8 +40,28 @@ extern int anz_net_devices;
|
|||||||
extern NW_NET_DEVICE *net_devices[];
|
extern NW_NET_DEVICE *net_devices[];
|
||||||
|
|
||||||
/* <======== SOCKETS =========> */
|
/* <======== SOCKETS =========> */
|
||||||
|
#if !IN_NWROUTED
|
||||||
# define WDOG_SLOT 0 /* Watchdog send + recv */
|
# define WDOG_SLOT 0 /* Watchdog send + recv */
|
||||||
#define SAP_SLOT 1 /* SAP wellkwon or dynamic */
|
|
||||||
|
# if SOCK_EXTERN
|
||||||
|
# define EXTERN_SLOT (WDOG_SLOT+1)
|
||||||
|
# ifdef _MAR_TESTS_1
|
||||||
|
# define PSERVER_SLOT (EXTERN_SLOT+1)
|
||||||
|
# define SAP_SLOT (PSERVER_SLOT+1)
|
||||||
|
# else
|
||||||
|
# define SAP_SLOT (EXTERN_SLOT+1)
|
||||||
|
# endif
|
||||||
|
# else
|
||||||
|
# ifdef _MAR_TESTS_1
|
||||||
|
# define PSERVER_SLOT (WDOG_SLOT+1)
|
||||||
|
# define SAP_SLOT (PSERVER_SLOT+1)
|
||||||
|
# else
|
||||||
|
# define SAP_SLOT (WDOG_SLOT+1)
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
#else
|
||||||
|
# define SAP_SLOT 0
|
||||||
|
#endif
|
||||||
|
|
||||||
#if INTERNAL_RIP_SAP
|
#if INTERNAL_RIP_SAP
|
||||||
# define RIP_SLOT (SAP_SLOT +1)
|
# define RIP_SLOT (SAP_SLOT +1)
|
||||||
|
26
nwvolume.c
26
nwvolume.c
@ -1,4 +1,4 @@
|
|||||||
/* nwvolume.c 11-May-96 */
|
/* nwvolume.c 14-Jul-96 */
|
||||||
/* (C)opyright (C) 1993,1996 Martin Stover, Marburg, Germany
|
/* (C)opyright (C) 1993,1996 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
|
||||||
@ -63,7 +63,7 @@ void nw_init_volumes(FILE *f)
|
|||||||
int founds = sscanf((char*)buff, "%s %s %s",sysname, unixname, optionstr);
|
int founds = sscanf((char*)buff, "%s %s %s",sysname, unixname, optionstr);
|
||||||
if (founds > 1) {
|
if (founds > 1) {
|
||||||
NW_VOL *vol=&(nw_volumes[used_nw_volumes]);
|
NW_VOL *vol=&(nw_volumes[used_nw_volumes]);
|
||||||
vol->options = 0;
|
vol->options = VOL_NAMESPACE_DOS;
|
||||||
new_str(vol->sysname, sysname);
|
new_str(vol->sysname, sysname);
|
||||||
if (1 == (len = strlen((char*)unixname)) && unixname[0] == '~') {
|
if (1 == (len = strlen((char*)unixname)) && unixname[0] == '~') {
|
||||||
vol->options |= VOL_OPTION_IS_HOME;
|
vol->options |= VOL_OPTION_IS_HOME;
|
||||||
@ -98,6 +98,14 @@ void nw_init_volumes(FILE *f)
|
|||||||
|= VOL_OPTION_READONLY;
|
|= VOL_OPTION_READONLY;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'O' : vol->options
|
||||||
|
|= VOL_NAMESPACE_OS2;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'N' : vol->options
|
||||||
|
|= VOL_NAMESPACE_NFS;
|
||||||
|
break;
|
||||||
|
|
||||||
default : break;
|
default : break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -311,3 +319,17 @@ int get_volume_options(int volnr, int mode)
|
|||||||
return(result);
|
return(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int get_volume_inode(int volnr)
|
||||||
|
/* returns inode if OK, else errocode < 0 */
|
||||||
|
{
|
||||||
|
int result = -0x98; /* Volume not exist */;
|
||||||
|
if (volnr > -1 && volnr < used_nw_volumes) {
|
||||||
|
struct stat statb;
|
||||||
|
result = stat(nw_volumes[volnr].unixname, &statb);
|
||||||
|
if (result == -1) result=-0x98;
|
||||||
|
else result=statb.st_ino;
|
||||||
|
}
|
||||||
|
XDPRINTF((5,0,"get_volume_inode of VOLNR:%d, result=0x%x", volnr, result));
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
20
nwvolume.h
20
nwvolume.h
@ -1,4 +1,4 @@
|
|||||||
/* nwvolume.h 11-May-96 */
|
/* nwvolume.h 14-Jul-96 */
|
||||||
/* (C)opyright (C) 1993,1995 Martin Stover, Marburg, Germany
|
/* (C)opyright (C) 1993,1995 Martin Stover, Marburg, Germany
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -42,12 +42,17 @@ typedef struct {
|
|||||||
int options; /* see defines below */
|
int options; /* see defines below */
|
||||||
} NW_VOL;
|
} NW_VOL;
|
||||||
|
|
||||||
#define VOL_OPTION_DOWNSHIFT 0x01 /* All downshift */
|
/* vol options */
|
||||||
#define VOL_OPTION_IS_PIPE 0x02 /* Volume contains pipes */
|
#define VOL_OPTION_DOWNSHIFT 0x0001 /* All downshift */
|
||||||
#define VOL_OPTION_REMOUNT 0x04 /* Volume can be remounted (cdroms) */
|
#define VOL_OPTION_IS_PIPE 0x0002 /* Volume contains pipes */
|
||||||
#define VOL_OPTION_IS_HOME 0x08 /* Volume is USERS HOME */
|
#define VOL_OPTION_REMOUNT 0x0004 /* Volume can be remounted (cdroms) */
|
||||||
#define VOL_OPTION_ONE_DEV 0x10 /* Volume has only one filesys */
|
#define VOL_OPTION_IS_HOME 0x0008 /* Volume is USERS HOME */
|
||||||
#define VOL_OPTION_READONLY 0x20 /* Volume is readonly */
|
#define VOL_OPTION_ONE_DEV 0x0010 /* Volume has only one filesys */
|
||||||
|
#define VOL_OPTION_READONLY 0x0020 /* Volume is readonly */
|
||||||
|
/* namespaces */
|
||||||
|
#define VOL_NAMESPACE_DOS 0x1000
|
||||||
|
#define VOL_NAMESPACE_OS2 0x2000
|
||||||
|
#define VOL_NAMESPACE_NFS 0x4000
|
||||||
|
|
||||||
/* stolen from GNU-fileutils */
|
/* stolen from GNU-fileutils */
|
||||||
/* Space usage statistics for a filesystem. Blocks are 512-byte. */
|
/* Space usage statistics for a filesystem. Blocks are 512-byte. */
|
||||||
@ -68,6 +73,7 @@ extern int nw_get_volume_number(uint8 *volname, int namelen);
|
|||||||
extern int nw_get_volume_name(int volnr, uint8 *volname);
|
extern int nw_get_volume_name(int volnr, uint8 *volname);
|
||||||
extern int nw_get_fs_usage(uint8 *volname, struct fs_usage *fsu);
|
extern int nw_get_fs_usage(uint8 *volname, struct fs_usage *fsu);
|
||||||
extern int get_volume_options(int volnr, int mode);
|
extern int get_volume_options(int volnr, int mode);
|
||||||
|
extern int get_volume_inode(int volnr);
|
||||||
|
|
||||||
extern uint32 nw_vol_inode_to_handle(int volume, ino_t inode,
|
extern uint32 nw_vol_inode_to_handle(int volume, ino_t inode,
|
||||||
DEV_NAMESPACE_MAP *dnm);
|
DEV_NAMESPACE_MAP *dnm);
|
||||||
|
Loading…
Reference in New Issue
Block a user