History log of /freebsd-11.0-release/usr.sbin/inetd/inetd.c
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 303975 11-Aug-2016 gjb

Copy stable/11@r303970 to releng/11.0 as part of the 11.0-RELEASE
cycle.

Prune svn:mergeinfo from the new branch, and rename it to RC1.

Update __FreeBSD_version.

Use the quarterly branch for the default FreeBSD.conf pkg(8) repo and
the dvd1.iso packages population.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

# 302408 08-Jul-2016 gjb

Copy head@r302406 to stable/11 as part of the 11.0-RELEASE cycle.
Prune svn:mergeinfo from the new branch, as nothing has been merged
here.

Additional commits post-branch will follow.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


# 298909 02-May-2016 araujo

Use MAX macro from sys/param.h.

MFC after: 2 weeks.


# 298114 16-Apr-2016 bapt

Use the SOCK_CLOEXEC flags in the socket(2) 'type' attribute instead of
calling fcntl(2)

MFC after: 1 week


# 298111 16-Apr-2016 bapt

Use pipe2(2) to directly set the close-on-exec flags directly

MFC after: 1 week


# 287998 19-Sep-2015 hrs

- Remove unused union p_un.

- Use NI_MAXHOST-long buffer for getnameinfo().
Although INET6_ADDRSTRLEN was designed to hold the longest
IPv6 address in IPv4-mapped address format a long time ago,
getnameinfo() can return scope identifier in addition to it.

MFC after: 1 day


# 287997 19-Sep-2015 hrs

- Fix a crash on a rpc entry when an IPv6 address is explicitly specified
in -a flag.

- Fix a bug that sockaddr_in was used where sockaddr_in6 should have
been used. This was not actually harmful because offsetof(struct
sockaddr_in, sin_port) is equal to offsetof(struct sockaddr_in6,
sin6_port).

MFC after: 1 day


# 281736 19-Apr-2015 eadler

identd: restore memcpy
I should not be committing at 2:30am....

Reported by: pluknet


# 281735 19-Apr-2015 eadler

identd: also zero se_rpc_highvers

Reported by: pluknet


# 281734 19-Apr-2015 eadler

identd: remove redundant zeroing
se_rpc_lowvers was set to 0 twice, so remove one of them
I can not find any other variable which they may have been a typo of.

Reported by: gcc5.1


# 274331 09-Nov-2014 melifaro

Renove faith(4) and faithd(8) from base. It looks like industry
have chosen different (and more traditional) stateless/statuful
NAT64 as translation mechanism. Last non-trivial commits to both
faith(4) and faithd(8) happened more than 12 years ago, so I assume
it is time to drop RFC3142 in FreeBSD.

No objections from: net@


# 245696 20-Jan-2013 zont

- Force inetd to have listen queue size to be set to the value of
kern.ipc.somaxconn instead of hardcoded value 64.

Submitted by: Andrey Ignatov <rdna@rdna.ru>
MFC after: 2 weeks


# 236572 04-Jun-2012 delphij

Replace the use of wall clock time with monotonically increasing
clock. In general, gettimeofday() is not appropriate interface
when accounting for elasped time because it can go backward, in
which case the policy code could errornously consider the limit
as exceeded.

MFC after: 1 week
Reported by: Mahesh Arumugam
Submitted by: Dorr H. Clark via gnn
Sponsored by: Citrix / NetScaler


# 229403 03-Jan-2012 ed

Replace index() and rindex() calls with strchr() and strrchr().

The index() and rindex() functions were marked LEGACY in the 2001
revision of POSIX and were subsequently removed from the 2008 revision.
The strchr() and strrchr() functions are part of the C standard.

This makes the source code a lot more consistent, as most of these C
files also call into other str*() routines. In fact, about a dozen
already perform strchr() calls.


# 201387 02-Jan-2010 ed

ANSIfy some more tools in usr.sbin/.

Most of these tools build with WARNS=6, except for their use of K&R
function declarations.


# 199804 25-Nov-2009 attilio

Avoid sshd, cron, syslogd and inetd to be killed under high-pressure swap
environments.
Please note that this can't be done while such processes run in jails.

