History log of /openbsd-current/usr.sbin/lpr/lpc/cmds.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.28 26-Apr-2018 guenther

Use <fcntl.h> instead of <sys/file.h> for open() and friends.
Delete a bunch of unnecessary #includes and sort to match style(9)
while doing the above cleanup.

ok deraadt@ krw@


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.27 16-Jan-2015 deraadt

Replace <sys/param.h> with <limits.h> and other less dirty headers where
possible. Annotate <sys/param.h> lines with their current reasons. Switch
to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change
MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where
sensible to avoid pulling in the pollution. These are the files confirmed
through binary verification.
ok guenther, millert, doug (helped with the verification protocol)


Revision tags: OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.26 29-Dec-2013 krw

Fix fd leaks when fd < 0 or flock() fails. Original diff from
NetBSD via Loganaden Velvindron out of cppcheck.


# 1.25 24-Nov-2013 deraadt

more ctype cleanups
checked by jca


Revision tags: OPENBSD_5_3_BASE OPENBSD_5_4_BASE
# 1.24 29-Nov-2012 guenther

Change scandir()'s 'select' argument from
int (*)(struct dirent *)
to
int (*)(const struct dirent *)
to match POSIX.

ok millert@, ports check by naddy@


Revision tags: OPENBSD_5_2_BASE
# 1.23 22-Mar-2012 guenther

Update alphasort() and scandir()'s argument types to match POSIX:
use "const struct dirent **" instead of "const void *". Also, add
__restrict to readdir_r().

ok matthew@


# 1.22 04-Mar-2012 fgsch

In preparation for getline and getdelim additions to libc, rename getline()
occurrences to get_line().
Based on a diff from Jan Klemkow <j-dot-klemkow-at-wemelug-dot-de> to tech.


Revision tags: OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE
# 1.21 29-Oct-2009 sobrado

it is possible specifying more than one printer concurrently; use
.Op macros for options instead of hardcoding brackets; remove a few
superfluous .Ar macros before ellipsis; "usage:" is lower case;
while here, apply some spacing tweaks.

tweaked by jmc@ for a synopsis with too many arguments.

ok jmc@


# 1.20 27-Oct-2009 deraadt

rcsid[] and sccsid[] and copyright[] are essentially unmaintained (and
unmaintainable). these days, people use source. these id's do not provide
any benefit, and do hurt the small install media
(the 33,000 line diff is essentially mechanical)
ok with the idea millert, ok dms


Revision tags: OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.19 07-Apr-2007 stevesk

KNF, spaces; ok millert@


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE
# 1.18 02-Jun-2003 millert

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999. Proofed by myself and Theo.


Revision tags: OPENBSD_3_2_BASE OPENBSD_3_3_BASE
# 1.17 08-Jun-2002 millert

Remove setuid root from lp*. lpr needs to be setuid daemon so the
files it creates are not owned by the user spooling them but the
others (lpc, lpq, lprm) can get away with setgid daemon. lpd runs
as user daemon for most things, only changing its uid to 0 for
things that must be done as root.

For the time being, don't require connections to come from a reserved
port since lpq/lpr/lprm can't acquire that w/o setuid root. In the
near future we will have a mechanism for select non-root processes
to grab reserved ports.

The upshot of this is that spool directories must be writable by
group daemon and the files within the spool dirs must be owned by
daemon.


# 1.16 20-May-2002 millert

Pull in useful bits from NetBSD and make our lp* easier to diff and
do some minor cleanup of my own:

o IPv6 support
o ANSI function headers
o use getopt()
o synce usage() with man pages
o passes -Wall on both 32bit and 64bit platforms
o add an option to set the max number of children lpd will fork off
o add an lpd option to bind to specific addresses instead of INADDR_ANY.
o allow user to specify how long to wait for a connection to remote servers
o more strlcpy() and snprintf() usage
o Use FOO_FILENO constants instead of hard-coding 0-2
o Add some keeps to man the page SYNOPSIS to avoid options being split


