inet.c (xinetd-2.3.15) | : | inet.c (xinetd-2.3.15.4.tar.xz) | ||
---|---|---|---|---|
skipping to change at line 26 | skipping to change at line 26 | |||
#include <pwd.h> | #include <pwd.h> | |||
#include <limits.h> | #include <limits.h> | |||
#include "str.h" | #include "str.h" | |||
#include "inet.h" | #include "inet.h" | |||
#include "msg.h" | #include "msg.h" | |||
#include "parse.h" | #include "parse.h" | |||
#include "parsesup.h" | #include "parsesup.h" | |||
#include "nvlists.h" | #include "nvlists.h" | |||
static int get_next_inet_entry( int fd, pset_h sconfs, | static int get_next_inet_entry( int fd, pset_h sconfs); | |||
struct service_config *defaults); | ||||
void parse_inet_conf_file( int fd, struct configuration *confp ) | void parse_inet_conf_file( int fd, struct configuration *confp ) | |||
{ | { | |||
pset_h sconfs = CNF_SERVICE_CONFS( confp ); | pset_h sconfs = CNF_SERVICE_CONFS( confp ); | |||
struct service_config *default_config = CNF_DEFAULTS( confp ); | ||||
line_count = 0; | line_count = 0; | |||
for( ;; ) | for( ;; ) | |||
{ | { | |||
if (get_next_inet_entry(fd, sconfs, default_config) == -2) | if (get_next_inet_entry(fd, sconfs) == -2) | |||
break; | break; | |||
} | } | |||
} | } | |||
static int get_next_inet_entry( int fd, pset_h sconfs, | static int get_next_inet_entry( int fd, pset_h sconfs) | |||
struct service_config *defaults) | ||||
{ | { | |||
char *p; | char *p; | |||
str_h strp; | str_h strp; | |||
char *line = next_line(fd); | char *line = next_line(fd); | |||
struct service_config *scp; | struct service_config *scp; | |||
unsigned u, i; | unsigned u, i; | |||
const char *func = "get_next_inet_entry"; | const char *func = "get_next_inet_entry"; | |||
char *name = NULL, *rpcvers = NULL, *rpcproto = NULL; | char *name = NULL, *rpcvers = NULL, *rpcproto = NULL; | |||
char *group, *proto, *stype; | char *group, *proto, *stype; | |||
const struct name_value *nvp; | const struct name_value *nvp; | |||
skipping to change at line 193 | skipping to change at line 190 | |||
return -1; | return -1; | |||
} | } | |||
*rpcproto = '\0'; | *rpcproto = '\0'; | |||
rpcproto++; | rpcproto++; | |||
proto = rpcproto; | proto = rpcproto; | |||
/* Set the RPC type field */ | /* Set the RPC type field */ | |||
nvp = nv_find_value( service_types, "RPC" ); | nvp = nv_find_value( service_types, "RPC" ); | |||
if ( nvp == NULL ) | if ( nvp == NULL ) | |||
{ | { | |||
parsemsg( LOG_WARNING, func, "inetd.conf - Bad foo %s", name ) ; | parsemsg( LOG_WARNING, func, "inetd.conf - Bad foo %s", SC_NAME(scp) ) ; | |||
pset_destroy(args); | pset_destroy(args); | |||
sc_free(scp); | sc_free(scp); | |||
return -1; | return -1; | |||
} | } | |||
M_SET(SC_TYPE(scp), nvp->value); | M_SET(SC_TYPE(scp), nvp->value); | |||
} | } | |||
if ( ( pep = getprotobyname( proto ) ) == NULL ) | if ( ( pep = getprotobyname( proto ) ) == NULL ) | |||
{ | { | |||
parsemsg( LOG_ERR, func, "inetd.conf - Protocol %s not in /etc/protocols", | parsemsg( LOG_ERR, func, "inetd.conf - Protocol %s not in /etc/protocols", | |||
skipping to change at line 284 | skipping to change at line 281 | |||
if ( p == NULL ) { | if ( p == NULL ) { | |||
parsemsg( LOG_ERR, func, "inetd.conf - No value specified for user" ); | parsemsg( LOG_ERR, func, "inetd.conf - No value specified for user" ); | |||
sc_free(scp); | sc_free(scp); | |||
return -1; | return -1; | |||
} | } | |||
if( EQ( p, "internal" ) ) | if( EQ( p, "internal" ) ) | |||
{ | { | |||
nvp = nv_find_value( service_types, "INTERNAL" ); | nvp = nv_find_value( service_types, "INTERNAL" ); | |||
if ( nvp == NULL ) | if ( nvp == NULL ) | |||
{ | { | |||
parsemsg( LOG_WARNING, func, "inetd.conf - Bad foo %s", name ) ; | parsemsg( LOG_WARNING, func, "inetd.conf - Bad foo %s", SC_NAME(scp) ) ; | |||
pset_destroy(args); | pset_destroy(args); | |||
sc_free(scp); | sc_free(scp); | |||
return -1; | return -1; | |||
} | } | |||
M_SET(SC_TYPE(scp), nvp->value); | M_SET(SC_TYPE(scp), nvp->value); | |||
if( EQ( SC_NAME(scp), "time" ) ) { | if( EQ( SC_NAME(scp), "time" ) ) { | |||
if( EQ( proto, "stream" ) ) | if( EQ( proto, "stream" ) ) | |||
SC_ID(scp) = new_string("time-stream"); | SC_ID(scp) = new_string("time-stream"); | |||
skipping to change at line 362 | skipping to change at line 359 | |||
pset_destroy(args); | pset_destroy(args); | |||
sc_free(scp); | sc_free(scp); | |||
return -1; | return -1; | |||
} | } | |||
SC_SERVER_ARGV(scp)[u] = p; | SC_SERVER_ARGV(scp)[u] = p; | |||
} | } | |||
/* Set the reuse flag, as this is the default for inetd */ | /* Set the reuse flag, as this is the default for inetd */ | |||
nvp = nv_find_value( service_flags, "REUSE" ); | nvp = nv_find_value( service_flags, "REUSE" ); | |||
if ( nvp == NULL ) | if ( nvp == NULL ) | |||
{ | { | |||
parsemsg( LOG_WARNING, func, "inetd.conf - Bad foo %s", name ) ; | parsemsg( LOG_WARNING, func, "inetd.conf - Bad foo %s", SC_NAME(scp) ) ; | |||
pset_destroy(args); | pset_destroy(args); | |||
sc_free(scp); | sc_free(scp); | |||
return -1; | return -1; | |||
} | } | |||
M_SET(SC_XFLAGS(scp), nvp->value); | M_SET(SC_XFLAGS(scp), nvp->value); | |||
/* Set the NOLIBWRAP flag, since inetd doesn't have libwrap built in */ | /* Set the NOLIBWRAP flag, since inetd doesn't have libwrap built in */ | |||
nvp = nv_find_value( service_flags, "NOLIBWRAP" ); | nvp = nv_find_value( service_flags, "NOLIBWRAP" ); | |||
if ( nvp == NULL ) | if ( nvp == NULL ) | |||
{ | { | |||
parsemsg( LOG_WARNING, func, "inetd.conf - Bad foo %s", name ) ; | parsemsg( LOG_WARNING, func, "inetd.conf - Bad foo %s", SC_NAME(scp) ) ; | |||
pset_destroy(args); | pset_destroy(args); | |||
sc_free(scp); | sc_free(scp); | |||
return -1; | return -1; | |||
} | } | |||
M_SET(SC_XFLAGS(scp), nvp->value); | M_SET(SC_XFLAGS(scp), nvp->value); | |||
/* Set the NAMEINARGS flag, as that's the default for inetd */ | /* Set the NAMEINARGS flag, as that's the default for inetd */ | |||
nvp = nv_find_value( service_flags, "NAMEINARGS" ); | nvp = nv_find_value( service_flags, "NAMEINARGS" ); | |||
if ( nvp == NULL ) | if ( nvp == NULL ) | |||
{ | { | |||
parsemsg( LOG_WARNING, func, "inetd.conf - Bad foo %s", name ) ; | parsemsg( LOG_WARNING, func, "inetd.conf - Bad foo %s", SC_NAME(scp) ) ; | |||
pset_destroy(args); | pset_destroy(args); | |||
sc_free(scp); | sc_free(scp); | |||
return (-1); | return (-1); | |||
} | } | |||
M_SET(SC_XFLAGS(scp), nvp->value); | M_SET(SC_XFLAGS(scp), nvp->value); | |||
SC_SPECIFY( scp, A_SERVER_ARGS ); | SC_SPECIFY( scp, A_SERVER_ARGS ); | |||
if ( (SC_ID(scp) = new_string( SC_NAME(scp) )) ) | if ( (SC_ID(scp) = new_string( SC_NAME(scp) )) ) | |||
SC_PRESENT( scp, A_ID ) ; | SC_PRESENT( scp, A_ID ) ; | |||
else | else | |||
End of changes. 9 change blocks. | ||||
11 lines changed or deleted | 8 lines changed or added |