Note: in future it would be interesting to find a way to do that
selectively for any desired proccess (choosen by user himself), probabilly
via a ptrace interface or whatever.

Obtained from: Sandvine Incorporated
Reviewed by: emaste, arch@
Sponsored by: Sandvine Incorporated
MFC: 1 month


# 188602 13-Feb-2009 delphij

Sync comment with actual configuration format.


# 171135 01-Jul-2007 gnn

Commit IPv6 support for FAST_IPSEC to the tree.
This commit includes all remaining changes for the time being including
user space updates.

Submitted by: bz
Approved by: re


# 167455 11-Mar-2007 dwmalone

Don't try to apply connection-per-ip rate limiting to unix domain
sockets. Instead of rejecting all unix domain connections when the
-C flag is given, allow them instead. Aragon tested an earlier
version of the patch.

PR: 109315
MFC after: 2 weeks
Tested-by: Aragon Gouveia <aragon@phat.za.net>


# 162305 14-Sep-2006 ru

Removed T/TCP bits.


# 154530 18-Jan-2006 delphij

Revert previous commit for now, which seems to have (re)introduced some
old bugs, as well as some unwanted side effects. I will do more
investigation and fix these issues first.

Pointed out by: dwmalone


# 154503 18-Jan-2006 delphij

Improves and cleanups over inetd(8):

- Teach inetd(8) about kqueue, originally implemented by jmg@[1].
- Use new C99 style function prototypes instead of K&Rs.
- Raise WARNS from 2 to 6

Glanced at by: ru
MFC After: 2 weeks

[1] http://people.freebsd.org/~jmg/inetd.kq.patch,
http://people.freebsd.org/~jmg/inetd.kq.html


# 150214 16-Sep-2005 pjd

Pidfiles should be created with permission preventing users from opening
them for reading. When user can open file for reading, he can also
flock(2) it, which can lead to confusions.

Pointed out by: green


# 149432 24-Aug-2005 pjd

Use pidfile(3) in inetd(8).


# 146187 13-May-2005 ume

NI_WITHSCOPEID cleanup. Neither RFC 2553 nor RFC 3493 defines
NI_WITHSCOPEID, and our getaddrinfo(3) does nothing special
for it, now.


# 135823 26-Sep-2004 stefanf

Prefer C99's __func__ over GCC's __FUNCTION__.

Approved by: dwmalone


# 133249 07-Aug-2004 imp

Per letter dated July 22, 1999 remove 3rd clause of Berkeley derived software
(with permission of addtional copyright holders where appropriate)


# 128501 20-Apr-2004 brooks

Remove the requirement that the "discard" service be defined in the
services database. Now only services that are actually used need to be
defined.

Submitted by: ume


# 127865 04-Apr-2004 dwmalone

The list of (key,value) pairs to request_init is terminated by a 0 key,
not NULL.

Submitted by: Stefan Farfeleder <stefan@fafoe.narf.at>
MFC after: 3 days


# 127301 22-Mar-2004 dwmalone

On startup, warn if inetd's config file doesn't exist. This isn't
exactly the same as patch from the PR, which also exited if the
config file was missing. I didn't use Jeff's patch because I was
worried that some people might start inetd, create the config file
and then HUP inetd.

PR: 60806
Submitted by: Jeff Ito <jeffi@rcn.com>
MFC after: 2 weeks


# 121766 30-Oct-2003 peter

Rather than use the gcc -fno-builtin-log flag, just rename the 'int log'
variable.


# 121559 26-Oct-2003 ume

Since semantic of IPV6_PKTINFO was changed in RFC3542, we need to
use IPV6_RECVPKTINFO instead.

Reported by: someone (I had removed the mail wrongly, sorry)


# 121555 26-Oct-2003 peter

Use -fno-builtin-log so gcc doesn't get ideas about using a math function
to log data. Clean up an unused variable that was hidden by the WARNS?=2
being commented out. Uncomment it now that it compiles cleanly again.


# 117644 15-Jul-2003 dwmalone

Get the connections per minute calculation right. By good fortune
(or possibly testing) the previous formula worked for the default
constants compiled into inetd, but if you recompiled with different
values of CHTSIZE and CHTGRAN the calculation might not have worked.