Revision tags: OPENBSD_3_1_BASE
# 1.15 16-Feb-2002 millert

Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.


Revision tags: OPENBSD_3_0_BASE
# 1.14 30-Aug-2001 millert

o kill register
o add const to rcsid and copyright strings
o placate -Wall


# 1.13 25-Jun-2001 pjanzen

Fix a bunch of one-byte possible overflows


# 1.12 25-Jun-2001 pjanzen

A little more careful with buffers, only relevant if /etc/printcap was set
up insanely wrong.


# 1.11 22-Jun-2001 lebel

use strlcpy vs strncpy+a[len-1]='\0'


Revision tags: OPENBSD_2_9_BASE
# 1.10 21-Nov-2000 deraadt

sigjmp & statics begone


Revision tags: OPENBSD_2_2_BASE OPENBSD_2_3_BASE OPENBSD_2_4_BASE OPENBSD_2_5_BASE OPENBSD_2_6_BASE OPENBSD_2_7_BASE OPENBSD_2_8_BASE
# 1.9 25-Jul-1997 grr

restore traditional "all" keyword option - see lpc(8)


Revision tags: OPENBSD_2_1_BASE
# 1.8 17-Jan-1997 millert

Add OpenBSD tags (was in wrong dir for previous commit)


# 1.7 17-Jan-1997 millert

possible oflow


# 1.6 03-Nov-1996 millert

Improve portability by using ANSI/POSIX interfaces when possible.


# 1.5 31-Oct-1996 millert

buf oflows pendantry


Revision tags: OPENBSD_2_0_BASE
# 1.4 29-Aug-1996 deraadt

hate warnings, kill warnings


# 1.3 04-Jul-1996 tholo

Integrated 4.4Lite2 source
Fixed potential problem pointed out by bitblt


# 1.2 15-Jan-1996 deraadt

from netbsd; More descriptive message for printer status. Addresses PR #509


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision


Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.27 16-Jan-2015 deraadt

Replace <sys/param.h> with <limits.h> and other less dirty headers where
possible. Annotate <sys/param.h> lines with their current reasons. Switch
to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change
MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where
sensible to avoid pulling in the pollution. These are the files confirmed
through binary verification.
ok guenther, millert, doug (helped with the verification protocol)


Revision tags: OPENBSD_5_5_BASE OPENBSD_5_6_BASE
# 1.26 29-Dec-2013 krw

Fix fd leaks when fd < 0 or flock() fails. Original diff from
NetBSD via Loganaden Velvindron out of cppcheck.


# 1.25 24-Nov-2013 deraadt

more ctype cleanups
checked by jca


Revision tags: OPENBSD_5_3_BASE OPENBSD_5_4_BASE
# 1.24 29-Nov-2012 guenther

Change scandir()'s 'select' argument from
int (*)(struct dirent *)
to
int (*)(const struct dirent *)
to match POSIX.

ok millert@, ports check by naddy@


Revision tags: OPENBSD_5_2_BASE
# 1.23 22-Mar-2012 guenther

Update alphasort() and scandir()'s argument types to match POSIX:
use "const struct dirent **" instead of "const void *". Also, add
__restrict to readdir_r().

ok matthew@


# 1.22 04-Mar-2012 fgsch

In preparation for getline and getdelim additions to libc, rename getline()
occurrences to get_line().
Based on a diff from Jan Klemkow <j-dot-klemkow-at-wemelug-dot-de> to tech.


Revision tags: OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE
# 1.21 29-Oct-2009 sobrado

it is possible specifying more than one printer concurrently; use
.Op macros for options instead of hardcoding brackets; remove a few
superfluous .Ar macros before ellipsis; "usage:" is lower case;
while here, apply some spacing tweaks.

tweaked by jmc@ for a synopsis with too many arguments.

