Commit Graph

334 Commits

Author SHA1 Message Date
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
simonb fd4ede242b Don't declare 'extern opt*' getopt variables. 2000-04-14 06:26:52 +00:00
mrg 3f207f4f5a - fix usage message to current reality.
- pull over "lpd [port]" code from freebsd's lpr code.
- use posix signal handling.
2000-04-10 08:09:33 +00:00
itojun 7b48263c7b (rcmd.c) to make Zoularis happier, pass sa_len separately from sockaddrs.
this changes function prototype for __ivalid*.
This commit breaks binary compatibility for __ivalid*.  I believe this can be
forgiven due to the following:
- this is not really exported function.  no function prototype is in headers.
  function name starts with underbars.  No third-party applications are
  expected to use it.
- the function was introduced very recently, when rcmd.c was made IPv6-ready.
- the only customer in NetBSD tree is lpd.

(lpd.c) sync with rcmd.c change.
2000-02-24 06:33:47 +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
mjl 8515b446a0 Fix null terminating the wrong buffer curtesy of similar variables
mixed up. Seemed to never have any ill effect, but then...
Noted by Tetsuya Furukawa in FreeBSD PR/15604.
1999-12-23 02:10:07 +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 585454b2f2 xref setsockopt (from freebsd) and hosts.equiv. 1999-12-11 01:59:43 +00:00
mrg 2e2dfe5c71 tsk. tsk. document new features i added. 1999-12-10 23:49:03 +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 5986e9b6ee main(): g/c variable errs accidentaly introduced in last commit, rename
'i' to 'opt'
1999-12-05 22:22:05 +00:00
jdolecek 0e29a42af3 Change the formatting of output so that entries with host:user longer than
24 characters would be displayed correctly.
Fixes bin/8880 by Brian Stark <bstark@uswest.net>.