PR: 54354
Submitted by: Claus Assmann <ca@sendmail.org>
Submitted by: Jose Marcio Martins da Cruz <Jose-Marcio.Martins@ensmp.fr>
MFC after: 5 days


# 111324 23-Feb-2003 dwmalone

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


# 111323 23-Feb-2003 dwmalone

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


# 110802 13-Feb-2003 ume

The tcp_wrappers function `fromhost()' can fail. In such
cases, the `struct sockaddr' will not be allocated.

Reported by: nectar
MFC after: 2 days


# 109349 16-Jan-2003 rwatson

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


# 108951 08-Jan-2003 rwatson

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


# 106054 27-Oct-2002 wollman

Add used #include <limits.h>.


# 102939 04-Sep-2002 dwmalone

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


# 102938 04-Sep-2002 dwmalone

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.


# 102937 04-Sep-2002 dwmalone

Fix parsing of unix domain entries after addition of IPv6 RPC support.

PR: 40771
Submitted by: Jean-Luc Richier <Jean-Luc.Richier@imag.fr>


# 102861 02-Sep-2002 dwmalone

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>


# 102860 02-Sep-2002 dwmalone

tpc -> tcp in an error message.

PR: 40771
Submitted by: Jean-Luc Richier <Jean-Luc.Richier@imag.fr>


# 102859 02-Sep-2002 dwmalone

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


# 101474 07-Aug-2002 ume

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


# 100505 22-Jul-2002 ume

use IPV6_V6ONLY instead of non standard IPV6_BINDV6ONLY.

MFC after: 1 week


# 100127 15-Jul-2002 alfred

add support for rpc IPv6 (rpc/udp/46 ...)

Submitted by: Jean-Luc Richier <Jean-Luc.Richier@imag.fr>


# 98611 22-Jun-2002 jmallett

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


# 98610 22-Jun-2002 jmallett

Unused macro.


# 98563 21-Jun-2002 jmallett

__FBSDID() strategic insertion.


# 98562 21-Jun-2002 jmallett

Kill __P, yuck.


# 98561 21-Jun-2002 jmallett

Mark unused variables __unused.

Built standalone, inetd(8) is WARNS=5 clean, WARNS=6 if you ignore %m fits.


# 98560 21-Jun-2002 jmallett

Use __typeof__ instead of typeof.


# 98558 21-Jun-2002 jmallett

ANSI prototypes via protoize(1).


# 97293 26-May-2002 jwd

Log invalid config entries. Make the -d option actually log to
the terminal(-d fix from dwmalone).

Approved by: dwmalone
MFC after: 2 weeks


# 96227 08-May-2002 ume

Make compilable without -DINET6.


# 96224 08-May-2002 ume

Log address family of a connection.

Requested by: matusita
Reviewed by: matusita


# 79815 17-Jul-2001 dwmalone

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>


# 78694 24-Jun-2001 dwmalone

Fix most of the warnings given by WARNS=2.


# 78356 16-Jun-2001 dwmalone

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


# 77832 06-Jun-2001 dwmalone

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


# 77518 31-May-2001 ume

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


# 71399 22-Jan-2001 dwmalone

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.


# 71398 22-Jan-2001 dwmalone

Don't mention /etc/protocols in inetd documentation or comments, as inetd
doesn't actually use it.

PR: 24307
Submitted by: opentrax@email.com


# 69546 03-Dec-2000 dwmalone

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.


# 67514 24-Oct-2000 dwmalone

Fix two typos in comments.

PR: 22268
Submitted by: Daniel S. Lewart <d-lewart@uiuc.edu>


# 67415 21-Oct-2000 dwmalone

Don't leak a file discriptor if a service we've called accept() for
loops.

Submitted by: Ian Dowse <iedowse@maths.tcd.ie>


# 66544 02-Oct-2000 dwmalone

Make reconfiguring an external service as builtin service work.

PR: 21650
Submitted by: ben
Tested by: dan@ducky.nz.freebsd.org


# 64197 03-Aug-2000 dwmalone

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>


# 64059 31-Jul-2000 dwmalone

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


# 58935 02-Apr-2000 ume

