Blame SOURCES/xinetd-2.3.15-tcpmux-nameinargs-disable-service.patch

f5f232
Xinetd parses and applies its configuration line by line. If a user wants to
f5f232
specify NAMEINARGS as a flag, it has to be *before* specifying 'server_args'.
f5f232
f5f232
Author: Jan Synacek <jsynacek@redhat.com>
f5f232
Resolves: #1037565
f5f232
f5f232
--- a/xinetd/parse.c	2013-11-21 10:51:25.025436376 +0100
f5f232
+++ b/xinetd/parse.c	2013-11-21 14:45:44.374121057 +0100
f5f232
@@ -633,7 +633,28 @@ static status_e identify_attribute( entr
f5f232
 
f5f232
    if ( (*ap->a_parser)( attr_values, scp, op ) == OK )
f5f232
    {    /* This is the normal path. */
f5f232
-	SC_SPECIFY( scp, ap->a_id ) ;
f5f232
+       /* If flags contain NAMEINARGS and server_args is already set, disable the service.
f5f232
+          Server args are already set incorrectly. */
f5f232
+       if ( strcmp( ap->a_name, "flags" ) == 0 &&
f5f232
+            SC_SERVER_ARGV( scp ) )
f5f232
+       {
f5f232
+           int i = 0, n = pset_count( attr_values ) ;
f5f232
+           for ( ; i < n ; i++ ) {
f5f232
+               char *v = (char *)pset_pointer( attr_values, i ) ;
f5f232
+               if ( strcmp( v, "NAMEINARGS" ) == 0 )
f5f232
+                   break ;
f5f232
+           }
f5f232
+
f5f232
+           if ( i != n ) {
f5f232
+               parsemsg( LOG_ERR, func,
f5f232
+                         "NAMEINARGS flag is set after server_args - DISABLING SERVICE" ) ;
f5f232
+               SC_DISABLE( scp ) ;
f5f232
+           }
f5f232
+       }
f5f232
+       else
f5f232
+       {
f5f232
+           SC_SPECIFY( scp, ap->a_id ) ;
f5f232
+       }
f5f232
    }
f5f232
    else if ( entry_type == SERVICE_ENTRY )
f5f232
    {
f5f232
--- a/xinetd/xinetd.conf.man	2013-12-03 10:06:35.717977075 +0100
f5f232
+++ b/xinetd/xinetd.conf.man	2013-12-03 10:41:14.779089430 +0100
f5f232
@@ -106,7 +106,8 @@
f5f232
 This will cause the first argument in "server_args" to be argv[0] when
f5f232
 executing the server, as specified in "server".  This allows you to use
f5f232
 tcpd by putting tcpd in "server" and the name of the server in "server_args"
f5f232
-like in normal inetd.
f5f232
+like in normal inetd. This flag has to be specified before "server_args",
f5f232
+otherwise is not taken into account.
f5f232
 .TP
f5f232
 .B NODELAY
f5f232
 If the service is a tcp service and the NODELAY flag is set, then the