Commit Graph

119 Commits

Author SHA1 Message Date
Jens Schweikhardt
57bd0fc6e8 english(4) police. 2002-12-27 12:15:40 +00:00
Sheldon Hearn
a4df5101a3 Use "deprecated" instead of "depreciated" where appropriate. 2002-10-30 07:49:11 +00:00
Hajimu UMEMOTO
4a78ccd771 use IPV6_V6ONLY instead of non standard IPV6_BINDV6ONLY.
Approved by:	gad
2002-07-22 18:16:05 +00:00
Philippe Charnier
490d5836b5 The .Nm utility 2002-07-14 14:47:15 +00:00
Garance A Drosehn
bd1d08a146 Redo the way that fatal-error messages are done in the chkhost() routine,
mainly so the compiler can correctly do printf-style parameter checking.
Some minor improvements to a few of the error messages, but the main
goal here is to get rid of a few more compile-time warning messages.

MFC after:	5 days
2002-06-24 20:57:14 +00:00
Garance A Drosehn
3c75ad7ec0 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
2002-06-23 20:57:18 +00:00
Garance A Drosehn
5e127035e4 Change some "process id" variables from 'int' to 'pid_t', renaming some
of them to keep better track of which-is-which (multiple variables were
named 'pid').  Moved a global pid-variable into the only routine that
used it.  Net result: fixes two compile-time warnings...

MFC after:	2 weeks
2002-06-04 03:40:24 +00:00
Garance A Drosehn
0dcfaee0af Cosmetic improvements to some of the syslog() calls in here (in some cases
simply getting the indentation right when the statement wraps).

MFC after:	2 weeks
2002-06-04 02:48:12 +00:00
Garance A Drosehn
609614565f Fix all the 'return' statements in here to follow style(9).
MFC after:	2 weeks
2002-06-04 01:28:15 +00:00
Garance A Drosehn
4a13c4d9ee Avoid checking WIFEXITED and WTERMSIG in some error situations where the
value in wstatus is not related to the process that we care about.

MFC after:	2 weeks
2002-06-04 01:16:13 +00:00
Garance A Drosehn
0760287064 Stop using the depreciated 'union wait' definitions, moving to a more
standard handling of wait()-related routines.

Submitted by:	mike
MFC after:	2 weeks
2002-06-03 20:47:01 +00:00
Alfred Perlstein
16d8455dcc Assume __STDC__, remove non-__STDC__ code. 2002-05-28 19:23:47 +00:00
Garance A Drosehn
98f6cc5401 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
2002-04-23 00:06:10 +00:00
Garance A Drosehn
4d39e5f937 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
2002-04-22 01:04:02 +00:00
Garance A Drosehn
c7e56d3248 Change lpd to recognize the '-s' parameter as a preferred synonym
for what is currently the '-p' parameter.  '-s' is what NetBSD
used (and they implemented it before I added -p in FreeBSD), and
it also matches the '-s' option in syslogd.  Someone in OpenBSD
land had also talked about adding a '-s' option, but it hasn't
happened yet.

MFC after:	5 days
2002-04-19 19:33:24 +00:00
Garance A Drosehn
fc7477304d Remove a safety-setting line which is unnecessary now that the previous
line is using strlcpy instead of strncpy.

MFC after:	4 days
2002-04-19 18:46:10 +00:00
Garance A Drosehn
f6d5668396 Fix 'deamon' -> 'daemon' in a comment.
Obtained from:	NetBSD, OpenBSD
MFC after:	4 days
2002-04-19 18:36:56 +00:00
Garance A Drosehn
150508c64d Add a little detail to the syslog-msg that comes up when lpd can not
execute a given filter.

MFC after:	4 days
2002-04-19 18:28:35 +00:00
Garance A Drosehn
50cf7393cb A variable had been unnecessarily assigned a bogus value because gcc was
"confused" about it being unassigned.  In fact, gcc was right.  Fix the
real problem by setting that variable before break-ing out of a select
statement so gcc is happy, and then remove the unnecessary assignment.