Make sure to use IPv4 mapped IPv6 address when mapped address is
requested in /etc/inetd.conf.

Reviewed by: shin


# 57906 11-Mar-2000 shin

Make inetd compilable without INET6.

Approved by: jkh

Submitted by: jhb


# 57383 22-Feb-2000 shin

Fix broken inet logging when wrapping options are not specified.

Approved by: jkh

Submitted by: Ben Smithurst <ben@scientia.demon.co.uk>


# 56973 03-Feb-2000 shin

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


# 56759 28-Jan-2000 shin

Fix inconsistent debug output. (syslog -> warnx)

Specified by: sheldonh

Reviewed by: des


# 56675 27-Jan-2000 shin

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.)


# 56590 25-Jan-2000 shin

several tcp apps IPv6 update
-inetd
-rshd
-rlogind
-telnetd
-rsh
-rlogin

Reviewed by: freebsd-arch, cvs-committers
Obtained from: KAME project


# 56482 23-Jan-2000 charnier

Do not dot terminate sentences inside FILES section. Lowercase
inside error messages.


# 53256 17-Nov-1999 peter

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.


# 52219 13-Oct-1999 charnier

Do not dot or \n terminate syslog string.


# 50479 28-Aug-1999 peter

$Id$ -> $FreeBSD$


# 49102 26-Jul-1999 sheldonh

Bring two wayward memory allocation failure messages in line with
those featured in the rest of the code.


# 49026 23-Jul-1999 des

Don't match up TCP services with UDP sockets.


# 48991 22-Jul-1999 sheldonh

Relegate the diagnostic descriptor counter to the -DSANITY_CHECK case.


# 48989 22-Jul-1999 sheldonh

Remove unnecessary macro introduced in previous commit.

Also, the previous commit failed to reference:

PR: 12731
Submitted by: dwmalone@maths.tcd.ie (David "Inetd" Malone)


# 48988 22-Jul-1999 sheldonh

Don't leak pipe descriptor to daemons on execv().


# 48985 22-Jul-1999 sheldonh

Signal handlers should use _exit(2) and not exit(3).


# 48981 22-Jul-1999 sheldonh

Move code for all builtin services from inetd.c to builtins.c, including
the Green Piece. :-)

In future, new builtin services are less likely to need to touch the
already tangled inetd.c .


# 48962 21-Jul-1999 sheldonh

Fix for the hosts_options(5) spawn option.

Restore default SIGHUP, SIGCHLD and SIGALRM handlers in forked inetd
processes. This happens to work around the fact that hosts_access()
doesn't (but should) set SIG_IGN as the handler for SIGCHLD while it
handles the spawn option, but it would make sense even if that were
not true.

This does not address the leaking descriptors issue discussed on the
same PR.

PR: 12731
Reviewed by: des
Submitted by: David Malone <dwmalone@maths.tcd.ie>


# 48958 21-Jul-1999 sheldonh

