home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 October
/
usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso
/
unix
/
volume26
/
port-lpr
/
part01
/
README
< prev
next >
Wrap
Text File
|
1993-04-09
|
9KB
|
219 lines
This is something I threw together to allow various non-BSD systems to
print over the network to print queues on BSD-style systems (like
SunOS and Ultrix and...). Basically, it's a standalone clone of the
BSD "lpr" command -- like BSD lpr but it doesn't need a print spooler
on the local machine. This program also runs on VMS systems, and
there's a gateway to allow the VMS systems to talk lpr over DECnet as
long as you have a UNIX host that also speaks DECnet which can act as
a gateway.
If you are running UNIX, you have to have a Berkeley-style TCP
implementation on your machine (with socket(), bind() and that sort of
stuff), and access to an Berkeley lpd server somewhere on the network.
If you are running VMS, you can use either DEC's Ultrix connection or
Wollongong WIN/TCP for VMS, or you can run lpr over DECnet. The
latter requires that you have access to a UNIX host that can speak
DECnet (either SunLink DNI or DECnet-Ultrix), and which can talk to an
lpr server somewhere.
At one time or another, I have tested the lpr program on SCO ODT 1.0,
SunOS 4.1, Ultrix 3.x, Ultrix 4.x, 4.3 BSD, an IBM RS/6000 running AIX
3.x, and on a Stardent Titan running some variant of SysV. It also
works on VAX/VMS 5.4 with UCX TCP and DECnet. (I got it to compile on
a machine with an old version of WIN/TCP, but I couldn't fully test it
because I don't have privileged access to that machine.) The dnet-lpr
gateway program has been tested on a Sun/3 running SunOS 4.1 and
SunLink DNI 6.0, and a DecStation 5000 running Ultrix 4.2 and
DECnet-Ultrix.
I have used SunOS and Ultrix machines as printer servers, but I would
expect this program to work with any lpd server running 4.2BSD or
4.3BSD-derived code.
* Warranty:
READ THIS BEFORE INSTALLING THIS CODE ON ANY MACHINE:
There is NO WARRANTY for this software, not even for merchantability
nor for fitness for any particular purpose. Anyone who installs or uses
this software, does so entirely at his or her own risk. The author
will not be responsible for any ill consequences of the installation
or use of this software, no matter how terrible.
* Copyright, use and redistribution:
The source code for this program is Copyright 1990, 1991 by Keith Moore
Use of this program and distribution of the code in either source or
compiled binary form are governed by the GNU General Public License,
Version 2. See the file LICENSE for details.
* Compiling on UNIX:
On many UNIX systems you can simply type "make".
On UNIX, if your C compiler does not define the macro "unix", add a
"CFLAGS=-Dunix" to the "make" command line, like so:
make CFLAGS=-Dunix
If you have SunLink DNI or DECnet-Ultrix and want to compile the
decnet lpd gateway, type "make dnet-lpd-gw".
* Compiling on VMS:
On VMS systems you need to edit the DESCRIP.MMS file first (assuming
you have DEC/MMS), and pick which transport you want to use. Also, be
sure to select the proper object library. Then type "mms" to make
things. If you use some other "make" clone besides DEC/MMS, then you
may have to make small changes to the DESCRIP.MMS file and rename it
to something like MAKEFILE.
If you don't have DEC/MMS or some flavor of "make", do the following:
cc/debug lpr.c
cc/debug DRIVER.c
link lpr,DRIVER,LIBRARY/lib
where DRIVER and LIBRARY are chosen from the following, based on whether
you are using UCX TCP, Wollongong TCP, or DECnet:
Transport DRIVER LIBRARY
UCX TCP vms-ucx-tcp sys$library:ucx$ipc.olb
WIN/TCP vms-win-tcp twg$tcp:[netdist.lib]twglib.olb
DECnet vms-decnet (not needed)
* UNIX Installation:
On UNIX, "make install" should do the trick to install the lpr
program. (NOTE:: make install creates a set-uid program. See below
under IMPORTANT NOTES for details.) You may have to edit the Makefile
to change the installation directory. Install the man page by hand,
if your system supports these. The file "lpr.cat" is a preformatted
man page, in case your system does not support nroff. If your system
has a man command, you may be able to copy the lpr.cat file into an
appropriate directory with an appropriate name so that "man lpr" will
work.
lpr expects a file named /etc/LPD_SERVER that contains the host name
of a machine that has a working BSD-style line printer daemon.
Failing this, it checks the environment variable LPD_SERVER for the
printer server host, so users can override the system default. Either
of these can be manually overriden with the -S command line option.
However the print server is specified, the client machine must have
permission to print on the server's print queues. Generally this is
done by editing either /etc/hosts.lpd or /etc/hosts.equiv on the
server.
* VMS Installation:
To run lpr on VMS, copy LPR.EXE to an appropriate directory and define a
DCL symbol to point to it, e.g.:
lpr == "$some$system$directory:[some.sub.directory]lpr.exe"
You may need to install the image with privileges; see below.
after which it works almost, but not quite, just like on UNIX.
Unfortunately, the VAX C library is really brain dead, so wildcards do
not work, the entire command line is lower cased, and you can't have
embedded spaces in file names. (The effect of the last restriction is
that you can't use lpr to print a file on a remote DECnet node if you
don't have proxy access to that machine.) If someone wants to
contribute a CLD based front end for this program, I'll be happy to
include it in a future release.
On VMS, the logical name LPD_SERVER must be defined to point to the
name of the host acting as a print server (for TCP, this is the
Internet domain name of the server; for DECnet, it's the DECnet node
name of the machine where the gateway runs). This can either be
defined by the user or as a system-wide logical name.
To do the equivalent of lprm or lpq on VMS, define symbols like the
following:
lpq == "$some$system$directory:[some.sub.directory]lpr.exe -showqueue"
lprm == "$some$system$directory:[some.sub.directory]lpr.exe -remove"
* Installation of the DECnet lpr gateway on SunOS:
(You must be running SunLink DNI to do this:)
"make install-gw" will install the dnet-lpd-gw program in an
appropriate directory. You might need to edit the Makefile, however,
if /usr/sunlink/dni is not an appropriate directory on your machine.
"dnet-lpd-gw" is also installed set-uid to root.
The dnet-lpd-gw program should be installed so that it will be run
with an remote DECnet client tries to connect to object 223. On Sun
systems, do this by editing the file /usr/sunlink/dni/dniserver.reg
and adding a line like the following:
223 DNETLPD /usr/sunlink/dni/dnet-lpd-gw
(Currently, the number 223 is wired into vms-decnet.c. This may
change at some point.) "make install-gw" will copy dnet-lpd-gw to the
/usr/sunlink/dni directory and install it with appropriate
permissions.
* Installation of the DECnet lpr gateway on Ultrix:
(You have to be running DECnet-Ultrix to do this:)
Become root and use the "ncp" program to define the DNETLPD object as follows:
# ncp
ncp>clear object dnetlpd
ncp>set object dnetlpd
Number : 223
File : /usr/local/lib/dnet-lpd-gw
Default User : daemon
Type : sequenced packet
Accept : deferred
ncp> ^D
(Note: you can set the "default user" to "root" instead of "daemon",
in which case dnet-lpd-gw need not be set-uid to root. The set-uid
approach is probably safer in this case.)
* IMPORTANT NOTES:
On UNIX, the program is installed set-uid to root, which is necessary
so that lpr can bind to a privileged TCP port. This should not
present a security risk since the first thing that the program does is
to create the socket and bind it to the privileged port, after which
it immediately disables its special privileges. All file opens,
reads, etc., are then done with the invoking user's normal privileges.
On VMS, similar concerns apply if using TCP -- the program must be
installed as a privileged image with the INSTALL utility. UCX TCP
requires either BYPASS or SYSPRV privilege in order to allow lpr to
bind to a privileged port. I'm not sure offhand what privileges
WIN/TCP requires. Anyway, immediately after successfully binding to a
privileged port, the lpr program turns off all image-installed
privileges.
For VMS systems using a DECnet-based lpr, no special installation is
required, but the UNIX-based server does have to be installed set-uid
to root. If when using lpr over DECnet you get the message "your host
does not have line printer access", you need to put "localhost" or the
hostname of the print server in the print server machine's
/etc/hosts.lpd file. You may then have to kill and restart lpd on the
server to get it to recognize the changed /etc/hosts.lpd file.
* Miscellaneous:
The UNIX Makefile has rules to generate this package in various
formats to allow it to be moved from system to system. Of special
interest is the rule for "make port-lpr.vms", which creates a VMS .COM
file that extracts itself when run in an empty VMS directory.
Sorry, there's no special HELP file for lpr on VMS. Perhaps someone
will contribute one.
If you find bugs and can supply fixes, please let me know and I'll try
and have the fixes incorporated into a future release.
Keith Moore
moore@cs.utk.edu