History log of /freebsd-10-stable/usr.sbin/lpr/lpr/
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
321275 20-Jul-2017 ngie

MFC r314475:

Simplify idioms in usr.sbin/lpr Makefiles

Use :H instead of .CURDIR-relative pathing to simplify make output, etc.

256281 10-Oct-2013 gjb

Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


241852 22-Oct-2012 eadler

Check the return error of set[ug]id. While this can never fail in the
current version of FreeBSD, this isn't guarenteed by the API. Custom
security modules, or future implementations of the setuid and setgid
may fail.

PR: bin/172289
PR: bin/172290
PR: bin/172291
Submittud by: Erik Cederstrand <erik@cederstrand.dk>
Discussed by: freebsd-security
Approved by: cperciva
MFC after: 1 week


241015 27-Sep-2012 mdf

Fix usr.bin/ and usr.sbin/ build with a 64-bit ino_t.

Original code by: Gleb Kurtsou


236289 30-May-2012 eadler

Relax security permissions on '.seq' file creation - the strict,
but odd permissions resulted in a security alert from 110.neggrpperm

PR: kern/165533
Submitted by: Anton Shterenlikht <mexas@bristol.ac.uk>
Submitted by: J B <jb.1234abcd@gmail.com>
Approved by: cperciva
MFC after: 1 week


233510 26-Mar-2012 joel

mdoc: terminate quoted strings.

Reviewed by: brueffer


216372 11-Dec-2010 joel

Remove the advertising clause from UCB copyrighted files in usr.sbin. This
is in accordance with the information provided at
ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change


214124 21-Oct-2010 edwin

Fix printing of files located on ZFS filesystem with an st_dev or
st_ino larger than 2**31.

From the PR:

Printing from a ZFS filesystem using 'lp' fails and returns an
email reporting "Your printer job was not printed because it was
not linked to the original file".

In order to protect against files being switched when files
are printed using 'lp' or 'lpr -s', the st_dev and st_ino
values for the original file are saved by lpr and verified
by lpd before the file is printed. Unfortunately, lpr prints
both values using '%d' (although both fields are unsigned)
and lpd(8) assumes a string of decimal digits.

ZFS (at least) generates st_dev values greater than 2^31-1,
resulting in negative values being printed - which lpd cannot
parse, leading it to report that the file has been switched.

A similar problem would occur with large inode numbers.

How-To-Repeat:

Find a file with either st_dev or st_ino greater than 2^31-1
(stat(1) will report both numbers) and print it with 'lpq -s'.
This should generate an email reporting that the file could
not be printed because it was not linked to the original file

PR: bin/151567
Submitted by: Peter Jeremy <Peter.Jeremy@alcatel-lucent.com>
MFC after: 1 week


210933 06-Aug-2010 joel

Fix typos and spelling mistakes.


201390 02-Jan-2010 ed

The last big commit: let usr.sbin/ use WARNS=6 by default.


140442 18-Jan-2005 ru

Sort sections.


131531 03-Jul-2004 ru

Eliminated double whitespace.


131500 02-Jul-2004 ru

Mechanically kill hard sentence breaks.


130132 05-Jun-2004 ru

Removed redundant mdoc(7) macro calls.


126018 19-Feb-2004 kientzle

Clarify the "lp" description to mention port@host syntax.

Suggested by: NetBSD man page


117681 17-Jul-2003 brueffer

Fix a grammar bogon and a typo

Submitted by: Warren Block <wblock@wonkity.com>
MFC after: 3 days


117621 15-Jul-2003 gad

More changes to use __FBSDID() for setting rcsids, and fix the
format of 'sccsid' lines so they consistently match style(9)
Also the 'sccsid' line is formatted to match style(9), and
a 'From:' is removed so the sccsid returns to what it was back
in the days of '-r CSRG' (1996).

Reviewed by: discussed with bde and obrien
MFC after: 15 days


112701 27-Mar-2003 eivind

Change DEFMX to 0. This removes the size limit for print jobs by default.

Discussed with: gad (now), arch (a year ago)