Fix horribly broken comment. The submitter of the associated code sent
me the right comment and I bastardized it. :-(


# 48821 15-Jul-1999 green

By popular demand, ident_stream now takes arguments. Ex:
# This enables the old, fake ident service.
auth stream tcp nowait root internal
# This enables the new, real ident service.
auth stream tcp nowait root internal auth -r
# This enables ~/.fakeid support, too.
auth stream tcp nowait root internal auth -r -f


# 48816 15-Jul-1999 green

This is the working internal ident service. Turn it on by setting
the make variable REAL_IDENT, and ~/.fakeid support can be added
with FAKEID set. Note that the default behavior is the same as
the old behavior.


# 48698 09-Jul-1999 sheldonh

Use the proctitle to indicate that we're busy wrapping a request for a
service. Inetd already uses the process title to indicate that a request
for an internal service is being serviced, so this addition is fairly
orthogonal.

Submitted by: David Malone <dwmalone@maths.tcd.ie>


# 48697 09-Jul-1999 sheldonh

Allow internal and external wrapping to be enabled independantly of
each other. Instead of allowing the -w option to be specified twice,
we now take -w (wrap external) and -W (wrap internal).

Discussed with: markm


# 48467 02-Jul-1999 sheldonh

Allow service alias names from /etc/services to be used when specifying
internal services in inetd.conf .

The inetd(8) manpage used to say that the official name of a service
_must_ be used, yet inetd itself was hardcoded to used a service alias for
the auth service, namely ident!

Rather than change inetd.conf and break existing configurations on next
upgrade, we now allow service aliases as well as official names. This
allows the software to work as expected and still support existing
configurations.

This should not breaking existing wrapped configurations either and the
inetd(8) manpage already states that it is the service name specified in
inetd.conf that is used for calls to hosts_access(3).

PR: 11796
Reported by: Alex Charalabidis <alex@wnm.net>
Approved by: des


# 48383 30-Jun-1999 sheldonh

Ommitted in previous commit message:

Submitted by: David Malone <dwmalone@maths.tcd.ie>


# 48382 30-Jun-1999 sheldonh

Enable wrapping for dgram services and fix logging so that -l really
does log all connections.


# 48315 28-Jun-1999 sheldonh

Sync usage() with the manpage.

Approved by: mpp


# 48309 28-Jun-1999 sheldonh

Fix broken logic: (!wrap || log) -> (!wrap && log) .

Reported by: David Malone <dwmalone@maths.tcd.ie>


# 48279 27-Jun-1999 sheldonh

Add command-line option (-w), specified once to enable wrapping and
twice to enable wrapping for internal wrapping as well. If the option is
not specified wrapping is turned off so that inetd will behave exactly
as it used to before TCP Wrappers was imported.

Change etc/defaults/rc.conf so as to encourage wrapping on new systems.

Clarify the use of TCP Wrappers in the IMPLEMENTATION NOTES of the
manual page.

Approved by: jkh


# 48069 21-Jun-1999 sheldonh

Fix handling of maximum children and connections per minute.

Submitted by: David Malone <dwmalone@maths.tcd.ie>


# 47972 17-Jun-1999 sheldonh

Various fixes for inetd's TCP Wrappers support:

1) Handle forking and non-forking internal services correctly.
Turn on wrapping for internal services because it works now.
2) Preserve server names for each service on HUP.
3) Honour hosts_options(5) severity option.
4) Add IMPLEMENTATION NOTES section to clarify TCP Wrappers
usage and limitations.

This change may cause previously allowed builtin services (e.g. daytime)
to be denied in existing configurations.

PR: 12097
Reviewed by: markm
1)
Reported by: Pierre Beyssac <pb@fasterix.freenix.org>
2)
Submitted by: Masachika ISHIZUKA <ishizuka@ish.org>
3)
Submitted by: David Malone <dwmalone@maths.tcd.ie>


# 47015 11-May-1999 des

Don't stop listening to the signal pipe just because you don't have
anything else to do.

PR: 10468, 11594


# 45588 11-Apr-1999 markm

Fix the "internal" wrapping as well as a nasty bug involving
the daemon name vs the path. Also fix some warnings and improve
the wrapper section of the man page.

Nice debugging work by: Sheldon Hearn


# 45089 28-Mar-1999 markm

Now inetd(8) has direct support for tcp_wrappers! Not working at the
moment is support for the internal serfvices, so these are not
enabled. Volunteers welcome!


# 42311 05-Jan-1999 danny

Make machtime() function unsigned long instead of long.
Reviewed by: phk


# 42250 02-Jan-1999 des

Style cleanups.

Requested by: bde


# 42122 28-Dec-1998 des

Back out rev. 1.42 and 1.43. Apply Graham Wheeler's signal handling patch.

Reviewed by: jkh & eivind
Submitted by: Graham Wheeler <gram@cdsec.com>
PR: bin/8183


# 41833 15-Dec-1998 dillon

Remove signal mask prior to calling exec


# 41685 11-Dec-1998 dillon

Reviewed by: freebsd-current

Fix signal/library corruption by blocking all signals except during
select(). The reported corruption was with reentrancy in the malloc lib.


# 40910 04-Nov-1998 phk

Add an "internal" driver for the "ident" protocol (tcp/113).

It will return "ERROR:HIDDEN-USER" for all requests.

To use it add:
ident stream tcp nowait root internal
to inetd.conf


