]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: pattern/acl: get rid of temp_pattern in ACLs
authorWilly Tarreau <w@1wt.eu>
Mon, 23 Apr 2012 16:53:56 +0000 (18:53 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 8 May 2012 18:57:14 +0000 (20:57 +0200)
This one is not needed anymore as we can return the data and its type in the
sample provided by the caller. ACLs now always return the proper type. BOOL
is already returned when the result is expected to be processed as a boolean.

temp_pattern has been unexported now.

include/proto/pattern.h
src/acl.c
src/backend.c
src/frontend.c
src/pattern.c
src/proto_http.c
src/proto_tcp.c
src/protocols.c
src/session.c

index e0fb3eb6ebca2d8e99fa66aadffab22b1a0ac3c8..8a896ff55bb866ebcaad30f37e887570ae06aada 100644 (file)
@@ -25,8 +25,6 @@
 #include <types/pattern.h>
 #include <types/stick_table.h>
 
-extern struct pattern temp_pattern;
-
 struct pattern_expr *pattern_parse_expr(char **str, int *idx, char *err, int err_size);
 struct pattern *pattern_process(struct proxy *px, struct session *l4,
                                 void *l7, int dir, struct pattern_expr *expr,
index b7251ceab34f8ca3891c83afd1f10a303bd8f363..91a9754c46901dcbf6be6b28e34cecd478714ee2 100644 (file)
--- a/src/acl.c
+++ b/src/acl.c
@@ -68,6 +68,7 @@ static int
 acl_fetch_true(struct proxy *px, struct session *l4, void *l7, int dir,
                struct acl_expr *expr, struct sample *smp)
 {
+       smp->type = SMP_T_BOOL;
        smp->flags |= SMP_F_SET_RES_PASS;
        return 1;
 }
@@ -83,6 +84,7 @@ acl_fetch_wait_end(struct proxy *px, struct session *l4, void *l7, int dir,
                smp->flags |= SMP_F_MAY_CHANGE;
                return 0;
        }
+       smp->type = SMP_T_BOOL;
        smp->flags |= SMP_F_SET_RES_PASS;
        return 1;
 }
@@ -92,6 +94,7 @@ static int
 acl_fetch_false(struct proxy *px, struct session *l4, void *l7, int dir,
                 struct acl_expr *expr, struct sample *smp)
 {
+       smp->type = SMP_T_BOOL;
        smp->flags |= SMP_F_SET_RES_FAIL;
        return 1;
 }
@@ -104,7 +107,8 @@ acl_fetch_req_len(struct proxy *px, struct session *l4, void *l7, int dir,
        if (!l4 || !l4->req)
                return 0;
 
-       temp_pattern.data.uint = l4->req->i;
+       smp->type = SMP_T_UINT;
+       smp->data.uint = l4->req->i;
        smp->flags = SMP_F_VOLATILE | SMP_F_MAY_CHANGE;
        return 1;
 }
@@ -157,7 +161,8 @@ acl_fetch_ssl_hello_type(struct proxy *px, struct session *l4, void *l7, int dir
                goto not_ssl_hello;
        }
 
-       temp_pattern.data.uint = hs_type;
+       smp->type = SMP_T_UINT;
+       smp->data.uint = hs_type;
        smp->flags = SMP_F_VOLATILE;
 
        return 1;
@@ -270,7 +275,8 @@ acl_fetch_req_ssl_ver(struct proxy *px, struct session *l4, void *l7, int dir,
        /* OK that's enough. We have at least the whole message, and we have
         * the protocol version.
         */
-       temp_pattern.data.uint = version;
+       smp->type = SMP_T_UINT;
+       smp->data.uint = version;
        smp->flags = SMP_F_VOLATILE;
        return 1;
 
@@ -425,8 +431,9 @@ acl_fetch_ssl_hello_sni(struct proxy *px, struct session *l4, void *l7, int dir,
                        name_len = (data[7] << 8) + data[8];
 
                        if (name_type == 0) { /* hostname */
-                               temp_pattern.data.str.str = (char *)data + 9;
-                               temp_pattern.data.str.len = name_len;
+                               smp->type = SMP_T_CSTR;
+                               smp->data.str.str = (char *)data + 9;
+                               smp->data.str.len = name_len;
                                smp->flags = SMP_F_VOLATILE;
                                return 1;
                        }
@@ -462,6 +469,7 @@ acl_fetch_rdp_cookie(struct proxy *px, struct session *l4, void *l7, int dir,
                return 0;
 
        smp->flags = 0;
+       smp->type = SMP_T_CSTR;
 
        bleft = l4->req->i;
        if (bleft <= 11)
@@ -514,8 +522,8 @@ acl_fetch_rdp_cookie(struct proxy *px, struct session *l4, void *l7, int dir,
        }
 
        /* data points to cookie value */
-       temp_pattern.data.str.str = (char *)data;
-       temp_pattern.data.str.len = 0;
+       smp->data.str.str = (char *)data;
+       smp->data.str.len = 0;
 
        while (bleft > 0 && *data != '\r') {
                data++;
@@ -528,7 +536,7 @@ acl_fetch_rdp_cookie(struct proxy *px, struct session *l4, void *l7, int dir,
        if (data[0] != '\r' || data[1] != '\n')
                goto not_cookie;
 
-       temp_pattern.data.str.len = (char *)data - temp_pattern.data.str.str;
+       smp->data.str.len = (char *)data - smp->data.str.str;
        smp->flags = SMP_F_VOLATILE;
        return 1;
 
@@ -546,14 +554,12 @@ acl_fetch_rdp_cookie_cnt(struct proxy *px, struct session *l4, void *l7, int dir
 
        ret = acl_fetch_rdp_cookie(px, l4, l7, dir, expr, smp);
 
-       temp_pattern.data.str.str = NULL;
-       temp_pattern.data.str.len = 0;
-
        if (smp->flags & SMP_F_MAY_CHANGE)
                return 0;
 
        smp->flags = SMP_F_VOLATILE;
-       temp_pattern.data.uint = ret;
+       smp->type = SMP_T_UINT;
+       smp->data.uint = ret;
 
        return 1;
 }
@@ -588,12 +594,12 @@ int acl_match_str(struct sample *smp, struct acl_pattern *pattern)
 {
        int icase;
 
-       if (pattern->len != temp_pattern.data.str.len)
+       if (pattern->len != smp->data.str.len)
                return ACL_PAT_FAIL;
 
        icase = pattern->flags & ACL_PAT_F_IGNORE_CASE;
-       if ((icase && strncasecmp(pattern->ptr.str, temp_pattern.data.str.str, temp_pattern.data.str.len) == 0) ||
-           (!icase && strncmp(pattern->ptr.str, temp_pattern.data.str.str, temp_pattern.data.str.len) == 0))
+       if ((icase && strncasecmp(pattern->ptr.str, smp->data.str.str, smp->data.str.len) == 0) ||
+           (!icase && strncmp(pattern->ptr.str, smp->data.str.str, smp->data.str.len) == 0))
                return ACL_PAT_PASS;
        return ACL_PAT_FAIL;
 }
@@ -608,12 +614,12 @@ static void *acl_lookup_str(struct sample *smp, struct acl_expr *expr)
        char prev;
 
        /* we may have to force a trailing zero on the test pattern */
-       prev = temp_pattern.data.str.str[temp_pattern.data.str.len];
+       prev = smp->data.str.str[smp->data.str.len];
        if (prev)
-               temp_pattern.data.str.str[temp_pattern.data.str.len] = '\0';
-       node = ebst_lookup(&expr->pattern_tree, temp_pattern.data.str.str);
+               smp->data.str.str[smp->data.str.len] = '\0';
+       node = ebst_lookup(&expr->pattern_tree, smp->data.str.str);
        if (prev)
-               temp_pattern.data.str.str[temp_pattern.data.str.len] = prev;
+               smp->data.str.str[smp->data.str.len] = prev;
        return node;
 }
 
@@ -630,28 +636,28 @@ int acl_match_reg(struct sample *smp, struct acl_pattern *pattern)
        if (unlikely(smp->flags & SMP_F_READ_ONLY)) {
                char *new_str;
 
-               new_str = calloc(1, temp_pattern.data.str.len + 1);
+               new_str = calloc(1, smp->data.str.len + 1);
                if (!new_str)
                        return ACL_PAT_FAIL;
 
-               memcpy(new_str, temp_pattern.data.str.str, temp_pattern.data.str.len);
-               new_str[temp_pattern.data.str.len] = 0;
+               memcpy(new_str, smp->data.str.str, smp->data.str.len);
+               new_str[smp->data.str.len] = 0;
                if (smp->flags & SMP_F_MUST_FREE)
-                       free(temp_pattern.data.str.str);
-               temp_pattern.data.str.str = new_str;
+                       free(smp->data.str.str);
+               smp->data.str.str = new_str;
                smp->flags |= SMP_F_MUST_FREE;
                smp->flags &= ~SMP_F_READ_ONLY;
        }
 
-       old_char = temp_pattern.data.str.str[temp_pattern.data.str.len];
-       temp_pattern.data.str.str[temp_pattern.data.str.len] = 0;
+       old_char = smp->data.str.str[smp->data.str.len];
+       smp->data.str.str[smp->data.str.len] = 0;
 
-       if (regexec(pattern->ptr.reg, temp_pattern.data.str.str, 0, NULL, 0) == 0)
+       if (regexec(pattern->ptr.reg, smp->data.str.str, 0, NULL, 0) == 0)
                ret = ACL_PAT_PASS;
        else
                ret = ACL_PAT_FAIL;
 
-       temp_pattern.data.str.str[temp_pattern.data.str.len] = old_char;
+       smp->data.str.str[smp->data.str.len] = old_char;
        return ret;
 }
 
@@ -660,12 +666,12 @@ int acl_match_beg(struct sample *smp, struct acl_pattern *pattern)
 {
        int icase;
 
-       if (pattern->len > temp_pattern.data.str.len)
+       if (pattern->len > smp->data.str.len)
                return ACL_PAT_FAIL;
 
        icase = pattern->flags & ACL_PAT_F_IGNORE_CASE;
-       if ((icase && strncasecmp(pattern->ptr.str, temp_pattern.data.str.str, pattern->len) != 0) ||
-           (!icase && strncmp(pattern->ptr.str, temp_pattern.data.str.str, pattern->len) != 0))
+       if ((icase && strncasecmp(pattern->ptr.str, smp->data.str.str, pattern->len) != 0) ||
+           (!icase && strncmp(pattern->ptr.str, smp->data.str.str, pattern->len) != 0))
                return ACL_PAT_FAIL;
        return ACL_PAT_PASS;
 }
@@ -675,11 +681,11 @@ int acl_match_end(struct sample *smp, struct acl_pattern *pattern)
 {
        int icase;
 
-       if (pattern->len > temp_pattern.data.str.len)
+       if (pattern->len > smp->data.str.len)
                return ACL_PAT_FAIL;
        icase = pattern->flags & ACL_PAT_F_IGNORE_CASE;
-       if ((icase && strncasecmp(pattern->ptr.str, temp_pattern.data.str.str + temp_pattern.data.str.len - pattern->len, pattern->len) != 0) ||
-           (!icase && strncmp(pattern->ptr.str, temp_pattern.data.str.str + temp_pattern.data.str.len - pattern->len, pattern->len) != 0))
+       if ((icase && strncasecmp(pattern->ptr.str, smp->data.str.str + smp->data.str.len - pattern->len, pattern->len) != 0) ||
+           (!icase && strncmp(pattern->ptr.str, smp->data.str.str + smp->data.str.len - pattern->len, pattern->len) != 0))
                return ACL_PAT_FAIL;
        return ACL_PAT_PASS;
 }
@@ -693,20 +699,20 @@ int acl_match_sub(struct sample *smp, struct acl_pattern *pattern)
        char *end;
        char *c;
 
-       if (pattern->len > temp_pattern.data.str.len)
+       if (pattern->len > smp->data.str.len)
                return ACL_PAT_FAIL;
 
-       end = temp_pattern.data.str.str + temp_pattern.data.str.len - pattern->len;
+       end = smp->data.str.str + smp->data.str.len - pattern->len;
        icase = pattern->flags & ACL_PAT_F_IGNORE_CASE;
        if (icase) {
-               for (c = temp_pattern.data.str.str; c <= end; c++) {
+               for (c = smp->data.str.str; c <= end; c++) {
                        if (tolower(*c) != tolower(*pattern->ptr.str))
                                continue;
                        if (strncasecmp(pattern->ptr.str, c, pattern->len) == 0)
                                return ACL_PAT_PASS;
                }
        } else {
-               for (c = temp_pattern.data.str.str; c <= end; c++) {
+               for (c = smp->data.str.str; c <= end; c++) {
                        if (*c != *pattern->ptr.str)
                                continue;
                        if (strncmp(pattern->ptr.str, c, pattern->len) == 0)
@@ -762,13 +768,13 @@ static int match_word(struct sample *smp, struct acl_pattern *pattern, unsigned
        while (pl > 0 && is_delimiter(ps[pl - 1], delimiters))
                pl--;
 
-       if (pl > temp_pattern.data.str.len)
+       if (pl > smp->data.str.len)
                return ACL_PAT_FAIL;
 
        may_match = 1;
        icase = pattern->flags & ACL_PAT_F_IGNORE_CASE;
-       end = temp_pattern.data.str.str + temp_pattern.data.str.len - pl;
-       for (c = temp_pattern.data.str.str; c <= end; c++) {
+       end = smp->data.str.str + smp->data.str.len - pl;
+       for (c = smp->data.str.str; c <= end; c++) {
                if (is_delimiter(*c, delimiters)) {
                        may_match = 1;
                        continue;
@@ -814,8 +820,8 @@ int acl_match_dom(struct sample *smp, struct acl_pattern *pattern)
 /* Checks that the integer in <test> is included between min and max */
 int acl_match_int(struct sample *smp, struct acl_pattern *pattern)
 {
-       if ((!pattern->val.range.min_set || pattern->val.range.min <= temp_pattern.data.uint) &&
-           (!pattern->val.range.max_set || temp_pattern.data.uint <= pattern->val.range.max))
+       if ((!pattern->val.range.min_set || pattern->val.range.min <= smp->data.uint) &&
+           (!pattern->val.range.max_set || smp->data.uint <= pattern->val.range.max))
                return ACL_PAT_PASS;
        return ACL_PAT_FAIL;
 }
@@ -823,8 +829,8 @@ int acl_match_int(struct sample *smp, struct acl_pattern *pattern)
 /* Checks that the length of the pattern in <test> is included between min and max */
 int acl_match_len(struct sample *smp, struct acl_pattern *pattern)
 {
-       if ((!pattern->val.range.min_set || pattern->val.range.min <= temp_pattern.data.str.len) &&
-           (!pattern->val.range.max_set || temp_pattern.data.str.len <= pattern->val.range.max))
+       if ((!pattern->val.range.min_set || pattern->val.range.min <= smp->data.str.len) &&
+           (!pattern->val.range.max_set || smp->data.str.len <= pattern->val.range.max))
                return ACL_PAT_PASS;
        return ACL_PAT_FAIL;
 }
@@ -833,10 +839,10 @@ int acl_match_ip(struct sample *smp, struct acl_pattern *pattern)
 {
        struct in_addr *s;
 
-       if (temp_pattern.type != SMP_T_IPV4)
+       if (smp->type != SMP_T_IPV4)
                return ACL_PAT_FAIL;
 
-       s = &temp_pattern.data.ipv4;
+       s = &smp->data.ipv4;
        if (((s->s_addr ^ pattern->val.ipv4.addr.s_addr) & pattern->val.ipv4.mask.s_addr) == 0)
                return ACL_PAT_PASS;
        return ACL_PAT_FAIL;
@@ -849,10 +855,10 @@ static void *acl_lookup_ip(struct sample *smp, struct acl_expr *expr)
 {
        struct in_addr *s;
 
-       if (temp_pattern.type != SMP_T_IPV4)
+       if (smp->type != SMP_T_IPV4)
                return ACL_PAT_FAIL;
 
-       s = &temp_pattern.data.ipv4;
+       s = &smp->data.ipv4;
        return ebmb_lookup_longest(&expr->pattern_tree, &s->s_addr);
 }
 
@@ -1899,8 +1905,8 @@ int acl_exec_cond(struct acl_cond *cond, struct proxy *px, struct session *l4, v
 
                                /* now we may have some cleanup to do */
                                if (smp.flags & SMP_F_MUST_FREE) {
-                                       free(temp_pattern.data.str.str);
-                                       temp_pattern.data.str.len = 0;
+                                       free(smp.data.str.str);
+                                       smp.data.str.len = 0;
                                }
 
                                /* we're ORing these terms, so a single PASS is enough */
index 36cf2c473d368916accd2db7d3858fd4a968c3f9..c60f3a3e1b72d06eff6b9dbcc57a156da2d28dea 100644 (file)
@@ -421,7 +421,7 @@ struct server *get_server_rch(struct session *s)
        expr.args = args;
 
        ret = acl_fetch_rdp_cookie(px, s, NULL, ACL_DIR_REQ, &expr, &smp);
-       len = temp_pattern.data.str.len;
+       len = smp.data.str.len;
 
        if (ret == 0 || (smp.flags & SMP_F_MAY_CHANGE) || len == 0)
                return NULL;
@@ -433,7 +433,7 @@ struct server *get_server_rch(struct session *s)
        /* Found a the hh_name in the headers.
         * we will compute the hash based on this value ctx.val.
         */
-       p = temp_pattern.data.str.str;
+       p = smp.data.str.str;
        while (len) {
                hash = *p + (hash << 6) + (hash << 16) - hash;
                len--;
@@ -1143,14 +1143,14 @@ int tcp_persist_rdp_cookie(struct session *s, struct buffer *req, int an_bit)
        expr.args = args;
 
        ret = acl_fetch_rdp_cookie(px, s, NULL, ACL_DIR_REQ, &expr, &smp);
-       if (ret == 0 || (smp.flags & SMP_F_MAY_CHANGE) || temp_pattern.data.str.len == 0)
+       if (ret == 0 || (smp.flags & SMP_F_MAY_CHANGE) || smp.data.str.len == 0)
                goto no_cookie;
 
        memset(&addr, 0, sizeof(addr));
        addr.sin_family = AF_INET;
 
        /* Considering an rdp cookie detected using acl, str ended with <cr><lf> and should return */
-       addr.sin_addr.s_addr = strtoul(temp_pattern.data.str.str, &p, 10);
+       addr.sin_addr.s_addr = strtoul(smp.data.str.str, &p, 10);
        if (*p != '.')
                goto no_cookie;
        p++;
@@ -1386,14 +1386,15 @@ acl_fetch_nbsrv(struct proxy *px, struct session *l4, void *l7, int dir,
                 struct acl_expr *expr, struct sample *smp)
 {
        smp->flags = SMP_F_VOL_TEST;
+       smp->type = SMP_T_UINT;
        px = expr->args->data.prx;
 
        if (px->srv_act)
-               temp_pattern.data.uint = px->srv_act;
+               smp->data.uint = px->srv_act;
        else if (px->lbprm.fbck)
-               temp_pattern.data.uint = 1;
+               smp->data.uint = 1;
        else
-               temp_pattern.data.uint = px->srv_bck;
+               smp->data.uint = px->srv_bck;
 
        return 1;
 }
@@ -1410,6 +1411,7 @@ acl_fetch_srv_is_up(struct proxy *px, struct session *l4, void *l7, int dir,
        struct server *srv = expr->args->data.srv;
 
        smp->flags = SMP_F_VOL_TEST;
+       smp->type = SMP_T_BOOL;
        if (!(srv->state & SRV_MAINTAIN) &&
            (!(srv->state & SRV_CHECKED) || (srv->state & SRV_RUNNING)))
                smp->flags |= SMP_F_SET_RES_PASS;
@@ -1429,7 +1431,8 @@ acl_fetch_connslots(struct proxy *px, struct session *l4, void *l7, int dir,
        struct server *iterator;
 
        smp->flags = SMP_F_VOL_TEST;
-       temp_pattern.data.uint = 0;
+       smp->type = SMP_T_UINT;
+       smp->data.uint = 0;
 
        for (iterator = expr->args->data.prx->srv; iterator; iterator = iterator->next) {
                if ((iterator->state & SRV_RUNNING) == 0)
@@ -1437,11 +1440,11 @@ acl_fetch_connslots(struct proxy *px, struct session *l4, void *l7, int dir,
 
                if (iterator->maxconn == 0 || iterator->maxqueue == 0) {
                        /* configuration is stupid */
-                       temp_pattern.data.uint = -1;  /* FIXME: stupid value! */
+                       smp->data.uint = -1;  /* FIXME: stupid value! */
                        return 1;
                }
 
-               temp_pattern.data.uint += (iterator->maxconn - iterator->cur_sess)
+               smp->data.uint += (iterator->maxconn - iterator->cur_sess)
                                       +  (iterator->maxqueue - iterator->nbpend);
        }
 
@@ -1454,8 +1457,9 @@ acl_fetch_be_id(struct proxy *px, struct session *l4, void *l7, int dir,
                 struct acl_expr *expr, struct sample *smp)
 {
        smp->flags = SMP_F_READ_ONLY;
-       temp_pattern.data.uint = l4->be->uuid;
-
+       smp->flags = SMP_F_VOL_TXN;
+       smp->type = SMP_T_UINT;
+       smp->data.uint = l4->be->uuid;
        return 1;
 }
 
@@ -1468,7 +1472,8 @@ acl_fetch_srv_id(struct proxy *px, struct session *l4, void *l7, int dir,
                return 0;
 
        smp->flags = SMP_F_READ_ONLY;
-       temp_pattern.data.uint = target_srv(&l4->target)->puid;
+       smp->type = SMP_T_UINT;
+       smp->data.uint = target_srv(&l4->target)->puid;
 
        return 1;
 }
@@ -1482,7 +1487,8 @@ acl_fetch_be_sess_rate(struct proxy *px, struct session *l4, void *l7, int dir,
                        struct acl_expr *expr, struct sample *smp)
 {
        smp->flags = SMP_F_VOL_TEST;
-       temp_pattern.data.uint = read_freq_ctr(&expr->args->data.prx->be_sess_per_sec);
+       smp->type = SMP_T_UINT;
+       smp->data.uint = read_freq_ctr(&expr->args->data.prx->be_sess_per_sec);
        return 1;
 }
 
@@ -1495,7 +1501,8 @@ acl_fetch_be_conn(struct proxy *px, struct session *l4, void *l7, int dir,
                  struct acl_expr *expr, struct sample *smp)
 {
        smp->flags = SMP_F_VOL_TEST;
-       temp_pattern.data.uint = expr->args->data.prx->beconn;
+       smp->type = SMP_T_UINT;
+       smp->data.uint = expr->args->data.prx->beconn;
        return 1;
 }
 
@@ -1508,7 +1515,8 @@ acl_fetch_queue_size(struct proxy *px, struct session *l4, void *l7, int dir,
                   struct acl_expr *expr, struct sample *smp)
 {
        smp->flags = SMP_F_VOL_TEST;
-       temp_pattern.data.uint = expr->args->data.prx->totpend;
+       smp->type = SMP_T_UINT;
+       smp->data.uint = expr->args->data.prx->totpend;
        return 1;
 }
 
@@ -1527,6 +1535,7 @@ acl_fetch_avg_queue_size(struct proxy *px, struct session *l4, void *l7, int dir
        int nbsrv;
 
        smp->flags = SMP_F_VOL_TEST;
+       smp->type = SMP_T_UINT;
        px = expr->args->data.prx;
 
        if (px->srv_act)
@@ -1537,9 +1546,9 @@ acl_fetch_avg_queue_size(struct proxy *px, struct session *l4, void *l7, int dir
                nbsrv = px->srv_bck;
 
        if (nbsrv > 0)
-               temp_pattern.data.uint = (px->totpend + nbsrv - 1) / nbsrv;
+               smp->data.uint = (px->totpend + nbsrv - 1) / nbsrv;
        else
-               temp_pattern.data.uint = px->totpend * 2;
+               smp->data.uint = px->totpend * 2;
 
        return 1;
 }
@@ -1552,7 +1561,9 @@ static int
 acl_fetch_srv_conn(struct proxy *px, struct session *l4, void *l7, int dir,
                  struct acl_expr *expr, struct sample *smp)
 {
-       temp_pattern.data.uint = expr->args->data.srv->cur_sess;
+       smp->flags = SMP_F_VOL_TEST;
+       smp->type = SMP_T_UINT;
+       smp->data.uint = expr->args->data.srv->cur_sess;
        return 1;
 }
 
index 2e91992f8955bf8bb2111c606910547f1c5c1134..2e0237a8e105548387d287ebd18b14889ceba272 100644 (file)
@@ -503,7 +503,9 @@ acl_fetch_fe_id(struct proxy *px, struct session *l4, void *l7, int dir,
                 struct acl_expr *expr, struct sample *smp)
 {
        smp->flags = SMP_F_READ_ONLY;
-       temp_pattern.data.uint = l4->fe->uuid;
+       smp->flags = SMP_F_VOL_SESS;
+       smp->type = SMP_T_UINT;
+       smp->data.uint = l4->fe->uuid;
        return 1;
 }
 
@@ -516,7 +518,8 @@ acl_fetch_fe_sess_rate(struct proxy *px, struct session *l4, void *l7, int dir,
                        struct acl_expr *expr, struct sample *smp)
 {
        smp->flags = SMP_F_VOL_TEST;
-       temp_pattern.data.uint = read_freq_ctr(&expr->args->data.prx->fe_sess_per_sec);
+       smp->type = SMP_T_UINT;
+       smp->data.uint = read_freq_ctr(&expr->args->data.prx->fe_sess_per_sec);
        return 1;
 }
 
@@ -529,7 +532,8 @@ acl_fetch_fe_conn(struct proxy *px, struct session *l4, void *l7, int dir,
                  struct acl_expr *expr, struct sample *smp)
 {
        smp->flags = SMP_F_VOL_TEST;
-       temp_pattern.data.uint = expr->args->data.prx->feconn;
+       smp->type = SMP_T_UINT;
+       smp->data.uint = expr->args->data.prx->feconn;
        return 1;
 }
 
index fac145fbd6fd1c70b1bbb69a86d3cee2e02d5a1e..4665be3d8fc24bb3259e0a29467aeb4015c2799b 100644 (file)
@@ -18,8 +18,8 @@
 #include <proto/buffers.h>
 #include <common/standard.h>
 
-/* static structure used on pattern_process if <p> is NULL*/
-struct pattern temp_pattern = { };
+/* static structure used on pattern_process if <p> is NULL */
+static struct pattern temp_pattern;
 
 /* trash chunk used for pattern conversions */
 static struct chunk trash_chunk;
index a8aa474200d8435071be081cc867e640a893fc79..e9ae1b44462c9ea17e09bff545c1bbcad2311808 100644 (file)
@@ -7554,6 +7554,7 @@ acl_prefetch_http(struct proxy *px, struct session *s, void *l7, int dir,
                return 0;
 
        /* Check for a dependency on a request */
+       smp->type = SMP_T_BOOL;
 
        if (expr->kw->requires & ACL_USE_L7REQ_ANY) {
                if (unlikely(!s->req))
@@ -7654,14 +7655,15 @@ acl_fetch_meth(struct proxy *px, struct session *l4, void *l7, int dir,
        CHECK_HTTP_MESSAGE_FIRST();
 
        meth = txn->meth;
-       temp_pattern.data.str.len = meth;
-       temp_pattern.data.str.str = NULL;
+       smp->type = SMP_T_UINT;
+       smp->data.uint = meth;
        if (meth == HTTP_METH_OTHER) {
                if (txn->rsp.msg_state != HTTP_MSG_RPBEFORE)
                        /* ensure the indexes are not affected */
                        return 0;
-               temp_pattern.data.str.len = txn->req.sl.rq.m_l;
-               temp_pattern.data.str.str = txn->req.buf->p + txn->req.sol;
+               smp->type = SMP_T_CSTR;
+               smp->data.str.len = txn->req.sl.rq.m_l;
+               smp->data.str.str = txn->req.buf->p + txn->req.sol;
        }
        smp->flags = SMP_F_READ_ONLY | SMP_F_VOL_1ST;
        return 1;
@@ -7673,9 +7675,9 @@ static int acl_match_meth(struct sample *smp, struct acl_pattern *pattern)
        int icase;
 
 
-       if (temp_pattern.data.str.str == NULL) {
+       if (smp->type == SMP_T_UINT) {
                /* well-known method */
-               if (temp_pattern.data.str.len == pattern->val.i)
+               if (smp->data.uint == pattern->val.i)
                        return ACL_PAT_PASS;
                return ACL_PAT_FAIL;
        }
@@ -7685,12 +7687,12 @@ static int acl_match_meth(struct sample *smp, struct acl_pattern *pattern)
                return ACL_PAT_FAIL;
 
        /* Other method, we must compare the strings */
-       if (pattern->len != temp_pattern.data.str.len)
+       if (pattern->len != smp->data.str.len)
                return ACL_PAT_FAIL;
 
        icase = pattern->flags & ACL_PAT_F_IGNORE_CASE;
-       if ((icase && strncasecmp(pattern->ptr.str, temp_pattern.data.str.str, temp_pattern.data.str.len) != 0) ||
-           (!icase && strncmp(pattern->ptr.str, temp_pattern.data.str.str, temp_pattern.data.str.len) != 0))
+       if ((icase && strncasecmp(pattern->ptr.str, smp->data.str.str, smp->data.str.len) != 0) ||
+           (!icase && strncmp(pattern->ptr.str, smp->data.str.str, smp->data.str.len) != 0))
                return ACL_PAT_FAIL;
        return ACL_PAT_PASS;
 }
@@ -7724,8 +7726,9 @@ acl_fetch_rqver(struct proxy *px, struct session *l4, void *l7, int dir,
        if (len <= 0)
                return 0;
 
-       temp_pattern.data.str.str = ptr;
-       temp_pattern.data.str.len = len;
+       smp->type = SMP_T_CSTR;
+       smp->data.str.str = ptr;
+       smp->data.str.len = len;
 
        smp->flags = SMP_F_READ_ONLY | SMP_F_VOL_1ST;
        return 1;
@@ -7748,8 +7751,9 @@ acl_fetch_stver(struct proxy *px, struct session *l4, void *l7, int dir,
        if (len <= 0)
                return 0;
 
-       temp_pattern.data.str.str = ptr;
-       temp_pattern.data.str.len = len;
+       smp->type = SMP_T_CSTR;
+       smp->data.str.str = ptr;
+       smp->data.str.len = len;
 
        smp->flags = SMP_F_READ_ONLY | SMP_F_VOL_1ST;
        return 1;
@@ -7769,7 +7773,8 @@ acl_fetch_stcode(struct proxy *px, struct session *l4, void *l7, int dir,
        len = txn->rsp.sl.st.c_l;
        ptr = txn->rsp.buf->p + txn->rsp.sol + txn->rsp.sl.st.c;
 
-       temp_pattern.data.uint = __strl2ui(ptr, len);
+       smp->type = SMP_T_UINT;
+       smp->data.uint = __strl2ui(ptr, len);
        smp->flags = SMP_F_VOL_1ST;
        return 1;
 }
@@ -7783,10 +7788,9 @@ acl_fetch_url(struct proxy *px, struct session *l4, void *l7, int dir,
 
        CHECK_HTTP_MESSAGE_FIRST();
 
-       temp_pattern.data.str.len = txn->req.sl.rq.u_l;
-       temp_pattern.data.str.str = txn->req.buf->p + txn->req.sol + txn->req.sl.rq.u;
-
-       /* we do not need to set READ_ONLY because the data is in a buffer */
+       smp->type = SMP_T_CSTR;
+       smp->data.str.len = txn->req.sl.rq.u_l;
+       smp->data.str.str = txn->req.buf->p + txn->req.sol + txn->req.sl.rq.u;
        smp->flags = SMP_F_VOL_1ST;
        return 1;
 }
@@ -7803,8 +7807,8 @@ acl_fetch_url_ip(struct proxy *px, struct session *l4, void *l7, int dir,
        url2sa(txn->req.buf->p + txn->req.sol + txn->req.sl.rq.u, txn->req.sl.rq.u_l, &l4->req->cons->addr.to);
        if (((struct sockaddr_in *)&l4->req->cons->addr.to)->sin_family != AF_INET)
                return 0;
-       temp_pattern.type = SMP_T_IPV4;
-       temp_pattern.data.ipv4 = ((struct sockaddr_in *)&l4->req->cons->addr.to)->sin_addr;
+       smp->type = SMP_T_IPV4;
+       smp->data.ipv4 = ((struct sockaddr_in *)&l4->req->cons->addr.to)->sin_addr;
 
        /*
         * If we are parsing url in frontend space, we prepare backend stage
@@ -7827,7 +7831,8 @@ acl_fetch_url_port(struct proxy *px, struct session *l4, void *l7, int dir,
 
        /* Same optimization as url_ip */
        url2sa(txn->req.buf->p + txn->req.sol + txn->req.sl.rq.u, txn->req.sl.rq.u_l, &l4->req->cons->addr.to);
-       temp_pattern.data.uint = ntohs(((struct sockaddr_in *)&l4->req->cons->addr.to)->sin_port);
+       smp->type = SMP_T_UINT;
+       smp->data.uint = ntohs(((struct sockaddr_in *)&l4->req->cons->addr.to)->sin_port);
 
        if (px->options & PR_O_HTTP_PROXY)
                l4->flags |= SN_ADDR_SET;
@@ -7860,8 +7865,9 @@ acl_fetch_hdr(struct proxy *px, struct session *l4, void *l7, int dir,
        if (http_find_header2(expr->args->data.str.str, expr->args->data.str.len, msg->buf->p + msg->sol, idx, ctx)) {
                smp->flags |= SMP_F_NOT_LAST;
                smp->flags |= SMP_F_VOL_HDR;
-               temp_pattern.data.str.str = (char *)ctx->line + ctx->val;
-               temp_pattern.data.str.len = ctx->vlen;
+               smp->type = SMP_T_CSTR;
+               smp->data.str.str = (char *)ctx->line + ctx->val;
+               smp->data.str.len = ctx->vlen;
 
                return 1;
        }
@@ -7894,7 +7900,8 @@ acl_fetch_hdr_cnt(struct proxy *px, struct session *l4, void *l7, int dir,
        while (http_find_header2(expr->args->data.str.str, expr->args->data.str.len, msg->buf->p + msg->sol, idx, &ctx))
                cnt++;
 
-       temp_pattern.data.uint = cnt;
+       smp->type = SMP_T_UINT;
+       smp->data.uint = cnt;
        smp->flags = SMP_F_VOL_HDR;
        return 1;
 }
@@ -7908,8 +7915,10 @@ acl_fetch_hdr_val(struct proxy *px, struct session *l4, void *l7, int dir,
 {
        int ret = acl_fetch_hdr(px, l4, l7, dir, expr, smp);
 
-       if (ret > 0)
-               temp_pattern.data.uint = strl2ic(temp_pattern.data.str.str, temp_pattern.data.str.len);
+       if (ret > 0) {
+               smp->type = SMP_T_UINT;
+               smp->data.uint = strl2ic(smp->data.str.str, smp->data.str.len);
+       }
 
        return ret;
 }
@@ -7923,8 +7932,8 @@ acl_fetch_hdr_ip(struct proxy *px, struct session *l4, void *l7, int dir,
        int ret;
 
        while ((ret = acl_fetch_hdr(px, l4, l7, dir, expr, smp)) > 0) {
-               temp_pattern.type = SMP_T_IPV4;
-               if (url2ipv4((char *)temp_pattern.data.str.str, &temp_pattern.data.ipv4))
+               smp->type = SMP_T_IPV4;
+               if (url2ipv4((char *)smp->data.str.str, &smp->data.ipv4))
                        break;
                /* if the header doesn't match an IP address, fetch next one */
        }
@@ -7949,12 +7958,13 @@ acl_fetch_path(struct proxy *px, struct session *l4, void *l7, int dir,
                return 0;
 
        /* OK, we got the '/' ! */
-       temp_pattern.data.str.str = ptr;
+       smp->type = SMP_T_CSTR;
+       smp->data.str.str = ptr;
 
        while (ptr < end && *ptr != '?')
                ptr++;
 
-       temp_pattern.data.str.len = ptr - temp_pattern.data.str.str;
+       smp->data.str.len = ptr - smp->data.str.str;
 
        /* we do not need to set READ_ONLY because the data is in a buffer */
        smp->flags = SMP_F_VOL_1ST;
@@ -7971,6 +7981,7 @@ acl_fetch_proto_http(struct proxy *px, struct session *l4, void *l7, int dir,
 
        CHECK_HTTP_MESSAGE_FIRST();
 
+       smp->type = SMP_T_BOOL;
        smp->flags |= SMP_F_SET_RES_PASS;
        return 1;
 }
@@ -7983,6 +7994,7 @@ acl_fetch_http_first_req(struct proxy *px, struct session *s, void *l7, int dir,
        if (!s)
                return 0;
 
+       smp->type = SMP_T_BOOL;
        if (s->txn.flags & TX_NOT_FIRST)
                smp->flags |= SMP_F_SET_RES_FAIL;
        else
@@ -8005,6 +8017,7 @@ acl_fetch_http_auth(struct proxy *px, struct session *l4, void *l7, int dir,
        if (!get_http_auth(l4))
                return 0;
 
+       smp->type = SMP_T_BOOL;
        if (check_user(expr->args->data.usr, 0, l4->txn.auth.user, l4->txn.auth.pass))
                smp->flags |= SMP_F_SET_RES_PASS;
        else
@@ -8164,13 +8177,14 @@ acl_fetch_cookie_value(struct proxy *px, struct session *l4, void *l7, int dir,
                        smp->ctx.a[1] = smp->ctx.a[0] + ctx->vlen;
                }
 
+               smp->type = SMP_T_CSTR;
                smp->ctx.a[0] = extract_cookie_value(smp->ctx.a[0], smp->ctx.a[1],
                                                 expr->args->data.str.str, expr->args->data.str.len,
                                                 (dir & ACL_DIR_MASK) == ACL_DIR_REQ,
-                                                &temp_pattern.data.str.str,
-                                                &temp_pattern.data.str.len);
+                                                &smp->data.str.str,
+                                                &smp->data.str.len);
                if (smp->ctx.a[0]) {
-                       /* one value was returned into temp_pattern.data.str.{str,len} */
+                       /* one value was returned into smp->data.str.{str,len} */
                        smp->flags |= SMP_F_NOT_LAST;
                        smp->flags |= SMP_F_VOL_HDR;
                        return 1;
@@ -8235,16 +8249,17 @@ acl_fetch_cookie_cnt(struct proxy *px, struct session *l4, void *l7, int dir,
                        val_end = val_beg + ctx.vlen;
                }
 
+               smp->type = SMP_T_CSTR;
                while ((val_beg = extract_cookie_value(val_beg, val_end,
                                                       expr->args->data.str.str, expr->args->data.str.len,
                                                       (dir & ACL_DIR_MASK) == ACL_DIR_REQ,
-                                                      &temp_pattern.data.str.str,
-                                                      &temp_pattern.data.str.len))) {
+                                                      &smp->data.str.str,
+                                                      &smp->data.str.len))) {
                        cnt++;
                }
        }
 
-       temp_pattern.data.uint = cnt;
+       smp->data.uint = cnt;
        smp->flags |= SMP_F_VOL_HDR;
        return 1;
 }
index eb35a855a0a0cc65b1e4b35e24218e094261229a..dc32a9fdfc7072adbbb7056139cddb1ad25a78ff 100644 (file)
@@ -1258,12 +1258,12 @@ acl_fetch_src(struct proxy *px, struct session *l4, void *l7, int dir,
 {
        switch (l4->si[0].addr.from.ss_family) {
        case AF_INET:
-               temp_pattern.data.ipv4 = ((struct sockaddr_in *)&l4->si[0].addr.from)->sin_addr;
-               temp_pattern.type = SMP_T_IPV4;
+               smp->data.ipv4 = ((struct sockaddr_in *)&l4->si[0].addr.from)->sin_addr;
+               smp->type = SMP_T_IPV4;
                break;
        case AF_INET6:
-               temp_pattern.data.ipv6 = ((struct sockaddr_in6 *)(&l4->si[0].addr.from))->sin6_addr;
-               temp_pattern.type = SMP_T_IPV6;
+               smp->data.ipv6 = ((struct sockaddr_in6 *)(&l4->si[0].addr.from))->sin6_addr;
+               smp->type = SMP_T_IPV6;
                break;
        default:
                return 0;
@@ -1302,7 +1302,8 @@ static int
 acl_fetch_sport(struct proxy *px, struct session *l4, void *l7, int dir,
                 struct acl_expr *expr, struct sample *smp)
 {
-       if (!(temp_pattern.data.uint = get_host_port(&l4->si[0].addr.from)))
+       smp->type = SMP_T_UINT;
+       if (!(smp->data.uint = get_host_port(&l4->si[0].addr.from)))
                return 0;
 
        smp->flags = 0;
@@ -1319,12 +1320,12 @@ acl_fetch_dst(struct proxy *px, struct session *l4, void *l7, int dir,
 
        switch (l4->si[0].addr.to.ss_family) {
        case AF_INET:
-               temp_pattern.data.ipv4 = ((struct sockaddr_in *)&l4->si[0].addr.to)->sin_addr;
-               temp_pattern.type = SMP_T_IPV4;
+               smp->data.ipv4 = ((struct sockaddr_in *)&l4->si[0].addr.to)->sin_addr;
+               smp->type = SMP_T_IPV4;
                break;
        case AF_INET6:
-               temp_pattern.data.ipv6 = ((struct sockaddr_in6 *)(&l4->si[0].addr.to))->sin6_addr;
-               temp_pattern.type = SMP_T_IPV6;
+               smp->data.ipv6 = ((struct sockaddr_in6 *)(&l4->si[0].addr.to))->sin6_addr;
+               smp->type = SMP_T_IPV6;
                break;
        default:
                return 0;
@@ -1370,7 +1371,8 @@ acl_fetch_dport(struct proxy *px, struct session *l4, void *l7, int dir,
 {
        stream_sock_get_to_addr(&l4->si[0]);
 
-       if (!(temp_pattern.data.uint = get_host_port(&l4->si[0].addr.to)))
+       smp->type = SMP_T_UINT;
+       if (!(smp->data.uint = get_host_port(&l4->si[0].addr.to)))
                return 0;
 
        smp->flags = 0;
@@ -1486,10 +1488,10 @@ pattern_fetch_rdp_cookie(struct proxy *px, struct session *l4, void *l7, int dir
        expr.args = args;
 
        ret = acl_fetch_rdp_cookie(px, l4, NULL, ACL_DIR_REQ, &expr, &smp);
-       if (ret == 0 || (smp.flags & SMP_F_MAY_CHANGE) || temp_pattern.data.str.len == 0)
+       if (ret == 0 || (smp.flags & SMP_F_MAY_CHANGE) || smp.data.str.len == 0)
                return 0;
 
-       data->str = temp_pattern.data.str;
+       data->str = smp.data.str;
        return 1;
 }
 
index 3ad8c2eedede153d391a4eb5ca5d9576fc675360..12d719a90bcc82120827eee5c6f79b05e3db8fd7 100644 (file)
@@ -328,7 +328,8 @@ static int
 acl_fetch_dconn(struct proxy *px, struct session *l4, void *l7, int dir,
                 struct acl_expr *expr, struct sample *smp)
 {
-       temp_pattern.data.uint = l4->listener->nbconn;
+       smp->type = SMP_T_UINT;
+       smp->data.uint = l4->listener->nbconn;
        return 1;
 }
 
@@ -338,7 +339,8 @@ acl_fetch_so_id(struct proxy *px, struct session *l4, void *l7, int dir,
                 struct acl_expr *expr, struct sample *smp)
 {
        smp->flags = SMP_F_READ_ONLY;
-       temp_pattern.data.uint = l4->listener->luid;
+       smp->type = SMP_T_UINT;
+       smp->data.uint = l4->listener->luid;
        return 1;
 }
 
index 54bd7a0716ebfcc0c1dfa20bd2dfc794344cf556..b4c0a82b847cd9ad275eef16178974011109a504 100644 (file)
@@ -2311,12 +2311,13 @@ static int
 acl_fetch_get_gpc0(struct stktable *table, struct sample *smp, struct stksess *ts)
 {
        smp->flags = SMP_F_VOL_TEST;
-       temp_pattern.data.uint = 0;
+       smp->type = SMP_T_UINT;
+       smp->data.uint = 0;
        if (ts != NULL) {
                void *ptr = stktable_data_ptr(table, ts, STKTABLE_DT_GPC0);
                if (!ptr)
                        return 0; /* parameter not stored */
-               temp_pattern.data.uint = stktable_data_cast(ptr, gpc0);
+               smp->data.uint = stktable_data_cast(ptr, gpc0);
        }
        return 1;
 }
@@ -2370,12 +2371,13 @@ static int
 acl_fetch_inc_gpc0(struct stktable *table, struct sample *smp, struct stksess *ts)
 {
        smp->flags = SMP_F_VOL_TEST;
-       temp_pattern.data.uint = 0;
+       smp->type = SMP_T_UINT;
+       smp->data.uint = 0;
        if (ts != NULL) {
                void *ptr = stktable_data_ptr(table, ts, STKTABLE_DT_GPC0);
                if (!ptr)
                        return 0; /* parameter not stored */
-               temp_pattern.data.uint = ++stktable_data_cast(ptr, gpc0);
+               smp->data.uint = ++stktable_data_cast(ptr, gpc0);
        }
        return 1;
 }
@@ -2429,12 +2431,13 @@ static int
 acl_fetch_clr_gpc0(struct stktable *table, struct sample *smp, struct stksess *ts)
 {
        smp->flags = SMP_F_VOL_TEST;
-       temp_pattern.data.uint = 0;
+       smp->type = SMP_T_UINT;
+       smp->data.uint = 0;
        if (ts != NULL) {
                void *ptr = stktable_data_ptr(table, ts, STKTABLE_DT_GPC0);
                if (!ptr)
                        return 0; /* parameter not stored */
-               temp_pattern.data.uint = stktable_data_cast(ptr, gpc0);
+               smp->data.uint = stktable_data_cast(ptr, gpc0);
                stktable_data_cast(ptr, gpc0) = 0;
        }
        return 1;
@@ -2487,12 +2490,13 @@ static int
 acl_fetch_conn_cnt(struct stktable *table, struct sample *smp, struct stksess *ts)
 {
        smp->flags = SMP_F_VOL_TEST;
-       temp_pattern.data.uint = 0;
+       smp->type = SMP_T_UINT;
+       smp->data.uint = 0;
        if (ts != NULL) {
                void *ptr = stktable_data_ptr(table, ts, STKTABLE_DT_CONN_CNT);
                if (!ptr)
                        return 0; /* parameter not stored */
-               temp_pattern.data.uint = stktable_data_cast(ptr, conn_cnt);
+               smp->data.uint = stktable_data_cast(ptr, conn_cnt);
        }
        return 1;
 }
@@ -2542,12 +2546,13 @@ static int
 acl_fetch_conn_rate(struct stktable *table, struct sample *smp, struct stksess *ts)
 {
        smp->flags = SMP_F_VOL_TEST;
-       temp_pattern.data.uint = 0;
+       smp->type = SMP_T_UINT;
+       smp->data.uint = 0;
        if (ts != NULL) {
                void *ptr = stktable_data_ptr(table, ts, STKTABLE_DT_CONN_RATE);
                if (!ptr)
                        return 0; /* parameter not stored */
-               temp_pattern.data.uint = read_freq_ctr_period(&stktable_data_cast(ptr, conn_rate),
+               smp->data.uint = read_freq_ctr_period(&stktable_data_cast(ptr, conn_rate),
                                               table->data_arg[STKTABLE_DT_CONN_RATE].u);
        }
        return 1;
@@ -2623,7 +2628,8 @@ acl_fetch_src_updt_conn_cnt(struct proxy *px, struct session *l4, void *l7, int
        if (!ptr)
                return 0; /* parameter not stored in this table */
 
-       temp_pattern.data.uint = ++stktable_data_cast(ptr, conn_cnt);
+       smp->type = SMP_T_UINT;
+       smp->data.uint = ++stktable_data_cast(ptr, conn_cnt);
        smp->flags = SMP_F_VOL_TEST;
        return 1;
 }
@@ -2633,13 +2639,14 @@ static int
 acl_fetch_conn_cur(struct stktable *table, struct sample *smp, struct stksess *ts)
 {
        smp->flags = SMP_F_VOL_TEST;
-       temp_pattern.data.uint = 0;
+       smp->type = SMP_T_UINT;
+       smp->data.uint = 0;
 
        if (ts != NULL) {
                void *ptr = stktable_data_ptr(table, ts, STKTABLE_DT_CONN_CUR);
                if (!ptr)
                        return 0; /* parameter not stored */
-               temp_pattern.data.uint = stktable_data_cast(ptr, conn_cur);
+               smp->data.uint = stktable_data_cast(ptr, conn_cur);
        }
        return 1;
 }
@@ -2689,12 +2696,13 @@ static int
 acl_fetch_sess_cnt(struct stktable *table, struct sample *smp, struct stksess *ts)
 {
        smp->flags = SMP_F_VOL_TEST;
-       temp_pattern.data.uint = 0;
+       smp->type = SMP_T_UINT;
+       smp->data.uint = 0;
        if (ts != NULL) {
                void *ptr = stktable_data_ptr(table, ts, STKTABLE_DT_SESS_CNT);
                if (!ptr)
                        return 0; /* parameter not stored */
-               temp_pattern.data.uint = stktable_data_cast(ptr, sess_cnt);
+               smp->data.uint = stktable_data_cast(ptr, sess_cnt);
        }
        return 1;
 }
@@ -2744,12 +2752,13 @@ static int
 acl_fetch_sess_rate(struct stktable *table, struct sample *smp, struct stksess *ts)
 {
        smp->flags = SMP_F_VOL_TEST;
-       temp_pattern.data.uint = 0;
+       smp->type = SMP_T_UINT;
+       smp->data.uint = 0;
        if (ts != NULL) {
                void *ptr = stktable_data_ptr(table, ts, STKTABLE_DT_SESS_RATE);
                if (!ptr)
                        return 0; /* parameter not stored */
-               temp_pattern.data.uint = read_freq_ctr_period(&stktable_data_cast(ptr, sess_rate),
+               smp->data.uint = read_freq_ctr_period(&stktable_data_cast(ptr, sess_rate),
                                               table->data_arg[STKTABLE_DT_SESS_RATE].u);
        }
        return 1;
@@ -2804,12 +2813,13 @@ static int
 acl_fetch_http_req_cnt(struct stktable *table, struct sample *smp, struct stksess *ts)
 {
        smp->flags = SMP_F_VOL_TEST;
-       temp_pattern.data.uint = 0;
+       smp->type = SMP_T_UINT;
+       smp->data.uint = 0;
        if (ts != NULL) {
                void *ptr = stktable_data_ptr(table, ts, STKTABLE_DT_HTTP_REQ_CNT);
                if (!ptr)
                        return 0; /* parameter not stored */
-               temp_pattern.data.uint = stktable_data_cast(ptr, http_req_cnt);
+               smp->data.uint = stktable_data_cast(ptr, http_req_cnt);
        }
        return 1;
 }
@@ -2859,12 +2869,13 @@ static int
 acl_fetch_http_req_rate(struct stktable *table, struct sample *smp, struct stksess *ts)
 {
        smp->flags = SMP_F_VOL_TEST;
-       temp_pattern.data.uint = 0;
+       smp->type = SMP_T_UINT;
+       smp->data.uint = 0;
        if (ts != NULL) {
                void *ptr = stktable_data_ptr(table, ts, STKTABLE_DT_HTTP_REQ_RATE);
                if (!ptr)
                        return 0; /* parameter not stored */
-               temp_pattern.data.uint = read_freq_ctr_period(&stktable_data_cast(ptr, http_req_rate),
+               smp->data.uint = read_freq_ctr_period(&stktable_data_cast(ptr, http_req_rate),
                                               table->data_arg[STKTABLE_DT_HTTP_REQ_RATE].u);
        }
        return 1;
@@ -2919,12 +2930,13 @@ static int
 acl_fetch_http_err_cnt(struct stktable *table, struct sample *smp, struct stksess *ts)
 {
        smp->flags = SMP_F_VOL_TEST;
-       temp_pattern.data.uint = 0;
+       smp->type = SMP_T_UINT;
+       smp->data.uint = 0;
        if (ts != NULL) {
                void *ptr = stktable_data_ptr(table, ts, STKTABLE_DT_HTTP_ERR_CNT);
                if (!ptr)
                        return 0; /* parameter not stored */
-               temp_pattern.data.uint = stktable_data_cast(ptr, http_err_cnt);
+               smp->data.uint = stktable_data_cast(ptr, http_err_cnt);
        }
        return 1;
 }
@@ -2974,12 +2986,13 @@ static int
 acl_fetch_http_err_rate(struct stktable *table, struct sample *smp, struct stksess *ts)
 {
        smp->flags = SMP_F_VOL_TEST;
-       temp_pattern.data.uint = 0;
+       smp->type = SMP_T_UINT;
+       smp->data.uint = 0;
        if (ts != NULL) {
                void *ptr = stktable_data_ptr(table, ts, STKTABLE_DT_HTTP_ERR_RATE);
                if (!ptr)
                        return 0; /* parameter not stored */
-               temp_pattern.data.uint = read_freq_ctr_period(&stktable_data_cast(ptr, http_err_rate),
+               smp->data.uint = read_freq_ctr_period(&stktable_data_cast(ptr, http_err_rate),
                                               table->data_arg[STKTABLE_DT_HTTP_ERR_RATE].u);
        }
        return 1;
@@ -3034,13 +3047,14 @@ static int
 acl_fetch_kbytes_in(struct stktable *table, struct sample *smp, struct stksess *ts)
 {
        smp->flags = SMP_F_VOL_TEST;
-       temp_pattern.data.uint = 0;
+       smp->type = SMP_T_UINT;
+       smp->data.uint = 0;
 
        if (ts != NULL) {
                void *ptr = stktable_data_ptr(table, ts, STKTABLE_DT_BYTES_IN_CNT);
                if (!ptr)
                        return 0; /* parameter not stored */
-               temp_pattern.data.uint = stktable_data_cast(ptr, bytes_in_cnt) >> 10;
+               smp->data.uint = stktable_data_cast(ptr, bytes_in_cnt) >> 10;
        }
        return 1;
 }
@@ -3096,12 +3110,13 @@ static int
 acl_fetch_bytes_in_rate(struct stktable *table, struct sample *smp, struct stksess *ts)
 {
        smp->flags = SMP_F_VOL_TEST;
-       temp_pattern.data.uint = 0;
+       smp->type = SMP_T_UINT;
+       smp->data.uint = 0;
        if (ts != NULL) {
                void *ptr = stktable_data_ptr(table, ts, STKTABLE_DT_BYTES_IN_RATE);
                if (!ptr)
                        return 0; /* parameter not stored */
-               temp_pattern.data.uint = read_freq_ctr_period(&stktable_data_cast(ptr, bytes_in_rate),
+               smp->data.uint = read_freq_ctr_period(&stktable_data_cast(ptr, bytes_in_rate),
                                               table->data_arg[STKTABLE_DT_BYTES_IN_RATE].u);
        }
        return 1;
@@ -3156,13 +3171,14 @@ static int
 acl_fetch_kbytes_out(struct stktable *table, struct sample *smp, struct stksess *ts)
 {
        smp->flags = SMP_F_VOL_TEST;
-       temp_pattern.data.uint = 0;
+       smp->type = SMP_T_UINT;
+       smp->data.uint = 0;
 
        if (ts != NULL) {
                void *ptr = stktable_data_ptr(table, ts, STKTABLE_DT_BYTES_OUT_CNT);
                if (!ptr)
                        return 0; /* parameter not stored */
-               temp_pattern.data.uint = stktable_data_cast(ptr, bytes_out_cnt) >> 10;
+               smp->data.uint = stktable_data_cast(ptr, bytes_out_cnt) >> 10;
        }
        return 1;
 }
@@ -3218,12 +3234,13 @@ static int
 acl_fetch_bytes_out_rate(struct stktable *table, struct sample *smp, struct stksess *ts)
 {
        smp->flags = SMP_F_VOL_TEST;
-       temp_pattern.data.uint = 0;
+       smp->type = SMP_T_UINT;
+       smp->data.uint = 0;
        if (ts != NULL) {
                void *ptr = stktable_data_ptr(table, ts, STKTABLE_DT_BYTES_OUT_RATE);
                if (!ptr)
                        return 0; /* parameter not stored */
-               temp_pattern.data.uint = read_freq_ctr_period(&stktable_data_cast(ptr, bytes_out_rate),
+               smp->data.uint = read_freq_ctr_period(&stktable_data_cast(ptr, bytes_out_rate),
                                               table->data_arg[STKTABLE_DT_BYTES_OUT_RATE].u);
        }
        return 1;
@@ -3281,7 +3298,8 @@ acl_fetch_table_cnt(struct proxy *px, struct session *l4, void *l7, int dir,
                     struct acl_expr *expr, struct sample *smp)
 {
        smp->flags = SMP_F_VOL_TEST;
-       temp_pattern.data.uint = expr->args->data.prx->table.current;
+       smp->type = SMP_T_UINT;
+       smp->data.uint = expr->args->data.prx->table.current;
        return 1;
 }
 
@@ -3294,7 +3312,8 @@ acl_fetch_table_avl(struct proxy *px, struct session *l4, void *l7, int dir,
 {
        px = expr->args->data.prx;
        smp->flags = SMP_F_VOL_TEST;
-       temp_pattern.data.uint = px->table.size - px->table.current;
+       smp->type = SMP_T_UINT;
+       smp->data.uint = px->table.size - px->table.current;
        return 1;
 }