While here, convert code to use getopt(3) and do some const poisoning.
Also g/c variables uid and euid, they are no longer needed after
the split of ../common_source/common.c
1999-12-05 22:18:40 +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
simonb 299578ebd5 Spell "privilege" correctly (correct spelling from Jonathan Stone). 1999-08-16 02:59:22 +00:00
mycroft 68d6f4bf44 Remove spurious .ne's. 1999-03-24 06:27:49 +00:00
garbled d1407362ba More and more .Os cleanups. .Os is defined in the tmac.doc-common file,
so we shouldn't override it with versions in the manpages.  Many more to
come.
1999-03-22 18:43:46 +00:00
lukem 7e1c62baf8 set MKLINT=no. noted by NAKAJIMA Yoshihiro <nakayosh@kcn.ne.jp> 1999-03-13 23:17:46 +00:00
erh 0f61c6801e Add missing .El line. 1999-03-10 08:17:35 +00:00
mycroft d77575d3c8 Clean up SYNOPSIS formatting. 1999-03-07 11:58:22 +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
mycroft 1f86e5830d const poisoning. 1998-07-27 00:52:00 +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 18ae3abbcd fix "-s" option 1998-07-07 17:05:28 +00:00
mrg c0aa4ce503 oops, missed this in gethostname sweep. 1998-07-07 03:36:53 +00:00
mrg 33c0bbba35 add "lp -s" switch, from darcy@druid.net in pr#5713. document "lp -s" and "lp -o" 1998-07-07 02:01:37 +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
fair dc026e0515 Change occurrences of "UNIX" to .Ux or .At as appropriate. 1998-04-28 06:00:51 +00:00
christos 8f09e5bcdb Use obj dirs 1997-12-21 15:53:38 +00:00
lukem 0a94f4f077 use CPPFLAGS instead of CFLAGS 1997-10-25 06:57:53 +00:00
scottr 94cf433266 Add support for DTR/CTS flow control, from Bill Studenmund. 1997-10-20 08:07:47 +00:00
mycroft e8018f6da9 Use S_IS*(), not S_IF*. 1997-10-19 19:40:21 +00:00
lukem fbafdc25f8 use memcmp/memset/memmove instead of bcmp/bzero/bcopy 1997-10-18 08:52:17 +00:00
lukem f5bf267d90 enable WARNS=1 by default, but disable in unclean 3rd party code 1997-10-18 06:42:25 +00:00
lukem 4d10189f4c fix race condition when building libcommon with make -j 1997-10-16 05:10:14 +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 38811f7fea document -d, -s. remove bogus #port. fix getopt(). 1997-10-09 07:58:39 +00:00
mrg 1bb06f8aab fix alpha compile warnings. 1997-10-05 16:45:43 +00:00
mrg d66fe73851 in rcleanup() don't unlink() the dfname if it contains a /. noted
by matt power <mhpower@mit.edu>.
1997-10-05 15:21:46 +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 90778e67aa add rcsid, use FILES, etc., in Makefile. 1997-10-05 12:48:35 +00:00
mrg bf7db08c40 freebsd's lp frontend for lpr 1997-10-05 12:40:42 +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 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 fff865d146 use <sys/cdefs.h> __COPYRIGHT and __RCSID macros
include <arpa/inet.h> for inet_ntoa() prototype, nuke local declaration
1997-07-17 05:49:13 +00:00
mikel 95abafa1a6 use <sys/cdefs.h> __RCSID macro, add prototype for local c_key function 1997-07-17 05:46:51 +00:00
mikel c27996f625 use <sys/cdefs.h> __RCSID macro 1997-07-17 05:44:32 +00:00
mikel 48f58872a4 xref pac(8) not nonexistent pac(1), sort xrefs 1997-07-16 05:54:25 +00:00
mikel 712b20e8f2 include <unistd.h> for get{,e}uid() prototypes 1997-07-11 06:43:51 +00:00
veego ff9b739e1a Add #include <stdio.h> for struct FILE. 1997-07-10 10:44:48 +00:00
mikel 1e7f2b7da9 fix printf formats and implicit comparisons (gcc -Wall) 1997-07-10 06:28:58 +00:00
mikel 3bf6872439 index array with int, not char 1997-07-10 06:26:44 +00:00
mikel 31e6ca8cc3 add prototypes for ksearch(), msearch(), and __ivaliduser() 1997-07-10 06:24:55 +00:00
mikel 4a711f6dd1 add parens (gcc -Wall) 1997-07-10 06:21:51 +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
mikel b38a221a9e oops 1997-07-10 06:09:27 +00:00
mikel 0b0a21a5e8 clarify assignments used as conditionals (gcc -Wall) 1997-07-10 05:38:54 +00:00
mikel 7d65d1af46 clarify conditional in for-loop (gcc -Wall) 1997-07-10 05:34:48 +00:00
jtc a6d081153f Changed pathnames to correspond to current reality. 1997-07-09 02:34:42 +00:00
jtc afdf5dcf23 Changed /var/spool/* to /var/spool/output/*, to be consistant with reality. 1997-07-09 02:04:26 +00:00
gwr 10e180cc49 Back out the .PATH.c changes. The .depend problem (and others)
will be fixed using the new .NOPATH make feature instead.
1997-05-08 21:11:01 +00:00
gwr 012e528f2e Use .PATH.c: ... 1997-05-06 20:44:56 +00:00
thorpej b6c41d0d18 getc() returns an int, not a char. 1997-04-19 06:33:13 +00:00
lukem cd08442b0d use O_EXCL with O_CREAT when making the tempfile 1997-03-22 03:20:38 +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
mouse ee6a5b2cd6 alternate -> alternative, per PR 2643 1997-03-08 14:24:19 +00:00
mrg 077acf5088 remove unsafe calls to strcpy(), strcat(), and sprintf(). some KNF. 1996-12-09 09:57:40 +00:00
explorer 37449d45b0 Fix the get-a-shell hole, even if we are not currently open to that attack.
(1.2 release is, however, and this should be pulled up and released ASAP)

The previous version (1.11) checked into current limits the duration of
setuid-root periods much more than the 1.2 released version does, so the
attacker DID get a shell, but it was not a root shell.
1996-10-25 22:07:53 +00:00
perry d8e1329af8 close out pr 2771, which added a -s ("secure") flag to lpd -- makes
lpd run in a mode where the it listens only to the local unix domain
socket and not to the network. Changes are similar but not identical
to the supplied patches.
1996-09-21 15:57:21 +00:00
explorer 66917416dd Fix printing over non-root-exported NFS at least.
The problem here is setuid(euid) is used far too much.  Since I removed
many of these calls, and added no new ones, I do not think this weakens
security.  In fact, it quite likely improves it quite a bit, since
access() is called as the real userid, and the file is opened for printing
as the real userid rather than the (setuid-root) effective one.
1996-08-10 20:09:19 +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
pk fee478451f `/dev/printer' => `/var/run/printer' (PR#2552).
Also, change `.Os 4.2' => `.Os 4.4' (this man page is from 4.4 lite), and
for now, refer to the "BSD 4.3 Line printer manual", because that is what
we now have in lpr/SMM.doc (SMM.doc needs updating too).
1996-06-16 22:36:59 +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
mrg d28f8743af Stylistic changes. 1996-04-24 14:54:06 +00:00
jtc cac62b2d65 Be pedantic, main() returns int in C. 1996-03-21 17:56:15 +00:00
hpeyerl 8c4481f80c More descriptive message for printer status. Addresses PR #509. 1996-01-14 17:25:21 +00:00
pk 3cf040d518 Fix typo (Noriyuki Soda; PR#1926). 1996-01-13 23:18:15 +00:00
jtc 21908ddbd5 merge in changes from 1.1 release branch 1995-11-28 19:43:04 +00:00
pk a29aff2565 Id -> NetBSD 1995-11-15 22:55:41 +00:00
pk f54b84516b Add RCSIDs 1995-11-15 22:48:07 +00:00
pk b965d4ffe4 Add RCSIDs 1995-11-15 22:27:27 +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
mycroft 49d5e89682 Update from kernel source. 1995-10-05 08:58:21 +00:00
mycroft 1e1d370eec Fix typos. 1995-10-05 08:23:18 +00:00
mycroft 2347ccba1b Fix various parity and character size bugs from the termios transition. 1995-10-05 08:20:20 +00:00
mycroft fde6ad0815 Fix a couple of things broken in the termios transition. 1995-10-05 08:01:29 +00:00
mycroft dfd0b8b273 Fix type errors. 1995-10-05 07:47:32 +00:00
mycroft 0231229adc Fix typo in previous. 1995-10-05 07:42:30 +00:00
mycroft 780c7fbe39 Change to use SET(), CLR(), and ISSET() macros. 1995-10-05 07:39:39 +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
jtc a0e044841b Use consistant style of quotes; PR #1194 1995-07-07 22:26:11 +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 d8806814a6 specify man pages the new way. 1994-12-22 11:32:57 +00:00
pk d88e845b42 Correct character array declaration (bug-report bin608). 1994-12-11 16:07:22 +00:00
cgd 138fcd8327 deal with new share/doc strategy 1994-06-30 05:33:30 +00:00
cgd 5b029eb9a8 update for new doc-make/install strategy 1994-06-25 05:57:47 +00:00
cgd 3e603ff386 clean up that import. no rcsids yet. 1994-05-18 01:26:07 +00:00
mycroft fc871868c1 Clean up deleted files. 1994-05-18 01:26:05 +00:00
cgd f881d1d4fe clean up that import. no rcsids yet. 1994-05-18 01:25:37 +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
mycroft ec7c1628df Clean up deleted files. 1994-05-18 01:25:20 +00:00
cgd 9c7878f37d clean up that import. no rcsids yet. 1994-05-18 01:25:17 +00:00
cgd 64c78025ff lpr from 4.4-Lite 1994-05-18 01:12:10 +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 44570762a9 header file foo 1994-04-21 18:53:47 +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
cgd 080c5b9220 Fix for symlink-related security hole. from comp.security.unix. 1994-03-07 04:07:52 +00:00
cgd 5b823d2a09 don't need -lutil 1994-01-28 00:52:03 +00:00
jtc 2a4121e39d Fix spelling errors 1994-01-14 16:22:25 +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
mycroft c3e42d1c64 Add RCS indentifiers. 1993-08-01 07:22:47 +00:00
mycroft b465cf4697 Add RCS identifiers. 1993-07-30 22:11:51 +00:00
mycroft ec956c81af And just one more. 1993-06-15 23:41:53 +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