mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-04-21 14:35:45 +00:00
BUG/MINOR: cfgparse: Fix transition between 2 sections with the same name
When a section's parser is registered, it can also define a post section callback, called at the end of the section parsing. But when 2 sections with the same name followed each other, the transition between them was missed. This induced 2 bugs. First, the call to the post section callback was skipped. Then, the parsing of the second section was mixed with the first one. This patch must be backported in 1.8.
This commit is contained in:
parent
2442f68dd3
commit
7805e2bc1f
@ -1880,32 +1880,31 @@ next_line:
|
|||||||
list_for_each_entry(ics, §ions, list) {
|
list_for_each_entry(ics, §ions, list) {
|
||||||
if (strcmp(args[0], ics->section_name) == 0) {
|
if (strcmp(args[0], ics->section_name) == 0) {
|
||||||
cursection = ics->section_name;
|
cursection = ics->section_name;
|
||||||
|
pcs = cs;
|
||||||
cs = ics;
|
cs = ics;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pcs && pcs->post_section_parser) {
|
||||||
|
err_code |= pcs->post_section_parser();
|
||||||
|
if (err_code & ERR_ABORT)
|
||||||
|
goto err;
|
||||||
|
pcs = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (!cs) {
|
if (!cs) {
|
||||||
ha_alert("parsing [%s:%d]: unknown keyword '%s' out of section.\n", file, linenum, args[0]);
|
ha_alert("parsing [%s:%d]: unknown keyword '%s' out of section.\n", file, linenum, args[0]);
|
||||||
err_code |= ERR_ALERT | ERR_FATAL;
|
err_code |= ERR_ALERT | ERR_FATAL;
|
||||||
} else {
|
} else {
|
||||||
/* else it's a section keyword */
|
|
||||||
|
|
||||||
if (pcs != cs && pcs && pcs->post_section_parser) {
|
|
||||||
err_code |= pcs->post_section_parser();
|
|
||||||
if (err_code & ERR_ABORT)
|
|
||||||
goto err;
|
|
||||||
}
|
|
||||||
|
|
||||||
err_code |= cs->section_parser(file, linenum, args, kwm);
|
err_code |= cs->section_parser(file, linenum, args, kwm);
|
||||||
if (err_code & ERR_ABORT)
|
if (err_code & ERR_ABORT)
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
pcs = cs;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pcs == cs && pcs && pcs->post_section_parser)
|
if (cs && pcs->post_section_parser)
|
||||||
err_code |= pcs->post_section_parser();
|
err_code |= cs->post_section_parser();
|
||||||
|
|
||||||
err:
|
err:
|
||||||
free(cfg_scope);
|
free(cfg_scope);
|
||||||
|
Loading…
Reference in New Issue
Block a user