Commit Graph

39 Commits

Author SHA1 Message Date
agc 326b2259b7 Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22366, verified by myself.
2003-08-07 11:25:11 +00:00
itojun 85da88227f use strlcpy/strlcat.
[fix off-by-one in displayq.c]
2003-05-17 20:46:42 +00:00
thorpej 2b3b2f08d6 Rather than relying on pure luck to get the log file on STDERR_FILENO,
explictly dup2 the log file dscriptor to STDERR_FILENO and close the
original.
2002-10-26 01:47:52 +00:00
abs 2cbe5b958f Add back __attribute__() data for pstatus() removed by error in last commit.
Noted by wiz.
2002-09-04 13:49:20 +00:00
abs 8531949548 When -r is given actually pass the file through of, and also enable if. 2002-09-03 18:35:11 +00:00
wiz 895dc72a69 Unifdef __STDC__. Remove __P(). ANSIfy. 2002-07-14 15:27:58 +00:00
hubertf 534ff5d5e9 This fixes various little problems in the lpd source.
lpd.c           bogus 'c' option in getopt option string

        printjob.c      spelling "prstatic inter" -> "printer"
                        finish ANSIfication

        recvjob.c       finish ANSIfication

Patch contributed by Brian Ginsbach <ginsbach@cray.com> in PR 17520
2002-07-09 01:12:35 +00:00
itojun b4daa6bb72 avoid hardcoded octals. openbsd 2002-06-08 23:40:12 +00:00
wiz b36c0a5406 deamon -> daemon 2002-01-21 14:42:26 +00:00
mjl c903850da8 Replace 1 and 2 with STDOUT_FILENO and STDERR_FILENO.
ANSIfy and constify.
2001-10-09 02:15:37 +00:00
wiz 4c99916337 va_{start,end} audit:
Make sure that each va_start has one and only one matching va_end,
especially in error cases.
If the va_list is used multiple times, do multiple va_starts/va_ends.
If a function gets va_list as argument, don't let it use va_end (since
it's the callers responsibility).

Improved by comments from enami and christos -- thanks!

Heimdal/krb4/KAME changes already fed back, rest to follow.

Inspired by, but not not based on, OpenBSD.
2001-09-24 13:22:25 +00:00
wiz 456dff6cb8 Spell 'occurred' with two 'r's. 2001-09-16 16:34:23 +00:00
mrg a062d79672 use DEFLP instead of "lp". 2001-06-25 11:04:51 +00:00
lukem c2aa46e7c2 use %ll_ instead of the less standard %q_ 2001-01-05 03:27:26 +00:00
is d8302e2d73 More format string cleanups by sommerfeld. 2000-10-11 20:23:46 +00:00
itojun c8b98b814c syslog() string format hole.
http://www.securityfocus.com/templates/archive.pike?start=2000-09-24&fromthread=0&mid=85023&list=1&end=2000-09-30&threads=0&
2000-09-26 17:44:38 +00:00
itohy 880baa236b Don't pass null pointer to syslog.
lpd[6813]: mail sent to user itohy about job foo.ps on printer lp ((null))
                                                                   ^^^^^^
2000-08-24 02:03:54 +00:00
mrg 2a987cd998 - use symbolic names for mode bits
- use _exit() where we should
- fix spelling mistake
- use vasprintf() in pstatus()
all from freebsd.
1999-12-11 02:01:18 +00:00
mrg 5b6d0e7e39 - add timeouts to displayq(), rmremote(), sendfile() and response(),
and use these timeout in the lpq, lpd and lprm programs.

these stop hung remote printers that accept tcp connections but do
not process jobs from hanging the whole system and letting the sysadmin
have a clue about what is going on with this rogue printer.

- add a -r flag to lpd to allow `of' filters for remote jobs.

i know there are ways around this, but i just don't care.

- add a -f flag to lpf to add missing carriage returns.

useful when printing UNIX files to an, eg, LaserWriter that wants CR's
as well as LF's in raw text.  stair-stepped text is no fun.

- implement child process accounting: we just have a limit on the number
  of children we can have (settable by the sysadmin), and we sleep when
  this number is reached.  this can reduce malicious not-so-malicious
  attacks on the print server by a rogue remote client..

- use setproctitle() where appropriate so the sysadmin has a clue about
  what each of the lpd's here are doing.

this was useful to help diagnose a problem (that the above child process
accounting change reduces the lossages of) where a rogue client was
attempting "lpq" operations on one stuck queue in rapid succession,
causing the lpd server to be extremely slow, due to the large number
of lpd processes running.


i have been running these changes in production for about a year.
1999-12-07 14:54:44 +00:00
mrg 23b9fac082 delint and other cleanups. 1999-09-26 10:32:27 +00:00
mrg 32f519716b - 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
1998-07-06 06:56:06 +00:00
mycroft e8018f6da9 Use S_IS*(), not S_IF*. 1997-10-19 19:40:21 +00:00
mrg 1bb06f8aab fix alpha compile warnings. 1997-10-05 16:45:43 +00:00
mrg fe7ed7ce37 - 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()
1997-10-05 15:11:58 +00:00
mrg e6a91a0997 merge 4.4 lite2 1997-10-05 11:52:17 +00:00
mikel 1b1fe0b84e use <sys/cdefs.h> __COPYRIGHT and __RCSID macros
garbage-collect old set_ttyflags() and ctime() declarations
1997-07-17 05:51:18 +00:00
mikel 1e7f2b7da9 fix printf formats and implicit comparisons (gcc -Wall) 1997-07-10 06:28:58 +00:00
lukem cd08442b0d use O_EXCL with O_CREAT when making the tempfile 1997-03-22 03:20:38 +00:00
mrg 077acf5088 remove unsafe calls to strcpy(), strcat(), and sprintf(). some KNF. 1996-12-09 09:57:40 +00:00
jtc d7eb41bd8e Changed to not use a compiled in table of baud rates. Evidently
there are some PC/Mac oriented devices that use non-standard speeds,
furthermore that's just not the way we do things anymore.

"Bad" baud rates are no longer caught with their own error message,
but the condition will still be diagnosed when the tcsetattr() fails.
1996-06-30 23:55:49 +00:00
jtc 678bd1b2eb Use XS, not XC, flags when setting tty flags.
From Brook Milligan <brook@trillium.nmsu.edu>.
1996-04-30 00:07:00 +00:00
pk f54b84516b Add RCSIDs 1995-11-15 22:48:07 +00:00
hpeyerl 8e41ca8016 -- 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>
1995-10-03 15:02:17 +00:00
mycroft abd8200176 Reset group list before execing child, as pointed out by Mike Pritchard. 1995-04-14 19:23:43 +00:00
cgd f881d1d4fe clean up that import. no rcsids yet. 1994-05-18 01:25:37 +00:00
cgd ea2217de0a off_t exp. 1994-03-27 09:13:06 +00:00
cgd d3c09b81a7 fix from John F. Woods <jfw@ksr.com>: don't clobber page width specified
in printcap file.
1994-03-07 05:38:21 +00:00
mycroft e9d867ef50 Add RCS identifiers. 1993-08-01 17:54:45 +00:00
cgd 61f282557f initial import of 386bsd-0.1 sources 1993-03-21 09:45:37 +00:00