Commit Graph

375 Commits

Author SHA1 Message Date
Simon J. Gerraty
76b28ad6ab Updated dependencies 2014-05-10 05:16:28 +00:00
Simon J. Gerraty
cc3f4b9965 Merge from head 2014-05-08 23:54:15 +00:00
Warner Losh
c6063d0da8 Use src.opts.mk in preference to bsd.own.mk except where we need stuff
from the latter.
2014-05-06 04:22:01 +00:00
Simon J. Gerraty
3b8f084595 Merge head 2014-04-28 07:50:45 +00:00
Warner Losh
3bdf775801 NO_MAN= has been deprecated in favor of MAN= for some time, go ahead
and finish the job. ncurses is now the only Makefile in the tree that
uses it since it wasn't a simple mechanical change, and will be
addressed in a future commit.
2014-04-13 05:21:56 +00:00
David Malone
e6a37eded4 Add missing description of du (daemon.user) printcap capability. 2014-03-04 15:09:57 +00:00
Simon J. Gerraty
d1d0158641 Merge from head 2013-09-05 20:18:59 +00:00
Garance A Drosehn
137076c5f7 Change the closeallfds() routine to use closefrom() when it is
available (closefrom() was added to FreeBSD in 8.0-release).
The selection is made at compile-time, as I still compile a
FreeBSD-based version of lpr&friends on other platforms.

While testing I out that (at least on my system) lpd has been
closing 11095 fd's, when there are only 6 fd's open.  The old
code took 120 times more clocktime than calling closefrom().
(although that was still less than 2/1000-ths of a second!)

Reviewed by:	jilles
MFC after:	2 weeks
2013-05-27 22:19:01 +00:00
Simon J. Gerraty
7cf3a1c6b2 Updated dependencies 2013-03-11 17:21:52 +00:00
Simon J. Gerraty
f5f7c05209 Updated dependencies 2013-02-16 01:23:54 +00:00
Simon J. Gerraty
23090366f7 Sync from head 2012-11-04 02:52:03 +00:00
Ed Schouten
6511bcb8c0 Let lpr build with -Wmissing-variable-declarations.
Mark variables static where possible and place the uid/euid variables in
lp.h, so that we can compile-time enforce that these variables have the
same type.
2012-10-25 20:16:38 +00:00
Eitan Adler
c47775a2f9 PRIV_START and PRIV_END were reversed.
Submitted by:	KAHO Toshikazu <kaho@elam.kais.kyoto-u.ac.jp>
Approved by:	secteam (simon)
MFC after:	3 days
2012-10-24 16:03:05 +00:00
Eitan Adler
1d1d4a4727 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
2012-10-22 03:31:22 +00:00
Matthew D Fleming
b424efd5b1 Fix usr.bin/ and usr.sbin/ build with a 64-bit ino_t.
Original code by:	Gleb Kurtsou
2012-09-27 23:31:19 +00:00
Kevin Lo
3dedcef753 Remove unused values 2012-09-11 07:54:41 +00:00
Marcel Moolenaar
7750ad47a9 Sync FreeBSD's bmake branch with Juniper's internal bmake branch.
Requested by: Simon Gerraty <sjg@juniper.net>
2012-08-22 19:25:57 +00:00
Warren Block
44d8663ddb Correct description of minfree to kilobytes rather than blocks.
PR:		125921
Submitted by:	Andre Albsmeier <Andre.Albsmeier@siemens.com>
MFC after:	3 days
2012-08-13 15:16:25 +00:00
Jaakko Heinonen
e0d20e6615 Make sure that arraysz is initialized to a value larger than zero.
arraysz could get initialized to zero on ZFS because ZFS reports
directory sizes differently compared to UFS.

PR:		bin/169493
Tested by:	swills
MFC after:	2 weeks
2012-07-17 09:34:52 +00:00
Jaakko Heinonen
f9fbbdf95b Remove trailing whitespace.
MFC after:	2 weeks
2012-07-17 09:31:05 +00:00
Eitan Adler
31fd5c1101 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
2012-05-30 04:08:29 +00:00
Gleb Kurtsou
0bb2aabf26 Hide DIR definition by making it an opaque struct typedef.
Introduce dirfd() libc exported symbol replacing macro with same name,
preserve _dirfd() macro for internal use.

Replace dirp->dd_fd with dirfd() call. Avoid using dirfd as variable
name to prevent shadowing global symbol.

Sponsored by:	Google Summer Of Code 2011
2012-05-19 12:44:27 +00:00
Garance A Drosehn
7574a1c16e 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
2012-04-30 01:10:13 +00:00
Garance A Drosehn
aa318fd726 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
2012-04-30 00:54:10 +00:00
Xin LI
2c81fb6a72 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
2012-04-13 22:34:01 +00:00
Joel Dahl
c2965cd185 mdoc: terminate quoted strings.
Reviewed by:	brueffer
2012-03-26 15:18:14 +00:00
Kevin Lo
6e807fa629 - Remove some unnecessary cast when assigning NULL to a handle.
- Silent a warning
2012-02-15 02:01:24 +00:00
Kevin Lo
a3a2bf4b67 fgets(3) returns a pointer, so compare against NULL, not integer 0. 2012-01-13 06:51:15 +00:00
Ulrich Spörlein
3df5ecac8c Spelling fixes for usr.sbin/ 2011-12-30 10:58:14 +00:00
Dimitry Andric
97fbdc11ea In usr.sbin/lpr/lpd/printjob.c, use the correct printf length modifiers
for off_t (aka int64_t).