ok jmc@


# 1.20 27-Oct-2009 deraadt

rcsid[] and sccsid[] and copyright[] are essentially unmaintained (and
unmaintainable). these days, people use source. these id's do not provide
any benefit, and do hurt the small install media
(the 33,000 line diff is essentially mechanical)
ok with the idea millert, ok dms


Revision tags: OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE
# 1.19 07-Apr-2007 stevesk

KNF, spaces; ok millert@


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE
# 1.18 02-Jun-2003 millert

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999. Proofed by myself and Theo.


Revision tags: OPENBSD_3_2_BASE OPENBSD_3_3_BASE
# 1.17 08-Jun-2002 millert

Remove setuid root from lp*. lpr needs to be setuid daemon so the
files it creates are not owned by the user spooling them but the
others (lpc, lpq, lprm) can get away with setgid daemon. lpd runs
as user daemon for most things, only changing its uid to 0 for
things that must be done as root.

For the time being, don't require connections to come from a reserved
port since lpq/lpr/lprm can't acquire that w/o setuid root. In the
near future we will have a mechanism for select non-root processes
to grab reserved ports.

The upshot of this is that spool directories must be writable by
group daemon and the files within the spool dirs must be owned by
daemon.


# 1.16 20-May-2002 millert

Pull in useful bits from NetBSD and make our lp* easier to diff and
do some minor cleanup of my own:

o IPv6 support
o ANSI function headers
o use getopt()
o synce usage() with man pages
o passes -Wall on both 32bit and 64bit platforms
o add an option to set the max number of children lpd will fork off
o add an lpd option to bind to specific addresses instead of INADDR_ANY.
o allow user to specify how long to wait for a connection to remote servers
o more strlcpy() and snprintf() usage
o Use FOO_FILENO constants instead of hard-coding 0-2
o Add some keeps to man the page SYNOPSIS to avoid options being split


Revision tags: OPENBSD_3_1_BASE
# 1.15 16-Feb-2002 millert

Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.


Revision tags: OPENBSD_3_0_BASE
# 1.14 30-Aug-2001 millert

o kill register
o add const to rcsid and copyright strings
o placate -Wall


# 1.13 25-Jun-2001 pjanzen

Fix a bunch of one-byte possible overflows


# 1.12 25-Jun-2001 pjanzen

A little more careful with buffers, only relevant if /etc/printcap was set
up insanely wrong.


# 1.11 22-Jun-2001 lebel

use strlcpy vs strncpy+a[len-1]='\0'


Revision tags: OPENBSD_2_9_BASE
# 1.10 21-Nov-2000 deraadt

sigjmp & statics begone


Revision tags: OPENBSD_2_2_BASE OPENBSD_2_3_BASE OPENBSD_2_4_BASE OPENBSD_2_5_BASE OPENBSD_2_6_BASE OPENBSD_2_7_BASE OPENBSD_2_8_BASE
# 1.9 25-Jul-1997 grr

restore traditional "all" keyword option - see lpc(8)


Revision tags: OPENBSD_2_1_BASE
# 1.8 17-Jan-1997 millert

Add OpenBSD tags (was in wrong dir for previous commit)


# 1.7 17-Jan-1997 millert

possible oflow


# 1.6 03-Nov-1996 millert

Improve portability by using ANSI/POSIX interfaces when possible.


# 1.5 31-Oct-1996 millert

buf oflows pendantry


Revision tags: OPENBSD_2_0_BASE
# 1.4 29-Aug-1996 deraadt

hate warnings, kill warnings


# 1.3 04-Jul-1996 tholo

Integrated 4.4Lite2 source
Fixed potential problem pointed out by bitblt


# 1.2 15-Jan-1996 deraadt

from netbsd; More descriptive message for printer status. Addresses PR #509


# 1.1 18-Oct-1995 deraadt

branches: 1.1.1;
Initial revision