98702 23-Jun-2002 gad

Stop adding ${CWARNFLAGS} to CFLAGS. The standard makefile processing will
add them automatically, and there is no point in adding them twice.

MFC after: 5 days


97561 30-May-2002 ru

mdoc(7) police: markup nits.


95434 25-Apr-2002 gad

Include <netinet/in.h> to squash one more compile-time warning.

MFC after: 3 days


95293 23-Apr-2002 gad

Implement new printcap option of "rc" aka "remote.resend_copies".
This is a boolean option, and if it is specified in a print queue
for a remote host, it causes lpd to resend the data file for each
copy the user requested on 'lpr -#n'. This is useful for network
printers which accept lpd-style jobs, but which ignore the control
file (and thus they ignore any request for multiple copies).

PR: 25635
Reviewed by: short review on freebsd-audit
MFC after: 6 days


95236 22-Apr-2002 gad

Underline the default value for rp=, the same way all the other string-type
default values are underlined (instead of using fake double-quotes).

MFC after: 4 days


95235 22-Apr-2002 gad

Add description of `mc' (max copies), add short-form to long-form mapping
for `tf' (troff filter), and add a cross-reference to chkprintcap in some
lpr-related man pages.

Submitted by: dwmalone
MFC after: 4 days


95127 20-Apr-2002 charnier

Use `The .Nm utility'


84697 09-Oct-2001 gad

Fix one more compile-time warning by renaming a local variable.

MFC after: 4 days


84696 09-Oct-2001 gad

Fix a compile-time warning by declaring 'len' as size_t instead of int.

MFC after: 4 days


84695 09-Oct-2001 gad

Rename the local variable 'person' to 'lpr_username', to avoid compile-time
warnings about conflict with a global variable used by 'lprm'.

MFC after: 4 days


83391 13-Sep-2001 ru

Set BINOWN=root explicitly for setuid root binaries.

This is not "useless", as one may have non-default
setting for BINOWN in make.conf, and we still want
these to be installed setuid root in this case.


80029 20-Jul-2001 obrien

Perform a major cleanup of the usr.sbin Makefiles.
These are not perfectly in agreement with each other style-wise, but they
are orders of orders of magnitude more consistent style-wise than before.


79755 15-Jul-2001 dd

Remove whitespace at EOL.


79743 15-Jul-2001 gad

Replace a call to 'alloca', thus avoiding an error when compiling on
freebsd/alpha with -ansi (and on some non-fbsd platforms). This change
can only affect the access checking of 'lpr -r'.

MFC after: 1 week


79537 10-Jul-2001 ru

mdoc(7) police: removed HISTORY info from the .Os call.


78300 15-Jun-2001 gad

Rename a few global variables which hold hostname-related values to be
more sensible/understandable. 'from'->'from_host' 'host'->'local_host'
'fromb'->'frombuf' 'fromhost'->'origin_host' and a local-variable
named 'host'->'hostbuf'. This fixes some compile-time warnings about
local variables shadowing global variables.

Other than renaming variables, the only actual code changes are to call
strlcpy() instead of strncpy() when setting those (renamed) variables,
and that 'from_ip' is now a strdup()-created buffer instead of being a
static buffer compiled in as 1025 bytes.

Reviewed by: freebsd-print@bostonradio.org (an earlier version)
MFC after: 1 week


78280 15-Jun-2001 gad

Rename global variable 'name' to 'progname', thus fixing a number of
warnings which come up for various routines that have a parameter which
is also called 'name'.

Reviewed by: freebsd-print@bostonradio.org
MFC after: 1 week


78146 12-Jun-2001 gad

Fix about 90-100 warnings one gets when trying to compile lpr&friends
with BDECFLAGS on, mainly by adding 'const' to parameters in a number
of routine declarations. While I'm at it, ANSI-fy all of the routine
declarations. The resulting object code is exactly the same after
this update as before it, with the exception of one unavoidable
change to lpd.o on freebsd/alpha.

Also added $FreeBSD$ line to lpc/extern.h lpc/lpc.h lptest/lptest.c

Reviewed by: /sbin/md5, and no feedback from freebsd-audit


77761 05-Jun-2001 sobomax

Correct cross-references:
setsockopt.3 --> setsockopt.2
syslog.8 --> syslogd.8
tcpdump.8 --> tcpdump.1

MFC after: 1 week


74816 26-Mar-2001 ru

- Backout botched attempt to introduce MANSECT feature.
- MAN[1-9] -> MAN.


72126 07-Feb-2001 ru

mdoc(7) police: Change -filled displays (which just happen
to be the same as -ragged in the current implementation) to
-ragged. With mdocNG, -filled displays produce the correct
output, formatted and justified to both margins.


71898 01-Feb-2001 ru

mdoc(7) police: split punctuation characters + misc fixes.


71102 16-Jan-2001 ru

Prepare for mdoc(7)NG.


70403 27-Dec-2000 ru

Prepare for mdoc(7)NG.


68965 20-Nov-2000 ru

mdoc(7) police: use the new features of the Nm macro.


68275 03-Nov-2000 gad

This update gets it so 'lpr -r' ("remove the file after printing") will
try to move the file from the source to the destination (spool) directory.
If that succeeds, much time and disk-space will be saved by doing that
instead of copying the entire file only to remove the original. This
could be a big win on machines doing samba-service or CAP-based printing.

Note that this is about the fourth or fifth iteration of the patch, after
trying to address all possible security implications of the change.

PR: 16124
Reviewed by: freebsd-current or freebsd-hackers (some time ago)


68253 02-Nov-2000 gad

Implement new printcap options of sr= (aka stat.recv) and sr= (aka stat.send)
in lpd. Stat.recv is useful on a printserver, as something of a network
performance-monitoring tool. Stat.send is a minimal accounting record of
sorts for jobs going to tcp/ip based printers.

Reviewed by: freebsd-print@bostonradio.org


68149 01-Nov-2000 gad

Change 'lpr' so -C (class) information is included in the control file
even for jobs or queues which will not print header (separator) pages.

Submitted by: "Steve O'Hara-Smith" <steveo@eircom.net>


62177 27-Jun-2000 wollman

Fix description of `-i' and `-w' options.
Fix spelling of `TeX'.
Move historical formats into a separate list, to make thier cruftiness
clear.


61948 22-Jun-2000 sheldonh

Allow Nm to expand gracefully instead of hard-coding an argument.


61913 21-Jun-2000 wollman

Allow those of us who have to print through LPRng spoolers to send
spooler options using `Z' control-file lines and the `-Z' flag.


