FreeBSD Bugzilla – Attachment 167900 Details for
Bug 202135
nscd does not accept a value of zero for negative-time-to-live for passwd nor group
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
patch for check nscd configuration value
nscd_invalid_config_check_11current.patch (text/plain), 3.17 KB, created by
Jov
on 2016-03-09 07:08:22 UTC
(
hide
)
Description:
patch for check nscd configuration value
Filename:
MIME Type:
Creator:
Jov
Created:
2016-03-09 07:08:22 UTC
Size:
3.17 KB
patch
obsolete
>diff --git a/parser.c b/parser.c >index 18b129f..0346eee 100644 >--- a/parser.c >+++ b/parser.c >@@ -375,6 +375,7 @@ parse_config_file(struct configuration *config, > char *fields[128]; > int field_count, line_num, value; > int res; >+ int invalid_value; > > TRACE_IN(parse_config_file); > assert(config != NULL); >@@ -388,6 +389,7 @@ parse_config_file(struct configuration *config, > > res = 0; > line_num = 0; >+ invalid_value = 0; > memset(buffer, 0, sizeof(buffer)); > while ((res == 0) && (fgets(buffer, sizeof(buffer) - 1, fin) != NULL)) { > field_count = strbreak(buffer, fields, sizeof(fields)); >@@ -421,12 +423,20 @@ parse_config_file(struct configuration *config, > (strcmp(fields[0], "positive-time-to-live") == 0) && > (check_cachename(fields[1]) == 0) && > ((value = get_number(fields[2], 0, -1)) != -1)) { >+ if (value <= 0) { >+ invalid_value = 1; >+ break; >+ } > set_positive_time_to_live(config, > fields[1], value); > continue; > } else if ((field_count == 3) && > (strcmp(fields[0], "positive-confidence-threshold") == 0) && > ((value = get_number(fields[2], 1, -1)) != -1)) { >+ if (value <= 0) { >+ invalid_value = 1; >+ break; >+ } > set_positive_confidence_threshold(config, > fields[1], value); > continue; >@@ -450,12 +460,20 @@ parse_config_file(struct configuration *config, > (strcmp(fields[0], "negative-time-to-live") == 0) && > (check_cachename(fields[1]) == 0) && > ((value = get_number(fields[2], 0, -1)) != -1)) { >+ if (value <= 0) { >+ invalid_value = 1; >+ break; >+ } > set_negative_time_to_live(config, > fields[1], value); > continue; > } else if ((field_count == 3) && > (strcmp(fields[0], "negative-confidence-threshold") == 0) && > ((value = get_number(fields[2], 1, -1)) != -1)) { >+ if (value <= 0) { >+ invalid_value = 1; >+ break; >+ } > set_negative_confidence_threshold(config, > fields[1], value); > continue; >@@ -473,6 +491,10 @@ parse_config_file(struct configuration *config, > (strcmp(fields[0], "suggested-size") == 0) && > (check_cachename(fields[1]) == 0) && > ((value = get_number(fields[2], 1, -1)) != -1)) { >+ if (value <= 0) { >+ invalid_value = 1; >+ break; >+ } > set_suggested_size(config, fields[1], value); > continue; > } >@@ -490,6 +512,10 @@ parse_config_file(struct configuration *config, > (strcmp(fields[0], "keep-hot-count") == 0) && > (check_cachename(fields[1]) == 0) && > ((value = get_number(fields[2], 0, -1)) != -1)) { >+ if (value < 0) { >+ invalid_value = 1; >+ break; >+ } > set_keep_hot_count(config, > fields[1], value); > continue; >@@ -508,10 +534,17 @@ parse_config_file(struct configuration *config, > default: > break; > } >- >- LOG_ERR_2("config file parser", "error in file " >- "%s on line %d", fname, line_num); >- *error_str = "syntax error"; >+ if ( invalid_value == 1){ >+ LOG_ERR_2("invalid value for configuration", >+ "error in file %s on line %d", >+ fname, line_num); >+ *error_str = "invalid value"; >+ } >+ else { >+ LOG_ERR_2("config file parser", "error in " >+ "file %s on line %d", fname, line_num); >+ *error_str = "syntax error"; >+ } > *error_line = line_num; > res = -1; > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 202135
: 167900