Import ncpfs 0.14
This commit is contained in:
BIN
.downloads/ncpfs-0.14.tgz
Normal file
BIN
.downloads/ncpfs-0.14.tgz
Normal file
Binary file not shown.
17
BUGS
17
BUGS
@@ -3,6 +3,8 @@ them to be bugs.
|
||||
|
||||
But there are really problems that might be fixed in the future.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
'df' returns 0:
|
||||
Free disk space is distributed among the volumes in NetWare. df is
|
||||
only able to report one number per mounted filesystem. As connections
|
||||
@@ -10,10 +12,19 @@ are quite expensive for NetWare (with lwared that might change ...), I
|
||||
rejected the alternative to mount only a single volume for a unix
|
||||
mount point. So I simply return 0.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
In your kernel log, there will appear messages like
|
||||
If you use Linux 1.2.x, In your kernel log there will appear messages
|
||||
like
|
||||
|
||||
Nov 25 16:09:08 lx01 kernel: alloc_skb called nonatomically from interrupt 0000002e
|
||||
|
||||
These are a bit annoying, but completely harmless. Maybe this will be
|
||||
fixed in the future.
|
||||
These are a bit annoying, but completely harmless.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
ncpfs has a problem with NetWare 4.1, when files are created. I think
|
||||
NW4.1 does not like some of the creation mode bits. If somebody with
|
||||
access to a NW4.1 server could compile the kernel module for 1.2 with
|
||||
-DDEBUG_NCP=2, and send me the syslog output gzipped/uuencoded, I
|
||||
might find out more about that problem.
|
||||
|
||||
9
Changes
9
Changes
@@ -1,6 +1,15 @@
|
||||
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.13 -> ncpfs-0.14
|
||||
|
||||
- Improvements of manual pages by B. Galliart <bgallia@luc.edu> and
|
||||
Terry Dawson <terry@perf.no.itg.telecom.com.au>
|
||||
- fsinfo
|
||||
- pserver.c. Please see this as ALPHA software. There is no
|
||||
documentation, and it is not tested enough. But it might be useful for
|
||||
you.
|
||||
|
||||
ncpfs-0.12 -> ncpfs-0.13
|
||||
|
||||
- support for automatic loading of ncpfs.o by kerneld.
|
||||
|
||||
4
Makefile
4
Makefile
@@ -16,8 +16,8 @@ SUBDIRS = util ipx-0.75 man
|
||||
# the following lines. You have to recompile your kernel
|
||||
# and say 'y' when 'make config' asks you for IPX and ncpfs.
|
||||
#
|
||||
SUBDIRS += kernel-1.2/src
|
||||
INCLUDES = -I$(TOPDIR)/kernel-1.2
|
||||
#SUBDIRS += kernel-1.2/src
|
||||
#INCLUDES = -I$(TOPDIR)/kernel-1.2
|
||||
|
||||
# If you are using kerneld to autoload ncp support,
|
||||
# uncomment this (kerneld is in linux since about 1.3.57):
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
.TH IPX_CONFIGURE 8 "IPX Utilities" "Caldera, Inc."
|
||||
.SH NAME
|
||||
ipx_configure \- query/configure IPX behavior
|
||||
ipx_configure \- display/configure IPX behavior
|
||||
.SH SYNOPSIS
|
||||
.B ipx_configure
|
||||
[\-\-help]
|
||||
@@ -8,7 +8,7 @@ ipx_configure \- query/configure IPX behavior
|
||||
[\-\-auto_primary=[on|off]]
|
||||
.SH DESCRIPTION
|
||||
.B ipx_configure
|
||||
queries or configures IPX behavior with respect to automatic IPX
|
||||
displays or configures IPX behavior with respect to automatic IPX
|
||||
interface detection. IPX can be configured to automatically create
|
||||
interfaces as they are detected. It can also be configured to
|
||||
automatically select a primary interface when none is explicitly
|
||||
@@ -23,15 +23,20 @@ arguments is described in the section
|
||||
.SS OPTIONS
|
||||
.TP
|
||||
.I "\-\-auto_interface=[on|off]"
|
||||
This argument either turns on or off the behavior of automatically creating
|
||||
interfaces.
|
||||
This argument enables or disables the feature that will automatically detect
|
||||
whether IPX is use on a network interface. If
|
||||
.B on
|
||||
and IPX packets are seen on an interface that interface will be automatically
|
||||
flagged as an IPX interface. The default setting is
|
||||
.B off.
|
||||
.TP
|
||||
.I "\-\-auto_primary=[on|off]"
|
||||
This argument either turns on or off the behavior of automatically selecting
|
||||
a primary interface.
|
||||
This argument enables or disables the feature that will automatically select
|
||||
which IPX interface will be the primary IPX interface. The default setting is
|
||||
.B off.
|
||||
.TP
|
||||
.I "\-\-help"
|
||||
Print out information about utility.
|
||||
Displays summarised usage instructions.
|
||||
.SH FILES
|
||||
.I /proc/net/ipx_interface
|
||||
.SH BUGS
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
.TH IPX_INTERFACE 8 "IPX Utilities" "Caldera, Inc."
|
||||
.SH NAME
|
||||
ipx_interface \- add, delete, or display an IPX interface
|
||||
ipx_interface \- add, delete, or display IPX interface configuration.
|
||||
.SH SYNOPSIS
|
||||
.B ipx_interface
|
||||
add [-p] device frame_type [network number]
|
||||
@@ -15,11 +15,11 @@ check device frame_type
|
||||
help
|
||||
.SH DESCRIPTION
|
||||
.B ipx_interface
|
||||
adds, deletes, or displays IPX interfaces depending on the option selected.
|
||||
adds, deletes, or displays the configuration of the specified IPX interface.
|
||||
.P
|
||||
An IPX interface is the item to which IPX sockets are bound.
|
||||
An IPX interface corresponds to an IPX Network Number which corresponds
|
||||
to a physical device and frame type. A sample IPX Interface would be:
|
||||
An IPX interface has an associated IPX Network Number, a physical device
|
||||
and frame type. A sample IPX Interface might look like:
|
||||
.LP
|
||||
Network Number: 0x00ABCDEF
|
||||
.LP
|
||||
@@ -35,22 +35,21 @@ or default interface.
|
||||
.I add
|
||||
This option is used to create an IPX interface. If the
|
||||
.B -p
|
||||
flag is used, the interface is made
|
||||
.B
|
||||
PRIMARY.
|
||||
The network number can be optionally assigned. If it is not assigned, it
|
||||
is set to 0 which indicates it should be detected from the traffic on the
|
||||
network.
|
||||
flag is used, the interface is flagged as the
|
||||
.B PRIMARY
|
||||
interface. The IPX network number may optionally be specified. If it is not
|
||||
specified it is set to 0 which indicates it should be automatically detected
|
||||
by analysis of the existing IPX traffic on the network.
|
||||
.TP
|
||||
.I del
|
||||
This option is used to delete an IPX interface.
|
||||
.TP
|
||||
.I check
|
||||
This option is used to display the device, frame type, and network number
|
||||
of an IPX interface.
|
||||
This option is used to display the network number associated with a specified
|
||||
device and frame type combination.
|
||||
.TP
|
||||
.I help
|
||||
This option displays information about the utility.
|
||||
This option displays summarised usage instructions.
|
||||
.SH FILES
|
||||
.I /proc/net/ipx_interface /proc/net/ipx_route
|
||||
.SH BUGS
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
.TH IPX_ROUTE 8 "IPX Utilities" "Caldera, Inc."
|
||||
.SH NAME
|
||||
ipx_route \- add or delete IPX route
|
||||
ipx_route \- add or delete an IPX route.
|
||||
.SH SYNOPSIS
|
||||
.B ipx_route
|
||||
add target_network router_network router_node
|
||||
@@ -10,11 +10,11 @@ del target_network
|
||||
.SH DESCRIPTION
|
||||
.B ipx_route
|
||||
adds or deletes an IPX route.
|
||||
The kernel IPX stores only one route per target network at a time.
|
||||
The kernel IPX software stores only one route to any target network.
|
||||
.SS OPTIONS
|
||||
.TP
|
||||
.I add
|
||||
This option is used to set up the route to a target network.
|
||||
This option is used to configure a route to a target network.
|
||||
.TP
|
||||
.I del
|
||||
This option is used to delete the route to a target network.
|
||||
|
||||
110
man/ncpmount.8
110
man/ncpmount.8
@@ -1,27 +1,27 @@
|
||||
.TH NCPMOUNT 8 12/27/1995 ncpmount ncpmount
|
||||
.SH NAME
|
||||
ncpmount \- mount program for ncpfs
|
||||
ncpmount \- mount all volumes of a specified Novell fileserver.
|
||||
.SH SYNOPSIS
|
||||
.B ncpmount
|
||||
[
|
||||
.B -h
|
||||
] [
|
||||
.B -S
|
||||
.I server
|
||||
] [
|
||||
.B -h
|
||||
] [
|
||||
.B -n
|
||||
.B -U
|
||||
.I user name
|
||||
] [
|
||||
.B -P
|
||||
.I password
|
||||
|
|
||||
.B -n
|
||||
] [
|
||||
.B -C
|
||||
] [
|
||||
.B -c
|
||||
.I client name
|
||||
] [
|
||||
.B -U
|
||||
.I user name
|
||||
] [
|
||||
.B -u
|
||||
.I uid
|
||||
] [
|
||||
@@ -37,10 +37,11 @@ ncpmount \- mount program for ncpfs
|
||||
mount-point
|
||||
|
||||
.SH DESCRIPTION
|
||||
This program is an interface to the NCP filesystem.
|
||||
This program is used to mount all volumes of the specified NetWare Fileserver
|
||||
under the specified mount point.
|
||||
|
||||
.B ncpfs
|
||||
is a filesystem which understands the NCP protocol. This is the
|
||||
is a linux filesystem which understands the NCP protocol. This is the
|
||||
protocol Novell NetWare clients use to talk to NetWare servers. ncpfs
|
||||
was inspired by
|
||||
.B lwared,
|
||||
@@ -48,18 +49,23 @@ a free NetWare emulator for Linux written by Ales Dryak. See
|
||||
ftp://klokan.sh.cvut.cz/pub/linux for this very intersting program.
|
||||
|
||||
.B ncpmount
|
||||
looks up the file
|
||||
when invoked with all appropriate arguments attaches, logs in and
|
||||
mounts all of the volumes associated with the specified fileserver that are
|
||||
readable by the user id under the specified mount point.
|
||||
.B ncpmount
|
||||
when invoked without any arguments specifying the fileserver, user id and
|
||||
password checks the file
|
||||
.I $HOME/.nwclient
|
||||
to find a file server, a user name and possibly a password. See
|
||||
nwclient(5) for more information. Please note that the access
|
||||
permissions of .nwclient MUST be 600, for security reasons.
|
||||
to find a file server, a user name and possibly a password to use for the
|
||||
specified mount point. See nwclient(5) for more information. Please note
|
||||
that the access permissions of .nwclient MUST be 600, for security reasons.
|
||||
|
||||
.SH OPTIONS
|
||||
.B mount-point
|
||||
.RS 3
|
||||
.B mount-point
|
||||
is the directory you want to mount the filesystem over. It's the same
|
||||
as in the normal mount command.
|
||||
is the directory you want to mount the filesystem over. Its function is the
|
||||
the same as for a normal mount command.
|
||||
|
||||
If the real uid of the caller is not root,
|
||||
.B ncpmount
|
||||
@@ -87,42 +93,40 @@ is used to print out a short help text.
|
||||
|
||||
.B -C
|
||||
.RS 3
|
||||
By default, passwords are converted to uppercase before they are sent
|
||||
to the server, because most servers require this. You can turn off
|
||||
this conversion by
|
||||
.B -C.
|
||||
By default passwords are converted to uppercase before they are sent
|
||||
to the server because most servers require this. This option disables this
|
||||
feature ensuring that passwords are sent without any case conversion.
|
||||
.RE
|
||||
|
||||
.B -n
|
||||
.RS 3
|
||||
.B -n
|
||||
should be given to mount shares which do not require a password to log in.
|
||||
must be specified for logins that do not have a password configured.
|
||||
.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.
|
||||
specifies the password to use for the Netware user id.
|
||||
|
||||
If neither
|
||||
.B -n
|
||||
nor
|
||||
nor the
|
||||
.B -P
|
||||
are given, ncpmount prompts for a password. This makes it difficult to
|
||||
use in scripts such as /etc/rc. But that's not ncpmount's fault, but a
|
||||
general problem with the fact that you need a password on every
|
||||
login. If anybody has a satisfying solution to this problem, please
|
||||
tell me.
|
||||
arguments are specified ncpmount will prompt for a password. This
|
||||
makes it difficult to use in scripts such as /etc/rc. If you want to
|
||||
have ncpmount work automatically from a script you must include the
|
||||
appropriate option and be very careful to ensure that appopriate file
|
||||
permissions are set for the script that includes your password to
|
||||
ensure that others can not read it.
|
||||
.RE
|
||||
|
||||
.B -U
|
||||
.I user name
|
||||
.RS 3
|
||||
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.
|
||||
Specifies the Netware user id to use when logging in to the fileserver. If
|
||||
this option is not specified then ncpmount will attempt to login to the
|
||||
fileserver using the Linux login id of the user invoking ncpmount.
|
||||
.RE
|
||||
|
||||
.B -u
|
||||
@@ -130,9 +134,9 @@ to tell the server about you NetWare user name.
|
||||
.B -g
|
||||
.I gid
|
||||
.RS 3
|
||||
Currently I did not implement a mapping from NetWare users/groups to
|
||||
unix users/groups. Unix requires that each file has an owner
|
||||
and a group it belongs to. With
|
||||
ncpmount does not yet implement a scheme for mapping NetWare users/groups
|
||||
to Linux users/groups. Linux requires that each file has an owner and group id.
|
||||
With
|
||||
.B -u
|
||||
and
|
||||
.B -g
|
||||
@@ -145,19 +149,20 @@ The defaults for these values are the current uid and gid.
|
||||
.B -c
|
||||
.I user name
|
||||
.RS 3
|
||||
This option is only makes sense if root mounts the directory. root can
|
||||
mount directories on behalf of other users.
|
||||
.B -c
|
||||
names the user who is the
|
||||
.I owner
|
||||
of the connection, where owner is not meant in the unix sense (that
|
||||
"owner" is set by -u), but as the one who has mounted the directory.
|
||||
This way it could be possible to mount a public read-only directory,
|
||||
of the connection, where owner does not refer to file ownership (that
|
||||
"owner" is set by the -u argument), but the owner of the mount, ie: who
|
||||
is allowed to call ncpumount on this mount. The default owner of the
|
||||
connection and the mount is the user who called ncpmount. This option
|
||||
allows you to specify that some other user should be set as the owner.
|
||||
|
||||
In this this way it is possible to mount a public read-only directory,
|
||||
but to allow the lp daemon to print on NetWare queues. This is
|
||||
possible, because only users who have write permissions on a directory
|
||||
may issue ncp requests over a connection. An exception is the owner
|
||||
(in the sense mentioned above), who is also given 'request
|
||||
permission'.
|
||||
possible because only users who have write permissions on a directory
|
||||
may issue ncp requests over a connection. The exception to this rule
|
||||
is the 'mount owner', who is also granted 'request permission'.
|
||||
.RE
|
||||
|
||||
.B -f
|
||||
@@ -169,14 +174,11 @@ Like
|
||||
.B -u
|
||||
and
|
||||
.B -g,
|
||||
these options are also used to cover deficiencies in the
|
||||
implementation of ncpfs. I did not implement a scheme to map NetWare
|
||||
permissions to unix permissions. So ncpmount has to be told which
|
||||
permissions it should assign to the mounted files and directories. The
|
||||
values have to be given as octal numbers. The default values are taken
|
||||
from the current umask, where the file mode is the current umask, and
|
||||
the dir mode adds execute permissions where the file mode gives read
|
||||
permissions.
|
||||
these options are used to determine what permissions should be assigned
|
||||
files and directories of the mounted volumes. The values must be specified
|
||||
as octal numbers. The default values are taken from the current umask, where
|
||||
the file mode is the current umask, and the dir mode adds execute permissions
|
||||
where the file mode gives read permissions.
|
||||
|
||||
Note that these permissions can differ from the rights the server
|
||||
gives to us. If you do not have write permissions on the server, you
|
||||
@@ -185,7 +187,9 @@ certainly cannot override the restrictions imposed by the server.
|
||||
.RE
|
||||
|
||||
.SH NOTES
|
||||
If you have difficulties in mounting, please make sure that you have configured your ipx subsystem correctly. It is especially important that there is a route to the internal network of your server.
|
||||
You must configure the IPX subsystem before ncpmount will work.
|
||||
It is especially important that there is a route to the internal network
|
||||
of your server.
|
||||
|
||||
.SH ENVIRONMENT VARIABLES
|
||||
.B USER / LOGNAME
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
.TH NCPUMOUNT 8 12/27/1995 ncpumount ncpumount
|
||||
.SH NAME
|
||||
ncpumount \- umount for normal users
|
||||
ncpumount \- unmount a NetWare filesystem mounted with ncpmount.
|
||||
.SH SYNOPSIS
|
||||
.B ncpumount
|
||||
.B mount-point
|
||||
|
||||
.SH DESCRIPTION
|
||||
With this program, normal users can unmount ncp-filesystems, provided
|
||||
that it is suid root.
|
||||
This utility unmounts a NetWare filesystem that was previously mounted
|
||||
with the ncpmount utility. If the this utility is made suid root then
|
||||
non-root users will also be able to make use of it.
|
||||
|
||||
.B ncpumount
|
||||
has been written to give normal linux-users more control over their
|
||||
|
||||
42
man/nprint.1
42
man/nprint.1
@@ -9,18 +9,16 @@ nprint \- NetWare print client
|
||||
] [
|
||||
.B -h
|
||||
] [
|
||||
.B -n
|
||||
] [
|
||||
.B -C
|
||||
] [
|
||||
.B -U
|
||||
.I user name
|
||||
] [
|
||||
.B -P
|
||||
.I password
|
||||
] [
|
||||
|
|
||||
.B -n
|
||||
] [
|
||||
.B -C
|
||||
] [
|
||||
.B -q
|
||||
.I queue name
|
||||
] [
|
||||
@@ -65,6 +63,13 @@ you can print files on print queues of a NetWare file server.
|
||||
There are a lot of options, so you should probably wrap some default
|
||||
configurations into some shell scripts.
|
||||
|
||||
.B nprint
|
||||
looks up the file
|
||||
.I $HOME/.nwclient
|
||||
to find a file server, a user name and possibly a password. See
|
||||
nwclient(5) for more information. Please note that the access
|
||||
permissions of .nwclient MUST be 600, for security reasons.
|
||||
|
||||
.SH OPTIONS
|
||||
.B file
|
||||
.RS 3
|
||||
@@ -73,6 +78,12 @@ is the name of the file you want to print. If file is '-', or no
|
||||
filename is given, standard input is used.
|
||||
.RE
|
||||
|
||||
.B -h
|
||||
.RS 3
|
||||
.B -h
|
||||
is used to print out a short help text.
|
||||
.RE
|
||||
|
||||
.B -S
|
||||
.I server
|
||||
.RS 3
|
||||
@@ -105,12 +116,20 @@ prompts for a password.
|
||||
should be given if no password is required for the print request.
|
||||
.RE
|
||||
|
||||
.B -C
|
||||
.RS 3
|
||||
By default, passwords are converted to uppercase before they are sent
|
||||
to the server, because most servers require this. You can turn off
|
||||
this conversion by
|
||||
.B -C.
|
||||
.RE
|
||||
|
||||
.B -q
|
||||
.I queue name
|
||||
.RS 3
|
||||
.B queue name
|
||||
is the name of the print queue to use at the print server. At
|
||||
present, you must give it in upper case characters.
|
||||
present, you must specify it in upper case characters.
|
||||
.RE
|
||||
|
||||
.B -d
|
||||
@@ -161,6 +180,13 @@ is the number of lines to put on one page. Default: 66
|
||||
is the number of rows to put on one page. Default: 80
|
||||
.RE
|
||||
|
||||
.B -c
|
||||
.I copies
|
||||
.RS 3
|
||||
.B copies
|
||||
tells the print server to the specified number of copies. Default: 1
|
||||
.RE
|
||||
|
||||
.B -t
|
||||
.I tabs
|
||||
.RS 3
|
||||
@@ -189,4 +215,8 @@ different from the one currently in the printer, your job is only
|
||||
printed if a printer operator has put in the correct form.
|
||||
.RE
|
||||
|
||||
.SH SEE ALSO
|
||||
.B nwclient(5), slist(1), pqlist(1), ncpmount(8), ncpumount(8)
|
||||
|
||||
.SH CREDITS
|
||||
nprint was written by Volker Lendecke (lendecke@namu01.gwdg.de)
|
||||
|
||||
@@ -13,8 +13,8 @@ connection. Lines beginning with # and empty lines are ignored as
|
||||
comments.
|
||||
|
||||
Because you can store passwords in .nwclient, the user programs will
|
||||
only scan .nwclient if ONLY the file owner has any access rights to
|
||||
the file.
|
||||
only scan .nwclient when only the file owner has access rights to
|
||||
the file. The file must be have permissions 0600.
|
||||
|
||||
To specify a NWClient connection, the name of the file server, the
|
||||
user name to be used and a password is necessary. The server name and
|
||||
@@ -40,3 +40,16 @@ 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.
|
||||
|
||||
.B nprint
|
||||
,
|
||||
.B pqlist
|
||||
and other user programs that require a valid login also look up
|
||||
.I $HOME/.nwclient
|
||||
to find a file server, a user name and possibly a password.
|
||||
|
||||
Please note that the access permissions of .nwclient MUST be 600, for
|
||||
security reasons.
|
||||
|
||||
.SH SEE ALSO
|
||||
.B ncpmount(8), ncpumount(8), slist(1), pqlist(1), nprint(1)
|
||||
|
||||
86
man/pqlist.1
86
man/pqlist.1
@@ -4,25 +4,40 @@ pqlist \- List available NetWare print queues
|
||||
.SH SYNOPSIS
|
||||
.B pqlist
|
||||
[
|
||||
.B -h
|
||||
] [
|
||||
.B -S
|
||||
.I server
|
||||
] [
|
||||
.B -U
|
||||
.I user name
|
||||
] [
|
||||
.B -n
|
||||
] [
|
||||
.B -P
|
||||
.I password
|
||||
|
|
||||
.B -n
|
||||
] [
|
||||
.B -C
|
||||
] [
|
||||
.I pattern
|
||||
]
|
||||
.SH DESCRIPTION
|
||||
With
|
||||
.B pqlist,
|
||||
you can list the NetWare print queues available to you on some
|
||||
server. If you are already connected to some server, this one is
|
||||
used.
|
||||
.B pqlist
|
||||
lists all the NetWare print queues available to you on some server.
|
||||
If you are already connected to some server, this one is used.
|
||||
|
||||
If pqlist does not print to a tty, the decorative header line is
|
||||
not printed, so that you can count the printing queue available
|
||||
on your server by doing
|
||||
|
||||
pqlist -S server | wc -l
|
||||
|
||||
.B pqlist
|
||||
looks up the file
|
||||
.I $HOME/.nwclient
|
||||
to find a file server, a user name and possibly a password. See
|
||||
nwclient(5) for more information. Please note that the access
|
||||
permissions of .nwclient MUST be 600, for security reasons.
|
||||
|
||||
.SH OPTIONS
|
||||
|
||||
@@ -34,6 +49,57 @@ pattern, but you have to be careful to prevent shell interpretation of
|
||||
wildcards like '*'.
|
||||
.RE
|
||||
|
||||
See ncpmount(8) for an explanation of the other options. They are
|
||||
necessary because you might have to login into a server before it
|
||||
tells you where you may print.
|
||||
.B -h
|
||||
.RS 3
|
||||
.B -h
|
||||
is used to print out a short help text.
|
||||
.RE
|
||||
|
||||
.B -S
|
||||
.I server
|
||||
.RS 3
|
||||
.B server
|
||||
is the name of the server you want to use.
|
||||
.RE
|
||||
|
||||
.B -U
|
||||
.I user name
|
||||
.RS 3
|
||||
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.
|
||||
.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.
|
||||
.RE
|
||||
|
||||
.B -n
|
||||
.RS 3
|
||||
.B -n
|
||||
should be given to mount shares which do not require a password to log in.
|
||||
|
||||
If neither
|
||||
.B -n
|
||||
nor
|
||||
.B -P
|
||||
are given, pqlist prompts for a password.
|
||||
.RE
|
||||
|
||||
.B -C
|
||||
.RS 3
|
||||
By default, passwords are converted to uppercase before they are sent
|
||||
to the server, because most servers require this. You can turn off
|
||||
this conversion by
|
||||
.B -C.
|
||||
.RE
|
||||
|
||||
.SH SEE ALSO
|
||||
.B nwclient(5), nprint(1), slist(1), ncpmount(8), ncpumount(8)
|
||||
|
||||
.SH CREDITS
|
||||
pqlist was written by Volker Lendecke (lendecke@namu01.gwdg.de)
|
||||
|
||||
25
man/slist.1
25
man/slist.1
@@ -1,16 +1,16 @@
|
||||
.TH SLIST 1 01/07/1996 slist slist
|
||||
.SH NAME
|
||||
slist \- List available NetWare Servers
|
||||
slist \- Lists available NetWare Servers
|
||||
.SH SYNOPSIS
|
||||
.B slist
|
||||
[
|
||||
.I pattern
|
||||
]
|
||||
.SH DESCRIPTION
|
||||
With
|
||||
.B slist,
|
||||
you can get a list of NetWare Servers available in your network. If
|
||||
slist does not print to a tty, the decorative header line is not
|
||||
.B slist
|
||||
lists all NetWare Servers available in your network.
|
||||
|
||||
If slist does not print to a tty, the decorative header line is not
|
||||
printed, so that you can count the servers on your network by doing
|
||||
|
||||
slist | wc -l
|
||||
@@ -20,10 +20,10 @@ slist | wc -l
|
||||
.B pattern
|
||||
.RS 3
|
||||
.B pattern
|
||||
is used to list only selected servers. For a server to be listed, the
|
||||
pattern must match the full server name. You can use wildcards for the
|
||||
pattern, but you must protect these wildcards from any command line
|
||||
expansion by quoting. Case doesn't matter.
|
||||
is used to list only servers whose names match the specified pattern. For a
|
||||
server to be listed, the pattern must match the full server name. You can use
|
||||
wildcards for the pattern, but you must protect these wildcards from any
|
||||
command line expansion by quoting. Case doesn't matter.
|
||||
.RE
|
||||
|
||||
.SH EXAMPLE
|
||||
@@ -34,3 +34,10 @@ or
|
||||
.TP
|
||||
slist "i*"
|
||||
List all available Netware servers on your Network, that begin with an "I".
|
||||
|
||||
|
||||
.SH SEE ALSO
|
||||
.B ncpmount(8), ncpumount(8), pqlist(1), nprint(1)
|
||||
|
||||
.SH CREDITS
|
||||
slist was written by Volker Lendecke (lendecke@namu01.gwdg.de)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
Begin3
|
||||
Title: ncpfs
|
||||
Version: 0.13
|
||||
Entered-date: 14. January 1996
|
||||
Version: 0.14
|
||||
Entered-date: 09. February 1996
|
||||
Description: With ncpfs you can mount volumes of your novell
|
||||
server under Linux. You need kernel 1.2.x or
|
||||
1.3.54 and above. ncpfs does NOT work with any 1.3.x
|
||||
@@ -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/
|
||||
~67k ncpfs-0.13.tgz
|
||||
~ 1k ncpfs-0.13.lsm
|
||||
~70k ncpfs-0.14.tgz
|
||||
~ 1k ncpfs-0.14.lsm
|
||||
Copying-policy: GPL
|
||||
End
|
||||
@@ -2,11 +2,12 @@
|
||||
# Makefile for the linux ncp-filesystem routines.
|
||||
#
|
||||
|
||||
UTIL_EXECS = ncpmount ncpumount nprint slist pqlist
|
||||
UTIL_EXECS = ncpmount ncpumount nprint slist pqlist fsinfo pserver
|
||||
UTILS = $(addprefix $(INTERM_BINDIR)/,$(UTIL_EXECS))
|
||||
UIDUTILS = ncpmount ncpumount
|
||||
|
||||
CFLAGS = -Wall $(INCLUDES) -O2 $(KERNELD)
|
||||
# CFLAGS = -Wall $(INCLUDES) -O2 $(KERNELD)
|
||||
CFLAGS = -Wall $(INCLUDES) $(KERNELD) -O2
|
||||
CC = gcc
|
||||
|
||||
all: $(UTILS) ncptest
|
||||
@@ -17,7 +18,7 @@ install: all
|
||||
for i in $(UIDUTILS); do chmod 4755 $(BINDIR)/$$i; done
|
||||
|
||||
$(UTILS): $(addsuffix .o,$(UTIL_EXECS)) ncplib.o
|
||||
$(CC) -s -o $@ $(addsuffix .o,$(notdir $@)) ncplib.o
|
||||
$(CC) -o $@ $(addsuffix .o,$(notdir $@)) ncplib.o
|
||||
|
||||
ncplib.o: ncplib.c ncplib.h
|
||||
$(CC) $(CFLAGS) -finline-functions -c ncplib.c
|
||||
|
||||
@@ -8,14 +8,14 @@
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include "ncplib.h"
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
struct ncp_conn conn;
|
||||
char strings[512];
|
||||
char *s;
|
||||
int opt;
|
||||
|
||||
if (ncp_initialize(&conn, &argc, argv, 0) != 0)
|
||||
{
|
||||
@@ -23,22 +23,54 @@ main(int argc, char **argv)
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (ncp_get_file_server_description_strings(&conn, strings) != 0)
|
||||
while ((opt = getopt(argc, argv, "dt")) != EOF)
|
||||
{
|
||||
perror("could not get strings");
|
||||
ncp_close(&conn);
|
||||
return 1;
|
||||
}
|
||||
|
||||
s = strings;
|
||||
while (s < strings+512)
|
||||
{
|
||||
if (strlen(s) == 0)
|
||||
switch(opt)
|
||||
{
|
||||
case 'd':
|
||||
{
|
||||
char strings[512];
|
||||
char *s;
|
||||
|
||||
if (ncp_get_file_server_description_strings(&conn,
|
||||
strings)
|
||||
!= 0)
|
||||
{
|
||||
perror("could not get strings");
|
||||
ncp_close(&conn);
|
||||
return 1;
|
||||
}
|
||||
|
||||
s = strings;
|
||||
while (s < strings+512)
|
||||
{
|
||||
if (strlen(s) == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
puts(s);
|
||||
s += strlen(s)+1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 't':
|
||||
{
|
||||
time_t t;
|
||||
|
||||
if (ncp_get_file_server_time(&conn, &t) != 0)
|
||||
{
|
||||
perror("could not get server time");
|
||||
ncp_close(&conn);
|
||||
return 1;
|
||||
}
|
||||
|
||||
fputs(ctime(&t), stdout);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
printf("unknown option: %c\n", opt);
|
||||
break;
|
||||
}
|
||||
puts(s);
|
||||
s += strlen(s)+1;
|
||||
}
|
||||
|
||||
ncp_close(&conn);
|
||||
|
||||
221
util/ncplib.c
221
util/ncplib.c
@@ -34,8 +34,13 @@ extern pid_t wait(int *);
|
||||
static int
|
||||
ncp_negotiate_buffersize(struct ncp_conn *conn,
|
||||
int size, int *target);
|
||||
static int
|
||||
ncp_login_object(struct ncp_conn *conn,
|
||||
const unsigned char *username,
|
||||
int login_type,
|
||||
const unsigned char *password);
|
||||
|
||||
static void
|
||||
void
|
||||
str_upper(char *name)
|
||||
{
|
||||
while (*name) {
|
||||
@@ -837,7 +842,8 @@ ncp_open_temporary(struct ncp_conn *conn,
|
||||
|
||||
if (strlen(spec->user) != 0)
|
||||
{
|
||||
if (ncp_login_user(conn, spec->user, spec->password) != 0)
|
||||
if (ncp_login_object(conn, spec->user, spec->login_type,
|
||||
spec->password) != 0)
|
||||
{
|
||||
ncp_close(conn);
|
||||
errno = EACCES;
|
||||
@@ -1269,9 +1275,9 @@ ncp_find_conn_spec(const char *server, const char *user, const char *password,
|
||||
}
|
||||
|
||||
int
|
||||
ncp_initialize(struct ncp_conn *conn,
|
||||
int *argc, char **argv,
|
||||
int login_necessary)
|
||||
ncp_initialize_as(struct ncp_conn *conn,
|
||||
int *argc, char **argv,
|
||||
int login_necessary, int login_type)
|
||||
{
|
||||
char *server = NULL;
|
||||
char *user = NULL;
|
||||
@@ -1361,9 +1367,20 @@ ncp_initialize(struct ncp_conn *conn,
|
||||
|
||||
errno = 0;
|
||||
|
||||
spec->login_type = login_type;
|
||||
|
||||
return ncp_open(conn, spec);
|
||||
}
|
||||
|
||||
int
|
||||
ncp_initialize(struct ncp_conn *conn,
|
||||
int *argc, char **argv,
|
||||
int login_necessary)
|
||||
{
|
||||
return ncp_initialize_as(conn, argc, argv, login_necessary,
|
||||
NCP_BINDERY_USER);
|
||||
}
|
||||
|
||||
static int
|
||||
ncp_request(struct ncp_conn *conn, int function)
|
||||
{
|
||||
@@ -1377,12 +1394,49 @@ ncp_request(struct ncp_conn *conn, int function)
|
||||
return -ENOTCONN;
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
/* */
|
||||
/* Helper functions */
|
||||
/* */
|
||||
/****************************************************************************/
|
||||
|
||||
static inline int
|
||||
min(int a, int b)
|
||||
{
|
||||
return (a<b) ? a : b;
|
||||
}
|
||||
|
||||
struct nw_time_buffer {
|
||||
__u8 year __attribute__ ((packed));
|
||||
__u8 month __attribute__ ((packed));
|
||||
__u8 day __attribute__ ((packed));
|
||||
__u8 hour __attribute__ ((packed));
|
||||
__u8 minute __attribute__ ((packed));
|
||||
__u8 second __attribute__ ((packed));
|
||||
__u8 wday __attribute__ ((packed));
|
||||
};
|
||||
|
||||
static time_t
|
||||
nw_to_ctime(struct nw_time_buffer *source)
|
||||
{
|
||||
struct tm u_time;
|
||||
|
||||
memzero(u_time);
|
||||
u_time.tm_sec = source->second;
|
||||
u_time.tm_min = source->minute;
|
||||
u_time.tm_hour = source->hour;
|
||||
u_time.tm_mday = source->day;
|
||||
u_time.tm_mon = source->month - 1;
|
||||
u_time.tm_year = source->year;
|
||||
|
||||
if (u_time.tm_year < 80)
|
||||
{
|
||||
u_time.tm_year += 100;
|
||||
}
|
||||
|
||||
return mktime(&u_time);
|
||||
}
|
||||
|
||||
static void
|
||||
assert_conn_locked(struct ncp_conn *conn)
|
||||
{
|
||||
@@ -1528,6 +1582,50 @@ ncp_get_file_server_description_strings(struct ncp_conn *conn,
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
ncp_get_file_server_time(struct ncp_conn *conn, time_t *target)
|
||||
{
|
||||
int result;
|
||||
|
||||
ncp_init_request(conn);
|
||||
|
||||
if ((result = ncp_request(conn, 20)) != 0)
|
||||
{
|
||||
ncp_unlock_conn(conn);
|
||||
return result;
|
||||
}
|
||||
|
||||
*target= nw_to_ctime((struct nw_time_buffer *)ncp_reply_data(conn, 0));
|
||||
ncp_unlock_conn(conn);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
ncp_get_connlist(struct ncp_conn *conn, __u32 last_id,
|
||||
__u16 object_type, const char *object_name,
|
||||
int *returned_no, __u16 conn_numbers[256])
|
||||
{
|
||||
int result;
|
||||
|
||||
ncp_init_request_s(conn, 27);
|
||||
ncp_add_dword(conn, htonl(last_id));
|
||||
ncp_add_word(conn, htons(object_type));
|
||||
ncp_add_pstring(conn, object_name);
|
||||
|
||||
if ((result = ncp_request(conn, 23)) != 0)
|
||||
{
|
||||
ncp_unlock_conn(conn);
|
||||
return result;
|
||||
}
|
||||
|
||||
*returned_no = ncp_reply_byte(conn, 0);
|
||||
memcpy(conn_numbers, ncp_reply_data(conn, 1),
|
||||
sizeof(__u16) * (*returned_no));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* result is a 8-byte buffer
|
||||
*/
|
||||
@@ -1672,6 +1770,15 @@ int
|
||||
ncp_login_user(struct ncp_conn *conn,
|
||||
const unsigned char *username,
|
||||
const unsigned char *password)
|
||||
{
|
||||
return ncp_login_object(conn, username, NCP_BINDERY_USER, password);
|
||||
}
|
||||
|
||||
static int
|
||||
ncp_login_object(struct ncp_conn *conn,
|
||||
const unsigned char *username,
|
||||
int login_type,
|
||||
const unsigned char *password)
|
||||
{
|
||||
int result;
|
||||
unsigned char ncp_key[8];
|
||||
@@ -1681,7 +1788,7 @@ ncp_login_user(struct ncp_conn *conn,
|
||||
return result;
|
||||
}
|
||||
|
||||
if ((result = ncp_get_bindery_object_id(conn, NCP_BINDERY_USER,
|
||||
if ((result = ncp_get_bindery_object_id(conn, login_type,
|
||||
username, &user)) != 0) {
|
||||
return result;
|
||||
}
|
||||
@@ -2394,7 +2501,6 @@ ncp_create_queue_job_and_file(struct ncp_conn *conn,
|
||||
}
|
||||
|
||||
memcpy(&(job->j), ncp_reply_data(conn, 0), 78);
|
||||
|
||||
ConvertToNWfromDWORD(job->j.JobFileHandle, job->file_handle);
|
||||
|
||||
ncp_unlock_conn(conn);
|
||||
@@ -2419,7 +2525,106 @@ ncp_close_file_and_start_job(struct ncp_conn *conn,
|
||||
|
||||
ncp_unlock_conn(conn);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
ncp_attach_to_queue(struct ncp_conn *conn,
|
||||
__u32 queue_id)
|
||||
{
|
||||
int result;
|
||||
|
||||
ncp_init_request_s(conn, 111);
|
||||
ncp_add_dword(conn, htonl(queue_id));
|
||||
|
||||
if ((result = ncp_request(conn, 23)) != 0) {
|
||||
ncp_unlock_conn(conn);
|
||||
return result;
|
||||
}
|
||||
|
||||
ncp_unlock_conn(conn);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
ncp_detach_from_queue(struct ncp_conn *conn,
|
||||
__u32 queue_id)
|
||||
{
|
||||
int result;
|
||||
|
||||
ncp_init_request_s(conn, 112);
|
||||
ncp_add_dword(conn, htonl(queue_id));
|
||||
|
||||
if ((result = ncp_request(conn, 23)) != 0) {
|
||||
ncp_unlock_conn(conn);
|
||||
return result;
|
||||
}
|
||||
|
||||
ncp_unlock_conn(conn);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
ncp_service_queue_job(struct ncp_conn *conn, __u32 queue_id, __u16 job_type,
|
||||
struct queue_job *job)
|
||||
{
|
||||
int result;
|
||||
|
||||
ncp_init_request_s(conn, 124);
|
||||
ncp_add_dword(conn, htonl(queue_id));
|
||||
ncp_add_word(conn, htons(job_type));
|
||||
|
||||
if ((result = ncp_request(conn, 23)) != 0) {
|
||||
ncp_unlock_conn(conn);
|
||||
return result;
|
||||
}
|
||||
|
||||
memcpy(&(job->j), ncp_reply_data(conn, 0), 78);
|
||||
ConvertToNWfromDWORD(job->j.JobFileHandle, job->file_handle);
|
||||
|
||||
ncp_unlock_conn(conn);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
ncp_finish_servicing_job(struct ncp_conn *conn, __u32 queue_id,
|
||||
__u32 job_number, __u32 charge_info)
|
||||
{
|
||||
int result;
|
||||
|
||||
ncp_init_request_s(conn, 131);
|
||||
ncp_add_dword(conn, htonl(queue_id));
|
||||
ncp_add_dword(conn, job_number);
|
||||
ncp_add_dword(conn, htonl(charge_info));
|
||||
|
||||
if ((result = ncp_request(conn, 23)) != 0) {
|
||||
ncp_unlock_conn(conn);
|
||||
return result;
|
||||
}
|
||||
|
||||
ncp_unlock_conn(conn);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
ncp_abort_servicing_job(struct ncp_conn *conn, __u32 queue_id,
|
||||
__u32 job_number)
|
||||
{
|
||||
int result;
|
||||
|
||||
ncp_init_request_s(conn, 132);
|
||||
ncp_add_dword(conn, htonl(queue_id));
|
||||
ncp_add_dword(conn, job_number);
|
||||
|
||||
if ((result = ncp_request(conn, 23)) != 0) {
|
||||
ncp_unlock_conn(conn);
|
||||
return result;
|
||||
}
|
||||
|
||||
ncp_unlock_conn(conn);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
ncp_do_read(struct ncp_conn *conn, const char *file_id,
|
||||
|
||||
@@ -14,13 +14,18 @@
|
||||
#include <linux/ipx.h>
|
||||
#include <sys/param.h>
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "ipxlib.h"
|
||||
|
||||
#ifndef memzero
|
||||
#include <string.h>
|
||||
#define memzero(object) memset(&(object), 0, sizeof(object))
|
||||
#endif
|
||||
|
||||
void
|
||||
str_upper(char *name);
|
||||
|
||||
enum connect_state {
|
||||
NOT_CONNECTED = 0,
|
||||
CONN_PERMANENT,
|
||||
@@ -64,6 +69,7 @@ struct ncp_conn_spec {
|
||||
char server[NCP_BINDERY_NAME_LEN];
|
||||
char user[NCP_BINDERY_NAME_LEN];
|
||||
uid_t uid;
|
||||
int login_type; /* NCP_BINDERY_USER / NCP_BINDERY_PSERVER */
|
||||
char password[NCP_BINDERY_NAME_LEN];
|
||||
};
|
||||
|
||||
@@ -82,6 +88,14 @@ ncp_initialize(struct ncp_conn *conn,
|
||||
int *argc, char **argv,
|
||||
int login_necessary);
|
||||
|
||||
/* You can login as another object by this procedure. As a first use
|
||||
pserver comes to mind. */
|
||||
int
|
||||
ncp_initialize_as(struct ncp_conn *conn,
|
||||
int *argc, char **argv,
|
||||
int login_necessary, int login_type);
|
||||
|
||||
|
||||
/* Open an existing permanent connection */
|
||||
int
|
||||
ncp_open(struct ncp_conn *conn,
|
||||
@@ -132,6 +146,14 @@ int
|
||||
ncp_get_file_server_description_strings(struct ncp_conn *conn,
|
||||
char target[512]);
|
||||
|
||||
int
|
||||
ncp_get_file_server_time(struct ncp_conn *conn, time_t *target);
|
||||
|
||||
int
|
||||
ncp_get_connlist(struct ncp_conn *conn, __u32 last_id,
|
||||
__u16 object_type, const char *object_name,
|
||||
int *returned_no, __u16 conn_numbers[256]);
|
||||
|
||||
int
|
||||
ncp_get_encryption_key(struct ncp_conn *conn,
|
||||
char *target);
|
||||
@@ -286,4 +308,24 @@ ncp_close_file_and_start_job(struct ncp_conn *conn,
|
||||
__u32 queue_id,
|
||||
struct queue_job *job);
|
||||
|
||||
int
|
||||
ncp_attach_to_queue(struct ncp_conn *conn,
|
||||
__u32 queue_id);
|
||||
|
||||
int
|
||||
ncp_detach_from_queue(struct ncp_conn *conn,
|
||||
__u32 queue_id);
|
||||
|
||||
int
|
||||
ncp_service_queue_job(struct ncp_conn *conn, __u32 queue_id, __u16 job_type,
|
||||
struct queue_job *job);
|
||||
|
||||
int
|
||||
ncp_finish_servicing_job(struct ncp_conn *conn, __u32 queue_id,
|
||||
__u32 job_number, __u32 charge_info);
|
||||
|
||||
int
|
||||
ncp_abort_servicing_job(struct ncp_conn *conn, __u32 queue_id,
|
||||
__u32 job_number);
|
||||
|
||||
#endif /* _NCPLIB_H */
|
||||
|
||||
@@ -47,7 +47,6 @@ extern pid_t waitpid(pid_t, int *, int);
|
||||
#include "ncplib.h"
|
||||
|
||||
static char *progname;
|
||||
static void str_upper(char *name);
|
||||
static void usage(void);
|
||||
static void help(void);
|
||||
|
||||
@@ -492,15 +491,6 @@ main(int argc, char *argv[])
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
str_upper(char *name)
|
||||
{
|
||||
while (*name) {
|
||||
*name = toupper(*name);
|
||||
name = name + 1;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
usage(void)
|
||||
{
|
||||
|
||||
@@ -137,6 +137,16 @@ test_ls(struct ncp_conn *server)
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
test_connlist(struct ncp_conn *conn)
|
||||
{
|
||||
__u16 conn_list[256];
|
||||
int no;
|
||||
|
||||
ncp_get_connlist(conn, 0, NCP_BINDERY_USER, "*", &no, conn_list);
|
||||
return;
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
@@ -148,8 +158,7 @@ main(int argc, char *argv[])
|
||||
return 1;
|
||||
}
|
||||
|
||||
test_ls(&conn);
|
||||
|
||||
test_connlist(&conn);
|
||||
ncp_close(&conn);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -20,8 +20,7 @@
|
||||
static char *progname;
|
||||
static void
|
||||
usage(void);
|
||||
static void
|
||||
str_upper(char *name);
|
||||
static void help(void);
|
||||
|
||||
void
|
||||
main(int argc, char *argv[])
|
||||
@@ -48,6 +47,13 @@ main(int argc, char *argv[])
|
||||
|
||||
memzero(j); memzero(pj); memzero(q); memzero(conn);
|
||||
|
||||
if ( (argc == 2)
|
||||
&& (strcmp(argv[1], "-h") == 0))
|
||||
{
|
||||
help();
|
||||
exit(0);
|
||||
}
|
||||
|
||||
if (ncp_initialize(&conn, &argc, argv, 1) != 0)
|
||||
{
|
||||
perror("Could not open connection");
|
||||
@@ -71,9 +77,13 @@ main(int argc, char *argv[])
|
||||
pj.Rows = htons(80);
|
||||
strcpy(pj.FnameHeader, "stdin");
|
||||
|
||||
while ((opt = getopt(argc, argv, "q:d:p:b:f:l:r:c:t:F:TN"))!=EOF)
|
||||
while ((opt = getopt(argc, argv, "hq:d:p:b:f:l:r:c:t:F:TN"))!=EOF)
|
||||
{
|
||||
switch (opt) {
|
||||
case 'h':
|
||||
help();
|
||||
ncp_close(&conn);
|
||||
exit(1);
|
||||
case 'p':
|
||||
/* Path */
|
||||
pj.CtrlFlags |= PRINT_BANNER;
|
||||
@@ -303,10 +313,27 @@ usage(void)
|
||||
}
|
||||
|
||||
static void
|
||||
str_upper(char *name)
|
||||
help(void)
|
||||
{
|
||||
while (*name) {
|
||||
*name = toupper(*name);
|
||||
name = name + 1;
|
||||
}
|
||||
printf("\n");
|
||||
printf("usage: %s [options] mount-point\n", progname);
|
||||
printf("\n"
|
||||
"-S server Server name to be used\n"
|
||||
"-U username Username sent to server\n"
|
||||
"-P password Use this password\n"
|
||||
"-n Do not use any password\n"
|
||||
"-C Don't convert password to uppercase\n"
|
||||
"-q queue name Name of the printing queue to use\n"
|
||||
"-d job desc Job description\n"
|
||||
"-p path name Path name to appear on banner\n"
|
||||
"-b bannername Banner name (up to 12 chars)\n"
|
||||
"-f filename Filename to appear on banner\n"
|
||||
"-l lines Number of lines per page\n"
|
||||
"-r rows Number of rows per page\n"
|
||||
"-t tab Number of spaces per tab\n"
|
||||
"-T Print server tab expantion\n"
|
||||
"-N Surpress print server form feeds\n"
|
||||
"-F form # Form number to print on\n"
|
||||
"-h print this help text\n"
|
||||
"\n");
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ main(int argc, char **argv)
|
||||
{
|
||||
found = 1;
|
||||
printf("%-52s", q.object_name);
|
||||
printf("%08lx\n", q.object_id);
|
||||
printf("%08x\n", q.object_id);
|
||||
}
|
||||
|
||||
if ((found == 0) && (isatty(1)))
|
||||
|
||||
282
util/pserver.c
Normal file
282
util/pserver.c
Normal file
@@ -0,0 +1,282 @@
|
||||
/*
|
||||
* pserver.c
|
||||
*
|
||||
* Copyright (C) 1996 by Volker Lendecke
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
#include <signal.h>
|
||||
#include "ncplib.h"
|
||||
|
||||
struct nw_queue {
|
||||
struct ncp_conn *conn;
|
||||
|
||||
char queue_name[NCP_BINDERY_NAME_LEN];
|
||||
__u32 queue_id;
|
||||
__u16 job_type;
|
||||
|
||||
char *command;
|
||||
};
|
||||
|
||||
static struct nw_queue q;
|
||||
|
||||
static int term_request;
|
||||
|
||||
static int
|
||||
init_queue(struct ncp_conn *conn, char *queue_name,
|
||||
char *command, struct nw_queue *q);
|
||||
|
||||
static int
|
||||
poll_queue(struct nw_queue *q);
|
||||
|
||||
void
|
||||
usage(void)
|
||||
{
|
||||
/* Obviously, there's more to do */
|
||||
return;
|
||||
}
|
||||
|
||||
#ifndef NCP_BINDERY_PSERVER
|
||||
#define NCP_BINDERY_PSERVER (0x0007)
|
||||
#endif
|
||||
|
||||
static void
|
||||
terminate_handler()
|
||||
{
|
||||
signal(SIGTERM,terminate_handler);
|
||||
term_request=1;
|
||||
}
|
||||
|
||||
#if 0
|
||||
static void
|
||||
daemonize()
|
||||
{
|
||||
int fd,c;
|
||||
|
||||
if ((c = fork()) > 0) exit(0);
|
||||
if (c < 0)
|
||||
{
|
||||
fprintf(stderr, "ipxripd: can't fork: %s\n",strerror(errno));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
close(0);
|
||||
close(1);
|
||||
close(2);
|
||||
if ((fd = open("/dev/tty", O_RDWR)) >= 0)
|
||||
{
|
||||
ioctl(fd, TIOCNOTTY, NULL);
|
||||
close(fd);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
struct ncp_conn conn;
|
||||
int poll_timeout = 30;
|
||||
int opt;
|
||||
int job_type = 0xffff;
|
||||
int debug = 0;
|
||||
|
||||
char *queue_name = NULL;
|
||||
|
||||
char default_command[] = "lpr";
|
||||
char *command = default_command;
|
||||
|
||||
if (ncp_initialize_as(&conn, &argc, argv, 1, NCP_BINDERY_PSERVER) != 0)
|
||||
{
|
||||
perror("Could not open connection");
|
||||
return 1;
|
||||
}
|
||||
|
||||
while ((opt = getopt(argc, argv, "q:c:j:t:d")) != EOF)
|
||||
{
|
||||
switch (opt)
|
||||
{
|
||||
case 'q':
|
||||
queue_name = optarg;
|
||||
break;
|
||||
case 'c':
|
||||
command = optarg;
|
||||
break;
|
||||
case 'j':
|
||||
job_type = atoi(optarg);
|
||||
break;
|
||||
case 't':
|
||||
poll_timeout = atoi(optarg);
|
||||
break;
|
||||
case 'd':
|
||||
debug = 1;
|
||||
break;
|
||||
default:
|
||||
usage();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
memzero(q);
|
||||
|
||||
if (debug == 0)
|
||||
{
|
||||
/* We can not daemonize after ncp_initialize, sorry */
|
||||
/* daemonize(); */
|
||||
}
|
||||
|
||||
if (init_queue(&conn, queue_name, command, &q) != 0)
|
||||
{
|
||||
perror("Could not init queue");
|
||||
ncp_close(&conn);
|
||||
return 1;
|
||||
}
|
||||
|
||||
q.job_type = job_type;
|
||||
|
||||
term_request = 0;
|
||||
signal(SIGTERM,terminate_handler);
|
||||
|
||||
while (1)
|
||||
{
|
||||
if ( (poll_queue(&q) != 0)
|
||||
&& (term_request == 0))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (term_request != 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
sleep(poll_timeout);
|
||||
}
|
||||
|
||||
ncp_detach_from_queue(&conn, q.queue_id);
|
||||
|
||||
ncp_close(&conn);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
init_queue(struct ncp_conn *conn, char *queue_name, char *command,
|
||||
struct nw_queue *q)
|
||||
{
|
||||
struct ncp_bindery_object obj;
|
||||
|
||||
str_upper(queue_name);
|
||||
|
||||
q->conn = conn;
|
||||
q->command = command;
|
||||
|
||||
if (ncp_get_bindery_object_id(conn, NCP_BINDERY_PQUEUE,
|
||||
queue_name, &obj) != 0)
|
||||
{
|
||||
fprintf(stderr, "Queue %s not found\n", queue_name);
|
||||
return -1;
|
||||
}
|
||||
|
||||
q->queue_id = obj.object_id;
|
||||
memcpy(q->queue_name, obj.object_name, sizeof(q->queue_name));
|
||||
|
||||
if (ncp_attach_to_queue(conn, q->queue_id) != 0)
|
||||
{
|
||||
fprintf(stderr, "Could not attach to queue %s\n",
|
||||
queue_name);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
poll_queue(struct nw_queue *q)
|
||||
{
|
||||
struct queue_job job;
|
||||
int fd[2];
|
||||
int pid;
|
||||
|
||||
if (ncp_service_queue_job(q->conn, q->queue_id, q->job_type,
|
||||
&job) != 0)
|
||||
{
|
||||
/* No job for us */
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (pipe(fd) < 0)
|
||||
{
|
||||
perror("pipe");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if ((pid = fork()) < 0)
|
||||
{
|
||||
perror("fork");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (pid > 0)
|
||||
{
|
||||
/* parent */
|
||||
char buf[1024];
|
||||
size_t result;
|
||||
off_t offset = 0;
|
||||
|
||||
close(fd[0]); /* close read end */
|
||||
|
||||
while ((result = ncp_read(q->conn, job.file_handle, offset,
|
||||
sizeof(buf), buf)) > 0)
|
||||
{
|
||||
offset += result;
|
||||
if (write(fd[1], buf, result) != result)
|
||||
{
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
|
||||
close(fd[1]); /* and close write end */
|
||||
|
||||
if (waitpid(pid, NULL, 0) < 0)
|
||||
{
|
||||
perror("waitpid");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* child */
|
||||
|
||||
close(fd[1]); /* close write end */
|
||||
|
||||
if (fd[0] != STDIN_FILENO)
|
||||
{
|
||||
if (dup2(fd[0], STDIN_FILENO) != STDIN_FILENO)
|
||||
{
|
||||
perror("dup2");
|
||||
close(fd[0]);
|
||||
exit(1);
|
||||
}
|
||||
close(fd[0]);
|
||||
}
|
||||
|
||||
execl("/bin/sh", "sh", "-c", q->command, NULL);
|
||||
perror("exec");
|
||||
close(fd[0]);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
ncp_finish_servicing_job(q->conn, q->queue_id, job.j.JobNumber,0);
|
||||
return 1;
|
||||
|
||||
fail:
|
||||
ncp_abort_servicing_job(q->conn, q->queue_id, job.j.JobNumber);
|
||||
/* We tell that we did not have a job to avoid overloading
|
||||
when something's wrong */
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user