Home | History | Annotate | Download | only in common_source
History log of /src/usr.sbin/lpr/common_source/common.c
RevisionDateAuthorComments
 1.44  13-May-2023  andvar change a typo in sizeof(struct queueue *) to sizeof(nqueue[0])
riastradh recommends using array[0] instead of pointer.
 1.43  20-Dec-2014  prlw1 MKINET6=no build fixes

http://mail-index.netbsd.org/tech-net/2014/12/13/msg004898.html
 1.42  13-Nov-2013  christos branches: 1.42.4;
CID 1125882: Don't use unitialized variable; move code inside conditional
where it was intended.
 1.41  19-Oct-2013  christos use new scopeid functions
 1.40  13-Jul-2009  roy branches: 1.40.6; 1.40.12;
Rename internal getline() function to get_line() so it does
conflict with the soon to be added getline(3) libc function.
 1.39  18-Jan-2009  lukem fix -Wsign-compare issues
 1.38  01-Dec-2007  mlelstv Sort queue by time and jobid so that jobs submitted within the
same second are printed in order.
Fixes PR bin/37346
 1.37  25-May-2006  christos branches: 1.37.4; 1.37.6; 1.37.10;
Add missing semicolon.
 1.36  25-May-2006  christos Coverity CID 3322: Fix memory leak.
 1.35  21-Mar-2006  christos Coverity CID 1750: Add a function to free a queue and use it.
 1.34  17-Mar-2006  christos free memory on allocation failure.
 1.33  20-Jan-2006  christos Instead of dealing with port@host in many places, do it where it is needed.
It reduces code and complexity and at the same time allows as to use symbolic
ports instead of just numeric everywhere.
 1.32  18-Jan-2006  garbled change return(0) to return(rv). We went to all the trouble to calculate the
return value, we might as well return it. (fixes lpq -a, and probably lpd)
 1.31  17-Jan-2006  garbled Fix PR bin/14247
This PR claims that MacOSX 10.1 cannot print postscript files to a NetBSD
lpd because the mac will tag the file with an "o" for postscript, which
we do not handle. Rather than simply mapping o -> f as was done in the
PR, or mapping o -> l as was done in FreeBSD, I have implemented full
support for the "o" option. If a postscript filter does not exist in the
printcap file however, it will default to "l" handling.

With this change, you can now specify a "pf" or postscript filter in your
printcap, and have it handle postscript files sent to it with "lpr -o".

The "o" format in lpd is specified in RFC1179 as being a valid format flag.
 1.30  17-Jan-2006  garbled in ckqueue() if "sd" is not an existing capability, than sd will be
uninitialized, causing the free() in out: to explode. Initialize sd to NULL.
 1.29  04-Jan-2006  garbled Address PR bin/12112
Lpd has the ability to start on a port other than "printer" but has no
way to connect to a remote lpd on that port. This change adds the
ability to specify port@host in the rm element of printcap(5). Tested to
work with both a standard lpd setup and one running on special ports.
 1.28  28-Nov-2005  christos - WARNS = 4
- factor out commonly used code.
- constify
- use warn/warnx instead of printf
 1.27  16-Nov-2004  itojun branches: 1.27.2;
NI_WITHSCOPEID was not picked up by IETF standardization
 1.26  16-Oct-2003  itojun safer use of realloc
 1.25  07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22366, verified by myself.
 1.24  18-Sep-2002  mycroft select() -> nanosleep()
 1.23  14-Jul-2002  wiz Unifdef __STDC__. Remove __P(). ANSIfy.
 1.22  05-Apr-2001  wiz Fix possible security problem (euid swapout in error handling).
Based on a similar patch in OpenBSD, reported there by
j@ida.interface-business.de.
Fix the second occurrance of a similar problem in that file, too, though.
 1.21  09-Aug-2000  itojun rewrite local address detection code, to use getifaddrs(3), not gethostname(3).
gethostname(3) do not necessarily represent local host addrses.
pointed out by: Chuck Cranor
 1.20  25-Apr-2000  itojun branches: 1.20.4;
allow lp=port@host again. PR9975 from Andreas Gustafsson.
 1.19  24-Apr-2000  itojun avoid NULL pointer access when rp=<ipv4 numberic address> (no ai_canonname).
From: hiro@takechi.org

XXX checkremote() should be improved. gethostname -> getaddrinfo is
not the right thing to do, we cannot assume DNS FQDNs is configured
as hostname. if the goal here is to check if it is really remote or not,
getifaddrs() is the way to go.
 1.18  18-Feb-2000  itojun do not sleep on ECONNREFUSED, rather, try the next address first.
the behavior itself has a room for debate. (why we retry on ECONNREFUSED?)

From: SHIMIZU Ryo <ryo@misakimix.org>
 1.17  27-Jan-2000  itojun IPv6 support, using rcmd-family funciton added.
NetBSD PR: 9050
From: Feico Dillema
 1.16  05-Dec-1999  jdolecek put fatal() and a some of variables used independantly of other functions
