Commit Graph

50 Commits

Author SHA1 Message Date
itojun f714bfb0d8 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
2000-08-09 14:28:50 +00:00
matt 3ab02a8704 More #include <stdlib.h> string, etc. cleanup 2000-07-04 20:27:35 +00:00
itojun 4be926fbb8 allow lp=port@host again. PR9975 from Andreas Gustafsson. 2000-04-25 02:34:49 +00:00
itojun e738bb5642 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.
2000-04-24 02:53:05 +00:00
mrg dd28a6c6dd make scandir(3)'s 3rd argument take a function that takes a *const*
struct dirent *, rather than non-const.  this makes scandir(3) the
same as the scandir implementations in libiberty and glibc, and the
select function has no need to modify the dirent.
2000-04-16 14:43:56 +00:00
itojun 0c281f2bda 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>
2000-02-18 03:53:16 +00:00
itojun 33ba3a0f18 IPv6 support, using rcmd-family funciton added.
NetBSD PR: 9050
From: Feico Dillema
2000-01-27 05:39:50 +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
jdolecek b86257129c 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 ....
1999-12-05 22:10:57 +00:00
mrg 23b9fac082 delint and other cleanups. 1999-09-26 10:32:27 +00:00
lukem 7e1c62baf8 set MKLINT=no. noted by NAKAJIMA Yoshihiro <nakayosh@kcn.ne.jp> 1999-03-13 23:17:46 +00:00
lukem dcab0210a0 convert from NOxxx= to MKxxx=no.
include <bsd.own.mk> if testing a MKxxx variable.
1999-02-13 02:54:17 +00:00
frueauf c548010b99 Fix pr 5071 better after feedback from the Originator Havard Eidnes. 1998-09-14 21:23:07 +00:00
frueauf 988c143116 Add (ugly?) code to prevent core dump as described in pr 5071 by Havard Eidnes.
XXX Maybe someone with more taste and understanding should have a look
XXX at this? At least I prefer this over the solution provided in the pr.
1998-09-14 11:52:21 +00:00
lukem 786b86d71b use AF_LOCAL instead of AF_UNIX 1998-07-18 05:04:35 +00:00
msaitoh 4944940fcf Declare ints, too, don't default them. 1998-07-09 18:32:52 +00:00
mrg c0aa4ce503 oops, missed this in gethostname sweep. 1998-07-07 03:36:53 +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
lukem fbafdc25f8 use memcmp/memset/memmove instead of bcmp/bzero/bcopy 1997-10-18 08:52:17 +00:00
mycroft 3ec2ebdb68 GC some garbage variables. 1997-10-11 20:25:53 +00:00
veego e288b27b29 Don't install this libraries, we only this during the build. 1997-10-11 19:42:34 +00:00
lukem 0acf0ef008 only compile common_source/* once (25% faster), remove unused printcap.c 1997-10-10 09:26:35 +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 cf3fe2a0b6 oops; did not mean to import these. 1997-10-05 12:35:50 +00:00
mrg e6a91a0997 merge 4.4 lite2 1997-10-05 11:52:17 +00:00
mrg e5d28dbbe3 lite-2 1997-10-05 11:20:29 +00:00
mikel ad1d686121 make explicit comparisons to NULL (gcc -Wall) 1997-07-10 06:19:53 +00:00
mikel 764d9a9d44 fix typos 1997-07-10 06:18:52 +00:00
thorpej b6c41d0d18 getc() returns an int, not a char. 1997-04-19 06:33:13 +00:00
mycroft 16cc2efbbd Change _PATH_MASTERLOCK to /var/run/lpd.pid. 1997-03-14 01:17:34 +00:00
cgd 72b0837ae3 fix one more goofup in the buffer safety changes: snprintf() should be
called with enough space for the trailing NUL, because it (unlike strn*())
always NUL-terminates.
1997-03-10 06:13:16 +00:00
cgd 7262daa78a fix two bugs pointed out by Paul Sijben <Paul.Sijben@huygens.org>:
(1) incorrect check on length of data being written (fix provided by
    Paul Sijben <Paul.Sijben@huygens.org>), and
(2) inadequate buffer (too small) for data being sent to remote meant
    that properly-formed messages couldn't be created, so job removal
    didn't work properly.
1997-03-08 22:50:52 +00:00
mrg 077acf5088 remove unsafe calls to strcpy(), strcat(), and sprintf(). some KNF. 1996-12-09 09:57:40 +00:00
jtc 21908ddbd5 merge in changes from 1.1 release branch 1995-11-28 19:43:04 +00:00
pk f93236c806 Add RCSIDs. 1995-11-15 22:23:06 +00:00
pk 0e9c04fab0 Fix garbled lines (from Thomas Eberhardt; PR#1756).
Add RCSId.
1995-11-15 22:20:33 +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 2f2adba37a Clean up deleted files. 1994-05-18 01:25:36 +00:00
cgd 2847add277 clean up that import. no rcsids yet. 1994-05-18 01:25:21 +00:00
cgd 73a5ffdf98 need unistd.h 1994-05-18 00:54:02 +00:00
cgd 725ed31e82 copyright foo 1994-05-17 04:13:48 +00:00
cgd ea2217de0a off_t exp. 1994-03-27 09:13:06 +00:00
jtc 3ccb82400b Upgraded to use <dirent.h>. 1993-12-08 00:47:01 +00:00
cgd d29e38973e bzero structs before using; fix from theo 1993-11-10 04:36:04 +00:00
mycroft e9d867ef50 Add RCS identifiers. 1993-08-01 17:54:45 +00:00
deraadt 9397be3182 make lpd know about modern ar files rather than the old ones.
Like, if it's going to want to make an effort, at least do it right.
1993-05-25 12:08:42 +00:00
deraadt 6dc90e5291 lpr should not access a_magic directly. That's what the N_BADMAG() macro
in a.out.h is there for!
1993-05-25 11:55:30 +00:00
mycroft c1fd012d95 Cleanup for GCC 2. 1993-04-18 20:01:35 +00:00
cgd 61f282557f initial import of 386bsd-0.1 sources 1993-03-21 09:45:37 +00:00