Reported by:	a user wondering why lpd syslog-ed about "compiler confusion"
MFC after:	12 days
2002-04-07 08:12:39 +00:00
Garance A Drosehn
6710feea89 Rename a variable from 'user' to 'userid' to avoid some compiler warnings.
MFC after:	12 days
2002-04-07 08:01:42 +00:00
Garance A Drosehn
57d49eaa35 Rearrange all the error returns from sendfile() to make sure the original
input file and any temporary (filter) file are closed upon return, and
that is generally done at the end of the routine.  This should make it
easier for a later update (not yet written) to implement a "resend_copies"
option.

MFC after:	12 days
2002-04-07 07:48:32 +00:00
Garance A Drosehn
197ccef0c9 Re-arrange how output filters (of=) are handled for queues going to
remote machines.  Now they really are handled *exactly* the same as
input filters (if=) for remote queues, except that they are started
with a different set of parameters.  This should fix a few subtle
bugs in output-filter processing on such queues.  It is a pretty
significant re-arranging of sendfile(), moving some of it to a new
execfilter() routine.

PR:		36552
Reviewed by:	no screams from freebsd-audit
MFC after:	12 days
2002-04-07 05:37:27 +00:00
Garance A Drosehn
7cf2c478e4 Move the checks for '/' a little sooner in the code which receives files
for a remote print job.  This change comes from OpenBSD (who got it from
Sebastian Krahmer of SuSE).  In OpenBSD this avoids a tiny theoretical
security issue, but that security issue does not exist in FreeBSD's lpr
due to the changes which added 'ctl_renametf()' just before 4.4-release.
This change is still worth doing in our version, but it isn't fixing a
security issue.

MFC after:	4 days
2001-12-05 02:07:20 +00:00
Garance A Drosehn
21ecfd4a44 Change the recently-added 'o'-processing so it maps to 'l' instead of 'f'.
'l' ("plain text which includes control characters") is somewhat more
appropriate for 'o' ("postscript files"), and in fact some printers treat
'l' as a request to print a postscript file.

MFC after:	1 week
2001-11-27 01:32:25 +00:00
Garance A Drosehn
626fb2a6fa Add minimal support for "o"-type print-file actions in lpd control files.
This was described in the original RFC wrt lpr, but most lpr's do not
actually implement it.  There is some indication that MacOS 10.1 will
be using this when sending postscript files to print servers (that is
what "o"-type was supposed to signify -- postscript files).

MFC after:	1 week
2001-09-20 01:04:50 +00:00
Garance A Drosehn
ad5fdfbda1 Basically rewrite the dofork() routine, to add more error-checking and
correct the error-checking that was there.  With the old code, an error
return from getpwuid(daemon_user) could turn the lpd process into a very
effective fork-bomb...

Reviewed by:	freebsd-audit freebsd-print (a little...)
MFC after:	6 days
2001-07-23 23:13:39 +00:00
Garance A Drosehn
190c0c3872 Get rid of some compile-time warnings by defining (or casting) variables
as size_t where appropriate.

MFC after:	1 week
2001-07-23 00:15:37 +00:00
Garance A Drosehn
e95b3b9b47 Fix two compile-time warnings by defining fromlen as socklen_t.
MFC after:	1 week
2001-07-23 00:13:02 +00:00
Garance A Drosehn
5d7321f61d Replace calls to strncpy with calls to strlcpy, and remove the extra step
needed to ensure that the result is null-terminated when using strncpy().

MFC after:	8 days
2001-07-22 07:25:27 +00:00
Garance A Drosehn
605d466b60 Rename the -w option to be -W. The recently-added -w option is different
than the long-standing -w option in NetBSD, so change it before anyone in
FreeBSD gets used to it.  For now, -w is still accepted, but prints out
some warnings via syslog.

