summaryrefslogtreecommitdiffstats
path: root/usr.sbin/lpr
Commit message (Collapse)AuthorAgeFilesLines
* Change the closeallfds() routine to use closefrom() when it isgad2013-05-272-8/+29
| | | | | | | | | | | | | | 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
* Let lpr build with -Wmissing-variable-declarations.ed2012-10-257-21/+14
| | | | | | 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.
* PRIV_START and PRIV_END were reversed.eadler2012-10-241-2/+2
| | | | | | Submitted by: KAHO Toshikazu <kaho@elam.kais.kyoto-u.ac.jp> Approved by: secteam (simon) MFC after: 3 days
* Check the return error of set[ug]id. While this can never fail in theeadler2012-10-2213-118/+137
| | | | | | | | | | | | | | 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
* Fix usr.bin/ and usr.sbin/ build with a 64-bit ino_t.mdf2012-09-271-2/+3
| | | | Original code by: Gleb Kurtsou
* Remove unused valueskevlo2012-09-111-1/+1
|
* Correct description of minfree to kilobytes rather than blocks.wblock2012-08-131-1/+1
| | | | | | PR: 125921 Submitted by: Andre Albsmeier <Andre.Albsmeier@siemens.com> MFC after: 3 days
* Make sure that arraysz is initialized to a value larger than zero.jh2012-07-171-0/+2
| | | | | | | | | 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
* Remove trailing whitespace.jh2012-07-171-4/+4
| | | | MFC after: 2 weeks
* Relax security permissions on '.seq' file creation - the strict,eadler2012-05-301-1/+1
| | | | | | | | | | 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
* Hide DIR definition by making it an opaque struct typedef.gleb2012-05-191-1/+1
| | | | | | | | | | 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
* Print out a warning message if a `lpc setstatus' is done whengad2012-04-301-0/+18
| | | | | | | | 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
* Catch the user-error when no queue name was specified on angad2012-04-301-0/+8
| | | | | | | lpc-command which supports '-msg' (e.g.: setstatus). Print out a helpful error message instead hitting a seg-fault. MFC after: 3 weeks
* The scandir(3) function expects fourth parameter, compar, be in type of:delphij2012-04-131-4/+4
| | | | | | | | | | | 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
* mdoc: terminate quoted strings.joel2012-03-261-1/+1
| | | | Reviewed by: brueffer
* - Remove some unnecessary cast when assigning NULL to a handle.kevlo2012-02-151-3/+3
| | | | - Silent a warning
* fgets(3) returns a pointer, so compare against NULL, not integer 0.kevlo2012-01-131-1/+1
|
* Spelling fixes for usr.sbin/uqs2011-12-304-11/+11
|
* In usr.sbin/lpr/lpd/printjob.c, use the correct printf length modifiersdim2011-12-171-2/+4
| | | | | | for off_t (aka int64_t). MFC after: 1 week
* In usr.sbin/lpr/filters/lpf.c, use a less obtuse way of clearing thedim2011-12-171-1/+2
| | | | | | buffer, that also avoids warnings. MFC after: 1 week
* - Fix the code that matches userids in match_jobspec(). It needs to checkgad2011-04-133-11/+11
| | | | | | | | | | 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
* Remove the advertising clause from UCB copyrighted files in usr.sbin. Thisjoel2010-12-1130-120/+2
| | | | | is in accordance with the information provided at ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change
* Move most of the remaining USD/PSD/SMM papers into share/docuqs2010-12-0411-1084/+1
|
* Fix printing of files located on ZFS filesystem with an st_dev oredwin2010-10-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* mdoc: drop redundant .Pp and .LP callsuqs2010-10-082-2/+0
| | | | They have no effect when coming in pairs, or before .Bl/.Bd
* - Improve the wait4data() routine so it behaves better when checkinggad2010-08-111-7/+23
| | | | | | | | | | | 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
* Fix typos and spelling mistakes.joel2010-08-061-1/+1
|
* Modernize scandir(3) and alphasort(3) interfaces according to the IEEEkib2010-01-042-2/+2
| | | | | | | | | | | | | | | | | | | | 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
* The last big commit: let usr.sbin/ use WARNS=6 by default.ed2010-01-025-0/+10
|
* Fix using lp(1) without the new -t option after r194171.jilles2009-09-291-2/+2
| | | | | | PR: standards/129554 Tested by: Steve Kargl MFC after: 1 week
* Fix end-of-line issues that can come up when `lpq' reads informationgad2009-06-241-1/+102
| | | | | | | | | | | | | | 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
* In preparation for raising NGROUPS and NGROUPS_MAX, change basebrooks2009-06-191-2/+6
| | | | | | | | | | | | | | | | | | | | | | 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
* Add -m and -t options.brian2009-06-142-2/+13
| | | | | | PR: 129554 Submitted by: gavin MFC after: 3 weeks
* use bigger local variable to calculate free spaceticso2008-09-011-1/+1
| | | | int overflows at 1T free space
* Cleanup of userland __P usekevlo2007-11-071-2/+2
|
* Use sizeof() for calculating the buffer size instead of hard-coded values.kevlo2007-03-061-1/+1
|
* Obey MK_INET6_SUPPORT.yar2006-07-271-0/+4
|
* Fix checking of the "lock" file in the spool directory for a queue,gad2006-07-071-2/+9
| | | | | | | | | | | 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
* Rever the previous changes. It turns out that it perfectly correctgad2006-03-093-3/+3
| | | | | | | 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
* Switch these makefiles to use 'MAN=' to indicate they will not generategad2006-03-083-3/+3
| | | | | | | a man page, instead of 'NO_MAN='. 'NO_MAN=' is something users would set, not something a makefile should be using. Based on comments by: des
* Use the new name H_SETSIZE instead of the old H_EVENT to set the historystefanf2005-10-191-1/+1
| | | | | | | size. PR: 86355 Approved by: gad
* Remove kludges intended to support src trees with partial obj trees.des2005-06-101-4/+0
| | | | Discussed with: ru
* NI_WITHSCOPEID cleanupume2005-05-132-5/+5
| | | | Reviewed by: gad
* MFS5: Minor style(9) tweak.delphij2005-02-221-1/+1
|
* Be more careful when doing el_parse() - only do it when el isdelphij2005-02-151-1/+1
| | | | | | | | | | 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
* Expand *n't contractions.ru2005-02-132-2/+2
|
* Fixed .Xr call.ru2005-01-211-1/+2
|
* Sort sections.ru2005-01-185-34/+34
|
* Fix so all parts of lpd, lpc, lpq, and lprm will use the same algorithmgad2004-12-315-37/+79
| | | | | | | | | | | | | | | | | for calculating the job number for a job based on the control-file name. We might receive cf-files named by other implementations of lpr, where the job number shown by lpq would not match the job number that other commands expected for the same name. This also uses a newer algorithm for determining a job number, to avoid problems caused when a control-file is named using an IP address, instead of the hostname. This also moved the declaration if isowner() from lp.h to rmjob.c. When I went to change the parameters, I noticed that rmjob.c was the only source file which uses it. MFC after: 2 weeks
* Do more extensive checking of the userid field which is read in from thegad2004-12-311-7/+46
| | | | | | | | | | | | | | | | control-file for each print job. This is partially because the previous checks still let through some characters which would cause trouble for other applications which try to process the resulting userid -- such as accounting programs. But the main reason is to handle the case where some remote host sends a print job where the given userid is an uppercase-version of the real userid. For that case, lpd will now check for uppercase letters in the userid. If there are any, it will check to see if the given userid (with the uppercase letters) is a valid one. If it is *not* valid, then lpd will change the userid to all-lowercase right when the job is received. MFC after: 2 weeks
OpenPOWER on IntegriCloud