BUG/MEDIUM: map: Bad map file parser
There is a mix-up between input type of the data and input type of the
map file. This mix-up causes that all pattern matching function based
on "string" (reg, beg, end, ...) don't run.
This bug came with commit d5f624d (MEDIUM: sample: add the "map" converter),
no backport is needed.
diff --git a/src/map.c b/src/map.c
index 81f892e..78392d4 100644
--- a/src/map.c
+++ b/src/map.c
@@ -368,7 +368,8 @@
else {
list_for_each_entry(desc, &ref->maps, list)
if (desc->conv->in_type == conv->in_type &&
- desc->conv->out_type == conv->out_type)
+ desc->conv->out_type == conv->out_type &&
+ desc->conv->private == conv->private)
break;
if (&desc->list != &ref->maps)
pat = desc->pat;
@@ -409,17 +410,7 @@
/* set the match method */
desc->pat->match = pat_match_fcts[conv->private];
-
- /* set the input parse method */
- switch (desc->conv->in_type) {
- case SMP_T_STR: desc->pat->parse = pat_parse_fcts[PAT_MATCH_STR]; break;
- case SMP_T_UINT: desc->pat->parse = pat_parse_fcts[PAT_MATCH_INT]; break;
- case SMP_T_ADDR: desc->pat->parse = pat_parse_fcts[PAT_MATCH_IP]; break;
- default:
- memprintf(err, "map: internal haproxy error: no default parse case for the input type <%d>.",
- conv->in_type);
- return 0;
- }
+ desc->pat->parse = pat_parse_fcts[conv->private];
/* parse each line of the file */
pattern = NULL;