Compare commits

...

1 Commits
v0.12 ... v0.13

Author SHA1 Message Date
ncpfs archive import
d31ec2ab61 Import ncpfs 0.13 2026-04-28 20:39:57 +02:00
12 changed files with 120 additions and 72 deletions

BIN
.downloads/ncpfs-0.13.tgz Normal file

Binary file not shown.

9
Changes Normal file
View File

@@ -0,0 +1,9 @@
I only began this file with ncpfs-0.12. If you're interested in older
versions, you can find them on linux01.gwdg.de:/pub/ncpfs/old.
ncpfs-0.12 -> ncpfs-0.13
- support for automatic loading of ncpfs.o by kerneld.
Thanks to Steven N. Hirsch <hirsch@emba.uvm.edu>.
- A subtle problem in the read routines has been removed by Uwe Bonnes
<bon@elektron.ikp.physik.th-darmstadt.de>. Thanks a lot.

View File

@@ -19,7 +19,11 @@ SUBDIRS = util ipx-0.75 man
SUBDIRS += kernel-1.2/src SUBDIRS += kernel-1.2/src
INCLUDES = -I$(TOPDIR)/kernel-1.2 INCLUDES = -I$(TOPDIR)/kernel-1.2
export INCLUDES BINDIR INTERM_BINDIR # If you are using kerneld to autoload ncp support,
# uncomment this (kerneld is in linux since about 1.3.57):
# KERNELD = -DHAVE_KERNELD
export INCLUDES BINDIR INTERM_BINDIR KERNELD
all: all:
for i in $(SUBDIRS); do make -C $$i; done for i in $(SUBDIRS); do make -C $$i; done

13
README
View File

@@ -1,11 +1,6 @@
This is version 0.12 of ncpfs, a free NetWare client filesystem for This is ncpfs, a free NetWare client filesystem for Linux. Besides
Linux. some little utilities it also contains nprint, which enables you to
print on NetWare print queues.
I would like to invite you to write documentation. As those whose
native tongue is English might have noticed, my C is better than my
English. So I doubt that everything in the man/ subdirectory is
written very well. Please feel free to send me any comments about
that.
INSTALLATION INSTALLATION
@@ -74,7 +69,7 @@ I do not want to leave those unmentioned, who have helped me with
ncpfs. ncpfs.
The most enthusiastic user and tester is certainly Uwe Bonnes The most enthusiastic user and tester is certainly Uwe Bonnes
<bon@elektron.ikp.physik.th-darmstadt.de>. Up to now he's the only one <bon@elektron.ikp.physik.th-darmstadt.de>. So far he's the only one
who has contributed something, namely manpages and corretions to who has contributed something, namely manpages and corretions to
existing manpages. existing manpages.

View File

@@ -5,16 +5,16 @@ UTILS = $(INTERM_BINDIR)/ipx_configure $(INTERM_BINDIR)/ipx_interface \
all: $(UTILS) all: $(UTILS)
$(INTERM_BINDIR)/ipx_configure: ipx_configure.o $(INTERM_BINDIR)/ipx_configure: ipx_configure.o
$(CC) -o $(INTERM_BINDIR)/ipx_configure ipx_configure.o $(CC) -s -o $(INTERM_BINDIR)/ipx_configure ipx_configure.o
$(INTERM_BINDIR)/ipx_interface: ipx_interface.o $(INTERM_BINDIR)/ipx_interface: ipx_interface.o
$(CC) -o $(INTERM_BINDIR)/ipx_interface ipx_interface.o $(CC) -s -o $(INTERM_BINDIR)/ipx_interface ipx_interface.o
$(INTERM_BINDIR)/ipx_internal_net: ipx_internal_net.o $(INTERM_BINDIR)/ipx_internal_net: ipx_internal_net.o
$(CC) -o $(INTERM_BINDIR)/ipx_internal_net ipx_internal_net.o $(CC) -s -o $(INTERM_BINDIR)/ipx_internal_net ipx_internal_net.o
$(INTERM_BINDIR)/ipx_route: ipx_route.o $(INTERM_BINDIR)/ipx_route: ipx_route.o
$(CC) -o $(INTERM_BINDIR)/ipx_route ipx_route.o $(CC) -s -o $(INTERM_BINDIR)/ipx_route ipx_route.o
dep: dep:
$(CPP) -M $(INCLUDES) *.c > .depend $(CPP) -M $(INCLUDES) *.c > .depend

