Commit Graph

119 Commits

Author SHA1 Message Date
David Malone
cbdbb7252f Under some unusual conditions, inetd can leak a open file discriptor
into a child process. Rather than closing the discriptors manually,
mark all discriptors as close-on-exec.

PR:		47694
Submitted by:	Max Okumoto <okumoto@ucsd.edu>
Obtained from:	NetBSD
MFC after:	2 weeks
2003-02-23 16:54:19 +00:00
David Malone
c40f2eef16 After calling login_getclass, be sure to call login_close so that
we don't leak memory. Only one of these two cases (reconfig) actually
causes a leak because the other is usually followed by an exec.

PR:		46845
Reviewed by:	David Wang <dsw@juniper.net>
MFC after:	2 weeks
2003-02-23 16:49:14 +00:00
Hajimu UMEMOTO
6431ecd0a1 The tcp_wrappers function `fromhost()' can fail. In such
cases, the `struct sockaddr' will not be allocated.

Reported by:	nectar
MFC after:	2 days
2003-02-13 17:08:23 +00:00
Robert Watson
42c0e331cd Using LOGIN_SETALL &~LOGIN_SETMAC to avoid setting the MAC label improperly,
rather than specifically setting the process priority and resource class;
otherwise, we improperly set other aspects of the login class.  We have
a bit more to do here, but the proper fix will probably involve breaking
out MAC labels from the login class at some point, as well as further
clarifying the logic here.

Pointed out by:	kuriyama, max
2003-01-16 03:41:57 +00:00
Robert Watson
15e90ad4c5 For now, set only the resource limits and process priority associated
with a class, rather than all aspects of the class when switching
classes for an inetd service.  Because we hard-code /daemon in the
current inetd implementation, using SETALL has unfortunate side-effects
involving the MAC code, and potentially other credential related
settings in the future.  This change maintains the DoS-resistent
aspects of the class behavior, which is all that is promised in the
inetd man page.

A larger set of diffs providing more pluggability and configurability
was deferred for this more simple approach in the short term.

Reviewed by:	ache
Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, Network Associates Laboratories
2003-01-08 17:10:11 +00:00
Garrett Wollman
cd9a4d5d7a Add used #include <limits.h>. 2002-10-27 17:46:53 +00:00
David Malone
7718f45c22 When printing the wait status, break it down into a signal and a exit status.
PR:		41912
Submitted by:	Aaron Smith <aaron@mutex.org>
MFC after:	2 weeks
2002-09-04 21:00:45 +00:00
David Malone
85d28cb43f Swap sense of no_v[46]bind variables and rename as v[46]bind_ok -
this avoids some double negatives which are a bit difficult to
parse.

Always tread v[46]bind{,_ok} as booleans.
2002-09-04 20:31:53 +00:00
David Malone
6d4129d240 Fix parsing of unix domain entries after addition of IPv6 RPC support.
PR:		40771
Submitted by:	Jean-Luc Richier <Jean-Luc.Richier@imag.fr>
2002-09-04 20:15:20 +00:00
David Malone
60c1ef970b Don't initialise policy, v4bind and v6bind where the variables are
declared - it was bad style and caused a bug. v[46]bind need to be
reset whenever we go to the "more:" label.

Jean-Luc and I came up with this patch independently, so it had
better be right!

PR:		40771
Submitted by:	Jean-Luc Richier <Jean-Luc.Richier@imag.fr>
2002-09-02 20:07:14 +00:00
David Malone
d0c55c69c9 tpc -> tcp in an error message.
PR:		40771
Submitted by:	Jean-Luc Richier <Jean-Luc.Richier@imag.fr>
2002-09-02 20:00:46 +00:00
David Malone
fa11816b52 Clear up a few warnings (unused variable, rpc versions are usigned so use %u,
rename a parameter to avoid shadowing a global).

MFC after:	1 month
2002-09-02 19:58:15 +00:00
Hajimu UMEMOTO
09b1c35707 Add capability for limiting the maximum number of simultaneous
invocations of each service from a single IP address.

