summaryrefslogtreecommitdiffstats
path: root/usr.sbin/lpr/common_source
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-256-10/+3
| | | | | | 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-226-64/+79
| | | | | | | | | | | | | | 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
* 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
* 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
* Spelling fixes for usr.sbin/uqs2011-12-301-4/+4
|
* - 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-116-24/+2
| | | | | is in accordance with the information provided at ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change
* 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-021-0/+2
|
* 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
* NI_WITHSCOPEID cleanupume2005-05-131-2/+2
| | | | Reviewed by: gad
* 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
* For variables that are only checked with defined(), don't provideru2004-10-241-1/+1
| | | | any fake value.
* Fix a warning about mismatched pointers. A pointer to "void *" is not thepeter2003-10-261-1/+1
| | | | same as a pointer to "char *". Tell the compiler this is ok.
* Remove a 'From:' that snuck into an sccsid comment line as part of -v1.3gad2003-08-011-1/+1
|
* Get the 'sccsid' lines even closer to correct style(9) form. Thegad2003-07-145-0/+13
| | | | | | | | '#ifdef lint/#endif' around the lines should not have been removed. Also add blank lines where one (per file) was missing. Reviewed by: First part noticed by bde, blank lines noticed by me MFC after: 15 days
* Get the 'sccsid' for this to match the original lines you wouldgad2003-07-141-2/+6
| | | | | | | | get from '-r CSRG', instead of having that sccsid as a comment. (this is the sccsid from 1996 -- there have been many changes to printcap.c since then!) MFC after: 15 days
* Take advantage of the common_source/lp.cdefs.h file to change lprgad2003-07-1412-42/+26
| | | | | | | | source to use __FBSDID() for setting rcsids. Also fix the format of 'sccsid' lines to consistently match style(9) guidelines. Reviewed by: discussed with bde and obrien MFC after: 15 days
* Introduce a new lp.cdefs.h file, which will be used to make itgad2003-07-141-0/+107
| | | | | | | | | | | | | somewhat easier to build this lpr on other operating systems. This simply includes <sys/cdefs.h> when that is appropriate, and then checks for any cdefs-ish macros that lpr uses, and defines them if they don't already exist. This is only a start at making freebsd's lpr less of a hassle to port. It is mainly added so all of lpr can be changed to use the __FBSDID() macro, without making it *more* of a hassle to build on other OS's. Reviewed by: discussed with bde and obrien MFC after: 15 days
* Minor improvement to some debugging code that is probably used by no onegad2003-06-121-4/+15
| | | | | | but me (it's usually #ifdef-ed out). MFC after: 1 week
* When sanity-checking a variable, it's good to check the correct variable...gad2003-06-121-1/+1
| | | | MFC after: 1 week
* Change DEFMX to 0. This removes the size limit for print jobs by default.eivind2003-03-271-2/+3
| | | | Discussed with: gad (now), arch (a year ago)
* Fix typos; each file has at least one s/seperat/separat/schweikh2002-08-111-1/+1
| | | | | | | | | | (I skipped those in contrib/, gnu/ and crypto/) While I was at it, fixed a lot more found by ispell that I could identify with certainty to be errors. All of these were in comments or text, not in actual code. Suggested by: bde MFC after: 3 days
* Changes which rewrite 'lpc topq', and which add 'lpc bottomq'. Thesegad2002-07-173-2/+688
| | | | | | | | | | | | | reflect much valuable feedback from wollman. More details on the new 'lpc topq' are in the log message for revision 1.2 of lpc/movejobs.c. The previous implementation of 'lpc topq' is available as 'lpc xtopq', in case there are any problems noticed in the new implementation. If there are no problems with this version, a later update will remove the 'lpc xtopq' command. Reviewed by: freebsd-print@bostonradio.org MFC after: 6 days
* Fix set_qstate() so it correctly checks for any error from chmod().gad2002-07-121-1/+1
| | | | | | Note that set_qstate() is only called from several 'lpc' commands. MFC after: 3 days
* Add a SQS_QCHANGED option to set_qstate(). This will soon be used by 'lpc'.gad2002-07-122-1/+11
| | | | | Reviewed by: freebsd-print@bostonradio.org MFC after: 3 days
* Add two variables to struct jobqueue, and change the way that getq()gad2002-07-122-3/+10
| | | | | | | calculates how much space to get for that struct, so it will get the right amount when new variables are added. MFC after: 3 days
* Move prototypes for ctl_readcf and ctl_freeinf from ctlinfo.c to ctlinfo.h,gad2002-07-122-2/+2
| | | | | | so the routines can be called by an upcoming change for 'lpc topq/bottomq'. MFC after: 3 days
* Stop adding ${CWARNFLAGS} to CFLAGS. The standard makefile processing willgad2002-06-231-2/+0
| | | | | | add them automatically, and there is no point in adding them twice. MFC after: 5 days
* Bah humbug. Fix another typo on the same comment line. It also hadgad2002-06-131-1/+1
| | | | | | an option-space instead of a space... MFC after: 10 days
* Fix a typo in a comment from the previous commit. I had a bullet-charactergad2002-06-131-1/+1
| | | | | | | instead of an asterisk. Noticed by: keramida MFC after: 10 days
* Almost complete rewrite of the lpc commands 'abort', 'enable', 'disable',gad2002-06-132-0/+151
| | | | | | | | | | | | | | | | | 'restart', 'start', 'stop' and 'up'. These are commands which mainly just alter the access bits on the lock-file of a queue, and they all now use a central routine to do that. This reduces the amount of code that is run as the priv userid, and eliminates a number of cases where error messages were written while that priv uid was in effect. As far as users are concerned, there should be no noticable difference in the new versions. In case there *is*, the previous implementations are still there as 'xabort', 'xenable', etc, so they are available for instant fallback. If no one reports a problem after a few weeks, then a later update will remove those x-commands. Reviewed by: freebsd-audit and freebsd-print@bostonradio.org MFC after: 10 days
* Assume __STDC__, remove non-__STDC__ code.alfred2002-05-281-15/+0
|
* Mark all internal libraries with INTERNALLIB.ru2002-05-131-5/+1
|
* When using %p to print out pointers to struct's, first cast the valuesgad2002-04-251-7/+8
| | | | | | | | to (void *) to satisfy some stricter warning-level checks in the new gcc (on sparc64). Reviewed by: obrien MFC after: 4 days
* Improve the error message the user sees if the startdaemon routine cannotgad2002-04-231-4/+6
| | | | | | | connect() to the socket for lpd. Tell them this error probably means that the master 'lpd' process is not running. MFC after: 4 days
* Implement new printcap option of "rc" aka "remote.resend_copies".gad2002-04-232-0/+2
| | | | | | | | | | | | 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
* Add 'const' to some casts to fix two warnings that are printed by thegad2002-04-221-2/+2
| | | | | | new gcc (on sparc64). MFC after: 4 days
* My recent changes to add the ctl_renametf routine assumed that print jobgad2001-11-281-8/+16
| | | | | | | | | | | control-files will always start with 'cfA*'. It turns out that some implementations of lpd (such as solaris) may send a control file which starts with 'cfB*', or really 'cf<anyLetter>*'. Although such filenames are very odd, we did used to accept them. This changes ctl_renametf to work correctly with them, and fixes up 'lpc clean' to match. PR: bin/32183 MFC after: 10 days
* Change the recently-added 'o'-processing so it maps to 'l' instead of 'f'.gad2001-11-271-2/+4
| | | | | | | | '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
* Add minimal support for "o"-type print-file actions in lpd control files.gad2001-09-201-12/+18
| | | | | | | | | 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
* Fix buffer overflow in queue file handling.kris2001-08-301-7/+13
| | | | | Submitted by: millert@openbsd.org, gad Reported by: X-Force <xforce@iss.net>
* Fix a few more minor compile-time warnings, mainly by using size_t wheregad2001-07-231-10/+15
| | | | | | | appropriate, and using '("%lu", (unsigned long)asizeval)' when printing something of type size_t. MFC after: 1 week
* Replace calls to strncpy with calls to strlcpy, and remove the extra stepgad2001-07-221-6/+3
| | | | | | needed to ensure that the result is null-terminated when using strncpy(). MFC after: 8 days
* Perform a major cleanup of the usr.sbin Makefiles.obrien2001-07-201-3/+4
| | | | | 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.
* Change lpd to perform sanity and safety checks on control files as itgad2001-07-153-2/+924
| | | | | | | | | | | | 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
OpenPOWER on IntegriCloud