Subject: CVS commit: basesrc
To: None <source-changes@netbsd.org>
From: matthew green <mrg@netbsd.org>
List: source-changes
Date: 12/07/1999 06:54:49
Module Name:	basesrc
Committed By:	mrg
Date:		Tue Dec  7 14:54:49 UTC 1999

Modified Files:
	basesrc/usr.sbin/lpr/common_source: displayq.c lp.h rmjob.c
	basesrc/usr.sbin/lpr/filters: lpf.c
	basesrc/usr.sbin/lpr/lpd: lpd.c printjob.c
	basesrc/usr.sbin/lpr/lpq: lpq.c
	basesrc/usr.sbin/lpr/lprm: lprm.c

Log Message:
- add timeouts to displayq(), rmremote(), sendfile() and response(),
  and use these timeout in the lpq, lpd and lprm programs.

these stop hung remote printers that accept tcp connections but do
not process jobs from hanging the whole system and letting the sysadmin
have a clue about what is going on with this rogue printer.

- add a -r flag to lpd to allow `of' filters for remote jobs.

i know there are ways around this, but i just don't care.

- add a -f flag to lpf to add missing carriage returns.

useful when printing UNIX files to an, eg, LaserWriter that wants CR's
as well as LF's in raw text.  stair-stepped text is no fun.

- implement child process accounting: we just have a limit on the number
  of children we can have (settable by the sysadmin), and we sleep when
  this number is reached.  this can reduce malicious not-so-malicious
  attacks on the print server by a rogue remote client..

- use setproctitle() where appropriate so the sysadmin has a clue about
  what each of the lpd's here are doing.

this was useful to help diagnose a problem (that the above child process
accounting change reduces the lossages of) where a rogue client was
attempting "lpq" operations on one stuck queue in rapid succession,
causing the lpd server to be extremely slow, due to the large number
of lpd processes running.

i have been running these changes in production for about a year.


To generate a diff of this commit:
cvs rdiff -r1.16 -r1.17 basesrc/usr.sbin/lpr/common_source/displayq.c
cvs rdiff -r1.12 -r1.13 basesrc/usr.sbin/lpr/common_source/lp.h
cvs rdiff -r1.14 -r1.15 basesrc/usr.sbin/lpr/common_source/rmjob.c
cvs rdiff -r1.6 -r1.7 basesrc/usr.sbin/lpr/filters/lpf.c
cvs rdiff -r1.17 -r1.18 basesrc/usr.sbin/lpr/lpd/lpd.c
cvs rdiff -r1.20 -r1.21 basesrc/usr.sbin/lpr/lpd/printjob.c
cvs rdiff -r1.8 -r1.9 basesrc/usr.sbin/lpr/lpq/lpq.c
cvs rdiff -r1.9 -r1.10 basesrc/usr.sbin/lpr/lprm/lprm.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.