History log of /freebsd-10.1-release/usr.sbin/lpr/lpc/
Revision Date Author Comments
272461 03-Oct-2014 gjb

Copy stable/10@r272459 to releng/10.1 as part of
the 10.1-RELEASE process.

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


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


234826 30-Apr-2012 gad

Print out a warning message if a `lpc setstatus' is done when
the queue is not 'lpc stop'-ed. In that situation `lpq' will
not display the status message to the user, and the operator
may think the queue is already stopped when it is not.

MFC after: 3 weeks


234824 30-Apr-2012 gad

Catch the user-error when no queue name was specified on an
lpc-command which supports '-msg' (e.g.: setstatus). Print
out a helpful error message instead hitting a seg-fault.

MFC after: 3 weeks


234244 13-Apr-2012 delphij

The scandir(3) function expects fourth parameter, compar, be in type of:

int (*compar)(const struct dirent **, const struct dirent **)

The current code defines sortq() to accept two void *, then cast them
to const struct dirent **. Because the code does not really need this
cast, we can eliminate the casts by changing the function prototype
to match scandir(3) expectation.

MFC after: 1 month


231723 15-Feb-2012 kevlo

- Remove some unnecessary cast when assigning NULL to a handle.
- Silent a warning


230044 13-Jan-2012 kevlo

fgets(3) returns a pointer, so compare against NULL, not integer 0.


228990 30-Dec-2011 uqs

Spelling fixes for usr.sbin/


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


201390 02-Jan-2010 ed

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


194494 19-Jun-2009 brooks

In preparation for raising NGROUPS and NGROUPS_MAX, change base
system callers of getgroups(), getgrouplist(), and setgroups() to
allocate buffers dynamically. Specifically, allocate a buffer of size
sysconf(_SC_NGROUPS_MAX)+1 (+2 in a few cases to allow for overflow).

This (or similar gymnastics) is required for the code to actually follow
the POSIX.1-2008 specification where {NGROUPS_MAX} may differ at runtime
and where getgroups may return {NGROUPS_MAX}+1 results on systems like
FreeBSD which include the primary group.

In id(1), don't pointlessly add the primary group to the list of all
groups, it is always the first result from getgroups(). In principle
the old code was more portable, but this was only done in one of the two
places where getgroups() was called to the overall effect was pointless.

Document the actual POSIX requirements in the getgroups(2) and
setgroups(2) manpages. We do not yet support a dynamic NGROUPS, but we
may in the future.

MFC after: 2 weeks


151476 19-Oct-2005 stefanf

Use the new name H_SETSIZE instead of the old H_EVENT to set the history
size.

PR: 86355
Approved by: gad


142199 22-Feb-2005 delphij

MFS5: Minor style(9) tweak.


141947 15-Feb-2005 delphij

Be more careful when doing el_parse() - only do it when el is
properly initialized, that happens when lpc is called from a tty.
Without this change, it's possible to get SIGSEGV simply doing:
echo "..:" | lpc

Reported by: Wojciech A. Koszek <dunstan at freebsd czest pl>
PR: 77462 (patch rewritten by myself)
MFC After: 1 week


141846 13-Feb-2005 ru

Expand *n't contractions.


140562 21-Jan-2005 ru

Fixed .Xr call.


140442 18-Jan-2005 ru

Sort sections.


121065 13-Oct-2003 tjr

Fix two buffer overflows caused by off-by-one errors: avoid writing a null
character 1 byte past the end of cmdline[] when libedit is being used for
input, and avoid writing a null pointer 1 element past the end of margv[].

Reviewed by: gad


117599 14-Jul-2003 gad

More changes to use __FBSDID() for setting rcsids, and fix the
format of 'sccsid' lines so they consistently match style(9)
guidelines. Note that this means you will have to add '-a' to
the 'strings' command when searching for rcs ids, eg:
strings -a /usr/sbin/lpc | grep '$FreeBSD'

Reviewed by: discussed on cvs-src & with bde and obrien
MFC after: 15 days


107312 27-Nov-2002 ru

mdoc(7) police: markup fixes.

Approved by: re


100203 17-Jul-2002 gad

Changes which rewrite 'lpc topq', and which add 'lpc bottomq'. These
reflect much valuable feedback from wollman. More details on the new
'lpc topq' are in the log message for revision 1.2 of lpc/movejobs.c.

The previous implementation of 'lpc topq' is available as 'lpc xtopq',
in case there are any problems noticed in the new implementation. If
there are no problems with this version, a later update will remove the
'lpc xtopq' command.

Reviewed by: freebsd-print@bostonradio.org
MFC after: 6 days


