diff --git a/.downloads/ncpfs-2.0.5.tgz b/.downloads/ncpfs-2.0.5.tgz new file mode 100644 index 0000000..fb33947 Binary files /dev/null and b/.downloads/ncpfs-2.0.5.tgz differ diff --git a/Changes b/Changes index c3f4c71..e06311e 100644 --- a/Changes +++ b/Changes @@ -1,6 +1,13 @@ I only began this file with ncpfs-0.12. If you're interested in older versions, you can find them on ftp.gwdg.de:/pub/linux/misc/ncpfs/old. +ncpfs-2.0.4 -> ncpfs-2.0.5 +- Removed another bug in nwbpvalues. +- Cleaned up man/Makefile +- Some manpage typos fixed. Thanks to Jim Van Zandt + +- added nwrights + ncpfs-2.0.3 -> ncpfs-2.0.4 - Changed name of npasswd to nwpasswd, as npasswd collides with RedHat. Thanks to Mike Slater for pointing me diff --git a/Makefile b/Makefile index 0885969..2e15187 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ # Makefile for the linux ncp-filesystem routines. # -VERSION = 2.0.4 +VERSION = 2.0.5 # If you are using kerneld to autoload ncp support, # uncomment this (kerneld is in linux since about 1.3.57): diff --git a/ipxdump/ipxparse.c b/ipxdump/ipxparse.c index 10726ce..6b42828 100644 --- a/ipxdump/ipxparse.c +++ b/ipxdump/ipxparse.c @@ -481,6 +481,12 @@ void handle_ncp (struct sockaddr_ipx *source, case 75: printf("Keyed change password\n"); break; + case 113: + printf("Service Queue Job (old)\n"); + break; + case 124: + printf("Service Queue Job \n"); + break; } data += 3; diff --git a/man/Makefile b/man/Makefile index e8647b7..5cdd1a7 100644 --- a/man/Makefile +++ b/man/Makefile @@ -1,20 +1,12 @@ -MAN1= slist nprint pqlist nsend pserver ncopy npasswd -MAN1 += nwbols nwboprops nwbpvalues nwfsinfo nwuserlist -MAN5= nwclient -MAN8= ncpmount ncpumount ipx_configure ipx_interface ipx_internal_net \ - ipx_route nwmsg -MAN8 += nwbocreate nwborm nwbpadd nwbpcreate nwbprm -MAN8 += nwgrant nwrevoke - - all: dep: install: - for i in $(MAN1); do install $$i.1 -m 755 /usr/local/man/man1; done - for i in $(MAN5); do install $$i.5 -m 755 /usr/local/man/man5; done - for i in $(MAN8); do install $$i.8 -m 755 /usr/local/man/man8; done + for i in *.1; do install $$i -m 755 /usr/local/man/man1; done + for i in *.5; do install $$i -m 755 /usr/local/man/man5; done + for i in *.8; do install $$i -m 755 /usr/local/man/man8; done clean: + rm -f *~ \ No newline at end of file diff --git a/man/ncpmount.8 b/man/ncpmount.8 index 6216af4..30b15c5 100644 --- a/man/ncpmount.8 +++ b/man/ncpmount.8 @@ -57,7 +57,7 @@ protocol Novell NetWare clients use to talk to NetWare servers. ncpfs was inspired by .B lwared, a free NetWare emulator for Linux written by Ales Dryak. See -ftp://klokan.sh.cvut.cz/pub/linux for this very intersting program. +ftp://klokan.sh.cvut.cz/pub/linux for this very interesting program. .B ncpmount when invoked with all appropriate arguments attaches, logs in and @@ -83,7 +83,7 @@ If the real uid of the caller is not root, checks whether the user is allowed to mount a filesystem on the mount-point. So it should be safe to make .B ncpmount - setuid root. The filesystem stores the uid of the user who called +setuid root. The filesystem stores the uid of the user who called ncpmount. So .B ncpumount can check whether the caller is allowed to unmount the filesystem. @@ -271,7 +271,7 @@ of your server. .B USER / LOGNAME .RS 3 The variables USER or LOGNAME may contain the username of the person -using the client. USER is tried first. If it's emtpy, LOGNAME is +using the client. USER is tried first. If it's empty, LOGNAME is tried. .RE diff --git a/man/nsend.1 b/man/nsend.1 index eafbf88..37fdf89 100644 --- a/man/nsend.1 +++ b/man/nsend.1 @@ -65,14 +65,14 @@ is the name of the server you want to use. If the user name your NetWare administrator gave to you differs from your unix user-id, you should use .B -U -to tell the server about you NetWare user name. +to tell the server about your NetWare user name. .RE .B -P .I password .RS 3 You may want to give the password required by the server on the -command line. You should be careful to use passwords in scripts. +command line. You should be careful about using passwords in scripts. .RE .B -n diff --git a/man/nwclient.5 b/man/nwclient.5 index afe6da3..942e016 100644 --- a/man/nwclient.5 +++ b/man/nwclient.5 @@ -1,4 +1,4 @@ -.TH NWCLIENT 5 12/27/1995 nwmount nwmount +.TH NWCLIENT 5 12/27/1995 nwclient nwclient .SH NAME nwclient \- configuration file for NWClient program suite .SH DESCRIPTION @@ -35,11 +35,11 @@ An example might be the following: # And a passwordless account on another server CD-SERV/GUEST - -With these lines in $HOME/.nwclient, calling 'nwmount /mnt' will mount +With these lines in $HOME/.nwclient, calling 'ncpmount /mnt' will mount the the file server FS311 with user name ME on /mnt after asking the user for a password. -\'nwmount -S cd-serv /cd' will silently mount the server cd-serv on /cd. +\'ncpmount -S cd-serv /cd' will silently mount the server cd-serv on /cd. .B nprint , diff --git a/man/nwrights.1 b/man/nwrights.1 new file mode 100644 index 0000000..c195623 --- /dev/null +++ b/man/nwrights.1 @@ -0,0 +1,41 @@ +.TH NWRIGHTS 1 8/1/1996 nwrights nwrights +.SH NAME +nwrights \- Show effective rights for file or directory +.SH SYNOPSIS +.B nwrights +[ +.B -h +] +.B file/directory + +.SH DESCRIPTION +.B nwrights +asks the NetWare server for the effective rights the user has for a +specific file or directory. The rights the server grants are the +definitive restriction for what you may do with files or +directories. The Linux permission bits are not really relevant, they +can only restrict the possibilities further. + +.B nwrights +operates on the current directory or the file or directory that is +given as an argument. Certainly the file or directory you specify has +to reside on a ncpfs mounted directory for nwrights to work properly. + +.SH OPTIONS + +.B -h +.RS 3 +.B -h +is used to print out a short help text. +.RE + +.B file/directory +.RS 3 +You can specify the file or directory you want information about. The +default is the current working directory. +.RE + +.SH AUTHORS +nwrights was written by Volker Lendecke with the corresponding NetWare +utility in mind. See the Changes file of ncpfs for other contributors. + diff --git a/man/pqlist.1 b/man/pqlist.1 index 793dce2..5779a8c 100644 --- a/man/pqlist.1 +++ b/man/pqlist.1 @@ -68,14 +68,14 @@ is the name of the server you want to use. If the user name your NetWare administrator gave to you differs from your unix user-id, you should use .B -U -to tell the server about you NetWare user name. +to tell the server about your NetWare user name. .RE .B -P .I password .RS 3 You may want to give the password required by the server on the -command line. You should be careful to use passwords in scripts. +command line. You should be careful about using passwords in scripts. .RE .B -n diff --git a/ncpfs-2.0.4.lsm b/ncpfs-2.0.5.lsm similarity index 84% rename from ncpfs-2.0.4.lsm rename to ncpfs-2.0.5.lsm index 0c3d76c..96361cd 100644 --- a/ncpfs-2.0.4.lsm +++ b/ncpfs-2.0.5.lsm @@ -1,7 +1,7 @@ Begin3 Title: ncpfs -Version: 2.0.4 -Entered-date: 25. July 1996 +Version: 2.0.5 +Entered-date: 01. August 1996 Description: With ncpfs you can mount volumes of your netware server under Linux. You can also print to netware print queues and spool netware print queues to the @@ -13,7 +13,7 @@ Author: lendecke@namu01.Num.Math.Uni-Goettingen.de (Volker Lendecke) Maintained-by: lendecke@namu01.Num.Math.Uni-Goettingen.de (Volker Lendecke) Primary-site: ftp.gwdg.de:/pub/linux/misc/ncpfs Alternate-site: sunsite.unc.edu:/pub/Linux/system/Filesystems/ncpfs - ~130k ncpfs-2.0.4.tgz - ~ 1k ncpfs-2.0.4.lsm + ~132k ncpfs-2.0.5.tgz + ~ 1k ncpfs-2.0.5.lsm Copying-policy: GPL End diff --git a/util/Makefile b/util/Makefile index 398d17e..0d58bc5 100644 --- a/util/Makefile +++ b/util/Makefile @@ -5,7 +5,7 @@ USERUTILS = slist pqlist nwfsinfo pserver nprint nsend ncopy nwpasswd USERUTILS += nwbols nwbocreate nwborm nwboprops USERUTILS += nwbpcreate nwbprm nwbpvalues nwbpadd -USERUTILS += nwgrant nwrevoke nwuserlist +USERUTILS += nwgrant nwrevoke nwuserlist nwrights UIDUTILS = ncpmount ncpumount SBINUTILS = nwmsg diff --git a/util/ncplib.c b/util/ncplib.c index 5b20a51..10bc8ba 100644 --- a/util/ncplib.c +++ b/util/ncplib.c @@ -680,6 +680,40 @@ ncp_temp_request(struct ncp_conn *conn, int function) return r->completion_code == 0 ? 0 : NCPL_ET_REQUEST_ERROR; } +#ifdef PACKET_SIGNATURES +static long +ncp_setup_security(struct ncp_conn *conn) +{ + __u8 security; + __u8 accepted_security; + __u16 socket, size; + + conn->want_signatures = 0; + if (ncp_get_big_ncp_max_packet_size(conn, 576, 0, &size, &socket, + &accepted_security) != 0) + { + return 0; + } + + if ((accepted_security & NCP_SEC_SIGNATURE_REQUESTED) == 0) + { + return 0; + } + security = NCP_SEC_SIGNATURE_REQUESTED; + if (ncp_get_big_ncp_max_packet_size(conn, 576, security, + &size, &socket, + &accepted_security) != 0) + { + return 0; + } + if ((accepted_security & NCP_SEC_SIGNATURE_REQUESTED) != 0) + { + conn->want_signatures = 1; + } + return 0; +} +#endif + static long ncp_connect_addr(struct ncp_conn *conn, const struct sockaddr_ipx *target, int wdog_needed) @@ -1085,6 +1119,15 @@ ncp_open_mount(const char *mount_point, long *err) } strcpy(result->mount_point, mount_point); result->is_connected = CONN_PERMANENT; + + result->i.version = NCP_GET_FS_INFO_VERSION; + + if (ioctl(result->mount_fid, NCP_IOC_GET_FS_INFO, &(result->i)) != 0) + { + free(result); + *err = NCPL_ET_NO_NCPFS_FILE; + return NULL; + } return result; } @@ -2255,6 +2298,31 @@ ncp_write_property_value(struct ncp_conn *conn, return result; } +long +ncp_get_big_ncp_max_packet_size(struct ncp_conn *conn, + __u16 proposed_max_size, + __u8 proposed_security_flag, + __u16 *accepted_max_size, + __u16 *echo_socket, + __u8 *accepted_security_flag) +{ + long result; + ncp_init_request(conn); + ncp_add_word(conn, htons(proposed_max_size)); + ncp_add_byte(conn, proposed_security_flag); + + if ((result = ncp_request(conn, 97)) != 0) + { + ncp_unlock_conn(conn); + return result; + } + *accepted_max_size = ntohs(ncp_reply_word(conn, 0)); + *echo_socket = ntohs(ncp_reply_word(conn, 2)); + *accepted_security_flag = ncp_reply_byte(conn, 4); + ncp_unlock_conn(conn); + return 0; +} + long ncp_login_encrypted(struct ncp_conn *conn, const struct ncp_bindery_object *object, @@ -2831,6 +2899,34 @@ ncp_obtain_file_or_subdir_info(struct ncp_conn *conn, return 0; } +long +ncp_get_eff_directory_rights(struct ncp_conn *conn, + __u8 source_ns, __u8 target_ns, + __u16 search_attribs, + __u8 vol, __u32 dirent, const char *path, + __u16 *my_effective_rights) +{ + long result; + + ncp_init_request(conn); + ncp_add_byte(conn, 29); + ncp_add_byte(conn, source_ns); + ncp_add_byte(conn, target_ns); + ncp_add_word(conn, search_attribs); + ncp_add_dword(conn, 0); + ncp_add_handle_path(conn, vol, dirent, 1, path); + + if ((result = ncp_request(conn, 87)) != 0) + { + ncp_unlock_conn(conn); + return result; + } + + *my_effective_rights = ncp_reply_word(conn, 0); + ncp_unlock_conn(conn); + return 0; +} + long ncp_do_lookup(struct ncp_conn *conn, struct nw_info_struct *dir, diff --git a/util/ncplib.h b/util/ncplib.h index b419ea9..0179b24 100644 --- a/util/ncplib.h +++ b/util/ncplib.h @@ -302,6 +302,22 @@ ncp_write_property_value(struct ncp_conn *conn, const char *property_name, __u8 segment, struct nw_property *property_value); + +/* Bit masks for security flag */ +#define NCP_SEC_CHECKSUMMING_REQUESTED (1) +#define NCP_SEC_SIGNATURE_REQUESTED (2) +#define NCP_SEC_COMPLETE_SIGNATURES_REQUESTED (4) +#define NCP_SEC_ENCRYPTION_REQUESTED (8) +#define NCP_SEC_LIP_DISABLED (128) + +long +ncp_get_big_ncp_max_packet_size(struct ncp_conn *conn, + __u16 proposed_max_size, + __u8 proposed_security_flag, + __u16 *accepted_max_size, + __u16 *echo_socket, + __u8 *accepted_security_flag); + long ncp_login_encrypted(struct ncp_conn *conn, const struct ncp_bindery_object *object, @@ -428,6 +444,22 @@ ncp_obtain_file_or_subdir_info(struct ncp_conn *conn, __u8 vol, __u32 dirent, const char *path, struct nw_info_struct *target); +#define NCP_PERM_READ (0x001) +#define NCP_PERM_WRITE (0x002) +#define NCP_PERM_OPEN (0x004) +#define NCP_PERM_CREATE (0x008) +#define NCP_PERM_DELETE (0x010) +#define NCP_PERM_OWNER (0x020) +#define NCP_PERM_SEARCH (0x040) +#define NCP_PERM_MODIFY (0x080) +#define NCP_PERM_SUPER (0x100) + +long +ncp_get_eff_directory_rights(struct ncp_conn *conn, + __u8 source_ns, __u8 target_ns, + __u16 search_attribs, + __u8 vol, __u32 dirent, const char *path, + __u16 *my_effective_rights); long ncp_do_lookup(struct ncp_conn *conn, diff --git a/util/ncplib_err.et b/util/ncplib_err.et index 5deeca4..2eee6e3 100644 --- a/util/ncplib_err.et +++ b/util/ncplib_err.et @@ -37,6 +37,9 @@ ec NCPL_ET_PWD_TOO_LONG, "Password too long" ec NCPL_ET_NO_IPX, - "Could not alloc IPX socket. Probably no IPX support in kernel." + "Could not alloc IPX socket. Probably no IPX support in kernel" + +ec NCPL_ET_NO_NCPFS_FILE, + "The file is probably not on a ncpfs mounted directory" end \ No newline at end of file diff --git a/util/ncptest.c b/util/ncptest.c index 8533633..ba64762 100644 --- a/util/ncptest.c +++ b/util/ncptest.c @@ -182,6 +182,43 @@ test_readdir(struct ncp_conn *conn) } +void +test_rights(struct ncp_conn *conn) +{ + struct nw_info_struct sys; + struct nw_info_struct me; + __u16 rights; + + if (ncp_do_lookup(conn, NULL, "SYS", &sys) != 0) + { + printf("lookup error\n"); + return; + } + if (ncp_do_lookup(conn, &sys, "ME", &me) != 0) + { + printf("lookup me error\n"); + return; + } + + if (ncp_get_eff_directory_rights(conn, 0, 0, 0x8006, + sys.volNumber, sys.DosDirNum, NULL, + &rights) != 0) + { + printf("get sys rights error\n"); + return; + } + printf("sys right: %4.4x\n", rights); + + if (ncp_get_eff_directory_rights(conn, 0, 0, 0x8006, + me.volNumber, me.DosDirNum, NULL, + &rights) != 0) + { + printf("get me rights error\n"); + return; + } + printf("me right: %4.4x\n", rights); + return; +} int main(int argc, char *argv[]) @@ -195,7 +232,7 @@ main(int argc, char *argv[]) return 1; } - test_readdir(conn); + test_rights(conn); ncp_close(conn); return 0; } diff --git a/util/nwbpvalues.c b/util/nwbpvalues.c index 214a834..66dfedb 100644 --- a/util/nwbpvalues.c +++ b/util/nwbpvalues.c @@ -151,17 +151,19 @@ main(int argc, char *argv[]) { int objects = 32 * segno; __u32 *value = (__u32 *)property_value; - int i; + int i = 0; - for (i = 0; i < objects; i++) + while (i < objects) { struct ncp_bindery_object o; - if ((*value == 0) || (*value == 0xffffffff)) + if ((value[i] == 0) || (value[i] == 0xffffffff)) { - break; + /* Continue with next segment */ + i = ((i/32) + 1) * 32; + continue; } - if (ncp_get_bindery_object_name(conn, ntohl(*value), + if (ncp_get_bindery_object_name(conn, ntohl(value[i]), &o) == 0) { if (verbose != 0) @@ -176,7 +178,7 @@ main(int argc, char *argv[]) printf("%s\n", o.object_name); } } - value += 1; + i += 1; } } result = 0; diff --git a/util/nwrights.c b/util/nwrights.c new file mode 100644 index 0000000..9bd3eda --- /dev/null +++ b/util/nwrights.c @@ -0,0 +1,141 @@ +/* + * nwrights.c + * + * Show effective rights for dir or file. + * + * Copyright (C) 1996 by Volker Lendecke + * + */ + +#include "ncplib.h" +#include +#include + +static char *progname; + +static void +usage(void) +{ + fprintf(stderr, "usage: %s [options]\n", progname); +} + +static void +help(void) +{ + printf("\n"); + printf("usage: %s [options] file/directory\n", progname); + printf("\n" + "-h Print this help text\n" + "\n" + "file/directory\n" + "\n"); +} + +int +main(int argc, char *argv[]) +{ + struct ncp_conn *conn = NULL; + char *path = "."; + long err; + int result = 1; + int opt; + __u16 rights; + + progname = argv[0]; + + while ((opt = getopt(argc, argv, "h?")) != EOF) + { + switch(opt) { + case 'h': + case '?': + help(); + goto finished; + default: + usage(); + goto finished; + } + } + + if (optind > argc) + { + usage(); + goto finished; + } + + if (optind == argc-1) + { + path = argv[optind]; + } + + if ((conn = ncp_open_mount(path, &err)) == NULL) + { + com_err(argv[0], err, "when initializing"); + goto finished; + } + + if ((err = ncp_get_eff_directory_rights(conn, 0, 0, 0x8006, + conn->i.volume_number, + conn->i.directory_id, NULL, + &rights)) != 0) + { + com_err(argv[0], err, "when finding rights"); + goto finished; + } + + printf("Your effective rights for %s are: [%c%c%c%c%c%c%c%c]\n", + path, + ((rights & NCP_PERM_SUPER ) != 0) ? 'S' : ' ', + ((rights & NCP_PERM_READ ) != 0) ? 'R' : ' ', + ((rights & NCP_PERM_WRITE ) != 0) ? 'W' : ' ', + ((rights & NCP_PERM_CREATE) != 0) ? 'C' : ' ', + ((rights & NCP_PERM_DELETE) != 0) ? 'E' : ' ', + ((rights & NCP_PERM_MODIFY) != 0) ? 'M' : ' ', + ((rights & NCP_PERM_SEARCH) != 0) ? 'F' : ' ', + ((rights & NCP_PERM_OWNER ) != 0) ? 'A' : ' '); + + if ((rights & NCP_PERM_SUPER ) != 0) + { + printf("(S): You have SUPERVISOR rights\n"); + } + + if ((rights & NCP_PERM_READ ) != 0) + { + printf("(R): You may READ from files\n"); + } + + if ((rights & NCP_PERM_WRITE ) != 0) + { + printf("(W): You may WRITE to files\n"); + } + + if ((rights & NCP_PERM_CREATE) != 0) + { + printf("(C): You may CREATE files\n"); + } + + if ((rights & NCP_PERM_DELETE) != 0) + { + printf("(E): You may ERASE files\n"); + } + + if ((rights & NCP_PERM_MODIFY) != 0) + { + printf("(M): You may MODIFY directory\n"); + } + + if ((rights & NCP_PERM_SEARCH) != 0) + { + printf("(F): You may SCAN for files\n"); + } + + if ((rights & NCP_PERM_OWNER ) != 0) + { + printf("(A): You may change ACCESS control\n"); + } + + result = 0; + + finished: + ncp_close(conn); + return result; +}