Home | History | Annotate | Download | only in common_source
History log of /src/usr.sbin/lpr/common_source/displayq.c
RevisionDateAuthorComments
 1.34  13-Jul-2009  roy Rename internal getline() function to get_line() so it does
conflict with the soon to be added getline(3) libc function.
 1.33  18-Jan-2009  lukem fix -Wsign-compare issues
 1.32  21-Mar-2006  christos Coverity CID 1750: Add a function to free a queue and use it.
 1.31  21-Mar-2006  christos Coverity CID 1752: getq() always allocates a queue if nitems >= 0, so always
free it.
 1.30  20-Jan-2006  christos Instead of dealing with port@host in many places, do it where it is needed.
It reduces code and complexity and at the same time allows as to use symbolic
ports instead of just numeric everywhere.
 1.29  04-Jan-2006  garbled Address PR bin/12112
Lpd has the ability to start on a port other than "printer" but has no
way to connect to a remote lpd on that port. This change adds the
ability to specify port@host in the rm element of printcap(5). Tested to
work with both a standard lpd setup and one running on special ports.
 1.28  28-Nov-2005  christos - WARNS = 4
- factor out commonly used code.
- constify
- use warn/warnx instead of printf
 1.27  30-Oct-2004  dsl Add (unsigned char) cast to ctype functions
Some of this code could usefully be converted to use strtoul() and/or
some small helper functions.
 1.26  07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22366, verified by myself.
 1.25  17-May-2003  itojun use strlcpy/strlcat.
[fix off-by-one in displayq.c]
 1.24  14-Jul-2002  wiz Unifdef __STDC__. Remove __P(). ANSIfy.
 1.23  08-Jun-2002  itojun avoid hardcoded octals
 1.22  30-Aug-2001  itojun use strlcpy. from openbsd
 1.21  30-Aug-2001  itojun security fix from openbsd:

Fix buffer oflow reading from queue file. While we are at it, crank
the size of buffers that can hold filenames to MAXPATHLEN.
 1.20  25-Jun-2001  mrg use DEFLP instead of "lp".
 1.19  05-Jan-2001  lukem use %ll_ instead of the less standard %q_
 1.18  11-Oct-2000  is More format string cleanups by sommerfeld.
 1.17  07-Dec-1999  mrg branches: 1.17.4;
- 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.
 1.16  26-Sep-1999  mrg delint and other cleanups.
 1.15  14-Sep-1998  frueauf branches: 1.15.2; 1.15.4;
Fix pr 5071 better after feedback from the Originator Havard Eidnes.
 1.14  14-Sep-1998  frueauf Add (ugly?) code to prevent core dump as described in pr 5071 by Havard Eidnes.

XXX Maybe someone with more taste and understanding should have a look
XXX at this? At least I prefer this over the solution provided in the pr.
 1.13  05-Oct-1997  mrg fix alpha compile warnings.
 1.12  05-Oct-1997  mrg - WARNS?=1
- be safe with unlinking files (from freebsd)
- remove register
- clean up $NetBSD$'s.
- use inet_ntoa() in one place (from openbsd)
- nul terminate after a bunch of strncpy()'s
- #ifdef __STDC__ rather than #if (from freebsd)
- be safe with a bunch of string operations (from freebsd)
- use warn()/err() over home grown versions (some from freebsd)
- rename warn() to nodaemon() to remove conflict with above
- check errno from failed kill(2) against ESRCH (from freebsd)
- use getopt() rather than home grown versions (from freebsd)
- clean up a bunch of man pages (some from freebsd)
- check for hostname spoof (from freebsd)
- use POSIX wait() interfaces
- use sysconf(_SC_OPEN_MAX) in preference to NOFILE (from freebsd)
- deal with fork() failure
- index/rindex -> strchr/strrchr (some from freebsd)
- add B57600 and B115200 speeds (from freebsd)
- some KNF
- be safe with files passed in over the network (some from freebsd)
- check return value of malloc(), calloc() and strdup()
 1.11  05-Oct-1997  mrg merge 4.4 lite2
 1.10  10-Jul-1997  mikel make explicit comparisons to NULL (gcc -Wall)
 1.9  19-Apr-1997  thorpej getc() returns an int, not a char.
 1.8  09-Dec-1996  mrg remove unsafe calls to strcpy(), strcat(), and sprintf(). some KNF.
 1.7  28-Nov-1995  jtc branches: 1.7.4;
merge in changes from 1.1 release branch
 1.6  15-Nov-1995  pk Fix garbled lines (from Thomas Eberhardt; PR#1756).
Add RCSId.
 1.5  03-Oct-1995  hpeyerl branches: 1.5.2;
-- convert sgtty to termios. From: Scott Bartram <scottb@iis.net>
-- Use seteuid() to only give lpr, lprm, lpq and lpc root when they
need it from matthew green <mrg@mame.mu.oz.au>
 1.4  18-May-1994  cgd clean up that import. no rcsids yet.
 1.3  27-Mar-1994  cgd off_t exp.
 1.2  01-Aug-1993  mycroft Add RCS identifiers.
 1.1  21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.3  05-Oct-1997  mrg lite-2
 1.1.1.2  18-May-1994  cgd lpr from 4.4-Lite
 1.1.1.1  21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.5.2.1  19-Nov-1995  pk Update from trunk: fix garbled lines.
 1.7.4.1  26-Jan-1997  rat Update from trunk. Fixes security bugs.
 1.15.4.1  27-Dec-1999  wrstuden Pull up to last week's -current.
 1.15.2.1  19-Oct-2000  he Pull up revision 1.18 (requested by he):
Format string cleanup.
 1.17.4.2  30-Sep-2001  he Pull up revision 1.21 (requested by itojun):
Fix buffer overflow reading from queue file. Also increase the
size of buffers for file names.
 1.17.4.1  17-Oct-2000  tv Pullup usr.sbin string format fixes [is].
See "cvs log" for explicit revision numbers per file, from sommerfeld.

RSS XML Feed