MFC after:	1 week
2001-07-22 01:05:20 +00:00
Garance A Drosehn
6897f282e5 Change a few read & write calls to use 'STDOUT_FILENO' instead of '1'.
Submitted by:	David Hill <david@phobia.ms>
Reviewed by:	freebsd-audit  (a little)
MFC after:	1 week
2001-07-22 00:03:21 +00:00
David E. O'Brien
90e655ea4e 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.
2001-07-20 06:20:32 +00:00
Dima Dorfman
f247324df7 Remove whitespace at EOL. 2001-07-15 08:06:20 +00:00
Garance A Drosehn
442e0eaf20 Change lpd to perform sanity and safety checks on control files as it
receives them from other hosts.  This is meant to protect from both
nefarious users (which maybe broke into some remote host that we accept
print jobs from), and broken implementations of lpr on other platforms.
This is done by changing recvjob.c to call the new ctl_renametf()
routine in the new common_source/ctlinfo.[ch] files.  This will not
affect jobs coming via lpr on the local machine.

Reviewed by:	freebsd-print@bostonradio.org & freebsd-audit
MFC after:	16 days
2001-07-15 05:29:38 +00:00
Garance A Drosehn
6d39e1b726 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
2001-07-15 00:09:46 +00:00
Garance A Drosehn
bfb9fa63fc Change signal-handling to reset SIGCHLD to SIGDFLT instead of SIG_IGN.
This fixes a problem with using print filters (if=, of=, etc) that showed
up in -current around June 20th.  That problem initially reported by
Georg-W Koltermann <gwk@sgi.com>, while most of the investigation that
led to this fix was done by Anton Berezin <tobez@FreeBSD.org>.

Reviewed by:	freebsd-print@bostonradio.org
MFC after:	1 week
2001-07-14 21:49:17 +00:00
Ruslan Ermilov
a4c37c816b mdoc(7) police: removed HISTORY info from the .Os call. 2001-07-10 15:12:08 +00:00
Brian Somers
7bc6d0158f Fix the type of the NULL arg to execl()
Idea from: Theo de Raadt <deraadt@openbsd.org>
2001-07-09 09:24:06 +00:00
Garance A Drosehn
6ddb63cad6 Add two new options for lpd: -c will log all connection-errors to syslog,
while -w allows connection from non-reserved ports.  Also improves the
helpfulness of various connection-error messages.

The changes for IPv6 added back in the reserved-port check which was mistakenly
dropped from lpd in 1997 (copying a change from openbsd).  It is best to have
that check in place, but the check breaks lpr's from some implementations of
lpr/lpd for Windows.  The -w option is for those admins who need to accept
jobs from non-reserved ports, the -c option is for admins who would like a
print-server machine to log all failed connection-attempts to syslog.

Reviewed by:	freebsd-audit@FreeBSD.org  freebsd-print@bostonradio.org
MFC after:	2 weeks
2001-06-25 01:45:25 +00:00
Garance A Drosehn
685f7a3889 Get rid of a trigraph ("??>") mistakenly put in an error message.
One less warning to annoy me...

MFC after:	1 week
2001-06-16 00:14:02 +00:00
Garance A Drosehn
aa4ad562c0 *** empty log message *** 2001-06-15 22:30:02 +00:00
Garance A Drosehn
cc3fd56f96 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
2001-06-15 22:03:07 +00:00
Garance A Drosehn
31058a75d0 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
2001-06-15 16:28:37 +00:00
Garance A Drosehn
ba7a1ad76a 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
2001-06-12 16:38:20 +00:00
Ruslan Ermilov
345e52e742 - Backout botched attempt to introduce MANSECT feature.
- MAN[1-9] -> MAN.
2001-03-26 14:42:20 +00:00
Ruslan Ermilov
c73e22c3d4 Set the default manual section for usr.sbin/ to 8. 2001-03-20 18:17:26 +00:00
Garance A Drosehn
9c83e8862e Fix a number of warnings that come up when compiling with BDECFLAGS. 2001-03-16 21:54:12 +00:00
Garance A Drosehn
affa003946 Change the usage() message to include the recently-added -4 and -6 options. 2001-03-12 02:03:53 +00:00
Garance A Drosehn
28b051021a Improve a few error messages wrt if= filters on remote print queues. 2001-03-12 00:22:03 +00:00
Ruslan Ermilov
8b5c4af3ff Prepare for mdoc(7)NG. 2000-12-27 15:30:30 +00:00