99968 14-Jul-2002 charnier

The .Nm utility


99846 12-Jul-2002 gad

Call routine to free everything obtained when filling in 'struct printer'.

MFC after: 3 days


99242 02-Jul-2002 gad

Remove the backup-versions ("x*") of various lpc commands that were
recently rewritten. No one in -current has reported any problems with
the newer versions.

MFC after: 3 weeks


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


98279 16-Jun-2002 gad

Just rename two generic-queue init routines from 'init_*' to '*_gi'
("gi" short for 'generic init'...).

MFC after: 10 days


98278 16-Jun-2002 gad

Add a nearly complete rewrite of the lpc command 'down'. The only user-
visible change should be that more than one queue can now be specified,
if one uses the '-msg' parameter to separate the list of queues from the
status message to set.

The previous implementation of 'down' remains available as the command
'xdown', available for instant fallback if there seems to be anything
wrong with the new one. If no one reports a problem after a few weeks,
then a later update will remove 'xdown'.

Reviewed by: freebsd-print@bostonradio.org
MFC after: 10 days


98274 15-Jun-2002 gad

Make the description of the 'down' command a little more readable.

MFC after: 10 days


98268 15-Jun-2002 gad

Reorganize the way that arguments are processed in lpc's generic-queue
commands, to make things a little cleaner (mainly for a later update).

Reviewed by: freebsd-print@bostonradio.org
MFC after: 10 days


98267 15-Jun-2002 gad

Add a new command to 'lpc' called 'setstatus', which would be used to
change the status message of a print queue. This includes some minor
changes to the upstat() routine, so that error messages are not printed
while seteuid(priv-user).

Reviewed by: freebsd-audit and freebsd-print@bostonradio.org
MFC after: 10 days


98152 13-Jun-2002 gad

Almost complete rewrite of the lpc commands 'abort', 'enable', 'disable',
'restart', 'start', 'stop' and 'up'. These are commands which mainly
just alter the access bits on the lock-file of a queue, and they all
now use a central routine to do that. This reduces the amount of code
that is run as the priv userid, and eliminates a number of cases where
error messages were written while that priv uid was in effect.

As far as users are concerned, there should be no noticable difference
in the new versions. In case there *is*, the previous implementations
are still there as 'xabort', 'xenable', etc, so they are available for
instant fallback. If no one reports a problem after a few weeks, then
a later update will remove those x-commands.

Reviewed by: freebsd-audit and freebsd-print@bostonradio.org
MFC after: 10 days


95291 22-Apr-2002 gad

Add 'const' to some casts to fix two warnings that are printed by the
new gcc (on sparc64).

MFC after: 4 days


95258 22-Apr-2002 des

Usage style sweep: spell "usage" with a small 'u'.
Also change one case of blatant __progname abuse (several more remain)
This commit does not touch anything in src/{contrib,crypto,gnu}/.


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


87034 28-Nov-2001 gad

My recent changes to add the ctl_renametf routine assumed that print job
control-files will always start with 'cfA*'. It turns out that some
implementations of lpd (such as solaris) may send a control file which
starts with 'cfB*', or really 'cf<anyLetter>*'. Although such filenames
are very odd, we did used to accept them. This changes ctl_renametf to
work correctly with them, and fixes up 'lpc clean' to match.

PR: bin/32183
MFC after: 10 days


84691 09-Oct-2001 gad

Fix minor compile-time warning that snunk in with changes to sortq() rtn.

MFC after: 4 days


84261 01-Oct-2001 obrien

*** empty log message ***


84034 27-Sep-2001 gad

Basically rewrite the sortq() routine which is used by 'lpc clean' and
'lpc tclean'. In some obscure cases, the previous version could cause a
valid user job to be removed (by 'clean'), due to invalid assumptions in
the sort routine. This was a rare problem, unless ctlinfo.c is compiled
with 'LEAVE_TMPCF_FILES' turned on (to check what that rtn was doing).

Reviewed by: Lack of outcry on -audit and freebsd-print@bostonradio.org
MFC after: 10 days


83563 17-Sep-2001 gad

Fix so that lpc's interactive-mode will not be confused by EditLine processing
into thinking that there is a print-queue called 'xterm'...

Reviewed by: short discussion on freebsd-stable
MFC after: 1 week


80174 23-Jul-2001 gad

Get rid of a compile-time warning by casting to (size_t).

MFC after: 1 week


80173 23-Jul-2001 gad

Get rid of a compile-time warning by casting to (size_t).

MFC after: 1 week


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.


79742 15-Jul-2001 gad

Get rid of one compile-time warning by changing an 'int' to a 'size_t'.