in common.c into separate files - this slighly cuts down size of pac(1)
not that it's really significant, but every bit counts ....
 1.15  26-Sep-1999  mrg delint and other cleanups.
 1.14  09-Jul-1998  msaitoh branches: 1.14.4;
Declare ints, too, don't default them.
 1.13  06-Jul-1998  mrg - use an array MAXHOSTNAMELEN+1 size to hold hostnames
- ensure hostname from gethostname() is nul-terminated in all cases
- minor KNF
- use MAXHOSTNAMELEN over various other values/defines
- be safe will buffers that hold hostnames
 1.12  18-Oct-1997  lukem use memcmp/memset/memmove instead of bcmp/bzero/bcopy
 1.11  05-Oct-1997  mrg - WARNS?=1
- be safe with unlinking files (from freebsd)
- remove register
- clean up $NetBSD$'s.
- use inet_ntoa() in one place (from openbsd)
- nul terminate after a bunch of strncpy()'s
- #ifdef __STDC__ rather than #if (from freebsd)
- be safe with a bunch of string operations (from freebsd)
- use warn()/err() over home grown versions (some from freebsd)
- rename warn() to nodaemon() to remove conflict with above
- check errno from failed kill(2) against ESRCH (from freebsd)
- use getopt() rather than home grown versions (from freebsd)
- clean up a bunch of man pages (some from freebsd)
- check for hostname spoof (from freebsd)
- use POSIX wait() interfaces
- use sysconf(_SC_OPEN_MAX) in preference to NOFILE (from freebsd)
- deal with fork() failure
- index/rindex -> strchr/strrchr (some from freebsd)
- add B57600 and B115200 speeds (from freebsd)
- some KNF
- be safe with files passed in over the network (some from freebsd)
- check return value of malloc(), calloc() and strdup()
 1.10  05-Oct-1997  mrg merge 4.4 lite2
 1.9  09-Dec-1996  mrg remove unsafe calls to strcpy(), strcat(), and sprintf(). some KNF.
 1.8  28-Nov-1995  jtc branches: 1.8.4;
merge in changes from 1.1 release branch
 1.7  15-Nov-1995  pk Add RCSIDs.
 1.6  03-Oct-1995  hpeyerl -- convert sgtty to termios. From: Scott Bartram <scottb@iis.net>
-- Use seteuid() to only give lpr, lprm, lpq and lpc root when they
need it from matthew green <mrg@mame.mu.oz.au>
 1.5  18-May-1994  cgd clean up that import. no rcsids yet.
 1.4  17-May-1994  cgd copyright foo
 1.3  08-Dec-1993  jtc Upgraded to use <dirent.h>.
 1.2  01-Aug-1993  mycroft Add RCS identifiers.
 1.1  21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.3  05-Oct-1997  mrg lite-2
 1.1.1.2  18-May-1994  cgd lpr from 4.4-Lite
 1.1.1.1  21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.8.4.1  26-Jan-1997  rat Update from trunk. Fixes security bugs.
 1.14.4.1  27-Dec-1999  wrstuden Pull up to last week's -current.
 1.20.4.2  24-Dec-2001  he Pull up revision 1.21 (requested by wiz):
Use getifaddrs(3) instead of gethostname(3) for local address
detection.
 1.20.4.1  26-Apr-2001  he Pull up revision 1.22 (requested by wiz):
Fix possible security problem (euid swapout in error handling).
 1.27.2.1  11-May-2008  jdc Pull up revision 1.38 via patch (requested by mlelstv in ticket #1929).

Sort queue by time and jobid so that jobs submitted within the
same second are printed in order.
 1.37.10.1  09-Jan-2008  matt sync with HEAD
 1.37.6.1  03-Jun-2008  skrll Sync with netbsd-4.
 1.37.4.1  11-May-2008  jdc Pull up revision 1.38 (requested by mlelstv in ticket #1136).

Sort queue by time and jobid so that jobs submitted within the
same second are printed in order.
 1.40.12.1  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.40.6.1  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.42.4.1  29-Dec-2014  martin Pull up following revision(s) (requested by prlw1 in ticket #358):
sbin/route/route.c: revision 1.149
external/apache2/mDNSResponder/dist/mDNSPosix/mDNSPosix.c: revision 1.7
external/bsd/ipf/dist/lib/printhost.c: revision 1.3
usr.sbin/lpr/common_source/common.c: revision 1.43
usr.sbin/lpr/common_source/Makefile: revision 1.12
external/bsd/ipf/dist/lib/printhostmask.c: revision 1.3
external/bsd/ipf/dist/lib/save_v1trap.c: revision 1.2
external/bsd/dhcpcd/dist/dhcpcd.c: revision 1.21
external/bsd/tcpdump/bin/Makefile: revision 1.12
external/bsd/ipf/dist/lib/save_v2trap.c: revision 1.2
external/bsd/ipf/dist/tools/lexer.c: revision 1.2
external/bsd/ppp/usr.sbin/pppd/sys-bsd.c: revision 1.3
external/bsd/ipf/dist/lib/printipfexpr.c: revision 1.2
MKINET6=no build fixes
http://mail-index.netbsd.org/tech-net/2014/12/13/msg004898.html

RSS XML Feed