parsers.c (xinetd-2.3.15) | : | parsers.c (xinetd-2.3.15.4.tar.xz) | ||
---|---|---|---|---|
skipping to change at line 53 | skipping to change at line 53 | |||
if ( (set) == NULL && \ | if ( (set) == NULL && \ | |||
( (set) = pset_create( (v1), (v2) ) ) == NULL ) \ | ( (set) = pset_create( (v1), (v2) ) ) == NULL ) \ | |||
{ \ | { \ | |||
out_of_memory( func ) ; \ | out_of_memory( func ) ; \ | |||
return( FAILED ) ; \ | return( FAILED ) ; \ | |||
} | } | |||
static void missing_attr_msg(const char *par, const char *item) | static void missing_attr_msg(const char *par, const char *item) | |||
{ | { | |||
parsemsg( LOG_WARNING, par, | parsemsg( LOG_WARNING, par, | |||
"attribute %s expects at least 1 value and none were given.", | "attribute %s expects at least 1 value and none was given.", | |||
item ); | item ); | |||
} | } | |||
/* | /* | |||
* Find the flags corresponding to strings in "values" and apply | * Find the flags corresponding to strings in "values" and apply | |||
* them to "*maskp" (apply means add or remove depending on "op") | * them to "*maskp" (apply means add or remove depending on "op") | |||
* "description" describes the type of flags. | * "description" describes the type of flags. | |||
*/ | */ | |||
static status_e parse_value_list( pset_h values, | static status_e parse_value_list( pset_h values, | |||
mask_t *maskp, | mask_t *maskp, | |||
skipping to change at line 244 | skipping to change at line 244 | |||
else if ( EQ( val, "no" ) ) | else if ( EQ( val, "no" ) ) | |||
SC_WAIT(scp) = NO ; | SC_WAIT(scp) = NO ; | |||
else | else | |||
{ | { | |||
parsemsg( LOG_ERR, func, "Bad value for wait: %s", val ) ; | parsemsg( LOG_ERR, func, "Bad value for wait: %s", val ) ; | |||
return( FAILED ); | return( FAILED ); | |||
} | } | |||
return( OK ) ; | return( OK ) ; | |||
} | } | |||
#ifdef HAVE_MDNS | ||||
status_e mdns_parser( pset_h values, | ||||
struct service_config *scp, | ||||
enum assign_op op ) | ||||
{ | ||||
char *val = (char *) pset_pointer( values, 0 ) ; | ||||
const char *func = "mdns_parser" ; | ||||
if ( EQ( val, "yes" ) ) | ||||
SC_MDNS(scp) = YES ; | ||||
else if ( EQ( val, "no" ) ) | ||||
SC_MDNS(scp) = NO ; | ||||
else | ||||
{ | ||||
parsemsg( LOG_ERR, func, "Bad value for mdns: %s", val ) ; | ||||
return( FAILED ); | ||||
} | ||||
return( OK ) ; | ||||
} | ||||
#endif | ||||
status_e user_parser( pset_h values, | status_e user_parser( pset_h values, | |||
struct service_config *scp, | struct service_config *scp, | |||
enum assign_op op ) | enum assign_op op ) | |||
{ | { | |||
char *user = (char *) pset_pointer( values, 0 ) ; | char *user = (char *) pset_pointer( values, 0 ) ; | |||
const char *func = "user_parser" ; | const char *func = "user_parser" ; | |||
if (parse_all_digits(user) == TRUE) | if (parse_all_digits(user) == TRUE) | |||
{ /* We will assume the number is a valid user. This is a workaround | { /* We will assume the number is a valid user. This is a workaround | |||
for some Solaris systems that have problems doing getgr*. */ | for some Solaris systems that have problems doing getgr*. */ | |||
skipping to change at line 931 | skipping to change at line 910 | |||
char *type ; | char *type ; | |||
const char *func = "parse_log_type" ; | const char *func = "parse_log_type" ; | |||
int count = pset_count( values); | int count = pset_count( values); | |||
if ( count == 0 ) | if ( count == 0 ) | |||
{ | { | |||
missing_attr_msg(func, "log_type"); | missing_attr_msg(func, "log_type"); | |||
return( FAILED ); | return( FAILED ); | |||
} | } | |||
if ( LOG_GET_TYPE( lp ) != L_NONE) { | ||||
parsemsg( LOG_ERR, func, "Cannot set more than one log_type attribute"); | ||||
return( FAILED ); | ||||
} | ||||
type = (char *) pset_pointer( values, 0 ) ; | type = (char *) pset_pointer( values, 0 ) ; | |||
if ( EQ( type, "FILE" ) ) | if ( EQ( type, "FILE" ) ) | |||
{ | { | |||
if ( parse_filelog( LOG_GET_FILELOG( lp ), values ) == FAILED ) | if ( parse_filelog( LOG_GET_FILELOG( lp ), values ) == FAILED ) | |||
return( FAILED ) ; | return( FAILED ) ; | |||
lp->l_type = L_FILE ; | lp->l_type = L_FILE ; | |||
} | } | |||
else if ( EQ( type, "SYSLOG" ) ) | else if ( EQ( type, "SYSLOG" ) ) | |||
{ | { | |||
skipping to change at line 1382 | skipping to change at line 1366 | |||
{ | { | |||
parsemsg( LOG_ERR, func, | parsemsg( LOG_ERR, func, | |||
"Data limit is invalid: %s", mem ) ; | "Data limit is invalid: %s", mem ) ; | |||
return( FAILED ) ; | return( FAILED ) ; | |||
} | } | |||
} | } | |||
return( OK ) ; | return( OK ) ; | |||
} | } | |||
#endif | #endif | |||
#ifdef RLIMIT_NOFILE | ||||
status_e rlim_files_parser( pset_h values, | ||||
struct service_config *scp, | ||||
enum assign_op op ) | ||||
{ | ||||
char *mem = (char *) pset_pointer( values, 0 ) ; | ||||
const char *func = "rlim_files_parser" ; | ||||
if ( EQ( mem, "UNLIMITED" ) ) | ||||
SC_RLIM_FILES(scp) = (rlim_t)RLIM_INFINITY ; | ||||
else | ||||
{ | ||||
if ( get_limit ( mem, &SC_RLIM_FILES(scp)) ) | ||||
{ | ||||
parsemsg( LOG_ERR, func, | ||||
"Max files limit is invalid: %s", mem ) ; | ||||
return( FAILED ) ; | ||||
} | ||||
} | ||||
return( OK ) ; | ||||
} | ||||
#endif | ||||
#ifdef RLIMIT_RSS | #ifdef RLIMIT_RSS | |||
status_e rlim_rss_parser( pset_h values, | status_e rlim_rss_parser( pset_h values, | |||
struct service_config *scp, | struct service_config *scp, | |||
enum assign_op op ) | enum assign_op op ) | |||
{ | { | |||
char *mem = (char *) pset_pointer( values, 0 ) ; | char *mem = (char *) pset_pointer( values, 0 ) ; | |||
const char *func = "rlim_rss_parser" ; | const char *func = "rlim_rss_parser" ; | |||
if ( EQ( mem, "UNLIMITED" ) ) | if ( EQ( mem, "UNLIMITED" ) ) | |||
SC_RLIM_RSS(scp) = (rlim_t)RLIM_INFINITY ; | SC_RLIM_RSS(scp) = (rlim_t)RLIM_INFINITY ; | |||
End of changes. 4 change blocks. | ||||
22 lines changed or deleted | 29 lines changed or added |