Requested by:	matusita
Reviewed by:	dwmalone
Tested by:	matusita on snapshots.jp.FreeBSD.org
MFC after:	2 weeks
2002-08-07 17:03:14 +00:00
Hajimu UMEMOTO
fc99a00c7f use IPV6_V6ONLY instead of non standard IPV6_BINDV6ONLY.
MFC after:	1 week
2002-07-22 15:22:53 +00:00
Alfred Perlstein
d14ca883cb add support for rpc IPv6 (rpc/udp/46 ...)
Submitted by: Jean-Luc Richier <Jean-Luc.Richier@imag.fr>
2002-07-15 19:09:33 +00:00
Juli Mallett
0ec563a548 Replace the SWAP(var0,var1) macro with SWAP(type,var0,var1) and use it as
is appropriate to avoid using typeof/__typeof__.  It is worth noting that
SWAP() is only ever used to swap pointer values so 'void *' assumptions would
have been acceptable, but I'd gladly pay you tuesday for a cheeseburger^W
cleaner interface today.

Poked into submission by:	bde
2002-06-22 10:44:47 +00:00
Juli Mallett
d3a4920c06 Unused macro. 2002-06-22 10:34:08 +00:00
Juli Mallett
35ea397030 __FBSDID() strategic insertion. 2002-06-21 11:52:59 +00:00
Juli Mallett
edb616bbdc Kill __P, yuck. 2002-06-21 11:42:37 +00:00
Juli Mallett
2306f8e98f Mark unused variables __unused.
Built standalone, inetd(8) is WARNS=5 clean, WARNS=6 if you ignore %m fits.
2002-06-21 11:40:03 +00:00
Juli Mallett
0e23eb871d Use __typeof__ instead of typeof. 2002-06-21 11:25:11 +00:00
Juli Mallett
081713dc5b ANSI prototypes via protoize(1). 2002-06-21 11:18:42 +00:00
John W. De Boskey
24aaa74c83 Log invalid config entries. Make the -d option actually log to
the terminal(-d fix from dwmalone).

Approved by:	dwmalone
MFC after:	2 weeks
2002-05-26 04:43:26 +00:00
Hajimu UMEMOTO
89511d9db3 Make compilable without -DINET6. 2002-05-08 17:20:08 +00:00
Hajimu UMEMOTO
7f59d20d17 Log address family of a connection.
Requested by:	matusita
Reviewed by:	matusita
2002-05-08 16:39:58 +00:00
David Malone
20e1eb2130 o Remove old setproctitle.
o Mark unused variables.
o Set WARNS?=2
o Results in no code changes.

Submitted by:	Mike Barcroft <mike@q9media.com>
2001-07-17 07:12:57 +00:00
David Malone
b585f768e1 Fix most of the warnings given by WARNS=2. 2001-06-24 09:20:07 +00:00
David Malone
1c8d1174b7 Give inetd the ability to manage unix domain sockets. Details of
how to use this feature are in the man page. This is based on work
by Lyndon Nerenberg.

(The only difficult part about this patch is the fact that you
can't fchown a unix domain socket, which means the sockets must be
put in a secure directory).

Reviewed by:	dillon
2001-06-16 18:54:54 +00:00
David Malone
d57dbd1615 Get rid of se_ctladdrinitok, which doesn't do anything and seemes
to have been accidently imported when ipv6 support was added to
inetd.

Approved by:	ume
2001-06-06 20:00:42 +00:00
Hajimu UMEMOTO
a07ae7a1d8 Recently, other BSDs had faith support in inetd. Though our inetd has
it already, their syntax is not compatible with ours.  It will confuse
users.  So, we have compatibility with their syntex.

Approved by:	dwmalone
Obtained from:	NetBSD
2001-05-31 10:09:36 +00:00
David Malone
1c3b5f2290 Various cleanups of inetd: Avoid shadowing variables, use socklen_t
instead of ints, don't cast to char *, clear up some remote name
handling code which had become a little odd.

Should result in no functional changes.
2001-01-22 23:19:30 +00:00
David Malone
6ef18ba88d Don't mention /etc/protocols in inetd documentation or comments, as inetd
doesn't actually use it.

PR:		24307
Submitted by:	opentrax@email.com
2001-01-22 23:11:02 +00:00
David Malone
13f1579a17 Tidy up some prototypes:
make sure there is exactly one prototype for each function,
        use K&R style definitions everywhere to match dominant style,
        make flag_signal take an int to avoid problems if we have
                ANSI prototypes and K&R definitions.
