diff options
author | Yu Ke <ke.yu@intel.com> | 2010-07-28 11:34:32 +0800 |
---|---|---|
committer | Richard Purdie <rpurdie@linux.intel.com> | 2010-08-19 13:06:56 +0100 |
commit | 23552a40fcc37f58cb4d6ab6a864dfaf9154267a (patch) | |
tree | 8edfa39cbdad41324e9a84ba3ce4bd29082ddd8a /meta-lsb | |
parent | 90e8bc75e3d32029bc740ce5ca3db1b45c8a7240 (diff) | |
download | poky-23552a40fcc37f58cb4d6ab6a864dfaf9154267a.tar.gz |
xinetd: add xinetd
xinetd is highly configurable, modular and secure inetd. this commmit add xinetd 2.3.14.
The receipts is borrowed from OE, with following changes:
- upgrade the version from 2.3.13 to 2.3.14
- pick three patches from debian xinetd 2.3.14-7.
Signed-off-by: Yu Ke <ke.yu@intel.com>
Diffstat (limited to 'meta-lsb')
6 files changed, 386 insertions, 0 deletions
diff --git a/meta-lsb/packages/xinetd/xinetd/Disable-services-from-inetd.conf-if-a-service-with-t.patch b/meta-lsb/packages/xinetd/xinetd/Disable-services-from-inetd.conf-if-a-service-with-t.patch new file mode 100644 index 0000000000..8602a88702 --- /dev/null +++ b/meta-lsb/packages/xinetd/xinetd/Disable-services-from-inetd.conf-if-a-service-with-t.patch | |||
@@ -0,0 +1,84 @@ | |||
1 | From d588b6530e1382a624898b3f4307f636c72c80a9 Mon Sep 17 00:00:00 2001 | ||
2 | From: Pierre Habouzit <madcoder@debian.org> | ||
3 | Date: Wed, 28 Nov 2007 10:13:08 +0100 | ||
4 | Subject: [PATCH] Disable services from inetd.conf if a service with the same id exists. | ||
5 | |||
6 | This way, if a service is enabled in /etc/xinetd* _and_ in | ||
7 | /etc/inetd.conf, the one (even if disabled) from /etc/xinetd* takes | ||
8 | precedence. | ||
9 | |||
10 | Signed-off-by: Pierre Habouzit <madcoder@debian.org> | ||
11 | --- | ||
12 | xinetd/inet.c | 22 +++++++++++++++++++--- | ||
13 | 1 files changed, 19 insertions(+), 3 deletions(-) | ||
14 | |||
15 | diff --git a/xinetd/inet.c b/xinetd/inet.c | ||
16 | index 1cb2ba2..8caab45 100644 | ||
17 | --- a/xinetd/inet.c | ||
18 | +++ b/xinetd/inet.c | ||
19 | @@ -23,6 +23,8 @@ | ||
20 | #include "parsesup.h" | ||
21 | #include "nvlists.h" | ||
22 | |||
23 | +static psi_h iter ; | ||
24 | + | ||
25 | static int get_next_inet_entry( int fd, pset_h sconfs, | ||
26 | struct service_config *defaults); | ||
27 | |||
28 | @@ -32,12 +34,15 @@ void parse_inet_conf_file( int fd, struct configuration *confp ) | ||
29 | struct service_config *default_config = CNF_DEFAULTS( confp ); | ||
30 | |||
31 | line_count = 0; | ||
32 | + iter = psi_create (sconfs); | ||
33 | |||
34 | for( ;; ) | ||
35 | { | ||
36 | if (get_next_inet_entry(fd, sconfs, default_config) == -2) | ||
37 | break; | ||
38 | } | ||
39 | + | ||
40 | + psi_destroy(iter); | ||
41 | } | ||
42 | |||
43 | static int get_next_inet_entry( int fd, pset_h sconfs, | ||
44 | @@ -46,7 +51,7 @@ static int get_next_inet_entry( int fd, pset_h sconfs, | ||
45 | char *p; | ||
46 | str_h strp; | ||
47 | char *line = next_line(fd); | ||
48 | - struct service_config *scp; | ||
49 | + struct service_config *scp, *tmp; | ||
50 | unsigned u, i; | ||
51 | const char *func = "get_next_inet_entry"; | ||
52 | char *name = NULL, *rpcvers = NULL, *rpcproto = NULL; | ||
53 | @@ -405,7 +410,16 @@ static int get_next_inet_entry( int fd, pset_h sconfs, | ||
54 | SC_SPECIFY( scp, A_SOCKET_TYPE ); | ||
55 | SC_SPECIFY( scp, A_WAIT ); | ||
56 | |||
57 | - if( ! pset_add(sconfs, scp) ) | ||
58 | + for ( tmp = SCP( psi_start( iter ) ) ; tmp ; tmp = SCP( psi_next(iter)) ){ | ||
59 | + if (EQ(SC_ID(scp), SC_ID(tmp))) { | ||
60 | + parsemsg(LOG_DEBUG, func, "removing duplicate service %s", SC_NAME(scp)); | ||
61 | + sc_free(scp); | ||
62 | + scp = NULL; | ||
63 | + break; | ||
64 | + } | ||
65 | + } | ||
66 | + | ||
67 | + if( scp && ! pset_add(sconfs, scp) ) | ||
68 | { | ||
69 | out_of_memory( func ); | ||
70 | pset_destroy(args); | ||
71 | @@ -414,7 +428,9 @@ static int get_next_inet_entry( int fd, pset_h sconfs, | ||
72 | } | ||
73 | |||
74 | pset_destroy(args); | ||
75 | - parsemsg( LOG_DEBUG, func, "added service %s", SC_NAME(scp)); | ||
76 | + if (scp) { | ||
77 | + parsemsg( LOG_DEBUG, func, "added service %s", SC_NAME(scp)); | ||
78 | + } | ||
79 | return 0; | ||
80 | } | ||
81 | |||
82 | -- | ||
83 | 1.5.3.6.2040.g15e6 | ||
84 | |||
diff --git a/meta-lsb/packages/xinetd/xinetd/Various-fixes-from-the-previous-maintainer.patch b/meta-lsb/packages/xinetd/xinetd/Various-fixes-from-the-previous-maintainer.patch new file mode 100644 index 0000000000..d243692769 --- /dev/null +++ b/meta-lsb/packages/xinetd/xinetd/Various-fixes-from-the-previous-maintainer.patch | |||
@@ -0,0 +1,77 @@ | |||
1 | From a3410b0bc81ab03a889d9ffc14e351badf8372f1 Mon Sep 17 00:00:00 2001 | ||
2 | From: Pierre Habouzit <madcoder@debian.org> | ||
3 | Date: Mon, 26 Nov 2007 16:02:04 +0100 | ||
4 | Subject: [PATCH] Various fixes from the previous maintainer. | ||
5 | |||
6 | --- | ||
7 | xinetd/child.c | 20 +++++++++++++++++--- | ||
8 | xinetd/service.c | 8 ++++---- | ||
9 | 2 files changed, 21 insertions(+), 7 deletions(-) | ||
10 | |||
11 | diff --git a/xinetd/child.c b/xinetd/child.c | ||
12 | index 89ee54c..48e9615 100644 | ||
13 | --- a/xinetd/child.c | ||
14 | +++ b/xinetd/child.c | ||
15 | @@ -284,6 +284,7 @@ void child_process( struct server *serp ) | ||
16 | connection_s *cp = SERVER_CONNECTION( serp ) ; | ||
17 | struct service_config *scp = SVC_CONF( sp ) ; | ||
18 | const char *func = "child_process" ; | ||
19 | + int fd, null_fd; | ||
20 | |||
21 | signal_default_state(); | ||
22 | |||
23 | @@ -296,9 +297,22 @@ void child_process( struct server *serp ) | ||
24 | signals_pending[0] = -1; | ||
25 | signals_pending[1] = -1; | ||
26 | |||
27 | - Sclose(0); | ||
28 | - Sclose(1); | ||
29 | - Sclose(2); | ||
30 | + if ( ( null_fd = open( "/dev/null", O_RDONLY ) ) == -1 ) | ||
31 | + { | ||
32 | + msg( LOG_ERR, func, "open('/dev/null') failed: %m") ; | ||
33 | + _exit( 1 ) ; | ||
34 | + } | ||
35 | + | ||
36 | + for ( fd = 0 ; fd <= MAX_PASS_FD ; fd++ ) | ||
37 | + { | ||
38 | + if ( fd != null_fd && dup2( null_fd, fd ) == -1 ) | ||
39 | + { | ||
40 | + msg( LOG_ERR, func, "dup2(%d, %d) failed: %m") ; | ||
41 | + _exit( 1 ) ; | ||
42 | + } | ||
43 | + } | ||
44 | + if ( null_fd > MAX_PASS_FD ) | ||
45 | + (void) Sclose( null_fd ) ; | ||
46 | |||
47 | |||
48 | #ifdef DEBUG_SERVER | ||
49 | diff --git a/xinetd/service.c b/xinetd/service.c | ||
50 | index 3d68d78..0132d6c 100644 | ||
51 | --- a/xinetd/service.c | ||
52 | +++ b/xinetd/service.c | ||
53 | @@ -745,8 +745,8 @@ static status_e failed_service(struct service *sp, | ||
54 | return FAILED; | ||
55 | |||
56 | if ( last == NULL ) { | ||
57 | - last = SAIN( calloc( 1, sizeof(union xsockaddr) ) ); | ||
58 | - SVC_LAST_DGRAM_ADDR(sp) = (union xsockaddr *)last; | ||
59 | + SVC_LAST_DGRAM_ADDR(sp) = SAIN( calloc( 1, sizeof(union xsockaddr) ) ); | ||
60 | + last = SAIN( SVC_LAST_DGRAM_ADDR(sp) ); | ||
61 | } | ||
62 | |||
63 | (void) time( ¤t_time ) ; | ||
64 | @@ -772,8 +772,8 @@ static status_e failed_service(struct service *sp, | ||
65 | return FAILED; | ||
66 | |||
67 | if( last == NULL ) { | ||
68 | - last = SAIN6(calloc( 1, sizeof(union xsockaddr) ) ); | ||
69 | - SVC_LAST_DGRAM_ADDR( sp ) = (union xsockaddr *)last; | ||
70 | + SVC_LAST_DGRAM_ADDR(sp) = SAIN6(calloc( 1, sizeof(union xsockaddr) ) ); | ||
71 | + last = SAIN6(SVC_LAST_DGRAM_ADDR(sp)); | ||
72 | } | ||
73 | |||
74 | (void) time( ¤t_time ) ; | ||
75 | -- | ||
76 | 1.5.3.6.2040.g15e6 | ||
77 | |||
diff --git a/meta-lsb/packages/xinetd/xinetd/xinetd-should-be-able-to-listen-on-IPv6-even-in-ine.patch b/meta-lsb/packages/xinetd/xinetd/xinetd-should-be-able-to-listen-on-IPv6-even-in-ine.patch new file mode 100644 index 0000000000..2b76fe3d41 --- /dev/null +++ b/meta-lsb/packages/xinetd/xinetd/xinetd-should-be-able-to-listen-on-IPv6-even-in-ine.patch | |||
@@ -0,0 +1,110 @@ | |||
1 | From f44b218ccc779ab3f4aed072390ccf129d94b58d Mon Sep 17 00:00:00 2001 | ||
2 | From: David Madore <david@pleiades.stars> | ||
3 | Date: Mon, 24 Mar 2008 12:45:36 +0100 | ||
4 | Subject: [PATCH] xinetd should be able to listen on IPv6 even in -inetd_compat mode | ||
5 | |||
6 | xinetd does not bind to IPv6 addresses (and does not seem to have an | ||
7 | option to do so) when used in -inetd_compat mode. As current inetd's | ||
8 | are IPv6-aware, this is a problem: this means xinetd cannot be used as | ||
9 | a drop-in inetd replacement. | ||
10 | |||
11 | The attached patch is a suggestion: it adds a -inetd_ipv6 global | ||
12 | option that, if used, causes inetd-compatibility lines to have an | ||
13 | implicit "IPv6" option. Perhaps this is not the best solution, but | ||
14 | there should definitely be a way to get inetd.conf to be read in | ||
15 | IPv6-aware mode. | ||
16 | --- | ||
17 | xinetd/confparse.c | 1 + | ||
18 | xinetd/inet.c | 17 +++++++++++++++++ | ||
19 | xinetd/options.c | 3 +++ | ||
20 | xinetd/xinetd.man | 6 ++++++ | ||
21 | 4 files changed, 27 insertions(+), 0 deletions(-) | ||
22 | |||
23 | diff --git a/xinetd/confparse.c b/xinetd/confparse.c | ||
24 | index db9f431..d7b0bcc 100644 | ||
25 | --- a/xinetd/confparse.c | ||
26 | +++ b/xinetd/confparse.c | ||
27 | @@ -40,6 +40,7 @@ | ||
28 | #include "inet.h" | ||
29 | #include "main.h" | ||
30 | |||
31 | +extern int inetd_ipv6; | ||
32 | extern int inetd_compat; | ||
33 | |||
34 | /* | ||
35 | diff --git a/xinetd/inet.c b/xinetd/inet.c | ||
36 | index 8caab45..2e617ae 100644 | ||
37 | --- a/xinetd/inet.c | ||
38 | +++ b/xinetd/inet.c | ||
39 | @@ -25,6 +25,8 @@ | ||
40 | |||
41 | static psi_h iter ; | ||
42 | |||
43 | +extern int inetd_ipv6; | ||
44 | + | ||
45 | static int get_next_inet_entry( int fd, pset_h sconfs, | ||
46 | struct service_config *defaults); | ||
47 | |||
48 | @@ -360,6 +362,21 @@ static int get_next_inet_entry( int fd, pset_h sconfs, | ||
49 | } | ||
50 | SC_SERVER_ARGV(scp)[u] = p; | ||
51 | } | ||
52 | + | ||
53 | + /* Set the IPv6 flag if we were passed the -inetd_ipv6 option */ | ||
54 | + if ( inetd_ipv6 ) | ||
55 | + { | ||
56 | + nvp = nv_find_value( service_flags, "IPv6" ); | ||
57 | + if ( nvp == NULL ) | ||
58 | + { | ||
59 | + parsemsg( LOG_WARNING, func, "inetd.conf - Bad foo %s", name ) ; | ||
60 | + pset_destroy(args); | ||
61 | + sc_free(scp); | ||
62 | + return -1; | ||
63 | + } | ||
64 | + M_SET(SC_XFLAGS(scp), nvp->value); | ||
65 | + } | ||
66 | + | ||
67 | /* Set the reuse flag, as this is the default for inetd */ | ||
68 | nvp = nv_find_value( service_flags, "REUSE" ); | ||
69 | if ( nvp == NULL ) | ||
70 | diff --git a/xinetd/options.c b/xinetd/options.c | ||
71 | index b058b6a..dc2f3a0 100644 | ||
72 | --- a/xinetd/options.c | ||
73 | +++ b/xinetd/options.c | ||
74 | @@ -30,6 +30,7 @@ int logprocs_option ; | ||
75 | unsigned logprocs_option_arg ; | ||
76 | int stayalive_option=0; | ||
77 | char *program_name ; | ||
78 | +int inetd_ipv6 = 0 ; | ||
79 | int inetd_compat = 0 ; | ||
80 | int dont_fork = 0; | ||
81 | |||
82 | @@ -128,6 +129,8 @@ int opt_recognize( int argc, char *argv[] ) | ||
83 | fprintf(stderr, "\n"); | ||
84 | exit(0); | ||
85 | } | ||
86 | + else if ( strcmp ( &argv[ arg ][ 1 ], "inetd_ipv6" ) == 0 ) | ||
87 | + inetd_ipv6 = 1; | ||
88 | else if ( strcmp ( &argv[ arg ][ 1 ], "inetd_compat" ) == 0 ) | ||
89 | inetd_compat = 1; | ||
90 | } | ||
91 | diff --git a/xinetd/xinetd.man b/xinetd/xinetd.man | ||
92 | index c76c3c6..c9dd803 100644 | ||
93 | --- a/xinetd/xinetd.man | ||
94 | +++ b/xinetd/xinetd.man | ||
95 | @@ -106,6 +106,12 @@ This option causes xinetd to read /etc/inetd.conf in addition to the | ||
96 | standard xinetd config files. /etc/inetd.conf is read after the | ||
97 | standard xinetd config files. | ||
98 | .TP | ||
99 | +.BI \-inetd_ipv6 | ||
100 | +This option causes xinetd to bind to IPv6 (AF_INET6) addresses for | ||
101 | +inetd compatibility lines (see previous option). This only affects | ||
102 | +how /etc/inetd.conf is interpreted and thus only has any effect if | ||
103 | +the \-inetd_compat option is also used. | ||
104 | +.TP | ||
105 | .BI \-cc " interval" | ||
106 | This option instructs | ||
107 | .B xinetd | ||
108 | -- | ||
109 | 1.5.5.rc0.127.gb4337 | ||
110 | |||
diff --git a/meta-lsb/packages/xinetd/xinetd/xinetd.conf b/meta-lsb/packages/xinetd/xinetd/xinetd.conf new file mode 100644 index 0000000000..9e6ea2577e --- /dev/null +++ b/meta-lsb/packages/xinetd/xinetd/xinetd.conf | |||
@@ -0,0 +1,11 @@ | |||
1 | # Simple configuration file for xinetd | ||
2 | # | ||
3 | # Some defaults, and include /etc/xinetd.d/ | ||
4 | |||
5 | defaults | ||
6 | { | ||
7 | |||
8 | |||
9 | } | ||
10 | |||
11 | includedir /etc/xinetd.d | ||
diff --git a/meta-lsb/packages/xinetd/xinetd/xinetd.init b/meta-lsb/packages/xinetd/xinetd/xinetd.init new file mode 100644 index 0000000000..26dbea7415 --- /dev/null +++ b/meta-lsb/packages/xinetd/xinetd/xinetd.init | |||
@@ -0,0 +1,57 @@ | |||
1 | #!/bin/sh | ||
2 | # | ||
3 | # /etc/init.d/xinetd -- script to start and stop xinetd. | ||
4 | |||
5 | if test -f /etc/default/xinetd; then | ||
6 | . /etc/default/xinetd | ||
7 | fi | ||
8 | |||
9 | |||
10 | test -x /usr/sbin/xinetd || exit 0 | ||
11 | |||
12 | checkportmap () { | ||
13 | if grep "^[^ *#]" /etc/xinetd.conf | grep -q 'rpc/'; then | ||
14 | if ! rpcinfo -u localhost portmapper >/dev/null 2>&1; then | ||
15 | echo | ||
16 | echo "WARNING: portmapper inactive - RPC services unavailable!" | ||
17 | echo " Commenting out or removing the RPC services from" | ||
18 | echo " the /etc/xinetd.conf file will remove this message." | ||
19 | echo | ||
20 | fi | ||
21 | fi | ||
22 | } | ||
23 | |||
24 | case "$1" in | ||
25 | start) | ||
26 | checkportmap | ||
27 | echo -n "Starting internet superserver: xinetd" | ||
28 | start-stop-daemon --start --quiet --background --exec /usr/sbin/xinetd -- -pidfile /var/run/xinetd.pid $XINETD_OPTS | ||
29 | echo "." | ||
30 | ;; | ||
31 | stop) | ||
32 | echo -n "Stopping internet superserver: xinetd" | ||
33 | start-stop-daemon --stop --signal 3 --quiet --exec /usr/sbin/xinetd | ||
34 | echo "." | ||
35 | ;; | ||
36 | reload) | ||
37 | echo -n "Reloading internet superserver configuration: xinetd" | ||
38 | start-stop-daemon --stop --signal 1 --quiet --exec /usr/sbin/xinetd | ||
39 | echo "." | ||
40 | ;; | ||
41 | force-reload) | ||
42 | echo "$0 force-reload: Force Reload is deprecated" | ||
43 | echo -n "Forcefully reloading internet superserver configuration: xinetd" | ||
44 | start-stop-daemon --stop --signal 1 --quiet --exec /usr/sbin/xinetd | ||
45 | echo "." | ||
46 | ;; | ||
47 | restart) | ||
48 | $0 stop | ||
49 | $0 start | ||
50 | ;; | ||
51 | *) | ||
52 | echo "Usage: /etc/init.d/xinetd {start|stop|reload|force-reload|restart}" | ||
53 | exit 1 | ||
54 | ;; | ||
55 | esac | ||
56 | |||
57 | exit 0 | ||
diff --git a/meta-lsb/packages/xinetd/xinetd_2.3.14.bb b/meta-lsb/packages/xinetd/xinetd_2.3.14.bb new file mode 100644 index 0000000000..02e68f2d34 --- /dev/null +++ b/meta-lsb/packages/xinetd/xinetd_2.3.14.bb | |||
@@ -0,0 +1,47 @@ | |||
1 | DESCRIPTION = "Highly configurable, modular and secure inetd" | ||
2 | HOMEPAGE = "http://www.xinetd.org" | ||
3 | |||
4 | # xinetd is a BSD-like license | ||
5 | LICENSE = "xinetd" | ||
6 | LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=8ad8615198542444f84d28a6cf226dd8" | ||
7 | |||
8 | DEPENDS = "" | ||
9 | PR ="r0" | ||
10 | |||
11 | SRC_URI = "http://www.xinetd.org/xinetd-${PV}.tar.gz \ | ||
12 | file://xinetd.init \ | ||
13 | file://xinetd.conf \ | ||
14 | file://Various-fixes-from-the-previous-maintainer.patch \ | ||
15 | file://Disable-services-from-inetd.conf-if-a-service-with-t.patch \ | ||
16 | file://xinetd-should-be-able-to-listen-on-IPv6-even-in-ine.patch \ | ||
17 | " | ||
18 | |||
19 | inherit autotools update-rc.d | ||
20 | |||
21 | INITSCRIPT_NAME = "xinetd" | ||
22 | INITSCRIPT_PARAMS = "defaults" | ||
23 | |||
24 | EXTRA_OECONF="--disable-nls" | ||
25 | |||
26 | do_configure() { | ||
27 | # Looks like configure.in is broken, so we are skipping | ||
28 | # rebuilding configure and are just using the shipped one | ||
29 | oe_runconf | ||
30 | } | ||
31 | |||
32 | INHIBIT_AUTO_STAGE = "1" | ||
33 | |||
34 | do_install() { | ||
35 | # Same here, the Makefile does some really stupid things, | ||
36 | # but since we only want two files why not override | ||
37 | # do_install from autotools and doing it ourselfs? | ||
38 | install -d "${D}/usr/sbin" | ||
39 | install -d "${D}/etc/init.d" | ||
40 | install -d "${D}/etc/xinetd.d" | ||
41 | install -m 644 "${WORKDIR}/xinetd.conf" "${D}/etc" | ||
42 | install -m 755 "${WORKDIR}/xinetd.init" "${D}/etc/init.d/xinetd" | ||
43 | install -m 755 "${S}/xinetd/xinetd" "${D}/usr/sbin" | ||
44 | install -m 755 "${S}/xinetd/itox" "${D}/usr/sbin" | ||
45 | } | ||
46 | |||
47 | CONFFILES_${PN} = "${sysconfdir}/xinetd.conf" | ||