# 38417 18-Aug-1998 jb

Bruce says that %p is intended to format void pointers only. So use a void *
cast. There are pointers and then there are _pointers_. One day I'll
figure out which are which. 8-)


# 38380 17-Aug-1998 jb

Remove a cast and print the pointer value with %p instead of %x.


# 37856 24-Jul-1998 ache

Add (struct timezone *) cast to NULL for K&R


# 37850 23-Jul-1998 ache

Use NULL as gettimeofday arg instead of 0 cast
Add missing arg to error diagnostic
Print yet one arg of error diagnostic


# 37844 22-Jul-1998 phk

last patch misapplied.


# 37816 22-Jul-1998 phk

This may apply to all known versions of inetd.

For a tcp/nowait connection, inetd invokes accept(2) for
each pending connection; this call returns a file descriptor
associated with the new connection.

Twelve years ago, code was added to inetd to detect "failing
servers". The heuristic that identifies a failing server is
one that has been invoked a large number of times over some
specified interval (e.g., more than 128 ftp services started
in 60 seconds may flag the ftp service as "failing"). These
compile-time constants vary depending on vendor.

The problem is that, when a failing server is detected, the
code neglects to close the file descriptor returned by the
accept(2).

Security-Implications:
I suppose someone with ample free time could orchestrate an
attack buy pummeling services until the inetd process finally
runs out of file descriptors thus rendering inetd useless to
any new connections that require a new descriptor.

PR: 7286
Reviewed by: phk
Submitted by: Jeff Forys <jeff@forys.cranbury.nj.us>


# 36042 14-May-1998 guido

On request of Garrett, ad a way to specify that a service should be
reachable via T/TCP
Reviewed by: Garrett Wollman


# 35948 11-May-1998 bde

