summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuiz Otavio O Souza <luiz@netgate.com>2016-07-13 14:18:30 -0500
committerLuiz Otavio O Souza <luiz@netgate.com>2016-07-13 14:30:01 -0500
commite1f27fb12740d1fe0ecc0bec46d17020cb4b4983 (patch)
tree983269e79d18bd8b92d97cfd55674a8cb04d76bc
parent183e03ef17989a8d77d0962ae7e2edaa4d265544 (diff)
downloadFreeBSD-ports-e1f27fb12740d1fe0ecc0bec46d17020cb4b4983.zip
FreeBSD-ports-e1f27fb12740d1fe0ecc0bec46d17020cb4b4983.tar.gz
Fix some edge cases in xinetd file descriptor handling.
This change fixes the case where the listening file descriptor is in 0~2 range (easily reprodutible with a single UDP service). Ticket #6315 FreeBSD PR: 211038 (cherry picked from commit eeb3abaa71905ccaec35b0bee7bc4dcc40cfc306)
-rw-r--r--security/xinetd/Makefile2
-rw-r--r--security/xinetd/files/patch-xinetd_child.c24
2 files changed, 25 insertions, 1 deletions
diff --git a/security/xinetd/Makefile b/security/xinetd/Makefile
index 06ffe8f..863b3f9 100644
--- a/security/xinetd/Makefile
+++ b/security/xinetd/Makefile
@@ -3,7 +3,7 @@
PORTNAME= xinetd
PORTVERSION= 2.3.15
-PORTREVISION= 1
+PORTREVISION= 2
CATEGORIES= security ipv6
MASTER_SITES= GENTOO
diff --git a/security/xinetd/files/patch-xinetd_child.c b/security/xinetd/files/patch-xinetd_child.c
new file mode 100644
index 0000000..6ddbf91
--- /dev/null
+++ b/security/xinetd/files/patch-xinetd_child.c
@@ -0,0 +1,24 @@
+--- xinetd/child.c.orig 2016-07-13 19:00:31 UTC
++++ xinetd/child.c
+@@ -168,7 +168,8 @@ void exec_server( const struct server *s
+ }
+ #endif
+
+- (void) Sclose( descriptor ) ;
++ if ( descriptor > MAX_PASS_FD )
++ (void) Sclose( descriptor ) ;
+
+ #ifndef solaris
+ #if !defined(HAVE_SETSID)
+@@ -321,11 +322,6 @@ void child_process( struct server *serp
+ signals_pending[0] = -1;
+ signals_pending[1] = -1;
+
+- Sclose(0);
+- Sclose(1);
+- Sclose(2);
+-
+-
+ #ifdef DEBUG_SERVER
+ if ( debug.on )
+ {
OpenPOWER on IntegriCloud