summaryrefslogtreecommitdiffstats
path: root/meta/recipes-extended/xinetd/xinetd/Disable-services-from-inetd.conf-if-a-service-with-t.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-extended/xinetd/xinetd/Disable-services-from-inetd.conf-if-a-service-with-t.patch')
-rw-r--r--meta/recipes-extended/xinetd/xinetd/Disable-services-from-inetd.conf-if-a-service-with-t.patch84
1 files changed, 84 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..8602a88702
--- /dev/null
+++ b/meta/recipes-extended/xinetd/xinetd/Disable-services-from-inetd.conf-if-a-service-with-t.patch
@@ -0,0 +1,84 @@
1From d588b6530e1382a624898b3f4307f636c72c80a9 Mon Sep 17 00:00:00 2001
2From: Pierre Habouzit <madcoder@debian.org>
3Date: Wed, 28 Nov 2007 10:13:08 +0100
4Subject: [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
8precedence.
9
10Signed-off-by: Pierre Habouzit <madcoder@debian.org>
11---
12 xinetd/inet.c | 22 +++++++++++++++++++---
13 1 files changed, 19 insertions(+), 3 deletions(-)
14
15diff --git a/xinetd/inet.c b/xinetd/inet.c
16index 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--
831.5.3.6.2040.g15e6
84