2000-12-03 11:32:26 +00:00
David Malone
caf6015598 Fix two typos in comments.
PR:		22268
Submitted by:	Daniel S. Lewart <d-lewart@uiuc.edu>
2000-10-24 18:47:57 +00:00
David Malone
f27a3b3e41 Don't leak a file discriptor if a service we've called accept() for
loops.

Submitted by:	Ian Dowse <iedowse@maths.tcd.ie>
2000-10-21 09:43:12 +00:00
David Malone
00205ff618 Make reconfiguring an external service as builtin service work.
PR:		21650
Submitted by:	ben
Tested by:	dan@ducky.nz.freebsd.org
2000-10-02 12:08:27 +00:00
David Malone
1b65d153ee Explain "-c" option more exactly and state the default in the man
page.

Add ability to run "inetd -R 0" to disable the default connection
per minute limit of 256 connections. Document this in man page.

Don't use maxchild as a boolean - instead check if it is greater
than zero.

Reviewed by:	sheldonh
Based on a patch by:	Alexander Langer <alex@big.endian.de>
2000-08-03 15:45:38 +00:00
David Malone
8acc38283a Sleep for a second after tcp wrappers rejects a connection, so we
don't traumatise the parent inetd.

Requested by:	wietse@porcupine.org
Approved by:	markm
2000-07-31 13:10:52 +00:00
Hajimu UMEMOTO
612c58996e Make sure to use IPv4 mapped IPv6 address when mapped address is
requested in /etc/inetd.conf.

Reviewed by:	shin
2000-04-02 16:11:14 +00:00
Yoshinobu Inoue
1a0760dd60 Make inetd compilable without INET6.
Approved by: jkh

Submitted by: jhb
2000-03-11 11:28:08 +00:00
Yoshinobu Inoue
58af74e6b8 Fix broken inet logging when wrapping options are not specified.
Approved by: jkh

Submitted by: Ben Smithurst <ben@scientia.demon.co.uk>
2000-02-22 00:27:53 +00:00
Yoshinobu Inoue
ef9c54c751 Fix inetd wrong AF check for RPC services
Incorrect Address Family check is done for RPC services, and
   fail to initialize it.
   The error check is replaced to new one, which checks if IPv4
   bind is enabled or not. (It is disabled when IPv6 numeric
   addr is specified for -a bind address option.)

An review reqeust is once sent to des, but he quit MAINTAINER.

Approved by: jkh
2000-02-03 09:54:49 +00:00
Yoshinobu Inoue
49de1b5759 Fix inconsistent debug output. (syslog -> warnx)
Specified by: sheldonh

Reviewed by: des
2000-01-28 20:06:15 +00:00
Yoshinobu Inoue
f669e3af26 Avoid verbose error messages when ipsec initialization for sockets failed
usually, and print it only when debug is enabled.
(This always happens when kernel is configured without IPSEC option.)
2000-01-27 14:46:15 +00:00
Yoshinobu Inoue
0cac72f42c several tcp apps IPv6 update
-inetd
 -rshd
 -rlogind
 -telnetd
 -rsh
 -rlogin

Reviewed by: freebsd-arch, cvs-committers
Obtained from: KAME project
2000-01-25 14:52:10 +00:00
Philippe Charnier
e2b7d85745 Do not dot terminate sentences inside FILES section. Lowercase
inside error messages.
2000-01-23 20:17:41 +00:00
Peter Wemm
0b8c4709dc Put the listening socket into non-blocking mode before doing an
accept(2).  This is a not really problem on -current as the accept race
is fixed, however it is a MFC candidate for -stable.

This could possibly be slightly more efficient and leave the listening
socket permanently in non-blocking mode, but I wasn't certain that I
could catch all the stream/wait (not nowait) mode implications.
1999-11-17 03:32:05 +00:00
Philippe Charnier
42474ae390 Do not dot or \n terminate syslog string. 1999-10-13 20:22:13 +00:00
Peter Wemm
97d92980a9 $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
Sheldon Hearn
daae13874a Bring two wayward memory allocation failure messages in line with
those featured in the rest of the code.
1999-07-26 06:39:46 +00:00