57673 01-Mar-2000 sheldonh

Remove single-space hard sentence breaks. These degrade the quality
of the typeset output, tend to make diffs harder to read and provide
bad examples for new-comers to mdoc.


56287 19-Jan-2000 joe

It's not been possible to configure a print server running lpd,
with remote hosts feeding it, so that some hosts have their header
pages supressed and some don't. This is because lpd doesn't know
how to rewrite a print job before forwarding it to a remote lpd.
In particular this causes problems with p rinters that contain
their own lpd, eg. HP jet direct cards, because they can't suppress
headers. It's not possible to have headers supressed by putting
'sh' in any printcap in the lpd chain, it is up to the originating
lpr to have a '-h' option specified at run time.

Lpr has been modified to allow _it_ to honour the 'sh' flag in the
local print cap. This allows the administrator to switch off
headers for a particular printer (on a particular host) irrespective
of whether that printer is local to the machine or remote.

This doesn't break anything, because in the case of a remote printer
the 'sh' flag would have had no meaning, in the case of the local
printer it would have been on anyway.

Submitted by: Scott James Remnant <scott@pavilion.net>


53956 30-Nov-1999 ache

Add support for pr's locale


50479 28-Aug-1999 peter

$Id$ -> $FreeBSD$


43519 02-Feb-1999 wollman

Sigh. Fix capitalization bogon. Who had the pointy hat?


