mars_nwe-0.99.pl03

This commit is contained in:
Mario Fetka 2011-11-13 00:38:59 +01:00
parent 38c27b50f1
commit 2569082c2f
16 changed files with 235 additions and 90 deletions

View File

@ -1,4 +1,4 @@
/* connect.c 29-Jul-97 */
/* connect.c 01-Nov-97 */
/* (C)opyright (C) 1993,1996 Martin Stover, Marburg, Germany
*
* This program is free software; you can redistribute it and/or modify
@ -1090,8 +1090,9 @@ int un_nw_attrib(struct stat *stb, int attrib, int mode)
/* 0x20 Archive Flag */
/* 0x80 Sharable */ /* TLINK (TCC 2.0) don't like it ???? */
int is_dir=S_ISDIR(stb->st_mode);
if (!mode) {
int is_dir=S_ISDIR(stb->st_mode);
/* UNIX access -> NW access */
if (!is_dir) {
attrib = FILE_ATTR_A;
@ -1131,10 +1132,13 @@ int un_nw_attrib(struct stat *stb, int attrib, int mode)
else
stb->st_mode |= mode;
if (attrib & FILE_ATTR_SHARE) /* Shared */
stb->st_mode |= S_IXGRP;
else
stb->st_mode &= ~S_IXGRP;
if (!is_dir) {
if (attrib & FILE_ATTR_SHARE) /* Shared */
stb->st_mode |= S_IXGRP;
else
stb->st_mode &= ~S_IXGRP;
}
return(stb->st_mode);
}
}
@ -1320,7 +1324,8 @@ int nw_mk_rd_dir(int dir_handle, uint8 *data, int len, int mode)
if (mode) {
XDPRINTF((5,0,"MKDIR dirname:%s:", unname));
if (!mkdir(unname, 0777)) {
chmod(unname, act_umode_dir);
if (act_umode_dir)
chmod(unname, act_umode_dir);
return(0);
}
if (errno == EEXIST)

View File

@ -1,6 +1,6 @@
Sorry, this is in German only.
User important notes are in the NEWS file.
Aenderungen in mars_nwe bis zum : 08-Aug-97
Aenderungen in mars_nwe bis zum : 03-Nov-97
--------------------------------
Erste 'oeffentliche' Version
^^^^^^^^^^ VERSION 0.94 ^^^^^^^^
@ -363,15 +363,29 @@ Erste 'oeffentliche' Version
- Nested FINDFIRST/FINDNEXT bug korrigiert durch Andrew Sapozhnikov.
- getpwnam/getspnam problem gefixed durch Leslie.
- Neues queue handling funktioniert nun auch mit netx.
Die Queue-job-id wird nun bei den 'neuen' calls, obwohl eigentlich
4 Byte gross, immer als 2 Byte Zahl behandelt.
Die Queue-job-id wird nun bei den 'neuen' calls, obwohl eigentlich
4 Byte gross, immer als 2 Byte Zahl behandelt.
- Resultcode in close_queue_job2() (nwqconn.c) korrigiert. Es wurde
immer Fehlercode zurueckgeliefert wodurch der capture aufgehoben
wurde.
- creat directory liefert nun bei EEXIST 0xff zurueck.
- pserver Unterstuetzung erweitert.
- pserver Unterstuetzung erweitert.
- creat queue, destroy queue Calls eingebaut.
- Routine nw_add_obj_to_set traegt nun keine doppelten Eintraege in das Set
ein.
<----- ^^^^^^^^^^ pl2 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- Limit bei Anzeige freier Plattenplatz eingebaut. ( section 8 )
- Open Fehleranzeige fuer nw.routes eingebaut.
- neue Funktion 0x17,1B ( Get Object Connection List (new) )
- bei Schalter -k warten auf beenden eingebaut.
neuer Schalter -q (quick ohne warten)
- home volume feature erweitert von Andrew Sapozhnikov.
- Bei Verzeichnissen wird nicht mehr das SHARED flag zuruegesetzt.
(Andrew Sapozhnikov)
- Es kann nun mittels SYSCON verhindert werden, dass User sein Passwort
aendern kann. ( Mr. Charlie Root (alexey) )
- PATHNAME_PROGS in examples/config.h auf /usr/sbin gesetzt.
- MAX_CONNECTIONS (default) auf 50 gesetzt.
- Logfilepfade von /tmp auf /var/log/. geaendert.
<----- ^^^^^^^^^^ pl3 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

View File

@ -70,8 +70,13 @@ Jiri A. Randus <Jiri.Randus@vslib.cz>
Mark Robson <mark@mythras.demon.co.uk>
fixed bindery security hole and added bindery options
Mr. Charlie Root (alexey) <root@cs.imi.udmurtia.su>
gave hint for standard user restrict change password.
Andrew Sapozhnikov <sapa@hq.icb.chel.su>
fixed findfirst/findnext bug
fixed findfirst/findnext bug,
fixed directory access bug,
added extend "Volume is home" feature.
Gregory Steuck <greg@nsu.ru>
testings and errorreports

View File

@ -1,3 +1,8 @@
------10-Nov-97--- 0.99.pl3 ---------
- some defaults in config.h and nw.ini changed.
default programpath is now /usr/sbin/ !!
nw.log, nw.routes -> /var/log
- nwserv -k now waits for stop of main process.
------16-Aug-97--- 0.99.pl2 ---------
- new flag in section '8' for using ncpfs as mars_nwe client.
------16-Aug-97--- 0.99.pl1 ---------

View File

@ -1,16 +1,16 @@
Begin3
Title: mars_nwe
Version: 0.99.pl2
Entered-date: 08-Oct-97
Version: 0.99.pl3
Entered-date: 10-Nov-97
Description: Full netware-emulator (src), beta.
Supports file-services, bindery-services,
printing-services, routing-services.
Keywords: novell, netware, server, ipx, ncp, tli
Author: mstover@stover.f.eunet.de (Martin Stover)
Maintained-by: mstover@stover.f.eunet.de (Martin Stover)
Primary-site: ftp.gwdg.de:/pub/linux/misc/ncpfs
250kB mars_nwe-0.99.pl2.tgz
Alternate-site: sunsite.unc.edu:/pub/Linux/system/filesystems/ncpfs
Author: mstover@compu-art.de (Martin Stover)
Maintained-by: mstover@compu-art.de (Martin Stover)
Primary-site: http://www.compu-art.de/download/mars_nwe-0.99.pl3.tgz
250 kB
Alternate-site: ftp://gwdg.de/pub/linux/misc/ncpfs/mars_nwe-0.99.pl3.tgz
Platforms: Linux (1.2.xx, 1.3.xx, 2.xx), UnixWare (2.xx)
Copying-policy: GNU
End

View File

@ -1,4 +1,4 @@
/* config.h: 02-Jun-97 */
/* config.h: 10-Nov-97 */
/* some of this config is needed by make, others by cc */
#define DO_DEBUG 1 /* compile in debug code */
@ -13,7 +13,7 @@
#else
# define FILENAME_NW_INI "/etc/nwserv.conf"
/* full name of ini (conf) file */
# define PATHNAME_PROGS "/sbin" /* where to find the executables */
# define PATHNAME_PROGS "/usr/sbin" /* where to find the executables */
# define PATHNAME_BINDERY "/etc" /* directory for bindery-files */
#endif
@ -29,7 +29,7 @@
/* serial number (4 byte) */
#define NETWORK_APPL_NMBR 0x2222 /* application number (2 byte) */
#define MAX_CONNECTIONS 5 /* max. number of simultaneous */
#define MAX_CONNECTIONS 50 /* max. number of simultaneous */
/* connections handled by mars_nwe */
/* !! NOTE !! */
/* If set > 255 some NCP calls will probably not work, try it with caution */

View File

@ -2,7 +2,7 @@
# This is the configuration-file for "mars_nwe", a free netware-emulator
# for Linux.
#
# last changed: 30-Aug-97
# last changed: 09-Nov-97
#
# !! section 4 : automatic creation of ipx-interfaces changed in 0.98.pl9 !!
#
@ -10,7 +10,9 @@
# the most important options in config.h can now be altered in
# this file begin at section 60.
#
# Most configuration errors depend on section 4.
# !! Please read section 4 very carefully. !!
#
# This file specifies which Linux-resources (printers, users, directories)
# should be accessible to the DOS-clients via "mars_nwe". Furthermore
@ -68,11 +70,8 @@
# VOLUMENAME: the name of the mars_nwe-volume (max. 8 characters)
# DIRECTORY: the directory on your Linux-system associated with that
# volume; use the special name "~" to refer to the users
# individual home-directory
#
# Attention ! A directory entry like "/home/~"
# do not work. Only is simple "~" as directory name
# has this special meaning.
# individual home-directory.
# A directory entry like "~/tmp" also work since 0.99.pl3.
#
# If the netadmin wants to map the homedirectories with the MAP-Command to
# every user, he can do it in two variants:
@ -125,6 +124,7 @@
# 1 SYS /var/local/nwe/SYS k
# 1 CDROM /cdrom kmor
# 1 HOME ~ k
# 1 HOMETMP ~/tmp kiO
1 SYS /u3/SYS/ k
@ -182,7 +182,7 @@
# could be the ip-address of your Linux-Box. It is reasonable because
# ip-addresse are unique and if every nw-administrator uses only this uniqe
# value, potential conflicts will be minimized. Of course this choice is
# no guarantee.
# no guarantee and it only works if your Linux-Box IP is well configured.
#
# Please note that you have to specify the address of your "internal
# ipx-network" in hexadecimal format (the leading "0x" indicates it).
@ -388,6 +388,10 @@
# Normally only directory base entries are stored.
# necessary if using ncpfs as mars_nwe client.
#
# 0x40 limit's volume's free space info to 2 GB.
# in some volume info calls.
# some DOS clients need it.
#
# other flags may follow.
# value will be interpreted as hex value.
@ -716,7 +720,7 @@
#
200 1 # 0 = no logfile and dont daemonize nwserv/nwrouted
# 1 = daemonize nwserv/nwrouted and use logfile
201 /tmp/nw.log # filename of logfile
201 /var/log/nw.log # filename of logfile
#201 syslog # if filename == syslog then syslogd will be used for
# all messages
@ -739,7 +743,7 @@
300 1 # > 0 print routing info to file every x broadcasts.
# ( normally minutes )
301 /tmp/nw.routes # filename of logfile
301 /var/log/nw.routes # filename of logfile
302 0x1 # flags will be interpreted as hex value.
# 0 = append to this file

View File

@ -1,5 +1,5 @@
#if 0
#makefile.unx 30-Aug-97
#makefile.unx 10-Nov-97
#endif
VPATH=$(V_VPATH)
@ -9,7 +9,7 @@ C=.c
V_H=0
V_L=99
P_L=2
P_L=3
#define D_P_L 1
DISTRIB=mars_nwe
@ -186,6 +186,10 @@ n_install_ini:
n_install:
cd $(VPATH) && $(INSTALL) -d $(M_PATHNAME_PROGS) && cd $(OBJDIR)
cd $(VPATH) && $(INSTALL) $(INSTALLPROGS) $(M_PATHNAME_PROGS) && cd $(OBJDIR)
@-if [ -r /sbin/nwserv ] && [ -r /usr/sbin/nwserv ] ; then \
echo "remove old version in /sbin ?" ; \
(cd /sbin && rm -i nwserv nwbind ncpserv nwconn nwclient nwrouted) ; \
fi ;
@cd $(VPATH) && (if [ -r $(M_FILENAME_NW_INI) ] ; then \
echo ""; \
echo "********************************************************"; \
@ -258,7 +262,8 @@ n_diff: make_dir clean_d
n_distrib: n_diff
-mkdir /tmp/x
cd $(VPATH) && (tar cvzf $(DISTRIBF).tgz $(DISTRIB) \
cd $(VPATH) && ./mk_lsm "$(V_H).$(V_L).pl$(P_L)" $(DISTRIBF) \
&& (tar cvzf $(DISTRIBF).tgz $(DISTRIB) \
; uue $(DISTRIBF).tgz; mv -f $(DISTRIB)-$(V_H).uue $(DISTRIBF).uue \
; cp -a $(DISTRIB)/doc/$(DISTRIB).lsm /tmp/yy \
; echo "" >> /tmp/yy \
@ -285,3 +290,4 @@ n_showconf:

View File

@ -1,5 +1,5 @@
/* nwbind.c */
#define REVISION_DATE "08-Oct-97"
#define REVISION_DATE "01-Nov-97"
/* NCP Bindery SUB-SERVER */
/* authentification and some message handling */
@ -262,15 +262,15 @@ static void handle_fxx(int gelen, int func)
if (0x15 == func) {
switch (ufunc) { /* Messages */
case 0x0 : { /* Send Broadcast Message (old) */
int anz_conns = (int)*(rdata); /* Number of connections */
int count_conns = (int)*(rdata); /* Number of connections */
uint8 *conns = rdata+1; /* connectionslist */
int msglen = *(conns+anz_conns);
uint8 *msg = conns+anz_conns+1;
int msglen = *(conns+count_conns);
uint8 *msg = conns+count_conns+1;
uint8 *p = responsedata;
int one_found = 0;
int k = -1;
*p++ = (uint8) anz_conns;
while (++k < anz_conns) {
*p++ = (uint8) count_conns;
while (++k < count_conns) {
int connr = (int) (*conns++);
int result = 0xff; /* target not ok */
CONNECTION *cn;
@ -285,7 +285,7 @@ static void handle_fxx(int gelen, int func)
}
*p++ = (uint8)result;
}
if (one_found) data_len = anz_conns+1;
if (one_found) data_len = count_conns+1;
else completition=0xff;
}
break;
@ -522,7 +522,7 @@ static void handle_fxx(int gelen, int func)
completition = (uint8) -result;
} break;
case 0x15 : { /* Get Object Connection List */
case 0x15 : { /* Get Object Connection List (old) */
uint8 *p = rdata;
int result;
NETOBJ obj;
@ -533,17 +533,17 @@ static void handle_fxx(int gelen, int func)
result = find_obj_id(&obj);
if (!result){
int k=-1;
int anz = 0;
int count = 0;
p = responsedata+1;
while (++k < max_connections && anz < 255) {
while (++k < max_connections && count < 255) {
CONNECTION *cn= &connections[k];
if (cn->active && cn->object_id == obj.id) {
*p++=(uint8)k+1;
anz++;
count++;
}
} /* while */
*responsedata = anz;
data_len = 1 + anz;
*responsedata = count;
data_len = 1 + count;
} else completition=(uint8)-result;
}
break;
@ -631,6 +631,37 @@ static void handle_fxx(int gelen, int func)
}
break;
case 0x1B : { /* Get Object Connection List */
uint8 *p = rdata;
int result;
NETOBJ obj;
int searchnr = (int) GET_BE32(p);
p+=4;
obj.type = GET_BE16(p);
p+=2;
strmaxcpy((char*)obj.name, (char*)(p+1), (int) *(p));
upstr(obj.name);
result = find_obj_id(&obj);
if (!result){
int k = max(-1, searchnr-1);
int count = 0;
p = responsedata+1;
while (++k < max_connections && count < 255) {
CONNECTION *cn= &connections[k];
if (cn->active && cn->object_id == obj.id) {
U16_TO_16(k+1, p); /* LO-HI !! */
p+=2;
count++;
}
} /* while */
*responsedata = count;
data_len = 1 + count*2;
} else completition=(uint8)-result;
}
break;
case 0x32 : { /* Create Bindery Object */
NETOBJ obj;
int result;
@ -1435,13 +1466,13 @@ static void handle_fxx(int gelen, int func)
case 0xd1 : /* Send Console Broadcast (old) */
{
uint8 *p = rdata;
int anz_conns = (int) *p++;
int count_conns = (int) *p++;
uint8 *co = p;
int msglen = (int) *(p+anz_conns);
char *msg = (char*) p+anz_conns+1;
int msglen = (int) *(p+count_conns);
char *msg = (char*) p+count_conns+1;
int k = -1;
if (anz_conns) {
while (++k < anz_conns) {
if (count_conns) {
while (++k < count_conns) {
int conn= (int) *co++;
if (conn == act_connection) {
strmaxcpy(act_c->message, msg, min(58, msglen));
@ -1501,7 +1532,7 @@ static void handle_fxx(int gelen, int func)
send_ipx_data(ipx_out_fd, 17, data_len, (char*)ncpresponse,
&my_addr, NULL);
XDPRINTF((2, 0, "func=0x%x ufunc=0x%x compl:0x%x, written anz = %d",
XDPRINTF((2, 0, "func=0x%x ufunc=0x%x compl:0x%x, written count = %d",
(int)func, (int)ufunc, (int) completition, data_len));
}

View File

@ -284,7 +284,8 @@ NWCONN 1:len 15, DATA:,0x5,0x1,0x0,0x12,0xa,'0','9','0','6',
memset(xdata, 0, sizeof(struct XDATA));
if ((result = nw_get_volume_name(volume, xdata->name))>-1){
struct fs_usage fsp;
if (!nw_get_fs_usage(xdata->name, &fsp)) {
if (!nw_get_fs_usage(xdata->name, &fsp,
entry8_flags&0x40 )) {
int sector_scale=1;
while (fsp.fsu_blocks/sector_scale > 0xffff)
sector_scale+=2;
@ -542,7 +543,8 @@ NWCONN 1:len 15, DATA:,0x5,0x1,0x0,0x12,0xa,'0','9','0','6',
result = nw_get_volume_name(volume, xdata->name);
if (result > -1) {
struct fs_usage fsp;
if (!nw_get_fs_usage(xdata->name, &fsp)) {
if (!nw_get_fs_usage(xdata->name, &fsp,
entry8_flags&0x40 )) {
int sector_scale=1;
while (fsp.fsu_blocks/sector_scale > 0xffff)
sector_scale+=2;
@ -784,7 +786,7 @@ NWCONN 1:len 15, DATA:,0x5,0x1,0x0,0x12,0xa,'0','9','0','6',
if (result > -1){
struct fs_usage fsp;
memset(xdata, 0, sizeof(struct XDATA));
if (!nw_get_fs_usage(name, &fsp)) {
if (!nw_get_fs_usage(name, &fsp, 0)) {
xdata->sec_per_block = 8; /* hard coded */
U32_TO_32(fsp.fsu_blocks/8, xdata->total_blocks);
U32_TO_32(fsp.fsu_bavail/8, xdata->avail_blocks);
@ -815,7 +817,7 @@ NWCONN 1:len 15, DATA:,0x5,0x1,0x0,0x12,0xa,'0','9','0','6',
if (result > -1) {
struct fs_usage fsp;
memset(xdata, 0, sizeof(struct XDATA));
if (!nw_get_fs_usage(name, &fsp)) {
if (!nw_get_fs_usage(name, &fsp, 0)) {
xdata->sec_per_block = 8; /* hard coded */
U32_TO_32(fsp.fsu_blocks/8, xdata->total_blocks);
U32_TO_32(fsp.fsu_bavail/8, xdata->avail_blocks);

16
nwdbm.c
View File

@ -1,4 +1,4 @@
/* nwdbm.c 08-Oct-97 data base for mars_nwe */
/* nwdbm.c 01-Nov-97 data base for mars_nwe */
/* (C)opyright (C) 1993,1995 Martin Stover, Marburg, Germany
*
* This program is free software; you can redistribute it and/or modify
@ -1235,6 +1235,7 @@ uint32 nw_new_obj_prop(uint32 wanted_id,
/* some property names */
/*STANDARD NOVELL properties */
static uint8 *pn_password=(uint8*) "PASSWORD";
static uint8 *pn_login_control=(uint8*)"LOGIN_CONTROL";
/* OWN properties */
static uint8 *pn_unix_user=(uint8*) "UNIX_USER";
@ -1484,12 +1485,11 @@ static int nw_test_time_access(uint32 obj_id)
struct tm *tm;
uint8 more_segments;
uint8 property_flags;
char *propname="LOGIN_CONTROL";
uint8 buff[200];
int segment = 1;
int half_hours;
int result=nw_get_prop_val_by_obj_id(obj_id, segment,
propname, strlen(propname),
pn_login_control, strlen(pn_login_control),
buff, &more_segments, &property_flags);
if (result < 0)
return(0); /* No time limits available */
@ -1742,6 +1742,16 @@ extern int test_allow_password_change(uint32 id)
buff, &more_segments, &property_flags);
if (result > -1 && (GET_BE32(buff) & 1))
return(-0xff);
/* hint from <root@cs.imi.udmurtia.su> (Mr. Charlie Root) */
result=nw_get_prop_val_by_obj_id(id, segment,
pn_login_control, strlen(pn_login_control),
buff, &more_segments, &property_flags);
/* can user change password ? */
if (result > -1 && (buff[62] & 1) ) /* Restriction Mask */
return(-0xff);
return(0);
}

View File

@ -187,8 +187,8 @@ static NW_NET_DEVICE *find_device_by_net(uint32 net)
int activate_slow_net(uint32 net)
{
NW_NET_DEVICE *nd=find_device_by_net(net);
if (nd && nd->ticks > 6) { /* if 'slow net' */
if (acttime_stamp > nd->updated_time + 600) {
if (nd && nd->ticks > 6) { /* if 'slow net' */
if (acttime_stamp > nd->updated_time + 600) {
nd->needs_update=NEEDS_UPDATE_ALL;
nd->updated_time=acttime_stamp;
return(1);
@ -415,7 +415,7 @@ static void send_rip_broadcast(int mode)
while (++k < count_net_devices) {
NW_NET_DEVICE *nd=net_devices[k];
if (mode == 4 && !(nd->needs_update&NEEDS_UPDATE_RIP)) continue;
if (nd->is_up && (nd->ticks < 7
if (nd->is_up && (nd->ticks < 7
|| mode || (nd->needs_update&NEEDS_UPDATE_RIP) )) {
/* isdn devices should not get RIP broadcasts everytime */
nd->needs_update&=~NEEDS_UPDATE_RIP;
@ -431,8 +431,8 @@ void rip_for_net(uint32 net)
int k=-1;
while (++k < count_net_devices) {
NW_NET_DEVICE *nd=net_devices[k];
if (nd->is_up && (nd->ticks < 7
|| (nd->needs_update&NEEDS_UPDATE_RIP_NET) ) ) {
if (nd->is_up && (nd->ticks < 7
|| (nd->needs_update&NEEDS_UPDATE_RIP_NET) ) ) {
/* isdn devices should not get RIP broadcasts everytime */
nd->needs_update&=~NEEDS_UPDATE_RIP_NET;
init_rip_buff(nd->net, 10);
@ -582,7 +582,7 @@ static void send_sap_broadcast(int mode)
while (++k < count_net_devices) {
NW_NET_DEVICE *nd=net_devices[k];
if (mode == 4 && !(nd->needs_update&NEEDS_UPDATE_SAP)) continue;
if (nd->is_up && (nd->ticks < 7 ||
if (nd->is_up && (nd->ticks < 7 ||
(nd->needs_update&NEEDS_UPDATE_SAP) || mode)) {
/* isdn devices should not get SAP broadcasts everytime */
nd->needs_update &= ~NEEDS_UPDATE_SAP;
@ -611,8 +611,10 @@ static FILE *open_route_info_fn(int force, FILE *ff, int section)
if (section == 1) {
if (NULL != f)
tacs = print_route_tac-1;
else
else {
print_route_tac=0;
errorp(0, "route info", "Openerror of `%s`", fn);
}
} else {
if (NULL != f)
fclose(ff);
@ -744,22 +746,22 @@ static void sap_find_nearest_server(uint32 net)
send_ipx_data(sockfd[SAP_SLOT], 17, sizeof(SQP),
(char*)&sqp, &wild, "SERVER Query");
}
void get_servers(void)
{
int k=-1;
while (++k < count_net_devices) {
NW_NET_DEVICE *nd=net_devices[k];
if (nd->is_up && (nd->ticks < 7
if (nd->is_up && (nd->ticks < 7
|| nd->needs_update&NEEDS_UPDATE_SAP_QUERY)){
nd->needs_update &= ~NEEDS_UPDATE_SAP_QUERY;
sap_find_nearest_server(nd->net);
sap_find_nearest_server(nd->net);
}
}
if (!count_net_devices) sap_find_nearest_server(internal_net);
}
int dont_send_wdog(ipxAddr_t *addr)
/* returns != 0 if ticks are to high for wdogs */
{
@ -802,7 +804,7 @@ int test_ins_device_net(uint32 rnet)
foundfree = k;
} else if (nd->net == rnet) return(0);
}
if ((rnetframe=get_interface_frame_name(rnetdevname, rnet)) < 0)
return(0);

View File

@ -897,7 +897,8 @@ static void get_ini(int full)
}
}
if (0==internal_net)
errorp(11, "Get_ini", "Cannot get AUTO internal net with help of gethostbyname");
errorp(11, "Get_ini", "Cannot get AUTO internal net with help of gethostbyname.\n%s",
"Please read section 3 of nwserv.conf carefully.");
}
}
break;
@ -1224,14 +1225,15 @@ static int server_is_down=0;
static int usage(char *prog)
{
#if !IN_NWROUTED
fprintf(stderr, "usage:\t%s [-V|-h|-u|-k|y]\n", prog);
fprintf(stderr, "usage:\t%s [-V|-h|-u|-k[q]|y]\n", prog);
#else
fprintf(stderr, "usage:\t%s [-v|-h|-u|-k]\n", prog);
fprintf(stderr, "usage:\t%s [-V|-h|-u|-k[q]]\n", prog);
#endif
fprintf(stderr, "\t-V: print version\n");
fprintf(stderr, "\t-h: send HUP to main process\n");
fprintf(stderr, "\t-u: update int. routing table\n");
fprintf(stderr, "\t-k: stop main process\n");
fprintf(stderr, "\t-k: stop main process, wait for it.\n");
fprintf(stderr, "\t-kq: don't wait till stop of main process\n");
#if !IN_NWROUTED
fprintf(stderr, "\t y: start testclient code.\n");
#endif
@ -1255,6 +1257,7 @@ int main(int argc, char **argv)
case 'h' : init_mode = 1; break;
case 'k' : init_mode = 2; break;
case 'u' : init_mode = 3; break;
case 'q' : if (init_mode == 2) init_mode=4; break;
case 'v' :
case 'V' : fprintf(stderr, "\n%s:Version %d.%d.pl%d\n",
argv[0], _VERS_H_, _VERS_L_, _VERS_P_ );

View File

@ -1,4 +1,4 @@
/* nwvolume.c 02-Aug-97 */
/* nwvolume.c 01-Nov-97 */
/* (C)opyright (C) 1993,1996 Martin Stover, Marburg, Germany
*
* This program is free software; you can redistribute it and/or modify
@ -96,9 +96,21 @@ void nw_init_volumes(FILE *f)
loaded_namespaces |= VOL_NAMESPACE_DOS;
up_fn(sysname);
new_str(vol->sysname, sysname);
if (1 == (len = strlen((char*)unixname)) && unixname[0] == '~') {
len = strlen((char*)unixname);
if (unixname[0] == '~' && (unixname[1]=='\0' || unixname[1]=='/')) {
vol->options |= VOL_OPTION_IS_HOME;
vol->options |= VOL_OPTION_REMOUNT;
if (len > 2) { /* tail is present */
if (unixname[len-1] != '/') {
unixname[len++] = '/';
unixname[len] = '\0';
}
new_str(vol->homeaddon, unixname+2); /* skip ~/ */
vol->addonlen = len-2;
} else {
vol->homeaddon=NULL;
vol->addonlen = 0;
}
unixname[0] = '\0';
len = 0;
} else if (unixname[len-1] != '/') {
@ -169,6 +181,8 @@ void nw_setup_home_vol(int len, uint8 *fn)
{
int k=used_nw_volumes;
uint8 unixname[258];
uint8 fullname[258];
unixname[0] = '\0';
xfree(home_dir);
home_dir_len=0;
@ -182,14 +196,31 @@ void nw_setup_home_vol(int len, uint8 *fn)
home_dir_len=len;
}
while (k--) { /* now set all HOME volumes */
uint8 *fname;
int flen;
if (nw_volumes[k].options & VOL_OPTION_IS_HOME) {
int i = -1;
while (++i < nw_volumes[k].maps_count)
xfree(nw_volumes[k].dev_namespace_maps[i]);
nw_volumes[k].maps_count = 0;
nw_volumes[k].unixnamlen = len;
new_str(nw_volumes[k].unixname, unixname);
if (len>0)
fname = unixname;
flen = len;
if (len > 0 && nw_volumes[k].addonlen) {
if (len + nw_volumes[k].addonlen > 256) {
flen = 0;
fname = "";
} else {
strcpy(fullname, unixname);
/* concatenation $HOME/ and add/on/ */
strcpy(fullname + len, nw_volumes[k].homeaddon);
fname = fullname;
flen = len + nw_volumes[k].addonlen;
}
}
nw_volumes[k].unixnamlen = flen;
new_str(nw_volumes[k].unixname, fname);
if (flen>0)
volume_to_namespace_map(k, &(nw_volumes[k]));
}
}
@ -315,7 +346,8 @@ static long adjust_blocks (long blocks, int fromsize, int tosize)
return (blocks + (blocks < 0 ? -1 : 1)) / (tosize / fromsize);
}
static int get_fs_usage(char *path, struct fs_usage *fsp)
static int get_fs_usage(char *path, struct fs_usage *fsp, int limit)
/* limit: 0 = no limit, 1 = limits to 2 Gb */
{
struct statfs fsd;
if (statfs (path, &fsd) < 0) return (-1);
@ -347,16 +379,23 @@ fsd.f_bsize = 1024;
fsp->fsu_files = fsd.f_files;
fsp->fsu_ffree = fsd.f_ffree;
if (limit) {
if (fsp->fsu_blocks > 4000000)
fsp->fsu_blocks = 4000000;
if (fsp->fsu_bfree > 4000000)
fsp->fsu_bfree = 4000000;
}
return(0);
}
int nw_get_fs_usage(uint8 *volname, struct fs_usage *fsu)
int nw_get_fs_usage(uint8 *volname, struct fs_usage *fsu, int limit)
/* returns 0 if OK, else errocode < 0 */
{
int volnr = nw_get_volume_number(volname, strlen((char*)volname));
if (volnr > -1) {
NW_VOL *v=&(nw_volumes[volnr]);
if (0 == (volnr=get_fs_usage((char*)v->unixname, fsu))) {
if (0 == (volnr=get_fs_usage((char*)v->unixname, fsu, limit))) {
if (v->options & VOL_OPTION_READONLY) {
fsu->fsu_bfree = 0;
fsu->fsu_bavail = 0;

View File

@ -1,4 +1,4 @@
/* nwvolume.h 02-Aug-97 */
/* nwvolume.h 01-Nov-97 */
/* (C)opyright (C) 1993,1995 Martin Stover, Marburg, Germany
*
* This program is free software; you can redistribute it and/or modify
@ -35,6 +35,10 @@ typedef struct {
uint8 *sysname; /* VOL_NAME */
uint8 *unixname; /* UNIX-DIR with ending '/' */
int unixnamlen; /* len of unixname */
/* next 2 fields added by Andrew Sapozhnikov */
/* for Extend "Volume is home" feature */
uint8 *homeaddon; /* tail for $HOME-relative volumes */
int addonlen; /* len of tail part of unixname */
DEV_NAMESPACE_MAP *dev_namespace_maps[MAX_DEV_NAMESPACE_MAPS];
int max_maps_count; /* may be less than MAX_DEV_NAMESPACE_MAPS */
int maps_count; /* count of dev_namespace_maps */
@ -78,7 +82,7 @@ extern void nw_init_volumes(FILE *f);
extern void nw_setup_home_vol(int len, uint8 *fn);
extern int nw_get_volume_number(uint8 *volname, int namelen);
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, int limit);
extern int get_volume_options(int volnr);
extern int get_volume_inode(int volnr, struct stat *stb);
extern int nw_set_vol_restrictions(uint8 volnr, int uid, uint32 quota);

21
tools.c
View File

@ -440,7 +440,7 @@ void init_tools(int module, int options)
int sig;
if (options == 1) { /* kill -HUP prog */
sig = SIGHUP;
} else if (options == 2) { /* kill prog */
} else if (options == 2|| options == 4) { /* kill prog */
sig = SIGTERM;
} else if (options == 3) { /* update tables */
sig = SIGUSR1;
@ -451,13 +451,28 @@ void init_tools(int module, int options)
}
if (kill_pid > 1) {
kill(kill_pid, sig);
if (sig == SIGUSR1) { /* we try twice */
if (sig == SIGUSR1 || sig == SIGTERM) { /* we try twice */
sleep(2);
kill(kill_pid, sig);
}
if (sig == SIGTERM && options == 2 ) { /* we want to wait for stop */
int k = 120; /* max. 4 min */
fprintf(stdout, "\nwaiting for stop of %s ...\n", get_modstr());
while (k--) {
if (fn_exist(pidfn)) {
sleep(2);
if (!(k % 5)) kill(kill_pid, sig);
} else {
fprintf(stdout, "\n%s stopped\n", get_modstr());
exit(0);
}
}
fprintf(stderr, "\n%s not stopped yet!\n", get_modstr());
exit(1);
}
}
exit(0);
} else if (options == 1 || options == 2 || options == 3) {
} else if (options == 1 || options == 2 || options == 3 || options == 4) {
errorp(11, "INIT", "Program not running yet" );
exit(1);
}