Fixed gross errors in previous commit. `sapipe' was used uninitialized
to attempt to unblock SIGCHLD, but we actually want to unignore SIGPIPE.

Obtained from: OpenBSD

Finished conversion from sigvec to sigaction (don't assume that sa_mask
is a scalar...). Didn't convert from sigblock to sigprocmask. Didn't
fix missing error checking for sigaction...


# 35848 08-May-1998 guido

Unblock SIGPIPE before execv(); convert from sigvec to sigaction
Obtained from: OpenBSD


# 35829 07-May-1998 guido

Redo tcpmux stuff. tcpmux handling is now performed after inetd
forks. Furthermore, invalid input for tcpmux does not lead to
an exiting inetd.
This patch is recommended for people running tcpmux (which is NOT
enabled by default)


# 33794 24-Feb-1998 pst

Make maxchild and max child-per-minute default values configurable from
the command line or Makefile.


# 30847 29-Oct-1997 dima

Add possibility to specify maximum number of connections per minute
for a given IP address.
This should be very effective against DoS attacks.


# 30807 28-Oct-1997 ache

Implement group part now, final syntax is:
user[:group][/login-class]


# 30792 27-Oct-1997 ache

Implement login classes sepcification as user[/loginclass]

By default inetd run things with the same limits as from /etc/rc
(daemon class) to not break anything as in good old days.


# 29602 19-Sep-1997 charnier

Use err(3).


# 28907 29-Aug-1997 imp

Remove and odd sleep found by David Holland and posted to -security.
Reviewed by: Theo de Raadt (who put it into OpenBSD)
Submitted by: David Holland <dholland@eecs.harvard.edu>


# 25674 10-May-1997 davidn

login_getclass() -> login_getpwclass().


# 25253 28-Apr-1997 wollman

Condition SO_PRIVSTATE twiddling on the definedness of SO_PRIVSTATE.
(This was done as a #ifdef to keep source compatibility between 2.2 and 3.0.)


# 24428 31-Mar-1997 imp

compare return value from getopt against -1 rather than EOF, per the final
posix standard on the topic.


# 22997 22-Feb-1997 peter

Revert $FreeBSD$ to $Id$


# 22306 05-Feb-1997 julian

The "-a" option for inetd specifies a specific IP address for the
server to bind to. This works until you send it a SIGHUP with a
new service defined ... the new service is bound to INADDR_ANY.

This patch fixes this bug (in both RELENG_2_2 and -current).

This is a 2.2 candidate..(i.e. pure bug fix)

Submitted by: Archie Cobbs (archie@whistle.com)


# 21673 14-Jan-1997 jkh

Make the long-awaited change from $Id$ to $FreeBSD$

This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore. This update would have been
insane otherwise.


# 21640 13-Jan-1997 peter

Implement minimal login class support (ie: does a setusercontext()).
Enabled by defining LOGIN_CAP in Makefile, on by default.


# 19618 10-Nov-1996 julian

Reviewed by: Bill fenner
Submitted by: Archie Cobbs (Archie@whistle.com)

Changes to allow inted to control the number of servers to
start on each service. This is a defence against a denial of service attack
in which the system is made unusable by
an external party. It also allows the behaviour of
small memory systems to be more accuratly predicted, by
bounding the extent to which processes can multiply.


# 19617 10-Nov-1996 julian

Reviewed by: Bill fenner
Submitted by: Archie Cobbs (archie@whistle.com)

changes to make inetd compile cleaner under -Wall


# 19298 01-Nov-1996 alex

Fix incorrect length argument to memset() function. Closes PR#1937.

Submitted by: Archie Cobbs <archie@whistle.com>


# 19237 28-Oct-1996 joerg

Do not modify a malloc()ed pointer; instead, use memmove().

Detected by: phkmalloc - AJ :)


# 17482 09-Aug-1996 julian

Reviewed by: various
Submitted by: archie@whistle.com

changes to allow inetd to bind to a single interface
for more complicated options see xinetd in ports.

Obtained from: whistle.com


# 17197 17-Jul-1996 dg

Increased listen() queue-depth limit to 64.


# 13956 07-Feb-1996 wollman

Call setsockopt(SO_PRIVSTATE) to renounce SS_PRIV on all the sockets
we create. (Nothing being called from inetd should use it anyway,
but you can never be too careful.)

Translate the man page back into -mdoc.


# 13142 01-Jan-1996 peter

Make inetd use setproctitle from libutil instead of it's own version.

The old code can probably still be compiled with #define OLD_SETPROCTITLE


# 12024 03-Nov-1995 peter

Workaround for the setlogin()-in-same-session-as-inetd bug.

This causes:
1: inetd to clear it's getlogin() name at startup (in case the sysadmin
logged in and su'ed to root and restarted inetd)
2: inetd to start each spawned process in it's own session.
3: inetd to call setlogin() on non-root processes (eg: uucp for uucico)
4: log failures more extensively

This means that root spawned processes from inetd remain responsible for
setting their login name if they change their uid. (eg: rshd, login, etc).

If they do not do so, it is safer for them to have no "login name" than a
wrong one (like "root") because the getlogin() system call is documented
as "secure" on 4.4BSD. inetd when started from /etc/rc would have no login
name anyway, so this isn't really a change - it's making it consistant with
the bootup state...

The setsid() change *may* cause something to break that is doing a setsid()
itself and checking the result - it will fail now because it's already been
done. The consensis seems to be that this is unlikely. David G. thinks
this is acceptable as it is cleaner from an architectural point of view.


# 11933 30-Oct-1995 adam

Implement simple quoting for command args.
Previously "abc xyz" became 2 args split at the space.


# 11447 12-Oct-1995 wollman

Record PID in /var/run/inetd.pid and document same.


# 9202 11-Jun-1995 rgrimes

Merge RELENG_2_0_5 into HEAD


# 8857 30-May-1995 rgrimes

Remove trailing whitespace.


# 5182 21-Dec-1994 wollman

Disable UDP service looping attack.


# 2659 11-Sep-1994 csgr

- increase TOOMANY, in line with 1.x
- add logging option from 1.x


# 2657 11-Sep-1994 csgr

Bring in handling of RPC services from 1.x
(Guess who forgot to replace his inetd until today ;-)


# 1554 26-May-1994 rgrimes

This commit was generated by cvs2svn to compensate for changes in r1553,
which included commits to RCS files with non-trunk default branches.


# 1553 26-May-1994 rgrimes

BSD 4.4 Lite usr.sbin Sources