mars_nwe-0.99.pl19
This commit is contained in:
202
examples/comm.c
202
examples/comm.c
@@ -1,17 +1,33 @@
|
||||
/*
|
||||
/* comm.c 22-Oct-98
|
||||
* simple demo for a command programm which do a
|
||||
* DOS <-> UNX command handling using PIPE filesystem.
|
||||
* DOS/WIN <-> UNX command handling using PIPE filesystem.
|
||||
* Most problem under W95 is the file caching.
|
||||
* Only the 32-bit version (comm32) works correct under W95.
|
||||
* NT do not have this problems.
|
||||
*
|
||||
* can be used with unxcomm for UNX.
|
||||
*
|
||||
* Can also be used under Linux for ncpfs <-> mars_nwe.
|
||||
*
|
||||
* comm and unxcomm must be same version !
|
||||
*/
|
||||
|
||||
#define MAXARGLEN 1024
|
||||
|
||||
/* Environment string could be in the form: UNXCOMM=p:/unxcomm
|
||||
* or under 32bit: UNXCOMM=\\lx1\pipes\unxcomm
|
||||
* or under linux: UNXCOMM=/pipes/unxcomm
|
||||
*
|
||||
*/
|
||||
#define ENV_UNXCOMM "UNXCOMM"
|
||||
|
||||
#ifdef LINUX
|
||||
# define DEFAULT_COMM "/pipes/unxcomm"
|
||||
#else
|
||||
# ifdef DEFAULT_UNC
|
||||
# define DEFAULT_COMM DEFAULT_UNC
|
||||
# else
|
||||
# define DEFAULT_COMM "p:/unxcomm"
|
||||
# define DEFAULT_COMM "p:/unxcomm"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
@@ -19,6 +35,8 @@
|
||||
#include <stddef.h>
|
||||
#ifndef LINUX
|
||||
# include <io.h>
|
||||
#else
|
||||
# define O_BINARY 0
|
||||
#endif
|
||||
#include <fcntl.h>
|
||||
|
||||
@@ -28,32 +46,172 @@ static int usage(char *progname)
|
||||
return(1);
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
#include <windows.h>
|
||||
#include <direct.h>
|
||||
int get_server_name(char *servername, char *path)
|
||||
/* returns len of servername if exist or 0 */
|
||||
{
|
||||
int result=0;
|
||||
char remotepath[300];
|
||||
if (path && *path != '\\' && *path != '/' && *(path+1) != ':'){
|
||||
getcwd(remotepath, sizeof(remotepath)-1);
|
||||
path=remotepath;
|
||||
}
|
||||
if (path && path[1] == ':') {
|
||||
char localpath[10];
|
||||
DWORD size=sizeof(remotepath);
|
||||
memcpy(localpath, path, 2);
|
||||
*(localpath+2)='\0';
|
||||
if (WNetGetConnection(localpath, remotepath,
|
||||
&size)==NO_ERROR) {
|
||||
path=remotepath;
|
||||
}
|
||||
}
|
||||
if (path && (*path == '\\' || *path == '/')
|
||||
&& (*(++path) == '\\' || *path == '/') ) {
|
||||
char *p=++path;
|
||||
while (*p && *p!='/' && *p!='\\') ++p;
|
||||
result= (int)(p-path);
|
||||
if (result&&servername) {
|
||||
memcpy(servername, path, result );
|
||||
servername[result] = '\0';
|
||||
}
|
||||
}
|
||||
return(result);
|
||||
}
|
||||
|
||||
HANDLE loc_open(char *fn, int mode)
|
||||
{
|
||||
HANDLE fd=CreateFile(fn, GENERIC_READ,
|
||||
FILE_SHARE_READ,
|
||||
NULL,
|
||||
OPEN_EXISTING,
|
||||
FILE_ATTRIBUTE_NORMAL|
|
||||
FILE_FLAG_SEQUENTIAL_SCAN|
|
||||
FILE_FLAG_NO_BUFFERING, /* IMPORTANT !!! */
|
||||
NULL);
|
||||
return(fd);
|
||||
}
|
||||
|
||||
int loc_read(HANDLE fd, char *buf, int size)
|
||||
{
|
||||
if (ReadFile(fd, buf, size, &size, NULL))
|
||||
return(size);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
|
||||
#define loc_close(fd) CloseHandle(fd)
|
||||
#define loc_lseek(fd, offs, what) /* not yet used */
|
||||
|
||||
#else
|
||||
#define loc_lseek lseek
|
||||
#define loc_read read
|
||||
#define loc_open open
|
||||
#define loc_close close
|
||||
typedef int HANDLE;
|
||||
#define INVALID_HANDLE_VALUE -1
|
||||
#endif
|
||||
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
char *unxcomm=getenv(ENV_UNXCOMM);
|
||||
if (NULL == unxcomm) unxcomm=DEFAULT_COMM;
|
||||
if (argc > 1) {
|
||||
int fdout = open(unxcomm, O_RDWR);
|
||||
int fdin = dup(fdout);
|
||||
if (fdout > -1 && fdin > -1) {
|
||||
char **pp=argv+1;
|
||||
unsigned char b=32;
|
||||
int size;
|
||||
int buf[512];
|
||||
while(--argc) {
|
||||
write(fdout, *pp, strlen(*pp));
|
||||
++pp;
|
||||
write(fdout, &b, 1);
|
||||
char **pp=argv+1;
|
||||
int size;
|
||||
char buf[MAXARGLEN+1024];
|
||||
HANDLE fdin = loc_open(unxcomm, O_RDONLY|O_BINARY);
|
||||
int fdout = -1;
|
||||
#ifdef WIN32
|
||||
char buf_unxcomm[200];
|
||||
if (fdin == INVALID_HANDLE_VALUE) {
|
||||
char servername[100];
|
||||
if (get_server_name(servername, argv[0])>0){
|
||||
sprintf(buf_unxcomm, "\\\\%s\\pipes\\unxcomm", servername);
|
||||
unxcomm=buf_unxcomm;
|
||||
fdin = loc_open(unxcomm, O_RDONLY|O_BINARY);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (fdin != INVALID_HANDLE_VALUE) {
|
||||
int count=loc_read(fdin, buf, 10);
|
||||
char pipepath[200];
|
||||
char *pipeext=pipepath;
|
||||
int tries=0;
|
||||
while (count < 10 && tries < 20) {
|
||||
int nc;
|
||||
if (count < 0) count =0;
|
||||
nc=loc_read(fdin, buf+count, 1);
|
||||
if (nc > 0) count+=nc;
|
||||
tries++;
|
||||
}
|
||||
b=0;
|
||||
write(fdout, &b, 1);
|
||||
close(fdout);
|
||||
|
||||
while (0 < (size = read(fdin, buf, sizeof(buf)))) {
|
||||
write(1, buf, size);
|
||||
if (count == 10 && buf[0]=='#' && buf[9] == '\n') {
|
||||
char *p;
|
||||
strcpy(pipepath, unxcomm);
|
||||
p=pipepath+strlen(unxcomm);
|
||||
while (p>pipepath) {
|
||||
if (*p=='\\' || *p=='/')
|
||||
break;
|
||||
--p;
|
||||
}
|
||||
|
||||
if (p > pipepath) {
|
||||
++p;
|
||||
*p++='r';
|
||||
*p++='u';
|
||||
*p++='n';
|
||||
*p++='/';
|
||||
memcpy(p, buf+1, 8);
|
||||
p += 8;
|
||||
*p++='.';
|
||||
pipeext = p;
|
||||
strcpy(pipeext, "in");
|
||||
} else pipepath[0] = '\0';
|
||||
|
||||
tries=0;
|
||||
do {
|
||||
fdout = open(pipepath, O_WRONLY|O_BINARY);
|
||||
} while (fdout < 0 && tries++ < 5);
|
||||
|
||||
if (fdout <0) {
|
||||
fprintf(stderr, "Cannot open pipe '%s'\n", pipepath);
|
||||
}
|
||||
|
||||
} else {
|
||||
buf[count>0 ? count : 0]='\0';
|
||||
fprintf(stderr, "%d Bytes read are wrong'%s'\n", count, buf);
|
||||
}
|
||||
close(fdin);
|
||||
return(0);
|
||||
|
||||
if (fdout > -1) {
|
||||
char *p=buf;
|
||||
while(--argc) {
|
||||
int l=strlen(*pp);
|
||||
memcpy(p, *pp, l);
|
||||
++pp;
|
||||
p+=l;
|
||||
*p++ = 32;
|
||||
}
|
||||
*p++='\0';
|
||||
write(fdout, buf, (int)(p-buf));
|
||||
|
||||
close(fdout);
|
||||
|
||||
loc_lseek(fdin, 0, 0);
|
||||
memset(buf, 0, 512);
|
||||
|
||||
while (0 < (size = loc_read(fdin, buf, 512 /*sizeof(buf)*/))) {
|
||||
write(1, buf, size);
|
||||
loc_lseek(fdin, 0, 2);
|
||||
}
|
||||
|
||||
loc_close(fdin);
|
||||
return(0);
|
||||
}
|
||||
loc_close(fdin);
|
||||
} else
|
||||
fprintf(stderr, "Cannot open PIPECOMMAND '%s'\n", unxcomm);
|
||||
}
|
||||
|
||||
Binary file not shown.
BIN
examples/comm32.exe
Normal file
BIN
examples/comm32.exe
Normal file
Binary file not shown.
@@ -1,4 +1,4 @@
|
||||
/* config.h: 04-Feb-98 */
|
||||
/* config.h: 11-Jul-98 */
|
||||
/* some of this config is needed by make, others by cc */
|
||||
|
||||
#define DO_DEBUG 1 /* compile in debug code */
|
||||
@@ -14,7 +14,7 @@
|
||||
# define FILENAME_NW_INI "/etc/nwserv.conf"
|
||||
/* full name of ini (conf) file */
|
||||
# define PATHNAME_PROGS "/usr/sbin" /* where to find the executables */
|
||||
# define PATHNAME_BINDERY "/etc" /* directory for bindery-files */
|
||||
# define PATHNAME_BINDERY "/var/nwserv/db" /* directory for bindery-files */
|
||||
#endif
|
||||
|
||||
#define PATHNAME_PIDFILES "/var/run" /* directory for 'pidfiles' */
|
||||
@@ -77,9 +77,7 @@
|
||||
|
||||
#define PERSISTENT_SYMLINKS 0 /* change to '1' for persistent symlinks */
|
||||
/* main idea from Victor Khimenko */
|
||||
/* in 0.99.pl0 still NOT working !! */
|
||||
|
||||
#define NEW_ATTRIB_HANDLING 0 /* better (if working ;)) attrib handling */
|
||||
/* still NOT working !! */
|
||||
|
||||
/* <--------------- next is for linux only ----------------------------> */
|
||||
#define INTERNAL_RIP_SAP 1 /* use internal/own rip/sap routines */
|
||||
|
||||
BIN
examples/e.pck
Normal file
BIN
examples/e.pck
Normal file
Binary file not shown.
1
examples/mk
Executable file
1
examples/mk
Executable file
@@ -0,0 +1 @@
|
||||
make unxcomm && mv unxcomm /u3/pipes/.
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/bin/sh
|
||||
# mk.li 10-Jul-97
|
||||
# mk.li 15-Dec-99
|
||||
# please edit this file !
|
||||
|
||||
mk()
|
||||
@@ -43,7 +43,8 @@ case $UNX in
|
||||
CPP="cc -E"
|
||||
# CFLAGS="-pipe -O2 -fomit-frame-pointer"
|
||||
# problems gcc2.5.8 ^^^^^^^^^^^^^^^^^^^^^
|
||||
CFLAGS="-pipe -Wall"
|
||||
# CFLAGS="-pipe -Wall -Dsignal=sysv_signal"
|
||||
CFLAGS="$RPM_OPT_FLAGS -pipe -Wall -D_GNU_SOURCE"
|
||||
|
||||
case $MASCHINE in
|
||||
sparc)
|
||||
@@ -59,7 +60,17 @@ if [ -f /usr/lib/libgdbm.a ] || [ -f /usr/lib/libgdbm.so ] ; then
|
||||
else
|
||||
NDBMLIB="-ldbm"
|
||||
fi
|
||||
|
||||
if [ -f /usr/lib/libcrypt.so ] ; then
|
||||
CRYPTLIB="-lcrypt"
|
||||
else
|
||||
CRYPTLIB=""
|
||||
fi
|
||||
|
||||
if [ -f /usr/include/sys/quota.h ] ; then
|
||||
HOSTCFLAGS="$HOSTCFLAGS -DQTAINSYS"
|
||||
fi
|
||||
|
||||
NSLLIB=""
|
||||
MAKE=make
|
||||
TMP=/tmp
|
||||
@@ -80,6 +91,28 @@ fi
|
||||
TMP=/tmp
|
||||
INSTALL=/usr/ucb/install
|
||||
;;
|
||||
|
||||
########## FreeBSD ############
|
||||
# created by Boris Popov
|
||||
freebsd)
|
||||
V_VPATH=".."
|
||||
OBJDIR="obj"
|
||||
CC=gcc
|
||||
CPP="gcc -E"
|
||||
if [ "x$CFLAGS" = "x" ]; then
|
||||
CFLAGS="native"
|
||||
fi
|
||||
|
||||
HOSTCFLAGS="-DFREEBSD -DLINUX"
|
||||
|
||||
CRYPTLIB="-lcrypt -lipx"
|
||||
|
||||
NSLLIB=""
|
||||
MAKE=make
|
||||
TMP="./"
|
||||
INSTALL="install -c"
|
||||
;;
|
||||
|
||||
*) echo "mk.li: Unknown or not supported OS, probably you must set \$UNX"
|
||||
;;
|
||||
esac
|
||||
@@ -95,7 +128,9 @@ esac
|
||||
|
||||
export CC
|
||||
export CPP
|
||||
export CFLAGS
|
||||
if [ "X$CFLAGS" != "Xnative" ]; then
|
||||
export CFLAGS
|
||||
fi
|
||||
export HOSTCFLAGS
|
||||
export NDBMLIB
|
||||
export CRYPTLIB
|
||||
|
||||
165
examples/nw.ini
165
examples/nw.ini
@@ -2,15 +2,18 @@
|
||||
# This is the configuration-file for "mars_nwe", a free netware-emulator
|
||||
# for Linux.
|
||||
#
|
||||
# last changed: 08-Feb-98
|
||||
#
|
||||
# !! section 5 : deleting of ipx devices/routes changed in 0.99.pl6 !!
|
||||
# !! section 4 : automatic creation of ipx-interfaces changed in 0.98.pl9 !!
|
||||
# last changed: 04-Apr-00
|
||||
# !! section 31 : flags added in 0.99.pl18, but not used
|
||||
# !! section 8 : new flags added in 0.99.pl18 !!
|
||||
# !! section 9 : default directory/file umask changed in 0.99.pl9 !!
|
||||
# !! section 46 : default attrib location changed in 0.99.pl9 !!
|
||||
# !! section 5 : deleting of ipx devices/routes changed in 0.99.pl6 !!
|
||||
# !! section 4 : automatic creation of ipx-interfaces changed in 0.98.pl9 !!
|
||||
#
|
||||
# since version 0.98.pl11:
|
||||
# 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. !!
|
||||
#
|
||||
@@ -52,7 +55,7 @@
|
||||
# /var/local/nwe/SYS -------> SYS -------------> W:
|
||||
#
|
||||
# More than one entry is allowed in this section.
|
||||
# The maximum number of volumes must be specified in `config.h'
|
||||
# The maximum number of volumes must be specified in `config.h'
|
||||
# or in section 61 in this file.
|
||||
#
|
||||
# Please note that at least the volume "SYS" must be defined and it must
|
||||
@@ -76,9 +79,9 @@
|
||||
#
|
||||
# If the netadmin wants to map the homedirectories with the MAP-Command to
|
||||
# every user, he can do it in two variants:
|
||||
# We suppose that the user test2 is logged in MARS_NWE. He has files
|
||||
# We suppose that the user test2 is logged in MARS_NWE. He has files
|
||||
# earlier stored in his homedirectory /home/test2.
|
||||
# In case of entry 1 in /etc/nwserv.conf (naturally amongst other entries)
|
||||
# In case of entry 1 in /etc/nwserv.conf (naturally amongst other entries)
|
||||
# there are other results of the MAP-command.
|
||||
#
|
||||
# Variant 1 Variant 2
|
||||
@@ -86,26 +89,29 @@
|
||||
#DOS-Command MAP H:=MARS\HOMEDIR: MAP H:=MARS\HOMEDIR:
|
||||
#
|
||||
#Entry in /etc/nwserv.conf
|
||||
# 1 HOMEDIR ~ k 1 HOMEDIR /home k
|
||||
# 1 HOMEDIR ~ k 1 HOMEDIR /home k
|
||||
#
|
||||
#Result of DIR *.* All files stored in All homedirs of the
|
||||
# /home/test2 will shown. users will shown.
|
||||
# Showing his own files
|
||||
# it is a command like
|
||||
# it is a command like
|
||||
# CD test2 and then
|
||||
# dir *.* necessary.
|
||||
#
|
||||
# OPTIONS: none or some of the following characters (without a seperator)
|
||||
# - Placeholder.
|
||||
#
|
||||
# Next two options control DOS and OS/2 namespace.
|
||||
# i ignore case, handle mixing upper/lowercase filenames (slow)
|
||||
# should only be used if you really need it.
|
||||
# k use lowercase-filenames (if you don't set this,
|
||||
# and you don't set 'i' all files _must_ be upper-case)
|
||||
#
|
||||
# m removable volume (e.g. cd-roms) or volumes, which
|
||||
# should be remountable when mars_nwe is running.
|
||||
# r volume is read-only and always reports "0 byte free"
|
||||
# (this is intended for copies of CD-ROMs on harddisks)
|
||||
# n (n)o fixed inodes. This volume do not have fixed inodes.
|
||||
# e.g. DOS-Volumes, CD-ROMS. This flag is very important for
|
||||
# attrib and trustee handling.
|
||||
# o (lowercase o)
|
||||
# volume has only one filesystem/device/namespace
|
||||
# this is for filesystems with high inode > 0xFFFFFFF.
|
||||
@@ -114,30 +120,41 @@
|
||||
# between several devices/namespaces for one volume.
|
||||
# p "PIPE"-filesystem. All files are pipe commands.
|
||||
# See `doc/PIPE-FS'.
|
||||
# r volume is read-only and always reports "0 byte free"
|
||||
# (this is intended for copies of CD-ROMs on harddisks)
|
||||
# t volume has trustees.
|
||||
# Real access is trustee rights + unix rights.
|
||||
# Trustees are stored in extra directories,
|
||||
# normally under /var/nwserv/trustees.
|
||||
# Must only be used for volume which have fix inodes.
|
||||
# A volume with trustees should never be renamed.
|
||||
# For some more notes see 'doc/TRUSTEES'.
|
||||
# T volume has trustees & ignore the rights granted in UN*X filesystem
|
||||
# exactly like option "t" except that the unix rights are not added
|
||||
#
|
||||
# additional Namespaces
|
||||
# O (uppercase o)
|
||||
# O (uppercase o)
|
||||
# + OS/2 namespace (useful for Win95 clients, see doc/FAQS).
|
||||
# N + NFS namespace (not really tested).
|
||||
#
|
||||
#
|
||||
# UMASKDIR: default directory creat umask.
|
||||
# UMASKFILE: default file creat umask.
|
||||
# value are always octal, overwrite standard section 9 entries
|
||||
# for this specific volume.
|
||||
# values are always octal, they overwrite standard
|
||||
# section 9 values for this specific volume.
|
||||
#
|
||||
# -------------------------------------------------------------------------
|
||||
#
|
||||
# Examples:
|
||||
# 1 SYS /var/local/nwe/SYS k
|
||||
# 1 CDROM /cdrom kmor
|
||||
# 1 SYS /var/local/nwe/SYS kt 711 600
|
||||
# 1 CDROM /cdrom kmnor
|
||||
# 1 HOME ~ k -1
|
||||
# 1 HOMETMP ~/tmp kiO
|
||||
# 1 PRIVAT ~/privat kO 700 600
|
||||
# 1 WORLD /var/world kiO 777 666
|
||||
# 1 FAXQ /var/spool/fax/faxqueue k
|
||||
|
||||
|
||||
1 SYS /u3/SYS/ k -1
|
||||
1 SYS /u3/SYS/ kt 711 600
|
||||
|
||||
|
||||
# =========================================================================
|
||||
@@ -260,7 +277,7 @@
|
||||
# routers, the shortest path can be determined by summing up
|
||||
# all ticks for every route and compare the results.
|
||||
# (1 tick = 1/18th second), default=1
|
||||
# Note: If ticks > 6 then the internal router handles
|
||||
# Note: If ticks > 6 then the internal router handles
|
||||
# RIP/SAP specially. (RIP/SAP filtering)
|
||||
#
|
||||
# !! NOTE !!
|
||||
@@ -286,7 +303,7 @@
|
||||
# 4 0x0 ippp0 AUTO 7 # auto ippp0 (isdn ppp) interface.
|
||||
# 4 0x0 ppp0 AUTO 7 # auto detection of ppp0 interface.
|
||||
|
||||
|
||||
|
||||
4 0x22 eth0 ethernet_ii 1
|
||||
4 0x0 * AUTO 1
|
||||
|
||||
@@ -295,20 +312,26 @@
|
||||
# Flags
|
||||
# 0x1 do not remove by nwserv/nwrouted added routes and ipx-devices
|
||||
# beyond the lifetime of the server or router.
|
||||
# If this flag is not set then all by nwserv/nwrouted added
|
||||
# ipx-devices/routes will be deleted when
|
||||
# nwserv/nwrouted ends (default).
|
||||
# If this flag is not set then all by nwserv/nwrouted added
|
||||
# ipx-devices/routes will be deleted when
|
||||
# nwserv/nwrouted ends and if no ipx socket is still
|
||||
# open. (default).
|
||||
#
|
||||
# 0x2 Switch on automatic kernel creation of ipx-interfaces.
|
||||
# The automatic kernel creating of ipx-devices sometimes
|
||||
# make trouble (Win95). It should only be used in the
|
||||
# beginning or for testing.
|
||||
# beginning or for testing !!
|
||||
#
|
||||
# 0x4 do remove ALL routes and ipx-devices
|
||||
# beyond the lifetime of the server or router.
|
||||
# If this flag is set then all ipx-devices/routes
|
||||
# will be deleted when nwserv/nwrouted ends.
|
||||
# will be deleted when nwserv/nwrouted ends,
|
||||
# without looking for open ipx sockets.
|
||||
# This was the default prior mars_nwe 0.99.pl6 !
|
||||
# This also do complete ipx reinit when starting
|
||||
# mars_nwe.
|
||||
# This was the default prior mars_nwe 0.99.pl9 !
|
||||
#
|
||||
#
|
||||
#
|
||||
# other flags may follow.
|
||||
@@ -329,7 +352,7 @@
|
||||
# SERVER_VERSION: the version-number reported to DOS-clients
|
||||
# 0 Version 2.15 (was default till version 0.98.pl7)
|
||||
# 1 Version 3.11 (is default now)
|
||||
# 2 Version 3.12
|
||||
# 2 Version 3.12
|
||||
#
|
||||
# If you want to use longfilenamesupport and/or namespace routines
|
||||
# you should set this section to '1' or '2'
|
||||
@@ -400,7 +423,7 @@
|
||||
#
|
||||
# 0x8 ignore station/time restrictions for supervisor.
|
||||
#
|
||||
# 0x10 allows deleting a file even if the file is opened by
|
||||
# 0x10 allows deleting a file even if the file is opened by
|
||||
# other process.
|
||||
# ( this was standard before mars_nwe-0.99.pl0 )
|
||||
#
|
||||
@@ -412,6 +435,15 @@
|
||||
# in some volume info calls.
|
||||
# some DOS clients need it.
|
||||
#
|
||||
# 0x80 allows renaming a file even if the file is opened by
|
||||
# other process.
|
||||
# ( this was standard before mars_nwe-0.99.pl18 )
|
||||
#
|
||||
# 0x100 not used yet.
|
||||
#
|
||||
# 0x200 needed for direct int17 printing on NETX clients
|
||||
# (patch from Przemyslaw Czerpak)
|
||||
#
|
||||
# other flags may follow.
|
||||
# value will be interpreted as hex value.
|
||||
|
||||
@@ -426,9 +458,9 @@
|
||||
# if -1 is specified for directories the st_mode of parent directory
|
||||
# will be used.
|
||||
# Volumes depended values can be set in section 1.
|
||||
# 9 -1 0664
|
||||
# 9 -1 0640
|
||||
#
|
||||
9 0755 0664
|
||||
9 0751 0640
|
||||
|
||||
# Section 10: UID and GID with minimal rights
|
||||
# =========================================================================
|
||||
@@ -536,17 +568,19 @@
|
||||
# a '-' sign as password.
|
||||
# -------------------------------------------------------------------------
|
||||
# Syntax:
|
||||
# 13 NW_LOGIN LINUX_LOGIN [PASSWORD] [FLAGS]
|
||||
# 13 NW_LOGIN [LINUX_LOGIN] [PASSWORD] [FLAGS]
|
||||
#
|
||||
# FLAGS must be a hex value begin with 0x
|
||||
# the only FLAG value in the moment is 0x1 for 'fixed passwords'
|
||||
# which cannot be changed by user.
|
||||
# Example:
|
||||
# 13 MARTIN
|
||||
# 13 MARTIN martin
|
||||
# 13 DAREK martin
|
||||
# 13 COMMON common gast 0x1 # no password change by user.
|
||||
# 13 COMMON common 0x1 # syntax is allowed too.
|
||||
|
||||
13 GUEST nobody - 0x1
|
||||
|
||||
# Section 14: currently not used
|
||||
|
||||
@@ -594,21 +628,45 @@
|
||||
15 0 top-secret
|
||||
|
||||
|
||||
|
||||
# =========================================================================
|
||||
# Section 16: Tests on startup
|
||||
#
|
||||
# If you want some sanity checks at startup, set this flag to 1.
|
||||
# If you want some sanity checks at startup, set this flag to > 0.
|
||||
# "mars_nwe" will try to create/change missing directories:
|
||||
# SYS:LOGIN, SYS:MAIL, SYS:MAIL/XXX, SYS:PUBLIC, SYS:SYSTEM ...
|
||||
# (with the "right" permissions, of course) if you enable this.
|
||||
# should also be enabled when you use a new mars_nwe version.
|
||||
# Disabling this test only spares little time when starting mars_nwe.
|
||||
# some values:
|
||||
# 1 few important tests.
|
||||
# 2 also check/compress bindery.
|
||||
|
||||
16 1
|
||||
|
||||
|
||||
# Section 17-20: currently not used
|
||||
# Section 17: some bindery / user related flags.
|
||||
# =========================================================================
|
||||
# Flags
|
||||
# 0x1 give all user an empty! login script, if they do not
|
||||
# already have one. Is interpreted by test routines
|
||||
# which run if section 16 is set and nwserv starts
|
||||
# or got a SIGHUP. ( nwserv -h )
|
||||
#
|
||||
# other flags may follow.
|
||||
# value will be interpreted as hex value.
|
||||
|
||||
17 0x0
|
||||
|
||||
# Section 18: some queue handling related flags.
|
||||
# =========================================================================
|
||||
# Flags
|
||||
# 0x1 always unset (disable) the print banner flag.
|
||||
#
|
||||
# other flags may follow.
|
||||
# value will be interpreted as hex value.
|
||||
18 0x0
|
||||
|
||||
# Section 19-20: currently not used
|
||||
|
||||
|
||||
# =========================================================================
|
||||
@@ -633,7 +691,7 @@
|
||||
# It must exist before printing.
|
||||
# (_not_ the spooling-directories of the Linux-lpd)
|
||||
# NOTE !
|
||||
# A '-' sign as QUEUE_DIR has special meaning of
|
||||
# A '-' sign as QUEUE_DIR has special meaning of
|
||||
# 'standard' queuedir name. ( SYS:\SYSTEM\queueid.QDR )
|
||||
#
|
||||
# PRINT_COMMAND: command used for serving the print-jobs under Linux
|
||||
@@ -644,13 +702,16 @@
|
||||
# command as last parameters.
|
||||
# NOTE !
|
||||
# If a print command is not specified the job can/must be
|
||||
# printed by any print server.
|
||||
# printed by any print server.
|
||||
# (e.g. pserver (ncpfs utils) or external printserver)
|
||||
#
|
||||
# Examples:
|
||||
# 21 LASER - lpr -Plaser
|
||||
# 21 OCTOPUSS
|
||||
# 21 OCTOPUSS
|
||||
# 21 FAXPRINT - /usr/bin/psfaxprn /var/spool/fax/faxqueue
|
||||
# -------------------------------------------------------------------------
|
||||
21 LP - lpr -
|
||||
21 LP_PS
|
||||
|
||||
|
||||
# =========================================================================
|
||||
@@ -659,9 +720,16 @@
|
||||
# e.g. to enable printing with ncpfs pserver
|
||||
# -------------------------------------------------------------------------
|
||||
# Syntax:
|
||||
# 22 PSERVER_NAME QUEUE_NAME
|
||||
# 22 PSERVER_NAME QUEUE_NAME [FLAGS]
|
||||
#
|
||||
# FLAGS:
|
||||
# 1 Let PSERVER_NAME be a 'normal' user (type 1).
|
||||
# Used for simple qserver which works under 'normal' user login.
|
||||
#
|
||||
# Examples:
|
||||
# 22 PS1 OCTOPUSS
|
||||
# 22 PS1 OCTOPUSS
|
||||
|
||||
22 PS_NWE LP_PS 1
|
||||
|
||||
|
||||
# =========================================================================
|
||||
@@ -675,22 +743,31 @@
|
||||
# 30 0x2000 0x2000
|
||||
|
||||
|
||||
# =========================================================================
|
||||
# Section 31: not used yet
|
||||
# =========================================================================
|
||||
# Flags not used yet
|
||||
#
|
||||
31 0x0
|
||||
|
||||
# =========================================================================
|
||||
# Section 40ff: Some pathes (optional)
|
||||
#
|
||||
# -------------------------------------------------------------------------
|
||||
# 40 = path for vol/dev/inode->path cache, needed for client-32,namespace
|
||||
40 /var/spool/nwserv/.volcache
|
||||
40 /var/spool/nwserv/.volcache
|
||||
# 41 = path for share/lock files
|
||||
41 /var/spool/nwserv/.locks
|
||||
# 42 = path for spool dir, e.g. internal print queue handling
|
||||
42 /var/spool/nwserv
|
||||
#
|
||||
#
|
||||
# 45 = path for bindery file's
|
||||
45 /etc
|
||||
# 46 = path for attribute handling and later trustees
|
||||
46 /var/lib/nwserv/attrib
|
||||
# 45 = path for bindery file's
|
||||
45 /var/nwserv/db
|
||||
# 46 = path for attribute handling
|
||||
46 /var/nwserv/attrib
|
||||
# 47 = path for trustee handling
|
||||
47 /var/nwserv/trustees
|
||||
# =========================================================================
|
||||
# Section 50: Conversion tables by Victor Khimenko <khim@mccme.ru>
|
||||
# Tables for DOS->Unix names translation & upper/lowercase translations
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
# example for nwopt file.
|
||||
# example for nwopt file.
|
||||
# !!!! NOT USED !!!!!
|
||||
#
|
||||
# last changed: 18-Nov-97
|
||||
# last changed: 10-May-98
|
||||
#
|
||||
# Syntax similar like nwserv.conf file.
|
||||
#
|
||||
|
||||
@@ -1,12 +1,21 @@
|
||||
/* unxcomm.c 08-Jun-97 */
|
||||
/* simple UNX program to work together with 'comm' */
|
||||
/* to demonstrate usage of pipefilesystem */
|
||||
/* unxcomm.c 22-Oct-98
|
||||
* simple UNX program to work together with 'comm'
|
||||
* to demonstrate usage of pipefilesystem
|
||||
* needs mars_nwe version >= 0.99.pl13 !
|
||||
* comm and unxcomm must be same version !
|
||||
* 'run' directory must exist and must have
|
||||
* read and write permission for every user.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <string.h>
|
||||
#include <signal.h>
|
||||
#include <sys/wait.h>
|
||||
|
||||
static char **build_argv(int bufsize, char *command, int len)
|
||||
/* routine returns **argv for use with execv routines */
|
||||
@@ -51,8 +60,8 @@ int bl_read(int fd, void *buf, int size)
|
||||
int result;
|
||||
FD_ZERO(&fdin);
|
||||
FD_SET(fd, &fdin);
|
||||
t.tv_sec = 0;
|
||||
t.tv_usec = 100; /* 100 msec should be enough */
|
||||
t.tv_sec = 1;
|
||||
t.tv_usec = 0;
|
||||
result = select(fd+1, &fdin, NULL, NULL, &t);
|
||||
if (result > 0)
|
||||
result=read(fd, buf, size);
|
||||
@@ -61,15 +70,49 @@ int bl_read(int fd, void *buf, int size)
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int size=0;
|
||||
int l;
|
||||
int size=-1;
|
||||
int pid=getpid();
|
||||
char buf[MAXARGLEN+1024];
|
||||
char fifopath[257];
|
||||
char *p;
|
||||
|
||||
close(2);
|
||||
dup2(1,2);
|
||||
|
||||
while (0 < (l=bl_read(0, buf+size, MAXARGLEN-size)))
|
||||
size+=l;
|
||||
|
||||
if (argc > 3) {
|
||||
strcpy(fifopath, argv[0]);
|
||||
p=strrchr(fifopath, '/');
|
||||
if (p) {
|
||||
++p;
|
||||
sprintf(p, "run/%08x.in", pid);
|
||||
if (mkfifo(fifopath, 0600)) {
|
||||
perror("mkfifo");
|
||||
fprintf(stderr, "unxcomm:fifo.in=`%s`\n", fifopath);
|
||||
} else {
|
||||
fprintf(stdout, "#%08x\n", pid);
|
||||
fflush(stdout);
|
||||
size=0;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!size) {
|
||||
int tries=0;
|
||||
int fd = open(fifopath, O_RDONLY);
|
||||
if (fd > -1) {
|
||||
while (tries++ < 5) {
|
||||
int l;
|
||||
while (0 < (l=bl_read(fd, buf+size, MAXARGLEN-size))) {
|
||||
size+=l;
|
||||
}
|
||||
if (size && buf[size-1] == '\0') break;
|
||||
}
|
||||
close(fd);
|
||||
} else {
|
||||
perror("open fifo");
|
||||
size=-1;
|
||||
}
|
||||
unlink(fifopath);
|
||||
}
|
||||
if ( 0 < size) {
|
||||
char **argvv=build_argv(sizeof(buf), buf, size);
|
||||
if (argvv) {
|
||||
|
||||
Reference in New Issue
Block a user