MFC after: 1 week


79739 15-Jul-2001 gad

Fix most of the warnings generated by compiling lpr with -Wnon-const-format,
often by just telling gcc that some internal routine is "__printflike"
(work done by Kris Kennaway <kris@FreeBSD.org>). Also fix the new warnings
which show up once gcc starts checking the "printf-like parameters" passed
to those routines.

MFC after: 1 week


79296 05-Jul-2001 ru

mdoc(7) police: removed hard sentence breaks, use new .Brq macro.


78750 25-Jun-2001 gad

Make 'lpc clean' somewhat safer. Add an 'lpc tclean' command, which allows
one to see what files would be removed *if* an 'lpc clean' is done. 'tclean'
will remove no files, and is therefore not a privileged command. Also, both
'lpc clean' and 'lpc tclean' will now look for 'core' files in spool directories
(but not remove them). They also print out an extra line of info when a
datafile to be removed is a symlink (from 'lpr -s'), saying what file it is
a symlink to.

The 'lpc clean' commands also now print out a summary line saying how many
queues were checked, how many files were removed (or "would be" removed, for
tclean), and how much disk space is involved. For the benefit of those who
have many print queues, 'lpc clean all' will only print out the names of print
queues where some "interesting" files were found, instead of printing out a
header-line for every queue in your printcap file.

Reviewed by: freebsd-print@bostonradio.org freebsd-audit@FreeBSD.org
MFC after: 2 weeks


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


75495 13-Apr-2001 dd

mdoc(7) police: properly use a -diag list in the DIAGNOSTICS section.

Reviewed by: ru


74816 26-Mar-2001 ru

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


74532 20-Mar-2001 ru

Set the default manual section for usr.sbin/ to 8.


71898 01-Feb-2001 ru

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


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.


68401 06-Nov-2000 gad

Cosmetic change of a structure name.
Turn 'struct queue { q_time, q_name }' (loosely-speaking)
into 'struct jobqueue { job_time, job_cfname }'

Reviewed by: GAWollman


68400 06-Nov-2000 gad

Get rid of a minor compile-time warning.


65035 23-Aug-2000 alfred

the code assumes that getgroups() always returns NGROUPS groups, however
that is not true. Instead of looping NGROUPS times, get the return value
from getgroups() and loop over the return that many times.

Noticed by: David A. Holland <dholland@eecs.harvard.edu>


62294 30-Jun-2000 mph

Quit on EOF from terminal instead of redisplaying the prompt.


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.


56562 24-Jan-2000 dillon

'start' command was not reenabling printing.

PR: bin/15728


50479 28-Aug-1999 peter

$Id$ -> $FreeBSD$


50077 20-Aug-1999 mdodd

Fix some cut and paste damage.

Noticed by: Norman C. Rice <nrice@emu.sourcee.com>


50071 20-Aug-1999 mdodd

What the heck was I thinking? Nobody else saw this? Sheesh.

(num > MAX) ? MAX : num

rather than

(MAX > num) ? MAX : num

Also, make things a little easier to read while I'm here.


50042 19-Aug-1999 mdodd

Use el_source() so we pick up .editrc


50039 19-Aug-1999 mdodd

Add support for command line editing and history.

Remove src/contrib/bind/bin/nslookup/commands.c as it is generated by lex
from commands.l.

Submitted by: lpc/cdcontrol patches originally by msmith.
Reviewed by: msmith (in theory)


48791 12-Jul-1999 nik

Add $Id$, to make it simpler for members of the translation teams to
track.

The Id line is normally at the bottom of the main comment block in the
man page, separated from the rest of the manpage by an empty comment,
like so;

.\" $Id$
.\"

If the immediately preceding comment is a @(#) format ID marker than the
the $Id$ will line up underneath it with no intervening blank lines.
Otherwise, an additional blank line is inserted.

Approved by: bde


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)


34784 22-Mar-1998 jb

Cast an argument to int for a printf field width the way that gcc
prefers it. This source is compiled with -Werror so the slightest
warning is enough to ruin my day.


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.


31780 16-Dec-1997 bde

Fixed DPADD.


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...


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


25789 13-May-1997 brian

Don't output extraneous tab

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


22462 09-Feb-1997 imp

Buffer overflow from OpenBSD:
Rev 1.7 millert:
possible oflow
Obtained from: OpenBSD


21880 20-Jan-1997 wosch

Sort cross references.


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


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>


15638 05-May-1996 joerg

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


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.


8857 30-May-1995 rgrimes

Remove trailing whitespace.


1863 05-Aug-1994 wollman

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


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.