summaryrefslogtreecommitdiffstats
path: root/meta/recipes-extended/xinetd/xinetd
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-extended/xinetd/xinetd')
-rw-r--r--meta/recipes-extended/xinetd/xinetd/Disable-services-from-inetd.conf-if-a-service-with-t.patch86
-rw-r--r--meta/recipes-extended/xinetd/xinetd/Various-fixes-from-the-previous-maintainer.patch79
-rw-r--r--meta/recipes-extended/xinetd/xinetd/xinetd-CVE-2013-4342.patch32
-rw-r--r--meta/recipes-extended/xinetd/xinetd/xinetd-should-be-able-to-listen-on-IPv6-even-in-ine.patch112
-rw-r--r--meta/recipes-extended/xinetd/xinetd/xinetd.conf11
-rw-r--r--meta/recipes-extended/xinetd/xinetd/xinetd.default12
-rw-r--r--meta/recipes-extended/xinetd/xinetd/xinetd.init64
7 files changed, 396 insertions, 0 deletions
diff --git a/meta/recipes-extended/xinetd/xinetd/Disable-services-from-inetd.conf-if-a-service-with-t.patch b/meta/recipes-extended/xinetd/xinetd/Disable-services-from-inetd.conf-if-a-service-with-t.patch
new file mode 100644
index 0000000000..cd6e6c1078
--- /dev/null
+++ b/meta/recipes-extended/xinetd/xinetd/Disable-services-from-inetd.conf-if-a-service-with-t.patch
@@ -0,0 +1,86 @@
1Upstream-Status: Pending [from other distro Debian]
2
3From d588b6530e1382a624898b3f4307f636c72c80a9 Mon Sep 17 00:00:00 2001
4From: Pierre Habouzit <madcoder@debian.org>
5Date: Wed, 28 Nov 2007 10:13:08 +0100
6Subject: [PATCH] Disable services from inetd.conf if a service with the same id exists.
7
8 This way, if a service is enabled in /etc/xinetd* _and_ in
9/etc/inetd.conf, the one (even if disabled) from /etc/xinetd* takes
10precedence.
11
12Signed-off-by: Pierre Habouzit <madcoder@debian.org>
13---
14 xinetd/inet.c | 22 +++++++++++++++++++---
15 1 files changed, 19 insertions(+), 3 deletions(-)
16
17diff --git a/xinetd/inet.c b/xinetd/inet.c
18index 1cb2ba2..8caab45 100644
19--- a/xinetd/inet.c
20+++ b/xinetd/inet.c
21@@ -23,6 +23,8 @@
22 #include "parsesup.h"
23 #include "nvlists.h"
24
25+static psi_h iter ;
26+
27 static int get_next_inet_entry( int fd, pset_h sconfs,
28 struct service_config *defaults);
29
30@@ -32,12 +34,15 @@ void parse_inet_conf_file( int fd, struct configuration *confp )
31 struct service_config *default_config = CNF_DEFAULTS( confp );
32
33 line_count = 0;
34+ iter = psi_create (sconfs);
35
36 for( ;; )
37 {
38 if (get_next_inet_entry(fd, sconfs, default_config) == -2)
39 break;
40 }
41+
42+ psi_destroy(iter);
43 }
44
45 static int get_next_inet_entry( int fd, pset_h sconfs,
46@@ -46,7 +51,7 @@ static int get_next_inet_entry( int fd, pset_h sconfs,
47 char *p;
48 str_h strp;
49 char *line = next_line(fd);
50- struct service_config *scp;
51+ struct service_config *scp, *tmp;
52 unsigned u, i;
53 const char *func = "get_next_inet_entry";
54 char *name = NULL, *rpcvers = NULL, *rpcproto = NULL;
55@@ -405,7 +410,16 @@ static int get_next_inet_entry( int fd, pset_h sconfs,
56 SC_SPECIFY( scp, A_SOCKET_TYPE );
57 SC_SPECIFY( scp, A_WAIT );
58
59- if( ! pset_add(sconfs, scp) )
60+ for ( tmp = SCP( psi_start( iter ) ) ; tmp ; tmp = SCP( psi_next(iter)) ){
61+ if (EQ(SC_ID(scp), SC_ID(tmp))) {
62+ parsemsg(LOG_DEBUG, func, "removing duplicate service %s", SC_NAME(scp));
63+ sc_free(scp);
64+ scp = NULL;
65+ break;
66+ }
67+ }
68+
69+ if( scp && ! pset_add(sconfs, scp) )
70 {
71 out_of_memory( func );
72 pset_destroy(args);
73@@ -414,7 +428,9 @@ static int get_next_inet_entry( int fd, pset_h sconfs,
74 }
75
76 pset_destroy(args);
77- parsemsg( LOG_DEBUG, func, "added service %s", SC_NAME(scp));
78+ if (scp) {
79+ parsemsg( LOG_DEBUG, func, "added service %s", SC_NAME(scp));
80+ }
81 return 0;
82 }
83
84--
851.5.3.6.2040.g15e6
86
diff --git a/meta/recipes-extended/xinetd/xinetd/Various-fixes-from-the-previous-maintainer.patch b/meta/recipes-extended/xinetd/xinetd/Various-fixes-from-the-previous-maintainer.patch
new file mode 100644
index 0000000000..8e59cdcaae
--- /dev/null
+++ b/meta/recipes-extended/xinetd/xinetd/Various-fixes-from-the-previous-maintainer.patch
@@ -0,0 +1,79 @@
1Upstream-Status: Pending [from other distro Debian]
2
3From a3410b0bc81ab03a889d9ffc14e351badf8372f1 Mon Sep 17 00:00:00 2001
4From: Pierre Habouzit <madcoder@debian.org>
5Date: Mon, 26 Nov 2007 16:02:04 +0100
6Subject: [PATCH] Various fixes from the previous maintainer.
7
8---
9 xinetd/child.c | 20 +++++++++++++++++---
10 xinetd/service.c | 8 ++++----
11 2 files changed, 21 insertions(+), 7 deletions(-)
12
13diff --git a/xinetd/child.c b/xinetd/child.c
14index 89ee54c..48e9615 100644
15--- a/xinetd/child.c
16+++ b/xinetd/child.c
17@@ -284,6 +284,7 @@ void child_process( struct server *serp )
18 connection_s *cp = SERVER_CONNECTION( serp ) ;
19 struct service_config *scp = SVC_CONF( sp ) ;
20 const char *func = "child_process" ;
21+ int fd, null_fd;
22
23 signal_default_state();
24
25@@ -296,9 +297,22 @@ void child_process( struct server *serp )
26 signals_pending[0] = -1;
27 signals_pending[1] = -1;
28
29- Sclose(0);
30- Sclose(1);
31- Sclose(2);
32+ if ( ( null_fd = open( "/dev/null", O_RDONLY ) ) == -1 )
33+ {
34+ msg( LOG_ERR, func, "open('/dev/null') failed: %m") ;
35+ _exit( 1 ) ;
36+ }
37+
38+ for ( fd = 0 ; fd <= MAX_PASS_FD ; fd++ )
39+ {
40+ if ( fd != null_fd && dup2( null_fd, fd ) == -1 )
41+ {
42+ msg( LOG_ERR, func, "dup2(%d, %d) failed: %m") ;
43+ _exit( 1 ) ;
44+ }
45+ }
46+ if ( null_fd > MAX_PASS_FD )
47+ (void) Sclose( null_fd ) ;
48
49
50 #ifdef DEBUG_SERVER
51diff --git a/xinetd/service.c b/xinetd/service.c
52index 3d68d78..0132d6c 100644
53--- a/xinetd/service.c
54+++ b/xinetd/service.c
55@@ -745,8 +745,8 @@ static status_e failed_service(struct service *sp,
56 return FAILED;
57
58 if ( last == NULL ) {
59- last = SAIN( calloc( 1, sizeof(union xsockaddr) ) );
60- SVC_LAST_DGRAM_ADDR(sp) = (union xsockaddr *)last;
61+ SVC_LAST_DGRAM_ADDR(sp) = SAIN( calloc( 1, sizeof(union xsockaddr) ) );
62+ last = SAIN( SVC_LAST_DGRAM_ADDR(sp) );
63 }
64
65 (void) time( &current_time ) ;
66@@ -772,8 +772,8 @@ static status_e failed_service(struct service *sp,
67 return FAILED;
68
69 if( last == NULL ) {
70- last = SAIN6(calloc( 1, sizeof(union xsockaddr) ) );
71- SVC_LAST_DGRAM_ADDR( sp ) = (union xsockaddr *)last;
72+ SVC_LAST_DGRAM_ADDR(sp) = SAIN6(calloc( 1, sizeof(union xsockaddr) ) );
73+ last = SAIN6(SVC_LAST_DGRAM_ADDR(sp));
74 }
75
76 (void) time( &current_time ) ;
77--
781.5.3.6.2040.g15e6
79
diff --git a/meta/recipes-extended/xinetd/xinetd/xinetd-CVE-2013-4342.patch b/meta/recipes-extended/xinetd/xinetd/xinetd-CVE-2013-4342.patch
new file mode 100644
index 0000000000..0542dbe835
--- /dev/null
+++ b/meta/recipes-extended/xinetd/xinetd/xinetd-CVE-2013-4342.patch
@@ -0,0 +1,32 @@
1xinetd: CVE-2013-4342
2
3xinetd does not enforce the user and group configuration directives
4for TCPMUX services, which causes these services to be run as root
5and makes it easier for remote attackers to gain privileges by
6leveraging another vulnerability in a service.
7http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2013-4342
8
9the patch come from:
10https://bugzilla.redhat.com/attachment.cgi?id=799732&action=diff
11
12Signed-off-by: Li Wang <li.wang@windriver.com>
13---
14 xinetd/builtins.c | 2 +-
15 1 file changed, 1 insertion(+), 1 deletion(-)
16
17diff --git a/xinetd/builtins.c b/xinetd/builtins.c
18index 3b85579..34a5bac 100644
19--- a/xinetd/builtins.c
20+++ b/xinetd/builtins.c
21@@ -617,7 +617,7 @@ static void tcpmux_handler( const struct server *serp )
22 if( SC_IS_INTERNAL( scp ) ) {
23 SC_INTERNAL(scp, nserp);
24 } else {
25- exec_server(nserp);
26+ child_process(nserp);
27 }
28 }
29
30--
311.7.9.5
32
diff --git a/meta/recipes-extended/xinetd/xinetd/xinetd-should-be-able-to-listen-on-IPv6-even-in-ine.patch b/meta/recipes-extended/xinetd/xinetd/xinetd-should-be-able-to-listen-on-IPv6-even-in-ine.patch
new file mode 100644
index 0000000000..2365ca123b
--- /dev/null
+++ b/meta/recipes-extended/xinetd/xinetd/xinetd-should-be-able-to-listen-on-IPv6-even-in-ine.patch
@@ -0,0 +1,112 @@
1Upstream-Status: Pending [from other distro Debian]
2
3From f44b218ccc779ab3f4aed072390ccf129d94b58d Mon Sep 17 00:00:00 2001
4From: David Madore <david@pleiades.stars>
5Date: Mon, 24 Mar 2008 12:45:36 +0100
6Subject: [PATCH] xinetd should be able to listen on IPv6 even in -inetd_compat mode
7
8xinetd does not bind to IPv6 addresses (and does not seem to have an
9option to do so) when used in -inetd_compat mode. As current inetd's
10are IPv6-aware, this is a problem: this means xinetd cannot be used as
11a drop-in inetd replacement.
12
13The attached patch is a suggestion: it adds a -inetd_ipv6 global
14option that, if used, causes inetd-compatibility lines to have an
15implicit "IPv6" option. Perhaps this is not the best solution, but
16there should definitely be a way to get inetd.conf to be read in
17IPv6-aware mode.
18---
19 xinetd/confparse.c | 1 +
20 xinetd/inet.c | 17 +++++++++++++++++
21 xinetd/options.c | 3 +++
22 xinetd/xinetd.man | 6 ++++++
23 4 files changed, 27 insertions(+), 0 deletions(-)
24
25diff --git a/xinetd/confparse.c b/xinetd/confparse.c
26index db9f431..d7b0bcc 100644
27--- a/xinetd/confparse.c
28+++ b/xinetd/confparse.c
29@@ -40,6 +40,7 @@
30 #include "inet.h"
31 #include "main.h"
32
33+extern int inetd_ipv6;
34 extern int inetd_compat;
35
36 /*
37diff --git a/xinetd/inet.c b/xinetd/inet.c
38index 8caab45..2e617ae 100644
39--- a/xinetd/inet.c
40+++ b/xinetd/inet.c
41@@ -25,6 +25,8 @@
42
43 static psi_h iter ;
44
45+extern int inetd_ipv6;
46+
47 static int get_next_inet_entry( int fd, pset_h sconfs,
48 struct service_config *defaults);
49
50@@ -360,6 +362,21 @@ static int get_next_inet_entry( int fd, pset_h sconfs,
51 }
52 SC_SERVER_ARGV(scp)[u] = p;
53 }
54+
55+ /* Set the IPv6 flag if we were passed the -inetd_ipv6 option */
56+ if ( inetd_ipv6 )
57+ {
58+ nvp = nv_find_value( service_flags, "IPv6" );
59+ if ( nvp == NULL )
60+ {
61+ parsemsg( LOG_WARNING, func, "inetd.conf - Bad foo %s", name ) ;
62+ pset_destroy(args);
63+ sc_free(scp);
64+ return -1;
65+ }
66+ M_SET(SC_XFLAGS(scp), nvp->value);
67+ }
68+
69 /* Set the reuse flag, as this is the default for inetd */
70 nvp = nv_find_value( service_flags, "REUSE" );
71 if ( nvp == NULL )
72diff --git a/xinetd/options.c b/xinetd/options.c
73index b058b6a..dc2f3a0 100644
74--- a/xinetd/options.c
75+++ b/xinetd/options.c
76@@ -30,6 +30,7 @@ int logprocs_option ;
77 unsigned logprocs_option_arg ;
78 int stayalive_option=0;
79 char *program_name ;
80+int inetd_ipv6 = 0 ;
81 int inetd_compat = 0 ;
82 int dont_fork = 0;
83
84@@ -128,6 +129,8 @@ int opt_recognize( int argc, char *argv[] )
85 fprintf(stderr, "\n");
86 exit(0);
87 }
88+ else if ( strcmp ( &argv[ arg ][ 1 ], "inetd_ipv6" ) == 0 )
89+ inetd_ipv6 = 1;
90 else if ( strcmp ( &argv[ arg ][ 1 ], "inetd_compat" ) == 0 )
91 inetd_compat = 1;
92 }
93diff --git a/xinetd/xinetd.man b/xinetd/xinetd.man
94index c76c3c6..c9dd803 100644
95--- a/xinetd/xinetd.man
96+++ b/xinetd/xinetd.man
97@@ -106,6 +106,12 @@ This option causes xinetd to read /etc/inetd.conf in addition to the
98 standard xinetd config files. /etc/inetd.conf is read after the
99 standard xinetd config files.
100 .TP
101+.BI \-inetd_ipv6
102+This option causes xinetd to bind to IPv6 (AF_INET6) addresses for
103+inetd compatibility lines (see previous option). This only affects
104+how /etc/inetd.conf is interpreted and thus only has any effect if
105+the \-inetd_compat option is also used.
106+.TP
107 .BI \-cc " interval"
108 This option instructs
109 .B xinetd
110--
1111.5.5.rc0.127.gb4337
112
diff --git a/meta/recipes-extended/xinetd/xinetd/xinetd.conf b/meta/recipes-extended/xinetd/xinetd/xinetd.conf
new file mode 100644
index 0000000000..9e6ea2577e
--- /dev/null
+++ b/meta/recipes-extended/xinetd/xinetd/xinetd.conf
@@ -0,0 +1,11 @@
1# Simple configuration file for xinetd
2#
3# Some defaults, and include /etc/xinetd.d/
4
5defaults
6{
7
8
9}
10
11includedir /etc/xinetd.d
diff --git a/meta/recipes-extended/xinetd/xinetd/xinetd.default b/meta/recipes-extended/xinetd/xinetd/xinetd.default
new file mode 100644
index 0000000000..20a38e3f3e
--- /dev/null
+++ b/meta/recipes-extended/xinetd/xinetd/xinetd.default
@@ -0,0 +1,12 @@
1# Default settings for xinetd. This file is sourced by /bin/sh from
2# /etc/init.d/xinetd
3
4# enable xinetd Inetd compat mode
5INETD_COMPAT=Yes
6
7# Options to pass to xinetd
8#
9# -stayalive comes by default : it can be removed if xinetd is expected
10# not to start when no service is configured
11#
12XINETD_OPTS="-stayalive"
diff --git a/meta/recipes-extended/xinetd/xinetd/xinetd.init b/meta/recipes-extended/xinetd/xinetd/xinetd.init
new file mode 100644
index 0000000000..777c2c8b46
--- /dev/null
+++ b/meta/recipes-extended/xinetd/xinetd/xinetd.init
@@ -0,0 +1,64 @@
1#!/bin/sh
2#
3# /etc/init.d/xinetd -- script to start and stop xinetd.
4
5# Source function library.
6. /etc/init.d/functions
7
8if test -f /etc/default/xinetd; then
9 . /etc/default/xinetd
10fi
11
12
13test -x /usr/sbin/xinetd || exit 0
14
15checkportmap () {
16 if grep "^[^ *#]" /etc/xinetd.conf | grep -q 'rpc/'; then
17 if ! rpcinfo -u localhost portmapper >/dev/null 2>&1; then
18 echo
19 echo "WARNING: portmapper inactive - RPC services unavailable!"
20 echo " Commenting out or removing the RPC services from"
21 echo " the /etc/xinetd.conf file will remove this message."
22 echo
23 fi
24 fi
25}
26
27case "$1" in
28 start)
29 checkportmap
30 echo -n "Starting internet superserver: xinetd"
31 start-stop-daemon --start --quiet --background --exec /usr/sbin/xinetd -- -pidfile /var/run/xinetd.pid $XINETD_OPTS
32 echo "."
33 ;;
34 stop)
35 echo -n "Stopping internet superserver: xinetd"
36 start-stop-daemon --stop --signal 3 --quiet --exec /usr/sbin/xinetd
37 echo "."
38 ;;
39 status)
40 status /usr/sbin/xinetd;
41 exit $?
42 ;;
43 reload)
44 echo -n "Reloading internet superserver configuration: xinetd"
45 start-stop-daemon --stop --signal 1 --quiet --exec /usr/sbin/xinetd
46 echo "."
47 ;;
48 force-reload)
49 echo "$0 force-reload: Force Reload is deprecated"
50 echo -n "Forcefully reloading internet superserver configuration: xinetd"
51 start-stop-daemon --stop --signal 1 --quiet --exec /usr/sbin/xinetd
52 echo "."
53 ;;
54 restart)
55 $0 stop
56 $0 start
57 ;;
58 *)
59 echo "Usage: /etc/init.d/xinetd {start|stop|status|reload|force-reload|restart}"
60 exit 1
61 ;;
62esac
63
64exit 0