diff --git a/.downloads/ncpfs-0.13.tgz b/.downloads/ncpfs-0.13.tgz new file mode 100644 index 0000000..3bcb861 Binary files /dev/null and b/.downloads/ncpfs-0.13.tgz differ diff --git a/Changes b/Changes new file mode 100644 index 0000000..0882828 --- /dev/null +++ b/Changes @@ -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 . +- A subtle problem in the read routines has been removed by Uwe Bonnes + . Thanks a lot. \ No newline at end of file diff --git a/Makefile b/Makefile index ee83bf3..3c5ff50 100644 --- a/Makefile +++ b/Makefile @@ -19,7 +19,11 @@ SUBDIRS = util ipx-0.75 man SUBDIRS += kernel-1.2/src 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: for i in $(SUBDIRS); do make -C $$i; done diff --git a/README b/README index fe518f9..7136095 100644 --- a/README +++ b/README @@ -1,11 +1,6 @@ -This is version 0.12 of ncpfs, a free NetWare client filesystem for -Linux. - -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. +This is ncpfs, a free NetWare client filesystem for Linux. Besides +some little utilities it also contains nprint, which enables you to +print on NetWare print queues. INSTALLATION @@ -74,7 +69,7 @@ I do not want to leave those unmentioned, who have helped me with ncpfs. The most enthusiastic user and tester is certainly Uwe Bonnes -. Up to now he's the only one +. So far he's the only one who has contributed something, namely manpages and corretions to existing manpages. diff --git a/ipx-0.75/Makefile b/ipx-0.75/Makefile index f2a2a8a..02fd3aa 100644 --- a/ipx-0.75/Makefile +++ b/ipx-0.75/Makefile @@ -5,16 +5,16 @@ UTILS = $(INTERM_BINDIR)/ipx_configure $(INTERM_BINDIR)/ipx_interface \ all: $(UTILS) $(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 - $(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 - $(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 - $(CC) -o $(INTERM_BINDIR)/ipx_route ipx_route.o + $(CC) -s -o $(INTERM_BINDIR)/ipx_route ipx_route.o dep: $(CPP) -M $(INCLUDES) *.c > .depend diff --git a/kernel-1.2/src/ncplib_kernel.c b/kernel-1.2/src/ncplib_kernel.c index e89fdd3..f163f26 100644 --- a/kernel-1.2/src/ncplib_kernel.c +++ b/kernel-1.2/src/ncplib_kernel.c @@ -583,7 +583,7 @@ ncp_read(struct ncp_server *server, const char *file_id, *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); return 0; diff --git a/ncpfs-0.12.lsm b/ncpfs-0.13.lsm similarity index 84% rename from ncpfs-0.12.lsm rename to ncpfs-0.13.lsm index 4e884ed..4e237fd 100644 --- a/ncpfs-0.12.lsm +++ b/ncpfs-0.13.lsm @@ -1,6 +1,6 @@ Begin3 Title: ncpfs -Version: 0.12 +Version: 0.13 Entered-date: 14. January 1996 Description: With ncpfs you can mount volumes of your novell 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) Primary-site: linux01.gwdg.de:/pub/ncpfs Alternate-site: sunsite.unc.edu:/pub/system/Filesystems/ - ~66k ncpfs-0.12.tgz - ~ 1k ncpfs-0.12.lsm + ~67k ncpfs-0.13.tgz + ~ 1k ncpfs-0.13.lsm Copying-policy: GPL End diff --git a/util/Makefile b/util/Makefile index cf5b50f..b5ea70c 100644 --- a/util/Makefile +++ b/util/Makefile @@ -6,7 +6,7 @@ UTIL_EXECS = ncpmount ncpumount nprint slist pqlist UTILS = $(addprefix $(INTERM_BINDIR)/,$(UTIL_EXECS)) UIDUTILS = ncpmount ncpumount -CFLAGS = -Wall $(INCLUDES) -O2 +CFLAGS = -Wall $(INCLUDES) -O2 $(KERNELD) CC = gcc all: $(UTILS) ncptest @@ -17,7 +17,7 @@ install: all for i in $(UIDUTILS); do chmod 4755 $(BINDIR)/$$i; done $(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 $(CC) $(CFLAGS) -finline-functions -c ncplib.c diff --git a/util/ncplib.c b/util/ncplib.c index c35c9cc..9d538f7 100644 --- a/util/ncplib.c +++ b/util/ncplib.c @@ -1306,6 +1306,7 @@ ncp_initialize(struct ncp_conn *conn, } errno = EINVAL; + memzero(*conn); while (i < *argc) { @@ -2272,14 +2273,22 @@ ncp_open_create_file_or_subdir(struct ncp_conn *conn, int ncp_initialize_search(struct ncp_conn *conn, - struct nw_info_struct *dir, - struct nw_search_sequence *target) + const struct nw_info_struct *dir, + int namespace, + struct ncp_search_seq *target) { int result; + if ((namespace < 0) || (namespace > 255)) + { + return EINVAL; + } + + memzero(*target); + ncp_init_request(conn); 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_handle_path(conn, dir->volNumber, dir->DosDirNum, 1, NULL); @@ -2289,7 +2298,8 @@ ncp_initialize_search(struct ncp_conn *conn, 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); return 0; @@ -2298,18 +2308,18 @@ ncp_initialize_search(struct ncp_conn *conn, /* Search for everything */ int 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) { int result; ncp_init_request(conn); 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_word(conn, 0xffff); /* Search attribs */ 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, 0xff); /* following is a wildcard */ ncp_add_byte(conn, '*'); diff --git a/util/ncplib.h b/util/ncplib.h index 4bc2076..9cc32f0 100644 --- a/util/ncplib.h +++ b/util/ncplib.h @@ -67,6 +67,11 @@ struct ncp_conn_spec { 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 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 @@ -257,12 +262,13 @@ ncp_open_create_file_or_subdir(struct ncp_conn *conn, int ncp_initialize_search(struct ncp_conn *conn, - struct nw_info_struct *dir, - struct nw_search_sequence *target); + const struct nw_info_struct *dir, + int namespace, + struct ncp_search_seq *target); int 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); int diff --git a/util/ncpmount.c b/util/ncpmount.c index 5079390..5dac6e9 100644 --- a/util/ncpmount.c +++ b/util/ncpmount.c @@ -3,6 +3,16 @@ * * 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 @@ -41,14 +51,15 @@ static void str_upper(char *name); static void usage(void); static void help(void); +#ifndef HAVE_KERNELD + /* Returns 0 if the filesystem is in the kernel after this routine completes */ static int load_ncpfs(void) { - FILE *fver, *ffs; + FILE *ffs; char s[1024]; - char modname[1024]; char *p, *p1; pid_t pid; int status; @@ -81,33 +92,6 @@ load_ncpfs(void) { 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 */ @@ -118,7 +102,7 @@ load_ncpfs(void) else if (pid == 0) { /* child */ - execl("/sbin/insmod", "insmod", modname, NULL); + execl("/sbin/insmod", "insmod", "ncpfs", NULL); _exit(127); /* execl error */ } else @@ -136,6 +120,8 @@ load_ncpfs(void) return status; } +#endif /* HAVE_KERNELD */ + /* Check whether user is allowed to mount on the specified mount point */ static int mount_ok(struct stat *st) @@ -345,6 +331,7 @@ main(int argc, char *argv[]) exit(1); } +#ifndef HAVE_KERNEL /* Check if the ncpfs filesystem is in the kernel. If not, attempt * to load the ncpfs module */ if (load_ncpfs() != 0) @@ -352,6 +339,7 @@ main(int argc, char *argv[]) fprintf(stderr, "Error: Unable to load ncpfs, exiting...\n"); exit(1); } +#endif data.version = NCP_MOUNT_VERSION; data.mounted_uid = conn_uid; diff --git a/util/ncptest.c b/util/ncptest.c index 30ed9b4..6443a77 100644 --- a/util/ncptest.c +++ b/util/ncptest.c @@ -96,24 +96,60 @@ test_print(struct ncp_conn *conn) } 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_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"); - exit(1); + perror("ncp_initialize"); + return 1; } - if (ncp_open(&conn, NULL) != 0) - { - perror("ncp_open"); - exit(1); - } - - test_print(&conn); + test_ls(&conn); ncp_close(&conn); + return 0; }