43507 01-Feb-1999 wollman

Observe -U flag again, and use it in preference to getlogin(), if
the user is privileged.

I believe this should address both concerns in PR 9729, and may also
provide the desired behavior from PR 9485.


42340 06-Jan-1999 imp

Change my mind on using base '0' for strtol for -i and -# operations
as this would change the meaning of -#050 in preexisting scripts.


42339 06-Jan-1999 imp

Add sanity checking to argument for -# and -i. Require these
arguments to be numbers. Also use '0' base to allow hex, octal or
decimal numbers.

This was done by me based on ideas in pr 3556, submitted by Uwe
Laubenstein and commented upon by j@uriah.heep.sax.de (J Wunsch).

PR: 3556


39496 19-Sep-1998 obrien

Remove useless `BINOWN=root' now that it is the default.


39084 11-Sep-1998 wollman

Fix additional warnings. Remove -Werror, since some people have complained
about it.

PR: 7886
Submitted by: Stefan Eggers <seggers@semyam.dinoco.de> (partially)


38470 21-Aug-1998 brian

Fix ``lp=port@machine'' syntax and mention it in printcap(5).


36853 10-Jun-1998 phk

Spelling fixes.

PR: 6903
Reviewed by: phk
Submitted by: Josh Gilliam <josh@quick.net>


35251 17-Apr-1998 obrien

Make ``-h'' follow the manpage, and suppress the burst page reguardless of
the number of ``-h'' given.


34160 07-Mar-1998 bde

Use `foo/bar.a' instead of `-Lfoo -lbar' for linking to static internal
libraries so that `ld -f' in can create correct dependencies for
yet-to-be-built libraries.

Get the default BINDIR correctly (by including ../Makefile.inc recursively.
Override the default it it is wrong.

Don't override defaults when the defaults are correct.


33098 04-Feb-1998 wollman

Install printcap.5 from here.


31780 16-Dec-1997 bde

Fixed DPADD.


31583 06-Dec-1997 jdp

Fix incorrect format string in call to errx().


31500 02-Dec-1997 wollman

Document the new long names for printcap capabilities.


31492 02-Dec-1997 wollman

Mega lpd/lpd upgrade, part I:

- Get rid of a lot of the static variables which were shared by
many routines and programs in the suite.
- Create an abstract interface to the printcap database, so that
other retrieval and iteration mechanisms could be developed
(e.g., YP, Hesiod, or automatic retrieval from a trusted server).
- Give each capability a human-readable name in addition to the historic
two-character one.
- Otherwise generally clean up a lot of dark corners. Many still remain.
- When submitting jobs, use the official login name record (from getlogin())
if there is one, rather than reverse-mapping the uid.

More to come...


30407 14-Oct-1997 joerg

Improve my hack from rev 1.6 of displayq.c, and make the TCP
connection timeout controllable by a new printcap(5) capability named
`ct' (connectiom timeout), defaulting to 120 seconds (which is the
default TCP connection timeout).

Would anybody see a problem with merging all this into RELENG_2_2?


29780 24-Sep-1997 charnier

Use err(3). Add usage(). Various fixes in man pages.


27757 29-Jul-1997 imp