MFC after:	1 week
2011-12-17 22:05:28 +00:00
Dimitry Andric
7ae1a27825 In usr.sbin/lpr/filters/lpf.c, use a less obtuse way of clearing the
buffer, that also avoids warnings.

MFC after:	1 week
2011-12-17 21:37:21 +00:00
Garance A Drosehn
ad1f7851dd - Fix the code that matches userids in match_jobspec(). It needs to check
the username-for-accounting field (P), not the username-for-headerpage (L).
  These are usually the same value, except that control files do not have
  the username-for-headerpage field if the user has requested no header page.
- Also rename the cji_username field to cji_headruser, to make it clear that
  the value should only be used for the header page.  (aka banner page)

MFC after:	3 weeks
2011-04-13 00:36:19 +00:00
Joel Dahl
914e11a72b 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
2010-12-11 09:38:12 +00:00
Ulrich Spörlein
cded07a878 Move most of the remaining USD/PSD/SMM papers into share/doc 2010-12-04 10:11:20 +00:00
Edwin Groothuis
e782099404 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
2010-10-21 06:52:14 +00:00
Ulrich Spörlein
0d9deed52c mdoc: drop redundant .Pp and .LP calls
They have no effect when coming in pairs, or before .Bl/.Bd
2010-10-08 12:40:16 +00:00
Garance A Drosehn
422605a3b9 - Improve the wait4data() routine so it behaves better when checking
print-jobs which have last-modification times that are in the future.
  This shouldn't happen, of course, but it can.  And when it did happen,
  the previous check could cause completely-spooled jobs to sit in the
  queue for 20 minutes per job.  The new code waits until the last-modify
  time is not changing, instead of making decisions based on the specific
  value of last-modify.

MFC after:	2 weeks
2010-08-11 19:32:49 +00:00
Joel Dahl
f6ac23919b Fix typos and spelling mistakes. 2010-08-06 14:33:42 +00:00
Konstantin Belousov
4176dd5267 Modernize scandir(3) and alphasort(3) interfaces according to the IEEE
Std 1003.1-2008. Both Linux and Solaris conforms to the new definitions,
so we better follow too (older glibc used old BSDish alphasort prototype
and corresponding type of the comparision function for scandir). While
there, change the definitions of the functions to ANSI C and fix several
style issues nearby.

Remove requirement for "sys/types.h" include for functions from manpage.

POSIX also requires that alphasort(3) sorts as if strcoll(3) was used,
but leave the strcmp(3) call in the function for now.

Adapt in-tree callers of scandir(3) to new declaration. The fact that
select_sections() from catman(1) could modify supplied struct dirent is
a bug.

PR:	standards/142255
MFC after:	2 weeks
2010-01-04 15:40:17 +00:00
Ed Schouten
71ccf09269 The last big commit: let usr.sbin/ use WARNS=6 by default. 2010-01-02 11:07:44 +00:00
Jilles Tjoelker
072a126d12 Fix using lp(1) without the new -t option after r194171.
PR:		standards/129554
Tested by:	Steve Kargl
MFC after:	1 week
2009-09-29 21:28:32 +00:00
Garance A Drosehn
46bfa198cf Fix end-of-line issues that can come up when `lpq' reads information
about a queue from a remote host.  That remote host may use \r, \r\n,
or \n\r as the line-ending character.  In some cases the remote host
will write a single line of information without *any* EOL sequence.

Translate all the non-unix EOL's to the standard newline, and make
sure the final line includes a terminating newline.  Logic is also
added to translate all unprintable characters to '?', but that is
#if-ed out for now.

PR:		bin/104731
MFC after:	3 weeks
2009-06-24 16:57:33 +00:00
Brooks Davis
54404cfb13 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
2009-06-19 15:58:24 +00:00
Brian Somers
a0347c7148 Add -m and -t options.
PR:		129554
Submitted by:	gavin
MFC after:	3 weeks
2009-06-14 06:47:21 +00:00
Bernd Walter
ee9069d1d9 use bigger local variable to calculate free space
int overflows at 1T free space
2008-09-01 12:32:40 +00:00
Kevin Lo
784bddbc5b Cleanup of userland __P use 2007-11-07 10:53:41 +00:00
Kevin Lo
d069140339 Use sizeof() for calculating the buffer size instead of hard-coded values. 2007-03-06 09:32:41 +00:00
Yaroslav Tykhiy
6884810944 Obey MK_INET6_SUPPORT. 2006-07-27 14:52:12 +00:00
Garance A Drosehn
ae39ffc92e Fix checking of the "lock" file in the spool directory for a queue,
so that the checking will wind up with the correct mode-bits in
the case where the initial open() of that lock file will create it.
Due to this bug, the first job ever sent to a queue could leave
that queue in a "printing is disabled" state.

PR:		93469
Submitted by:	Michael Szklarski of kco.com.pl
MFC after:	1 week
2006-07-07 01:12:26 +00:00
Garance A Drosehn
1f6676cf8f Rever the previous changes. It turns out that it perfectly correct
for a makefile to set 'NO_MAN=' when the makefile is for a program
that will not create a man page.

Based on reaction from:		ru bde
2006-03-09 19:52:44 +00:00