View File

@@ -583,7 +583,7 @@ ncp_read(struct ncp_server *server, const char *file_id,
*bytes_read = ntohs(ncp_reply_word(server, 0)); *bytes_read = ntohs(ncp_reply_word(server, 0));
memcpy_tofs(target, ncp_reply_data(server, 2), *bytes_read); memcpy_tofs(target, ncp_reply_data(server, 2+(offset&1)), *bytes_read);
ncp_unlock_server(server); ncp_unlock_server(server);
return 0; return 0;

View File

@@ -1,6 +1,6 @@
Begin3 Begin3
Title: ncpfs Title: ncpfs
Version: 0.12 Version: 0.13
Entered-date: 14. January 1996 Entered-date: 14. January 1996
Description: With ncpfs you can mount volumes of your novell Description: With ncpfs you can mount volumes of your novell
server under Linux. You need kernel 1.2.x or server under Linux. You need kernel 1.2.x or
@@ -11,7 +11,7 @@ Author: lendecke@namu01.gwdg.de (Volker Lendecke)
Maintained-by: lendecke@namu01.gwdg.de (Volker Lendecke) Maintained-by: lendecke@namu01.gwdg.de (Volker Lendecke)
Primary-site: linux01.gwdg.de:/pub/ncpfs Primary-site: linux01.gwdg.de:/pub/ncpfs
Alternate-site: sunsite.unc.edu:/pub/system/Filesystems/ Alternate-site: sunsite.unc.edu:/pub/system/Filesystems/
~66k ncpfs-0.12.tgz ~67k ncpfs-0.13.tgz
~ 1k ncpfs-0.12.lsm ~ 1k ncpfs-0.13.lsm
Copying-policy: GPL Copying-policy: GPL
End End

View File

@@ -6,7 +6,7 @@ UTIL_EXECS = ncpmount ncpumount nprint slist pqlist
UTILS = $(addprefix $(INTERM_BINDIR)/,$(UTIL_EXECS)) UTILS = $(addprefix $(INTERM_BINDIR)/,$(UTIL_EXECS))
UIDUTILS = ncpmount ncpumount UIDUTILS = ncpmount ncpumount
CFLAGS = -Wall $(INCLUDES) -O2 CFLAGS = -Wall $(INCLUDES) -O2 $(KERNELD)
CC = gcc CC = gcc
all: $(UTILS) ncptest all: $(UTILS) ncptest
@@ -17,7 +17,7 @@ install: all
for i in $(UIDUTILS); do chmod 4755 $(BINDIR)/$$i; done for i in $(UIDUTILS); do chmod 4755 $(BINDIR)/$$i; done
$(UTILS): $(addsuffix .o,$(UTIL_EXECS)) ncplib.o $(UTILS): $(addsuffix .o,$(UTIL_EXECS)) ncplib.o
$(CC) -o $@ $(addsuffix .o,$(notdir $@)) ncplib.o $(CC) -s -o $@ $(addsuffix .o,$(notdir $@)) ncplib.o
ncplib.o: ncplib.c ncplib.h ncplib.o: ncplib.c ncplib.h
$(CC) $(CFLAGS) -finline-functions -c ncplib.c $(CC) $(CFLAGS) -finline-functions -c ncplib.c

View File

@@ -1306,6 +1306,7 @@ ncp_initialize(struct ncp_conn *conn,
} }
errno = EINVAL; errno = EINVAL;
memzero(*conn);
while (i < *argc) while (i < *argc)
{ {
@@ -2272,14 +2273,22 @@ ncp_open_create_file_or_subdir(struct ncp_conn *conn,
int int
ncp_initialize_search(struct ncp_conn *conn, ncp_initialize_search(struct ncp_conn *conn,
struct nw_info_struct *dir, const struct nw_info_struct *dir,
struct nw_search_sequence *target) int namespace,
struct ncp_search_seq *target)
{ {
int result; int result;
if ((namespace < 0) || (namespace > 255))
{
return EINVAL;
}
memzero(*target);
ncp_init_request(conn); ncp_init_request(conn);
ncp_add_byte(conn, 2); /* subfunction */ ncp_add_byte(conn, 2); /* subfunction */
ncp_add_byte(conn, 0); /* dos name space */ ncp_add_byte(conn, namespace);
ncp_add_byte(conn, 0); /* reserved */ ncp_add_byte(conn, 0); /* reserved */
ncp_add_handle_path(conn, dir->volNumber, ncp_add_handle_path(conn, dir->volNumber,
dir->DosDirNum, 1, NULL); dir->DosDirNum, 1, NULL);
@@ -2289,7 +2298,8 @@ ncp_initialize_search(struct ncp_conn *conn,
return result; return result;
} }
memcpy(target, ncp_reply_data(conn, 0), sizeof(*target)); memcpy(&(target->s), ncp_reply_data(conn, 0), sizeof(target->s));
target->namespace = namespace;
ncp_unlock_conn(conn); ncp_unlock_conn(conn);
return 0; return 0;
@@ -2298,18 +2308,18 @@ ncp_initialize_search(struct ncp_conn *conn,
/* Search for everything */ /* Search for everything */
int int
ncp_search_for_file_or_subdir(struct ncp_conn *conn, ncp_search_for_file_or_subdir(struct ncp_conn *conn,
struct nw_search_sequence *seq, struct ncp_search_seq *seq,
struct nw_info_struct *target) struct nw_info_struct *target)
{ {
int result; int result;
ncp_init_request(conn); ncp_init_request(conn);
ncp_add_byte(conn, 3); /* subfunction */ ncp_add_byte(conn, 3); /* subfunction */
ncp_add_byte(conn, 0); /* dos name space */ ncp_add_byte(conn, seq->namespace);
ncp_add_byte(conn, 0); /* data stream (???) */ ncp_add_byte(conn, 0); /* data stream (???) */
ncp_add_word(conn, 0xffff); /* Search attribs */ ncp_add_word(conn, 0xffff); /* Search attribs */
ncp_add_dword(conn, RIM_ALL); /* return info mask */ ncp_add_dword(conn, RIM_ALL); /* return info mask */
ncp_add_mem(conn, seq, 9); ncp_add_mem(conn, &(seq->s), 9);
ncp_add_byte(conn, 2); /* 2 byte pattern */ ncp_add_byte(conn, 2); /* 2 byte pattern */
ncp_add_byte(conn, 0xff); /* following is a wildcard */ ncp_add_byte(conn, 0xff); /* following is a wildcard */
ncp_add_byte(conn, '*'); ncp_add_byte(conn, '*');

View File

@@ -67,6 +67,11 @@ struct ncp_conn_spec {
char password[NCP_BINDERY_NAME_LEN]; char password[NCP_BINDERY_NAME_LEN];
}; };
struct ncp_search_seq {
struct nw_search_sequence s;
int namespace;
};
/* ncp_initialize is the main entry point for user programs which want /* ncp_initialize is the main entry point for user programs which want
to connect to a NetWare Server. It looks for -S, -U, -P and -n in to connect to a NetWare Server. It looks for -S, -U, -P and -n in
the argument list, opens the connection and removes the arguments the argument list, opens the connection and removes the arguments
@@ -257,12 +262,13 @@ ncp_open_create_file_or_subdir(struct ncp_conn *conn,
int int
ncp_initialize_search(struct ncp_conn *conn, ncp_initialize_search(struct ncp_conn *conn,
struct nw_info_struct *dir, const struct nw_info_struct *dir,
struct nw_search_sequence *target); int namespace,
struct ncp_search_seq *target);
int int
ncp_search_for_file_or_subdir(struct ncp_conn *conn, ncp_search_for_file_or_subdir(struct ncp_conn *conn,
struct nw_search_sequence *seq, struct ncp_search_seq *seq,
struct nw_info_struct *target); struct nw_info_struct *target);
int int

View File

@@ -3,6 +3,16 @@
* *
* Copyright (C) 1995 by Volker Lendecke * Copyright (C) 1995 by Volker Lendecke
* *
* 1/20/96 - Steven N. Hirsch (hirsch@emba.uvm.edu)
*
* If the ncpfs support is not loaded and we are using kerneld to
* autoload modules, then we don't want to do it here. I added
* a conditional which leaves out the test and load code.
*
* Even if we _do_ want ncpmount to load the module, passing a
* fully-qualified pathname to insmod causes it to bypass a
* path search. This may lead to ncpfs.o not being found on
* some systems.
*/ */
#include <stdio.h> #include <stdio.h>
@@ -41,14 +51,15 @@ static void str_upper(char *name);
static void usage(void); static void usage(void);
static void help(void); static void help(void);
#ifndef HAVE_KERNELD
/* Returns 0 if the filesystem is in the kernel after this routine /* Returns 0 if the filesystem is in the kernel after this routine
completes */ completes */
static int static int
load_ncpfs(void) load_ncpfs(void)
{ {
FILE *fver, *ffs; FILE *ffs;
char s[1024]; char s[1024];
char modname[1024];
char *p, *p1; char *p, *p1;
pid_t pid; pid_t pid;
int status; int status;
@@ -81,33 +92,6 @@ load_ncpfs(void)
{ {
return 0; return 0;
} }
fver = fopen("/proc/version", "r");
if (fver == NULL)
{
perror("Error: \"/proc/version\" could not be read:");
return -1;
}
fgets(s, 1024, fver);
fclose(fver);
p = strstr(s, "version ");
if (p == NULL)
{
version_error:
fprintf(stderr, "Error: Unable to determine the Linux version"
"from \"/proc/version\n");
return -1;
}
p = strchr(p, ' ') + 1;
p1 = strchr(p, ' ');
if (p1 == NULL)
{
goto version_error;
}
strcpy(modname, "/lib/modules/");
strncat(modname, p, p1 - p);
strcat(modname, "/ncpfs.o");
/* system() function without signal handling, from Stevens */ /* system() function without signal handling, from Stevens */
@@ -118,7 +102,7 @@ load_ncpfs(void)
else if (pid == 0) else if (pid == 0)
{ {
/* child */ /* child */
execl("/sbin/insmod", "insmod", modname, NULL); execl("/sbin/insmod", "insmod", "ncpfs", NULL);
_exit(127); /* execl error */ _exit(127); /* execl error */
} }
else else
@@ -136,6 +120,8 @@ load_ncpfs(void)
return status; return status;
} }
#endif /* HAVE_KERNELD */
/* Check whether user is allowed to mount on the specified mount point */ /* Check whether user is allowed to mount on the specified mount point */
static int static int
mount_ok(struct stat *st) mount_ok(struct stat *st)
@@ -345,6 +331,7 @@ main(int argc, char *argv[])
exit(1); exit(1);
} }
#ifndef HAVE_KERNEL
/* Check if the ncpfs filesystem is in the kernel. If not, attempt /* Check if the ncpfs filesystem is in the kernel. If not, attempt
* to load the ncpfs module */ * to load the ncpfs module */
if (load_ncpfs() != 0) if (load_ncpfs() != 0)
@@ -352,6 +339,7 @@ main(int argc, char *argv[])
fprintf(stderr, "Error: Unable to load ncpfs, exiting...\n"); fprintf(stderr, "Error: Unable to load ncpfs, exiting...\n");
exit(1); exit(1);
} }
#endif
data.version = NCP_MOUNT_VERSION; data.version = NCP_MOUNT_VERSION;
data.mounted_uid = conn_uid; data.mounted_uid = conn_uid;

View File

@@ -96,24 +96,60 @@ test_print(struct ncp_conn *conn)
} }
void void
main(void) test_ls(struct ncp_conn *server)
{
struct nw_info_struct sys;
struct nw_info_struct public;
struct ncp_search_seq seq;
struct nw_info_struct found;
int res;
if (ncp_do_lookup(server, NULL, "SYS", &sys) != 0)
{
printf("lookup error\n");
return;
}
if (ncp_do_lookup(server, &sys, "PUBLIC", &public) != 0)
{
printf("lookup public error\n");
return;
}
if (ncp_initialize_search(server, &public, 4, &seq) != 0)
{
printf("init error\n");
return;
}
while ((res=ncp_search_for_file_or_subdir(server,&seq,&found)) == 0)
{
printf("found %s: %s\n",
(found.attributes & aDIR) ? "dir " : "file",
found.entryName);
}
if (res == 0xfe)
{
printf("result: no more files\n");
}
else
{
printf("other error: %x\n", res);
}
return;
}
int
main(int argc, char *argv[])
{ {
struct ncp_conn conn; struct ncp_conn conn;
struct ncp_conn_spec *spec;
if ((spec = ncp_find_conn_spec("NW311", "me", "", 0)) == NULL) if (ncp_initialize(&conn, &argc, argv, 1) != 0)
{ {
perror("could not find spec"); perror("ncp_initialize");
exit(1); return 1;
} }
if (ncp_open(&conn, NULL) != 0) test_ls(&conn);
{
perror("ncp_open");
exit(1);
}
test_print(&conn);
ncp_close(&conn); ncp_close(&conn);
return 0;
} }