]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MAJOR: patterns: -i and -n are ignored for inlined patterns
authorWilly Tarreau <w@1wt.eu>
Sat, 26 Apr 2014 21:33:51 +0000 (23:33 +0200)
committerWilly Tarreau <w@1wt.eu>
Sun, 27 Apr 2014 07:21:08 +0000 (09:21 +0200)
These flags are only passed to pattern_read_from_file() which
loads the patterns from a file. The functions used to parse the
patterns from the current line do not provide the means to pass
the pattern flags so they're lost.

This issue was introduced in dev23 with the major pattern rework,
and was reported by Graham Morley. No backport is needed.

include/proto/pattern.h
src/acl.c
src/dumpstats.c
src/pattern.c
src/proto_http.c

index e6ceba8ed36f20f0529cf5e6eb80d26629ccfb64..22da6d5e8092b14cac1fa9573cd92c839a765c7f 100644 (file)
@@ -183,7 +183,7 @@ struct pat_ref *pat_ref_new(const char *reference, const char *display, unsigned
 struct pat_ref *pat_ref_newid(int unique_id, const char *display, unsigned int flags);
 struct pat_ref_elt *pat_ref_find_elt(struct pat_ref *ref, const char *key);
 int pat_ref_append(struct pat_ref *ref, char *pattern, char *sample, int line);
-int pat_ref_add(struct pat_ref *ref, const char *pattern, const char *sample, char **err);
+int pat_ref_add(struct pat_ref *ref, const char *pattern, const char *sample, int patflags, char **err);
 int pat_ref_set(struct pat_ref *ref, const char *pattern, const char *sample, char **err);
 int pat_ref_set_by_id(struct pat_ref *ref, struct pat_ref_elt *refelt, const char *value, char **err);
 int pat_ref_delete(struct pat_ref *ref, const char *key);
index 29b158fae051639ed314223d7323adfba5a198e5..93cf31cd5c8275cee6969d26f0c6f26a434188d8 100644 (file)
--- a/src/acl.c
+++ b/src/acl.c
@@ -659,7 +659,7 @@ struct acl_expr *parse_acl_expr(const char **args, char **err, struct arg_list *
                /* Add sample to the reference, and try to compile it fior each pattern
                 * using this value.
                 */
-               if (!pat_ref_add(ref, arg, NULL, err))
+               if (!pat_ref_add(ref, arg, NULL, patflags, err))
                        goto out_free_expr;
                args++;
        }
index 5f28e1c99dcde6ca09293f42c53a64a527396ec0..7cf4d84cf7e9a9ad272e9b21afb83e49d6c69648 100644 (file)
@@ -2055,9 +2055,9 @@ static int stats_sock_parse_request(struct stream_interface *si, char *line)
                        /* Add value. */
                        err = NULL;
                        if (appctx->ctx.map.display_flags == PAT_REF_MAP)
-                               ret = pat_ref_add(appctx->ctx.map.ref, args[3], args[4], &err);
+                               ret = pat_ref_add(appctx->ctx.map.ref, args[3], args[4], 0, &err);
                        else
-                               ret = pat_ref_add(appctx->ctx.map.ref, args[3], NULL, &err);
+                               ret = pat_ref_add(appctx->ctx.map.ref, args[3], NULL, 0, &err);
                        if (!ret) {
                                if (err)
                                        memprintf(&err, "%s.\n", err);
index 5ebb5ce818c5c43eaadaa1bb748da206108633db..e741b20d031030f65bad828b660b915e2088edfc 100644 (file)
@@ -1697,7 +1697,7 @@ int pat_ref_push(struct pat_ref_elt *elt, struct pattern_expr *expr,
  */
 int pat_ref_add(struct pat_ref *ref,
                 const char *pattern, const char *sample,
-                char **err)
+                int patflags, char **err)
 {
        struct pat_ref_elt *elt;
        struct pattern_expr *expr;
@@ -1732,7 +1732,7 @@ int pat_ref_add(struct pat_ref *ref,
        LIST_ADDQ(&ref->head, &elt->list);
 
        list_for_each_entry(expr, &ref->pat, list) {
-               if (!pat_ref_push(elt, expr, 0, err)) {
+               if (!pat_ref_push(elt, expr, patflags, err)) {
                        /* If the insertion fails, try to delete all the added entries. */
                        pat_ref_delete_by_id(ref, elt);
                        return 0;
index 90b73dacd7771941d31346954c83131a847bbc69..b7f6edff81baa3e4bf4f62ee78f7593d4d3778a2 100644 (file)
@@ -3260,7 +3260,7 @@ http_req_get_intercept_rule(struct proxy *px, struct list *rules, struct session
                        /* perform update */
                        /* add entry only if it does not already exist */
                        if (pat_ref_find_elt(ref, key) == NULL)
-                               pat_ref_add(ref, key, NULL, NULL);
+                               pat_ref_add(ref, key, NULL, 0, NULL);
 
                        break;
                        }
@@ -3295,7 +3295,7 @@ http_req_get_intercept_rule(struct proxy *px, struct list *rules, struct session
                                pat_ref_set(ref, key, value, NULL);
                        else
                                /* insert a new entry */
-                               pat_ref_add(ref, key, value, NULL);
+                               pat_ref_add(ref, key, value, 0, NULL);
 
                        break;
                        }
@@ -3441,7 +3441,7 @@ http_res_get_intercept_rule(struct proxy *px, struct list *rules, struct session
                        /* perform update */
                        /* check if the entry already exists */
                        if (pat_ref_find_elt(ref, key) == NULL)
-                               pat_ref_add(ref, key, NULL, NULL);
+                               pat_ref_add(ref, key, NULL, 0, NULL);
 
                        break;
                        }
@@ -3476,7 +3476,7 @@ http_res_get_intercept_rule(struct proxy *px, struct list *rules, struct session
                                pat_ref_set(ref, key, value, NULL);
                        else
                                /* insert a new entry */
-                               pat_ref_add(ref, key, value, NULL);
+                               pat_ref_add(ref, key, value, 0, NULL);
 
                        break;
                        }