Two minor, pedantic fixes from bde for my last pedantic fixes, plus
the following from recent OpenBSD changes. These changes (and all
I've made) should be merged back into 2.2 when they are vetted in
-current.

common.c:
OpenBSD 1.7: mickey: #if __STDC__ --> #ifdef __STDC__

displayq.c:
OpenBSD 1.8: deraadt: 1 byte oflows; millert

rmjob.c:
OpenBSD 1.8: deraadt: 1 byte oflows; millert

cmds.c:
OpenBSD 1.9: grr: restore traditional "all" keyword option - see lpc(8)
[[ This makes lpc status all work again -- imp ]]

printjob.c:
OpenBSD 1.17: deraadt: use sendmail -t
OpenBSD 1.16: mickey: #if __STDC__ --> #ifdef __STDC__
OpenBSD 1.15: deraadt: 1 byte oflow; Don.Lewis@tsc.tdk.com

recvjob.c:
OpenBSD 1.11: mickey: #if __STDC__ --> #ifdef __STDC__

lpr.c:
OpenBSD 1.19: mickey: #if __STDC__ --> #ifdef __STDC__

Obtained from: OpenBSD


27748 29-Jul-1997 imp

Fix boatloads of buffer overflows from the OpenBSD tree.
Be pedantic about always using sizeof(blah) vs sizeof (blah) or sizeof blah.
Obtained from:OpenBSD


27635 23-Jul-1997 imp

index -> strchr and rindex -> strrchr to reduce the number of gratuitous
diffes with NetBSD/OpenBSD. These changes seem to predate the NetBSD/OpenBSD
split, so it is hard to give proper credit for them.
Obtained from: OpenBSD.


27618 23-Jul-1997 imp

Use setuid/seteuid around dangerous operations. Also a few buffer
overflow patches that were "near" to where these operations are taking
place. The buffer overflows are from OpenBSD. The setuid/seteuid patches
are from NetBSD by way of OpenBSD (they changed them a little), at least from
my read of the tree.

This is the first of a series of OpenBSD lpr/et al merges. It (and them)
should be merged back into 2.2 and/or 2.1 (if requested) branches when they
have been shaken out in -current.
Obtained from: OpenBSD


27282 08-Jul-1997 dima

Fixed buffer overflow.

Reviewed by: Warner


25787 13-May-1997 brian

Don't drop into the troff args after parsing -#.

Submitted by: Garance A Drosehn <gad@eclipse.its.rpi.edu>


25589 08-May-1997 joerg

Kill a stale .pq line.


24831 12-Apr-1997 brian

Support input and output filters with remote printing.
Output filters are executed on a per-file basis as it's
necessary to supply the file size to the "other side".


24428 31-Mar-1997 imp

compare return value from getopt against -1 rather than EOF, per the final
posix standard on the topic.


23122 26-Feb-1997 mpp

Fix an off by one error when determing the default job name for
the banner page.

Closes PR# 1986.

Submitted by: Mark Valentine <mark@linus.demon.co.uk>


22997 22-Feb-1997 peter

Revert $FreeBSD$ to $Id$


22986 22-Feb-1997 peter

Revert $FreeBSD$ back to $Id$


21673 14-Jan-1997 jkh

Make the long-awaited change from $Id$ to $FreeBSD$

This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore. This update would have been
insane otherwise.


20914 26-Dec-1996 wosch

Sort cross references.


19675 12-Nov-1996 phk

doc/1987, table heading in error.
Submitted by: Mark Valentine Mark Valentine <mark@linus.demon.co.uk>


19202 27-Oct-1996 imp

lpc/cmds.c:
From NetBSD via OpenBSD to fix NetBSD PR #506
More descriptive message for printer status
(OpenBSD: 1.2)

Various warnings cleaned up (OpenBSD: 1.4)

lpc/lpc.c:
Various warnings cleaned up (OpenBSD: 1.3)

lpd/lpd.c:
Remove trailing blank lines (OpenBSD: 1.2)

Potential umask problem with creating /dev/printer
(OpenBSD: 1.4 and 1.5)

Ftp bounce attack (untested on FreeBSD)
(OpenBSD: 1.6, 1.8, 1.9)
Fencepost in strncpy
(OpenBSD: 1.6)

lpd/printjob.c:
Fix from freebsd for waiting for an exiting filter, that
appears not in the FreeBSD CVS tree.
(OpenBSD: 1.6)

lpd/recvjob.c:
Buffer overflow protection: use strncpy rather than strcpy.
(OpenBSD: 1.3)

lpr/lpr.c:
NetBSD change of return type for main()
(OpenBSD: 1.2)

Restrict time running as root
(OpenBSD: 1.7)

Use getcwd rather than getwd (from NetBSD)

Use snprintf rather than sprintf
(OpenBSD: 1.8)

Minor tweak to end of loop and buffer overflow sanity. card()
overflow already in FreeBSD
(OpenBSD: 1.9)

lptest/lptest.c:
void -> int return type of main, from NetBSD via OpenBSD
(OpenBSD: 1.2)

pac/pac.c:
void -> int return type of main, from NetBSD via OpenBSD
(OpenBSD: 1.3)

Obtained from: OpenBSD


19187 26-Oct-1996 imp

Fix transcription error I introduced in last patch. This created a
fencepost error that would run one off the end of the buffer.

Noticed by: Bruce Evans


19184 25-Oct-1996 imp

Fix a problem where the command line could be used to overflow a stack
buffer which could be made to lead to a root shell. This patch is
OpenBSD's solution to the problem, and will silently truncate the
output rather than overflow the buffer.

Obtained from: OpenBSD


17293 27-Jul-1996 alex

"appeared in 4.2BSD.." changed to "appeared in 4.2BSD."


16062 01-Jun-1996 wosch

People ask in Usenet, how to configure remoteprinting successfully
having a hosts.lpd(5) manpage and some references to it from
within lpd(8) might help here. Close PR docs/1277

Submitted by: andreas@knobel.gun.de (Andreas Klemm)


15733 11-May-1996 joerg

Convert the option parser to use getopt(3). This makes it more
orthogonal with the rest of the system (you can now use either -PPS or
-P PS), and makes the parser more intelligible. The only drawback is
that the old semantics for the -i flag in case a non-numeric argument
is following are no longer fully supported (only if -i is the very
last arg at all), since getopt(3) doesn't support the discticnction
between numeric and non-numeric arguments.

Make lpr also understand dashes as input pseudo filenames. This
finally makes lp(1) fully comply with Posix.2.


15703 09-May-1996 joerg

Cleanup.

The removed files are no longer needed, they are actually labelled as
``Use only if you are not 4.4BSD''. (Yeah, the ol' crufty printcap.c
is really gone!)

Properly declare all external objects in files ending in .h, as
opposed to embed them into files ending in .c.


15648 05-May-1996 joerg

Pull a bunch of fixes from the 4.4BSD-Lite2 branch. It's really
surprising how many trivial errors there have been... :-)

