Trivial patch to xinetd-2.3.12 to fix Red Hat Bugzilla #103009

Jay Fenlason <[email protected]> Tue, 2 Sep 2003 22:23:19 -0400
Newsgroups gmane.network.xinetd
Message-ID <[email protected]>
--SLDf9lqlvOQaIe6s
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

This patch fixes a bug where xinetd stops working if you send it
SIGHUP to cause a reconfiguration while running with the included
config file.  To reproduce the problem, start

xinetd -f xinetd.conf.103009 -stayalive -pidfile /var/run/xinetd.pid

then run "service xinetd reload" twice on a Red Hat Enterprise Linux 3 Beta
system.

After the second reconfiguration, xinetd will either lock up
completely or die with a segmentation fault.

With the included patch applied xinetd behaves as it should.

			-- JF

--SLDf9lqlvOQaIe6s
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="xinetd-2.3.12-reconfig.patch"

--- xinetd-2.3.12/libs/src/sio/siosup.c.reconfig	2003-09-02 22:09:49.000000000 -0400
+++ xinetd-2.3.12/libs/src/sio/siosup.c	2003-09-02 22:10:01.000000000 -0400
@@ -861,7 +861,7 @@
    int n_fds = 4; /* Let's bump 4 at a time for hysteresis */
 
    /* If the fd is out of range of the proposed size, make n_fds big enough */
-   if (fd > (__sio_n_descriptors+n_fds))
+   if (fd >= (__sio_n_descriptors+n_fds))
       n_fds += fd - __sio_n_descriptors;
 
 #ifdef HAVE_MMAP

--SLDf9lqlvOQaIe6s
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="xinetd.conf.103009"

defaults
{
	instances               = 60
        log_type                = SYSLOG authpriv
        log_on_success		= HOST PID
        log_on_failure		= HOST
	cps			= 25 30
}
service nextstep
{
        flags           = REUSE NAMEINARGS
        socket_type     = stream
        protocol        = tcp
        wait            = no
        user            = nobody
        server          = /usr/local/bin/dtdate
        server_args     = dtdate
}
service time
{
	type		= INTERNAL UNLISTED
	id		= time-dgram
	socket_type	= dgram
	protocol	= udp
	user		= root
	wait		= yes
	disable		= no
	port		= 37
}
service time
{
	type		= INTERNAL
	id		= time-stream
	socket_type	= stream
	protocol	= tcp
	user		= root
	wait		= no
	disable		= no
}
service ident
{
        flags           = REUSE NAMEINARGS
        socket_type     = stream
        protocol        = tcp
        wait            = yes
        user            = root
        server          = /usr/sbin/tcpd
        server_args     = in.identd -w
}
service shell
{
	disable	= no
	socket_type		= stream
	wait			= no
	user			= root
	log_on_success		+= USERID
	log_on_failure 		+= USERID
	server			= /usr/sbin/in.rshd
}
service login
{
	disable	= no
	socket_type		= stream
	wait			= no
	user			= root
	log_on_success		+= USERID
	log_on_failure 		+= USERID
	server			= /usr/sbin/in.rlogind
}

--SLDf9lqlvOQaIe6s--