Commit Graph

19 Commits

Author SHA1 Message Date
Joerg Wunsch 36d0e2a3e2 common_source: staticize private version of warn() so to not conflict
with libc's version.

lpd: use getopt(3), err(3), add usage(), allow specification of a port #
on the command line as the documentation suggested for more than 10 years.

PR:		docs/3290
1997-08-23 15:53:00 +00:00
Warner Losh 6ee8b26997 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
1997-07-29 13:24:01 +00:00
Warner Losh 5f87a7b6b1 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
1997-07-29 04:17:19 +00:00
Warner Losh f8eb25da54 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.
1997-07-23 20:53:41 +00:00
Warner Losh 360d4ad5ab 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
1997-07-23 00:49:46 +00:00
Warner Losh eb6c72e98f Add code to make sure that we don't overflow the buffer that we copy
the hostname into.  In theory the bind library should do this, but
in practice the limites between system defines and bind defines make
an attack using this vector possible.  These patches have been in
use on my systems for three months now, so I am fairly confident about
them.  I plan on commiting this to 2.2 and 2.1 in the near future,
as well as many other patches of this nature.
1997-07-18 18:52:53 +00:00
Warner Losh fb9108baa9 Fix a problem where remote files could be removed by exploiting race
conditions similar to those reported in CERT's CA-91:10a advisory.
Obtained from: Hiroshi NAKANO <nakano@rins.ryukoku.ac.jp> by way of CERT.
1997-07-18 18:33:15 +00:00
Poul-Henning Kamp 63cfc56271 Increase size of tmp hostname buffer.
PR:		3889
Reviewed by:	phk
Submitted by:	Yujiro MIYATA <miyata@bioele.nuee.nagoya-u.ac.jp>
1997-07-16 11:22:57 +00:00
Joerg Wunsch 334a95086d Imply a 10-second connection timeout when querying remote queues, to
prevent lpq from hanging indefinately (well, 10 minutes are for sure
counting as `indefinately' in this case).
1997-06-23 10:00:01 +00:00
Warner Losh d583a7c3cb Buffer overflow from OpenBSD:
Rev 1.4 deraadt: (partial from full commit, other files not done yet)
	proactive bounds checking; help from millert
Rev 1.5 millert:
	Possible buf oflow.

Plus minor style nits to keep the style police happy (I hope)
Obtained from: OpenBSD
1997-02-09 05:19:03 +00:00
Warner Losh bc407914f9 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
1996-10-27 03:06:52 +00:00
Joerg Wunsch 7f72cbbae9 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.
1996-05-09 22:44:28 +00:00
Joerg Wunsch 5458e2f421 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>
1996-05-05 22:40:51 +00:00
Joerg Wunsch 4ebd2ee491 Fix my botched 4.4Lite2 import, and revert these files to their HEAD
versions.
1996-05-05 19:28:34 +00:00
Joerg Wunsch f519e3067e This commit was generated by cvs2svn to compensate for changes in r15637,
which included commits to RCS files with non-trunk default branches.
1996-05-05 14:04:33 +00:00
Joerg Wunsch 0b561052df Vendor-branch import of the 4.4BSD-Lite2 code for lpr. There are
several bugfixes in it that are worth considering.

Don't be alarmed about the import conflicts...

Obtained from: 4.4BSD-Lite2
1996-05-05 14:04:33 +00:00
Sean Eric Fagan a1e5d6f458 Remove definitions and declarations for FS, FC, XS, XC variables, and
replace them with MS char* variable.

Reviewed by:	rgrimes, joerg
1996-04-03 22:46:59 +00:00
Rodney W. Grimes 709e8f9ae1 Remove trailing whitespace. 1995-05-30 03:57:47 +00:00
Rodney W. Grimes dea673e932 BSD 4.4 Lite usr.sbin Sources 1994-05-26 05:23:31 +00:00