Some more cleanup is needed, but i'd like to separate the Lite2 changes
from other work, that's why this goes into a different commit.

People with serial printers should see whether i have broken the stty-
style printcap options (i hope not).

Inspired by: Sergey Shkonda <serg@bcs1.bcs.zaporizhzhe.ua>


15135 08-Apr-1996 mpp

Correct some man page xrefs, and some other minor changes to bring some
man pages up to mdoc guidelines and fix some minor formatting glitches.
Also fixed a number of man pages to not abuse the .Xr macro to
display functions and path names and a lot of other junk.


15073 06-Apr-1996 mpp

Correct some cross references and some path names.


15030 03-Apr-1996 sef

printcap.5: Remove fs,fc,xs,xc capability, and replace them with the ms
capability

Reviewed by: rgrimes, joerg


11235 05-Oct-1995 jkh

Fix a longstanding bug in `lpr -r'. I used alloca() instead of
malloc(), but the change is fundamentally Chris's.
Submitted by: Chris Stenton <jacs@gnome.co.uk>


9568 17-Jul-1995 torstenb

lpr uses access(2) to determine if the parent directory of the file
is writeable (by the real uid). if it is, lpr assumes that the file
can be unlinked. lpr does not check for directories with S_ISVTX set

Reviewed by: dima


8857 30-May-1995 rgrimes

Remove trailing whitespace.


5031 11-Dec-1994 ats

Fixed a typo: /usr/sbin/lpd* to /usr/sbin/lpd as the name of the daemon.


1863 05-Aug-1994 wollman

Get rid of update. Make man page installation work with our scheme
(and rename a few in the process).


1638 30-May-1994 rgrimes

BSD 4.4 Lite Share Sources


1554 26-May-1994 rgrimes

This commit was generated by cvs2svn to compensate for changes in r1553,
which included commits to RCS files with non-trunk default branches.