From 736459eab8e5e1a5e698c38aaadad095ebf78881 Mon Sep 17 00:00:00 2001 From: Thierry FOURNIER Date: Wed, 11 Dec 2013 11:20:24 +0100 Subject: [PATCH] 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. --- src/map.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/src/map.c b/src/map.c index 81f892e4a..78392d476 100644 --- a/src/map.c +++ b/src/map.c @@ -368,7 +368,8 @@ static int sample_load_map(struct arg *arg, struct sample_conv *conv, char **err 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 @@ static int sample_load_map(struct arg *arg, struct sample_conv *conv, char **err /* 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;