]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MAJOR: arg: converts uint and sint in sint
authorThierry FOURNIER <tfournier@arpalert.org>
Mon, 20 Jul 2015 15:45:02 +0000 (17:45 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 21 Jul 2015 22:48:23 +0000 (00:48 +0200)
This patch removes the 32 bits unsigned integer and the 32 bit signed
integer. It replaces these types by a unique type 64 bit signed.

include/types/arg.h
src/arg.c
src/hlua.c
src/map.c
src/payload.c
src/proto_http.c
src/sample.c
src/ssl_sock.c
src/stream.c

index c38d9d68ff8520c8779ea791e7769322ee96a00b..28cdfb332e5a6521569592575c2a0da03deb0a5e 100644 (file)
@@ -44,8 +44,7 @@
 
 enum {
        ARGT_STOP = 0, /* end of the arg list */
-       ARGT_UINT,     /* unsigned integer, which is a positive integer without any sign */
-       ARGT_SINT,     /* signed integer, the sign (+/-) was explicit. Falls back to UINT if no sign. */
+       ARGT_SINT,     /* signed 64 bit integer. */
        ARGT_STR,      /* string */
        ARGT_IPV4,     /* an IPv4 address */
        ARGT_MSK4,     /* an IPv4 address mask (integer or dotted), stored as ARGT_IPV4 */
@@ -88,8 +87,7 @@ struct userlist;
 struct my_regex;
 
 union arg_data {
-       unsigned int uint; /* used for uint, time, size */
-       int sint;
+       long long int sint;
        struct chunk str;
        struct in_addr ipv4;
        struct in6_addr ipv6;
index e212f6ba9ceb1023c0bf2a568bfbb6420c5b7be1..93389e18816cc880966b0862efecef6bdb5196d6 100644 (file)
--- a/src/arg.c
+++ b/src/arg.c
@@ -19,8 +19,7 @@
 
 const char *arg_type_names[ARGT_NBTYPES] = {
        [ARGT_STOP] = "end of arguments",
-       [ARGT_UINT] = "unsigned integer",
-       [ARGT_SINT] = "signed integer",
+       [ARGT_SINT] = "integer",
        [ARGT_STR]  = "string",
        [ARGT_IPV4] = "IPv4 address",
        [ARGT_MSK4] = "IPv4 mask",
@@ -125,6 +124,8 @@ int make_arg_list(const char *in, int len, unsigned int mask, struct arg **argp,
 
        /* Note: empty arguments after a comma always exist. */
        while (pos < nbarg) {
+               unsigned int uint;
+
                beg = in;
                while (len && *in != ',') {
                        in++;
@@ -145,28 +146,10 @@ int make_arg_list(const char *in, int len, unsigned int mask, struct arg **argp,
                case ARGT_SINT:
                        if (in == beg)    // empty number
                                goto empty_err;
-                       else if (*beg < '0' || *beg > '9') {
-                               beg++;
-                               arg->data.sint = read_uint(&beg, in);
-                               if (beg < in)
-                                       goto parse_err;
-                               if (*word == '-')
-                                       arg->data.sint = -arg->data.sint;
-                               else if (*word != '+')    // invalid first character
-                                       goto parse_err;
-                               break;
-                       }
-
-                       arg->type = ARGT_UINT;
-                       /* fall through ARGT_UINT if no sign is present */
-
-               case ARGT_UINT:
-                       if (in == beg)    // empty number
-                               goto empty_err;
-
-                       arg->data.uint = read_uint(&beg, in);
+                       arg->data.sint = read_int64(&beg, in);
                        if (beg < in)
                                goto parse_err;
+                       arg->type = ARGT_SINT;
                        break;
 
                case ARGT_FE:
@@ -226,22 +209,23 @@ int make_arg_list(const char *in, int len, unsigned int mask, struct arg **argp,
                        if (in == beg)    // empty time
                                goto empty_err;
 
-                       ptr_err = parse_time_err(word, &arg->data.uint, TIME_UNIT_MS);
+                       ptr_err = parse_time_err(word, &uint, TIME_UNIT_MS);
                        if (ptr_err)
                                goto parse_err;
-
-                       arg->type = ARGT_UINT;
+                       arg->data.sint = uint;
+                       arg->type = ARGT_SINT;
                        break;
 
                case ARGT_SIZE:
                        if (in == beg)    // empty size
                                goto empty_err;
 
-                       ptr_err = parse_size_err(word, &arg->data.uint);
+                       ptr_err = parse_size_err(word, &uint);
                        if (ptr_err)
                                goto parse_err;
 
-                       arg->type = ARGT_UINT;
+                       arg->data.sint = uint;
+                       arg->type = ARGT_SINT;
                        break;
 
                        /* FIXME: other types need to be implemented here */
index 34e14e87d59b27282d20c1e30ddf5d6fffcfcbc0..6fe3797bc6555fbb5f788ad59c0b9495c44ae191 100644 (file)
@@ -317,10 +317,6 @@ static int hlua_arg2lua(lua_State *L, const struct arg *arg)
 {
        switch (arg->type) {
        case ARGT_SINT:
-               lua_pushinteger(L, arg->data.sint);
-               break;
-
-       case ARGT_UINT:
        case ARGT_TIME:
        case ARGT_SIZE:
                lua_pushinteger(L, arg->data.sint);
@@ -374,7 +370,7 @@ static int hlua_lua2arg(lua_State *L, int ud, struct arg *arg)
        case LUA_TTHREAD:
        case LUA_TLIGHTUSERDATA:
                arg->type = ARGT_SINT;
-               arg->data.uint = 0;
+               arg->data.sint = 0;
                break;
        }
        return 1;
@@ -608,12 +604,6 @@ __LJMP int hlua_lua2arg_check(lua_State *L, int first, struct arg *argp,
                        argp[idx].type = ARGT_SINT;
                        break;
 
-               case ARGT_UINT:
-                       if (argp[idx].type != ARGT_SINT)
-                               WILL_LJMP(luaL_argerror(L, first + idx, "integer expected"));
-                       argp[idx].type = ARGT_SINT;
-                       break;
-
                case ARGT_TIME:
                        if (argp[idx].type != ARGT_SINT)
                                WILL_LJMP(luaL_argerror(L, first + idx, "integer expected"));
index be33c2cc20e20ed77a4a942b44c4e957593164e9..fedd9d2472e5b2eb450770ab1a85e59ea4171602 100644 (file)
--- a/src/map.c
+++ b/src/map.c
@@ -188,7 +188,7 @@ static int sample_conv_map(const struct arg *arg_p, struct sample *smp, void *pr
 
        case SMP_T_SINT:
                smp->type = SMP_T_SINT;
-               smp->data.sint = arg_p[1].data.uint;
+               smp->data.sint = arg_p[1].data.sint;
                break;
 
        case SMP_T_IPV4:
@@ -233,15 +233,15 @@ static struct sample_conv_kw_list sample_conv_kws = {ILH, {
        { "map_int",     sample_conv_map, ARG2(1,STR,STR), sample_load_map, SMP_T_SINT, SMP_T_STR,  (void *)PAT_MATCH_INT },
        { "map_ip",      sample_conv_map, ARG2(1,STR,STR), sample_load_map, SMP_T_ADDR, SMP_T_STR,  (void *)PAT_MATCH_IP  },
 
-       { "map_str_int", sample_conv_map, ARG2(1,STR,UINT), sample_load_map, SMP_T_STR,  SMP_T_SINT, (void *)PAT_MATCH_STR },
-       { "map_beg_int", sample_conv_map, ARG2(1,STR,UINT), sample_load_map, SMP_T_STR,  SMP_T_SINT, (void *)PAT_MATCH_BEG },
-       { "map_sub_int", sample_conv_map, ARG2(1,STR,UINT), sample_load_map, SMP_T_STR,  SMP_T_SINT, (void *)PAT_MATCH_SUB },
-       { "map_dir_int", sample_conv_map, ARG2(1,STR,UINT), sample_load_map, SMP_T_STR,  SMP_T_SINT, (void *)PAT_MATCH_DIR },
-       { "map_dom_int", sample_conv_map, ARG2(1,STR,UINT), sample_load_map, SMP_T_STR,  SMP_T_SINT, (void *)PAT_MATCH_DOM },
-       { "map_end_int", sample_conv_map, ARG2(1,STR,UINT), sample_load_map, SMP_T_STR,  SMP_T_SINT, (void *)PAT_MATCH_END },
-       { "map_reg_int", sample_conv_map, ARG2(1,STR,UINT), sample_load_map, SMP_T_STR,  SMP_T_SINT, (void *)PAT_MATCH_REG },
-       { "map_int_int", sample_conv_map, ARG2(1,STR,UINT), sample_load_map, SMP_T_SINT, SMP_T_SINT, (void *)PAT_MATCH_INT },
-       { "map_ip_int",  sample_conv_map, ARG2(1,STR,UINT), sample_load_map, SMP_T_ADDR, SMP_T_SINT, (void *)PAT_MATCH_IP  },
+       { "map_str_int", sample_conv_map, ARG2(1,STR,SINT), sample_load_map, SMP_T_STR,  SMP_T_SINT, (void *)PAT_MATCH_STR },
+       { "map_beg_int", sample_conv_map, ARG2(1,STR,SINT), sample_load_map, SMP_T_STR,  SMP_T_SINT, (void *)PAT_MATCH_BEG },
+       { "map_sub_int", sample_conv_map, ARG2(1,STR,SINT), sample_load_map, SMP_T_STR,  SMP_T_SINT, (void *)PAT_MATCH_SUB },
+       { "map_dir_int", sample_conv_map, ARG2(1,STR,SINT), sample_load_map, SMP_T_STR,  SMP_T_SINT, (void *)PAT_MATCH_DIR },
+       { "map_dom_int", sample_conv_map, ARG2(1,STR,SINT), sample_load_map, SMP_T_STR,  SMP_T_SINT, (void *)PAT_MATCH_DOM },
+       { "map_end_int", sample_conv_map, ARG2(1,STR,SINT), sample_load_map, SMP_T_STR,  SMP_T_SINT, (void *)PAT_MATCH_END },
+       { "map_reg_int", sample_conv_map, ARG2(1,STR,SINT), sample_load_map, SMP_T_STR,  SMP_T_SINT, (void *)PAT_MATCH_REG },
+       { "map_int_int", sample_conv_map, ARG2(1,STR,SINT), sample_load_map, SMP_T_SINT, SMP_T_SINT, (void *)PAT_MATCH_INT },
+       { "map_ip_int",  sample_conv_map, ARG2(1,STR,SINT), sample_load_map, SMP_T_ADDR, SMP_T_SINT, (void *)PAT_MATCH_IP  },
 
        { "map_str_ip",  sample_conv_map, ARG2(1,STR,IPV4), sample_load_map, SMP_T_STR,  SMP_T_IPV4, (void *)PAT_MATCH_STR },
        { "map_beg_ip",  sample_conv_map, ARG2(1,STR,IPV4), sample_load_map, SMP_T_STR,  SMP_T_IPV4, (void *)PAT_MATCH_BEG },
index c81c0b42e7f61cf27a6beefbf440a7df6bd8de5c..32c530c9a2ba74381a3daa01ac67b246f99deed6 100644 (file)
@@ -637,8 +637,8 @@ smp_fetch_rdp_cookie_cnt(const struct arg *args, struct sample *smp, const char
 static int
 smp_fetch_payload_lv(const struct arg *arg_p, struct sample *smp, const char *kw, void *private)
 {
-       unsigned int len_offset = arg_p[0].data.uint;
-       unsigned int len_size = arg_p[1].data.uint;
+       unsigned int len_offset = arg_p[0].data.sint;
+       unsigned int len_size = arg_p[1].data.sint;
        unsigned int buf_offset;
        unsigned int buf_size = 0;
        struct channel *chn;
@@ -659,12 +659,16 @@ smp_fetch_payload_lv(const struct arg *arg_p, struct sample *smp, const char *kw
                buf_size = (buf_size << 8) + ((unsigned char *)chn->buf->p)[i + len_offset];
        }
 
-       /* buf offset may be implicit, absolute or relative */
+       /* buf offset may be implicit, absolute or relative. If the LSB
+        * is set, then the offset is relative otherwise it is absolute.
+        */
        buf_offset = len_offset + len_size;
-       if (arg_p[2].type == ARGT_UINT)
-               buf_offset = arg_p[2].data.uint;
-       else if (arg_p[2].type == ARGT_SINT)
-               buf_offset += arg_p[2].data.sint;
+       if (arg_p[2].type == ARGT_SINT) {
+               if (arg_p[2].data.sint & 1)
+                       buf_offset += arg_p[2].data.sint >> 1;
+               else
+                       buf_offset = arg_p[2].data.sint >> 1;
+       }
 
        if (!buf_size || buf_size > chn->buf->size || buf_offset + buf_size > chn->buf->size) {
                /* will never match */
@@ -690,8 +694,8 @@ smp_fetch_payload_lv(const struct arg *arg_p, struct sample *smp, const char *kw
 static int
 smp_fetch_payload(const struct arg *arg_p, struct sample *smp, const char *kw, void *private)
 {
-       unsigned int buf_offset = arg_p[0].data.uint;
-       unsigned int buf_size = arg_p[1].data.uint;
+       unsigned int buf_offset = arg_p[0].data.sint;
+       unsigned int buf_size = arg_p[1].data.sint;
        struct channel *chn;
 
        chn = ((smp->opt & SMP_OPT_DIR) == SMP_OPT_DIR_RES) ? &smp->strm->res : &smp->strm->req;
@@ -729,19 +733,43 @@ smp_fetch_payload(const struct arg *arg_p, struct sample *smp, const char *kw, v
  * not NULL, it will be filled with a pointer to an error message in case of
  * error, that the caller is responsible for freeing. The initial location must
  * either be freeable or NULL.
+ *
+ * Note that offset2 is stored with SINT type, but its not directly usable as is.
+ * The value is contained in the 63 MSB and the LSB is used as a flag for marking
+ * the "relative" property of the value.
  */
 int val_payload_lv(struct arg *arg, char **err_msg)
 {
-       if (!arg[1].data.uint) {
-               memprintf(err_msg, "payload length must be > 0");
+       int relative = 0;
+       const char *str;
+
+       if (arg[0].data.sint < 0) {
+               memprintf(err_msg, "payload offset1 must be positive");
                return 0;
        }
 
-       if (arg[2].type == ARGT_SINT &&
-           (int)(arg[0].data.uint + arg[1].data.uint + arg[2].data.sint) < 0) {
-               memprintf(err_msg, "payload offset too negative");
+       if (!arg[1].data.sint) {
+               memprintf(err_msg, "payload length must be > 0");
                return 0;
        }
+
+       if (arg[2].type == ARGT_STR && arg[2].data.str.len > 0) {
+               if (arg[2].data.str.str[0] == '+' || arg[2].data.str.str[0] == '-')
+                       relative = 1;
+               str = arg[2].data.str.str;
+               arg[2].type = ARGT_SINT;
+               arg[2].data.sint = read_int64(&str, str + arg[2].data.str.len);
+               if (*str != '\0') {
+                       memprintf(err_msg, "payload offset2 is not a number");
+                       return 0;
+               }
+          if (arg[0].data.sint + arg[1].data.sint + arg[2].data.sint < 0) {
+                       memprintf(err_msg, "payload offset2 too negative");
+                       return 0;
+               }
+               if (relative)
+                       arg[2].data.sint = ( arg[2].data.sint << 1 ) + 1;
+       }
        return 1;
 }
 
@@ -755,8 +783,8 @@ int val_payload_lv(struct arg *arg, char **err_msg)
  * instance IPv4/IPv6 must be declared IPv4.
  */
 static struct sample_fetch_kw_list smp_kws = {ILH, {
-       { "payload",             smp_fetch_payload,        ARG2(2,UINT,UINT),      NULL,           SMP_T_BIN,  SMP_USE_L6REQ|SMP_USE_L6RES },
-       { "payload_lv",          smp_fetch_payload_lv,     ARG3(2,UINT,UINT,UINT), val_payload_lv, SMP_T_BIN,  SMP_USE_L6REQ|SMP_USE_L6RES },
+       { "payload",             smp_fetch_payload,        ARG2(2,SINT,SINT),      NULL,           SMP_T_BIN,  SMP_USE_L6REQ|SMP_USE_L6RES },
+       { "payload_lv",          smp_fetch_payload_lv,     ARG3(2,SINT,SINT,STR),  val_payload_lv, SMP_T_BIN,  SMP_USE_L6REQ|SMP_USE_L6RES },
        { "rdp_cookie",          smp_fetch_rdp_cookie,     ARG1(0,STR),            NULL,           SMP_T_STR,  SMP_USE_L6REQ },
        { "rdp_cookie_cnt",      smp_fetch_rdp_cookie_cnt, ARG1(0,STR),            NULL,           SMP_T_SINT, SMP_USE_L6REQ },
        { "rep_ssl_hello_type",  smp_fetch_ssl_hello_type, 0,                      NULL,           SMP_T_SINT, SMP_USE_L6RES },
@@ -766,8 +794,8 @@ static struct sample_fetch_kw_list smp_kws = {ILH, {
        { "req_ssl_ver",         smp_fetch_req_ssl_ver,    0,                      NULL,           SMP_T_SINT, SMP_USE_L6REQ },
 
        { "req.len",             smp_fetch_len,            0,                      NULL,           SMP_T_SINT, SMP_USE_L6REQ },
-       { "req.payload",         smp_fetch_payload,        ARG2(2,UINT,UINT),      NULL,           SMP_T_BIN,  SMP_USE_L6REQ },
-       { "req.payload_lv",      smp_fetch_payload_lv,     ARG3(2,UINT,UINT,UINT), val_payload_lv, SMP_T_BIN,  SMP_USE_L6REQ },
+       { "req.payload",         smp_fetch_payload,        ARG2(2,SINT,SINT),      NULL,           SMP_T_BIN,  SMP_USE_L6REQ },
+       { "req.payload_lv",      smp_fetch_payload_lv,     ARG3(2,SINT,SINT,STR),  val_payload_lv, SMP_T_BIN,  SMP_USE_L6REQ },
        { "req.rdp_cookie",      smp_fetch_rdp_cookie,     ARG1(0,STR),            NULL,           SMP_T_STR,  SMP_USE_L6REQ },
        { "req.rdp_cookie_cnt",  smp_fetch_rdp_cookie_cnt, ARG1(0,STR),            NULL,           SMP_T_SINT, SMP_USE_L6REQ },
        { "req.ssl_ec_ext",      smp_fetch_req_ssl_ec_ext, 0,                      NULL,           SMP_T_BOOL, SMP_USE_L6REQ },
@@ -775,8 +803,8 @@ static struct sample_fetch_kw_list smp_kws = {ILH, {
        { "req.ssl_sni",         smp_fetch_ssl_hello_sni,  0,                      NULL,           SMP_T_STR,  SMP_USE_L6REQ },
        { "req.ssl_ver",         smp_fetch_req_ssl_ver,    0,                      NULL,           SMP_T_SINT, SMP_USE_L6REQ },
        { "res.len",             smp_fetch_len,            0,                      NULL,           SMP_T_SINT, SMP_USE_L6RES },
-       { "res.payload",         smp_fetch_payload,        ARG2(2,UINT,UINT),      NULL,           SMP_T_BIN,  SMP_USE_L6RES },
-       { "res.payload_lv",      smp_fetch_payload_lv,     ARG3(2,UINT,UINT,SINT), val_payload_lv, SMP_T_BIN,  SMP_USE_L6RES },
+       { "res.payload",         smp_fetch_payload,        ARG2(2,SINT,SINT),      NULL,           SMP_T_BIN,  SMP_USE_L6RES },
+       { "res.payload_lv",      smp_fetch_payload_lv,     ARG3(2,SINT,SINT,STR),  val_payload_lv, SMP_T_BIN,  SMP_USE_L6RES },
        { "res.ssl_hello_type",  smp_fetch_ssl_hello_type, 0,                      NULL,           SMP_T_SINT, SMP_USE_L6RES },
        { "wait_end",            smp_fetch_wait_end,       0,                      NULL,           SMP_T_BOOL, SMP_USE_INTRN },
        { /* END */ },
index c35e6a1ef581849018ebc1a6b1dbfadb57f30299..18a9455c972a24504d7599df7fde734ab3424106 100644 (file)
@@ -10603,8 +10603,8 @@ smp_fetch_fhdr(const struct arg *args, struct sample *smp, const char *kw, void
                name_str = args[0].data.str.str;
                name_len = args[0].data.str.len;
 
-               if (args[1].type == ARGT_UINT || args[1].type == ARGT_SINT)
-                       occ = args[1].data.uint;
+               if (args[1].type == ARGT_SINT)
+                       occ = args[1].data.sint;
        }
 
        CHECK_HTTP_MESSAGE_FIRST();
@@ -10731,8 +10731,8 @@ smp_fetch_hdr(const struct arg *args, struct sample *smp, const char *kw, void *
                name_str = args[0].data.str.str;
                name_len = args[0].data.str.len;
 
-               if (args[1].type == ARGT_UINT || args[1].type == ARGT_SINT)
-                       occ = args[1].data.uint;
+               if (args[1].type == ARGT_SINT)
+                       occ = args[1].data.sint;
        }
 
        CHECK_HTTP_MESSAGE_FIRST();
@@ -11216,10 +11216,10 @@ smp_fetch_capture_header_req(const struct arg *args, struct sample *smp, const c
        struct proxy *fe = strm_fe(smp->strm);
        int idx;
 
-       if (!args || args->type != ARGT_UINT)
+       if (!args || args->type != ARGT_SINT)
                return 0;
 
-       idx = args->data.uint;
+       idx = args->data.sint;
 
        if (idx > (fe->nb_req_cap - 1) || smp->strm->req_cap == NULL || smp->strm->req_cap[idx] == NULL)
                return 0;
@@ -11241,10 +11241,10 @@ smp_fetch_capture_header_res(const struct arg *args, struct sample *smp, const c
        struct proxy *fe = strm_fe(smp->strm);
        int idx;
 
-       if (!args || args->type != ARGT_UINT)
+       if (!args || args->type != ARGT_SINT)
                return 0;
 
-       idx = args->data.uint;
+       idx = args->data.sint;
 
        if (idx > (fe->nb_rsp_cap - 1) || smp->strm->res_cap == NULL || smp->strm->res_cap[idx] == NULL)
                return 0;
@@ -12081,10 +12081,11 @@ static int sample_conv_http_date(const struct arg *args, struct sample *smp, voi
        const char mon[12][4] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
        struct chunk *temp;
        struct tm *tm;
-       time_t curr_date = smp->data.sint;
+       /* With high numbers, the date returned can be negative, the 55 bits mask prevent this. */
+       time_t curr_date = smp->data.sint & 0x007fffffffffffffLL;
 
        /* add offset */
-       if (args && (args[0].type == ARGT_SINT || args[0].type == ARGT_UINT))
+       if (args && (args[0].type == ARGT_SINT))
                curr_date += args[0].data.sint;
 
        tm = gmtime(&curr_date);
@@ -12302,10 +12303,10 @@ static int smp_conv_req_capture(const struct arg *args, struct sample *smp, void
        struct cap_hdr *hdr;
        int len;
 
-       if (!args || args->type != ARGT_UINT)
+       if (!args || args->type != ARGT_SINT)
                return 0;
 
-       idx = args->data.uint;
+       idx = args->data.sint;
 
        /* Check the availibity of the capture id. */
        if (idx > fe->nb_req_cap - 1)
@@ -12343,10 +12344,10 @@ static int smp_conv_res_capture(const struct arg *args, struct sample *smp, void
        struct cap_hdr *hdr;
        int len;
 
-       if (!args || args->type != ARGT_UINT)
+       if (!args || args->type != ARGT_SINT)
                return 0;
 
-       idx = args->data.uint;
+       idx = args->data.sint;
 
        /* Check the availibity of the capture id. */
        if (idx > fe->nb_rsp_cap - 1)
@@ -13013,15 +13014,15 @@ static struct sample_fetch_kw_list sample_fetch_keywords = {ILH, {
        { "base32+src",      smp_fetch_base32_src,     0,                NULL,    SMP_T_BIN,  SMP_USE_HRQHV },
 
        /* capture are allocated and are permanent in the stream */
-       { "capture.req.hdr", smp_fetch_capture_header_req, ARG1(1, UINT), NULL,   SMP_T_STR,  SMP_USE_HRQHP },
+       { "capture.req.hdr", smp_fetch_capture_header_req, ARG1(1,SINT), NULL,   SMP_T_STR,  SMP_USE_HRQHP },
 
        /* retrieve these captures from the HTTP logs */
-       { "capture.req.method", smp_fetch_capture_req_method, 0,          NULL,   SMP_T_STR,  SMP_USE_HRQHP },
-       { "capture.req.uri",    smp_fetch_capture_req_uri,    0,          NULL,   SMP_T_STR,  SMP_USE_HRQHP },
-       { "capture.req.ver",    smp_fetch_capture_req_ver,    0,          NULL,   SMP_T_STR,  SMP_USE_HRQHP },
+       { "capture.req.method", smp_fetch_capture_req_method, 0,         NULL,   SMP_T_STR,  SMP_USE_HRQHP },
+       { "capture.req.uri",    smp_fetch_capture_req_uri,    0,         NULL,   SMP_T_STR,  SMP_USE_HRQHP },
+       { "capture.req.ver",    smp_fetch_capture_req_ver,    0,         NULL,   SMP_T_STR,  SMP_USE_HRQHP },
 
-       { "capture.res.hdr", smp_fetch_capture_header_res, ARG1(1, UINT), NULL,   SMP_T_STR,  SMP_USE_HRSHP },
-       { "capture.res.ver", smp_fetch_capture_res_ver,       0,          NULL,   SMP_T_STR,  SMP_USE_HRQHP },
+       { "capture.res.hdr", smp_fetch_capture_header_res, ARG1(1,SINT), NULL,   SMP_T_STR,  SMP_USE_HRSHP },
+       { "capture.res.ver", smp_fetch_capture_res_ver,       0,         NULL,   SMP_T_STR,  SMP_USE_HRQHP },
 
        /* cookie is valid in both directions (eg: for "stick ...") but cook*
         * are only here to match the ACL's name, are request-only and are used
@@ -13123,8 +13124,8 @@ static struct sample_fetch_kw_list sample_fetch_keywords = {ILH, {
 static struct sample_conv_kw_list sample_conv_kws = {ILH, {
        { "http_date", sample_conv_http_date,  ARG1(0,SINT),     NULL, SMP_T_SINT, SMP_T_STR},
        { "language",  sample_conv_q_prefered, ARG2(1,STR,STR),  NULL, SMP_T_STR,  SMP_T_STR},
-       { "capture-req", smp_conv_req_capture, ARG1(1,UINT),     NULL, SMP_T_STR,  SMP_T_STR},
-       { "capture-res", smp_conv_res_capture, ARG1(1,UINT),     NULL, SMP_T_STR,  SMP_T_STR},
+       { "capture-req", smp_conv_req_capture, ARG1(1,SINT),     NULL, SMP_T_STR,  SMP_T_STR},
+       { "capture-res", smp_conv_res_capture, ARG1(1,SINT),     NULL, SMP_T_STR,  SMP_T_STR},
        { "url_dec",   sample_conv_url_dec,    0,                NULL, SMP_T_STR,  SMP_T_STR},
        { NULL, NULL, 0, 0, 0 },
 }};
index 17e331acc127c3ac028af268c442c8af3bfd5099..15c004ff30569ecddc7ecb24867004ae4a7744e3 100644 (file)
@@ -1433,7 +1433,7 @@ static int sample_conv_bin2hex(const struct arg *arg_p, struct sample *smp, void
 static int sample_conv_djb2(const struct arg *arg_p, struct sample *smp, void *private)
 {
        smp->data.sint = hash_djb2(smp->data.str.str, smp->data.str.len);
-       if (arg_p && arg_p->data.uint)
+       if (arg_p && arg_p->data.sint)
                smp->data.sint = full_hash(smp->data.sint);
        smp->type = SMP_T_SINT;
        return 1;
@@ -1488,11 +1488,12 @@ static int sample_conv_ipmask(const struct arg *arg_p, struct sample *smp, void
 static int sample_conv_ltime(const struct arg *args, struct sample *smp, void *private)
 {
        struct chunk *temp;
-       time_t curr_date = smp->data.sint;
+       /* With high numbers, the date returned can be negative, the 55 bits mask prevent this. */
+       time_t curr_date = smp->data.sint & 0x007fffffffffffffLL;
        struct tm *tm;
 
        /* add offset */
-       if (args[1].type == ARGT_SINT || args[1].type == ARGT_UINT)
+       if (args[1].type == ARGT_SINT)
                curr_date += args[1].data.sint;
 
        tm = localtime(&curr_date);
@@ -1509,7 +1510,7 @@ static int sample_conv_ltime(const struct arg *args, struct sample *smp, void *p
 static int sample_conv_sdbm(const struct arg *arg_p, struct sample *smp, void *private)
 {
        smp->data.sint = hash_sdbm(smp->data.str.str, smp->data.str.len);
-       if (arg_p && arg_p->data.uint)
+       if (arg_p && arg_p->data.sint)
                smp->data.sint = full_hash(smp->data.sint);
        smp->type = SMP_T_SINT;
        return 1;
@@ -1522,11 +1523,12 @@ static int sample_conv_sdbm(const struct arg *arg_p, struct sample *smp, void *p
 static int sample_conv_utime(const struct arg *args, struct sample *smp, void *private)
 {
        struct chunk *temp;
-       time_t curr_date = smp->data.sint;
+       /* With high numbers, the date returned can be negative, the 55 bits mask prevent this. */
+       time_t curr_date = smp->data.sint & 0x007fffffffffffffLL;
        struct tm *tm;
 
        /* add offset */
-       if (args[1].type == ARGT_SINT || args[1].type == ARGT_UINT)
+       if (args[1].type == ARGT_SINT)
                curr_date += args[1].data.sint;
 
        tm = gmtime(&curr_date);
@@ -1543,7 +1545,7 @@ static int sample_conv_utime(const struct arg *args, struct sample *smp, void *p
 static int sample_conv_wt6(const struct arg *arg_p, struct sample *smp, void *private)
 {
        smp->data.sint = hash_wt6(smp->data.str.str, smp->data.str.len);
-       if (arg_p && arg_p->data.uint)
+       if (arg_p && arg_p->data.sint)
                smp->data.sint = full_hash(smp->data.sint);
        smp->type = SMP_T_SINT;
        return 1;
@@ -1553,7 +1555,7 @@ static int sample_conv_wt6(const struct arg *arg_p, struct sample *smp, void *pr
 static int sample_conv_crc32(const struct arg *arg_p, struct sample *smp, void *private)
 {
        smp->data.sint = hash_crc32(smp->data.str.str, smp->data.str.len);
-       if (arg_p && arg_p->data.uint)
+       if (arg_p && arg_p->data.sint)
                smp->data.sint = full_hash(smp->data.sint);
        smp->type = SMP_T_SINT;
        return 1;
@@ -1590,38 +1592,38 @@ static int sample_conv_json_check(struct arg *arg, struct sample_conv *conv,
        }
 
        if (strcmp(arg->data.str.str, "") == 0) {
-               arg->type = ARGT_UINT;
-               arg->data.uint = IT_ASCII;
+               arg->type = ARGT_SINT;
+               arg->data.sint = IT_ASCII;
                return 1;
        }
 
        else if (strcmp(arg->data.str.str, "ascii") == 0) {
-               arg->type = ARGT_UINT;
-               arg->data.uint = IT_ASCII;
+               arg->type = ARGT_SINT;
+               arg->data.sint = IT_ASCII;
                return 1;
        }
 
        else if (strcmp(arg->data.str.str, "utf8") == 0) {
-               arg->type = ARGT_UINT;
-               arg->data.uint = IT_UTF8;
+               arg->type = ARGT_SINT;
+               arg->data.sint = IT_UTF8;
                return 1;
        }
 
        else if (strcmp(arg->data.str.str, "utf8s") == 0) {
-               arg->type = ARGT_UINT;
-               arg->data.uint = IT_UTF8S;
+               arg->type = ARGT_SINT;
+               arg->data.sint = IT_UTF8S;
                return 1;
        }
 
        else if (strcmp(arg->data.str.str, "utf8p") == 0) {
-               arg->type = ARGT_UINT;
-               arg->data.uint = IT_UTF8P;
+               arg->type = ARGT_SINT;
+               arg->data.sint = IT_UTF8P;
                return 1;
        }
 
        else if (strcmp(arg->data.str.str, "utf8ps") == 0) {
-               arg->type = ARGT_UINT;
-               arg->data.uint = IT_UTF8PS;
+               arg->type = ARGT_SINT;
+               arg->data.sint = IT_UTF8PS;
                return 1;
        }
 
@@ -1642,7 +1644,7 @@ static int sample_conv_json(const struct arg *arg_p, struct sample *smp, void *p
        char *p;
 
        if (arg_p)
-               input_type = arg_p->data.uint;
+               input_type = arg_p->data.sint;
 
        temp = get_trash_chunk();
        temp->len = 0;
@@ -1746,18 +1748,18 @@ static int sample_conv_json(const struct arg *arg_p, struct sample *smp, void *p
  * Optional second arg is the length to truncate */
 static int sample_conv_bytes(const struct arg *arg_p, struct sample *smp, void *private)
 {
-       if (smp->data.str.len <= arg_p[0].data.uint) {
+       if (smp->data.str.len <= arg_p[0].data.sint) {
                smp->data.str.len = 0;
                return 1;
        }
 
        if (smp->data.str.size)
-                       smp->data.str.size -= arg_p[0].data.uint;
-       smp->data.str.len -= arg_p[0].data.uint;
-       smp->data.str.str += arg_p[0].data.uint;
+                       smp->data.str.size -= arg_p[0].data.sint;
+       smp->data.str.len -= arg_p[0].data.sint;
+       smp->data.str.str += arg_p[0].data.sint;
 
-       if ((arg_p[1].type == ARGT_UINT) && (arg_p[1].data.uint < smp->data.str.len))
-               smp->data.str.len = arg_p[1].data.uint;
+       if ((arg_p[1].type == ARGT_SINT) && (arg_p[1].data.sint < smp->data.str.len))
+               smp->data.str.len = arg_p[1].data.sint;
 
        return 1;
 }
@@ -1772,12 +1774,12 @@ static int sample_conv_field_check(struct arg *args, struct sample_conv *conv,
                return 0;
        }
 
-       if (arg->type != ARGT_UINT) {
+       if (arg->type != ARGT_SINT) {
                memprintf(err, "Unexpected arg type");
                return 0;
        }
 
-       if (!arg->data.uint) {
+       if (!arg->data.sint) {
                memprintf(err, "Unexpected value 0 for index");
                return 0;
        }
@@ -1807,7 +1809,7 @@ static int sample_conv_field(const struct arg *arg_p, struct sample *smp, void *
        char *start, *end;
        int i;
 
-       if (!arg_p[0].data.uint)
+       if (!arg_p[0].data.sint)
                return 0;
 
        field = 1;
@@ -1816,7 +1818,7 @@ static int sample_conv_field(const struct arg *arg_p, struct sample *smp, void *
 
                for (i = 0 ; i < arg_p[1].data.str.len ; i++) {
                        if (*end == arg_p[1].data.str.str[i]) {
-                               if (field == arg_p[0].data.uint)
+                               if (field == arg_p[0].data.sint)
                                        goto found;
                                start = end+1;
                                field++;
@@ -1827,7 +1829,7 @@ static int sample_conv_field(const struct arg *arg_p, struct sample *smp, void *
        }
 
        /* Field not found */
-       if (field != arg_p[0].data.uint) {
+       if (field != arg_p[0].data.sint) {
                smp->data.str.len = 0;
                return 1;
        }
@@ -1858,7 +1860,7 @@ static int sample_conv_word(const struct arg *arg_p, struct sample *smp, void *p
        char *start, *end;
        int i, issep, inword;
 
-       if (!arg_p[0].data.uint)
+       if (!arg_p[0].data.sint)
                return 0;
 
        word = 0;
@@ -1880,7 +1882,7 @@ static int sample_conv_word(const struct arg *arg_p, struct sample *smp, void *p
                        }
                }
                else if (issep) {
-                       if (word == arg_p[0].data.uint)
+                       if (word == arg_p[0].data.sint)
                                goto found;
                        inword = 0;
                }
@@ -1888,7 +1890,7 @@ static int sample_conv_word(const struct arg *arg_p, struct sample *smp, void *p
        }
 
        /* Field not found */
-       if (word != arg_p[0].data.uint) {
+       if (word != arg_p[0].data.sint) {
                smp->data.str.len = 0;
                return 1;
        }
@@ -2029,7 +2031,7 @@ static int sample_conv_binary_cpl(const struct arg *arg_p, struct sample *smp, v
  */
 static int sample_conv_binary_and(const struct arg *arg_p, struct sample *smp, void *private)
 {
-       smp->data.sint &= arg_p->data.uint;
+       smp->data.sint &= arg_p->data.sint;
        return 1;
 }
 
@@ -2038,7 +2040,7 @@ static int sample_conv_binary_and(const struct arg *arg_p, struct sample *smp, v
  */
 static int sample_conv_binary_or(const struct arg *arg_p, struct sample *smp, void *private)
 {
-       smp->data.sint |= arg_p->data.uint;
+       smp->data.sint |= arg_p->data.sint;
        return 1;
 }
 
@@ -2047,7 +2049,7 @@ static int sample_conv_binary_or(const struct arg *arg_p, struct sample *smp, vo
  */
 static int sample_conv_binary_xor(const struct arg *arg_p, struct sample *smp, void *private)
 {
-       smp->data.sint ^= arg_p->data.uint;
+       smp->data.sint ^= arg_p->data.sint;
        return 1;
 }
 
@@ -2056,7 +2058,7 @@ static int sample_conv_binary_xor(const struct arg *arg_p, struct sample *smp, v
  */
 static int sample_conv_arith_add(const struct arg *arg_p, struct sample *smp, void *private)
 {
-       smp->data.sint += arg_p->data.uint;
+       smp->data.sint += arg_p->data.sint;
        return 1;
 }
 
@@ -2066,7 +2068,7 @@ static int sample_conv_arith_add(const struct arg *arg_p, struct sample *smp, vo
 static int sample_conv_arith_sub(const struct arg *arg_p,
                                  struct sample *smp, void *private)
 {
-       smp->data.sint -= arg_p->data.uint;
+       smp->data.sint -= arg_p->data.sint;
        return 1;
 }
 
@@ -2076,7 +2078,7 @@ static int sample_conv_arith_sub(const struct arg *arg_p,
 static int sample_conv_arith_mul(const struct arg *arg_p,
                                  struct sample *smp, void *private)
 {
-       smp->data.sint *= arg_p->data.uint;
+       smp->data.sint *= arg_p->data.sint;
        return 1;
 }
 
@@ -2087,8 +2089,8 @@ static int sample_conv_arith_mul(const struct arg *arg_p,
 static int sample_conv_arith_div(const struct arg *arg_p,
                                  struct sample *smp, void *private)
 {
-       if (arg_p->data.uint)
-               smp->data.sint /= arg_p->data.uint;
+       if (arg_p->data.sint)
+               smp->data.sint /= arg_p->data.sint;
        else
                smp->data.sint = ~0;
        return 1;
@@ -2101,8 +2103,8 @@ static int sample_conv_arith_div(const struct arg *arg_p,
 static int sample_conv_arith_mod(const struct arg *arg_p,
                                  struct sample *smp, void *private)
 {
-       if (arg_p->data.uint)
-               smp->data.sint %= arg_p->data.uint;
+       if (arg_p->data.sint)
+               smp->data.sint %= arg_p->data.sint;
        else
                smp->data.sint = 0;
        return 1;
@@ -2213,7 +2215,7 @@ smp_fetch_date(const struct arg *args, struct sample *smp, const char *kw, void
        smp->data.sint = date.tv_sec;
 
        /* add offset */
-       if (args && (args[0].type == ARGT_SINT || args[0].type == ARGT_UINT))
+       if (args && args[0].type == ARGT_SINT)
                smp->data.sint += args[0].data.sint;
 
        smp->type = SMP_T_SINT;
@@ -2248,8 +2250,8 @@ smp_fetch_rand(const struct arg *args, struct sample *smp, const char *kw, void
        smp->data.sint = random();
 
        /* reduce if needed. Don't do a modulo, use all bits! */
-       if (args && args[0].type == ARGT_UINT)
-               smp->data.sint = (smp->data.sint * args[0].data.uint) / ((u64)RAND_MAX+1);
+       if (args && args[0].type == ARGT_SINT)
+               smp->data.sint = (smp->data.sint * args[0].data.sint) / ((u64)RAND_MAX+1);
 
        smp->type = SMP_T_SINT;
        smp->flags |= SMP_F_VOL_TEST | SMP_F_MAY_CHANGE;
@@ -2278,14 +2280,14 @@ static int smp_check_const_bool(struct arg *args, char **err)
 {
        if (strcasecmp(args[0].data.str.str, "true") == 0 ||
            strcasecmp(args[0].data.str.str, "1") == 0) {
-               args[0].type = ARGT_UINT;
-               args[0].data.uint = 1;
+               args[0].type = ARGT_SINT;
+               args[0].data.sint = 1;
                return 1;
        }
        if (strcasecmp(args[0].data.str.str, "false") == 0 ||
            strcasecmp(args[0].data.str.str, "0") == 0) {
-               args[0].type = ARGT_UINT;
-               args[0].data.uint = 0;
+               args[0].type = ARGT_SINT;
+               args[0].data.sint = 0;
                return 1;
        }
        memprintf(err, "Expects 'true', 'false', '0' or '1'");
@@ -2295,7 +2297,7 @@ static int smp_check_const_bool(struct arg *args, char **err)
 static int smp_fetch_const_bool(const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
        smp->type = SMP_T_BOOL;
-       smp->data.sint = args[0].data.uint;
+       smp->data.sint = args[0].data.sint;
        return 1;
 }
 
@@ -2349,8 +2351,8 @@ static int smp_check_const_meth(struct arg *args, char **err)
 
        meth = find_http_meth(args[0].data.str.str, args[0].data.str.len);
        if (meth != HTTP_METH_OTHER) {
-               args[0].type = ARGT_UINT;
-               args[0].data.uint = meth;
+               args[0].type = ARGT_SINT;
+               args[0].data.sint = meth;
        } else {
                /* Check method avalaibility. A methos is a token defined as :
                 * tchar = "!" / "#" / "$" / "%" / "&" / "'" / "*" / "+" / "-" / "." /
@@ -2370,9 +2372,9 @@ static int smp_check_const_meth(struct arg *args, char **err)
 static int smp_fetch_const_meth(const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
        smp->type = SMP_T_METH;
-       if (args[0].type == ARGT_UINT) {
+       if (args[0].type == ARGT_SINT) {
                smp->flags &= ~SMP_F_CONST;
-               smp->data.meth.meth = args[0].data.uint;
+               smp->data.meth.meth = args[0].data.sint;
                smp->data.meth.str.str = "";
                smp->data.meth.str.len = 0;
        } else {
@@ -2396,7 +2398,7 @@ static struct sample_fetch_kw_list smp_kws = {ILH, {
        { "date",         smp_fetch_date,  ARG1(0,SINT), NULL, SMP_T_SINT, SMP_USE_INTRN },
        { "nbproc",       smp_fetch_nbproc,0,            NULL, SMP_T_SINT, SMP_USE_INTRN },
        { "proc",         smp_fetch_proc,  0,            NULL, SMP_T_SINT, SMP_USE_INTRN },
-       { "rand",         smp_fetch_rand,  ARG1(0,UINT), NULL, SMP_T_SINT, SMP_USE_INTRN },
+       { "rand",         smp_fetch_rand,  ARG1(0,SINT), NULL, SMP_T_SINT, SMP_USE_INTRN },
        { "stopping",     smp_fetch_stopping, 0,         NULL, SMP_T_BOOL, SMP_USE_INTRN },
 
        { "str",  smp_fetch_const_str,  ARG1(1,STR),  NULL                , SMP_T_STR,  SMP_USE_INTRN },
@@ -2423,29 +2425,29 @@ static struct sample_conv_kw_list sample_conv_kws = {ILH, {
        { "ipmask", sample_conv_ipmask,    ARG1(1,MSK4), NULL, SMP_T_IPV4, SMP_T_IPV4 },
        { "ltime",  sample_conv_ltime,     ARG2(1,STR,SINT), NULL, SMP_T_SINT, SMP_T_STR },
        { "utime",  sample_conv_utime,     ARG2(1,STR,SINT), NULL, SMP_T_SINT, SMP_T_STR },
-       { "crc32",  sample_conv_crc32,     ARG1(0,UINT),  NULL, SMP_T_BIN, SMP_T_SINT  },
-       { "djb2",   sample_conv_djb2,      ARG1(0,UINT),  NULL, SMP_T_BIN, SMP_T_SINT  },
-       { "sdbm",   sample_conv_sdbm,      ARG1(0,UINT),  NULL, SMP_T_BIN, SMP_T_SINT  },
-       { "wt6",    sample_conv_wt6,       ARG1(0,UINT),  NULL, SMP_T_BIN, SMP_T_SINT  },
+       { "crc32",  sample_conv_crc32,     ARG1(0,SINT), NULL, SMP_T_BIN,  SMP_T_SINT  },
+       { "djb2",   sample_conv_djb2,      ARG1(0,SINT), NULL, SMP_T_BIN,  SMP_T_SINT  },
+       { "sdbm",   sample_conv_sdbm,      ARG1(0,SINT), NULL, SMP_T_BIN,  SMP_T_SINT  },
+       { "wt6",    sample_conv_wt6,       ARG1(0,SINT), NULL, SMP_T_BIN,  SMP_T_SINT  },
        { "json",   sample_conv_json,      ARG1(1,STR),  sample_conv_json_check, SMP_T_STR,  SMP_T_STR },
-       { "bytes",  sample_conv_bytes,     ARG2(1,UINT,UINT), NULL, SMP_T_BIN,  SMP_T_BIN },
-       { "field",  sample_conv_field,     ARG2(2,UINT,STR), sample_conv_field_check, SMP_T_STR,  SMP_T_STR },
-       { "word",   sample_conv_word,      ARG2(2,UINT,STR), sample_conv_field_check, SMP_T_STR,  SMP_T_STR },
+       { "bytes",  sample_conv_bytes,     ARG2(1,SINT,SINT), NULL, SMP_T_BIN,  SMP_T_BIN },
+       { "field",  sample_conv_field,     ARG2(2,SINT,STR), sample_conv_field_check, SMP_T_STR,  SMP_T_STR },
+       { "word",   sample_conv_word,      ARG2(2,SINT,STR), sample_conv_field_check, SMP_T_STR,  SMP_T_STR },
        { "regsub", sample_conv_regsub,    ARG3(2,REG,STR,STR), sample_conv_regsub_check, SMP_T_STR, SMP_T_STR },
 
-       { "and",    sample_conv_binary_and, ARG1(1,UINT), NULL, SMP_T_SINT, SMP_T_SINT },
-       { "or",     sample_conv_binary_or,  ARG1(1,UINT), NULL, SMP_T_SINT, SMP_T_SINT },
-       { "xor",    sample_conv_binary_xor, ARG1(1,UINT), NULL, SMP_T_SINT, SMP_T_SINT },
+       { "and",    sample_conv_binary_and, ARG1(1,SINT), NULL, SMP_T_SINT, SMP_T_SINT },
+       { "or",     sample_conv_binary_or,  ARG1(1,SINT), NULL, SMP_T_SINT, SMP_T_SINT },
+       { "xor",    sample_conv_binary_xor, ARG1(1,SINT), NULL, SMP_T_SINT, SMP_T_SINT },
        { "cpl",    sample_conv_binary_cpl,            0, NULL, SMP_T_SINT, SMP_T_SINT },
        { "bool",   sample_conv_arith_bool,            0, NULL, SMP_T_SINT, SMP_T_BOOL },
        { "not",    sample_conv_arith_not,             0, NULL, SMP_T_SINT, SMP_T_BOOL },
        { "odd",    sample_conv_arith_odd,             0, NULL, SMP_T_SINT, SMP_T_BOOL },
        { "even",   sample_conv_arith_even,            0, NULL, SMP_T_SINT, SMP_T_BOOL },
-       { "add",    sample_conv_arith_add,  ARG1(1,UINT), NULL, SMP_T_SINT, SMP_T_SINT },
-       { "sub",    sample_conv_arith_sub,  ARG1(1,UINT), NULL, SMP_T_SINT, SMP_T_SINT },
-       { "mul",    sample_conv_arith_mul,  ARG1(1,UINT), NULL, SMP_T_SINT, SMP_T_SINT },
-       { "div",    sample_conv_arith_div,  ARG1(1,UINT), NULL, SMP_T_SINT, SMP_T_SINT },
-       { "mod",    sample_conv_arith_mod,  ARG1(1,UINT), NULL, SMP_T_SINT, SMP_T_SINT },
+       { "add",    sample_conv_arith_add,  ARG1(1,SINT), NULL, SMP_T_SINT, SMP_T_SINT },
+       { "sub",    sample_conv_arith_sub,  ARG1(1,SINT), NULL, SMP_T_SINT, SMP_T_SINT },
+       { "mul",    sample_conv_arith_mul,  ARG1(1,SINT), NULL, SMP_T_SINT, SMP_T_SINT },
+       { "div",    sample_conv_arith_div,  ARG1(1,SINT), NULL, SMP_T_SINT, SMP_T_SINT },
+       { "mod",    sample_conv_arith_mod,  ARG1(1,SINT), NULL, SMP_T_SINT, SMP_T_SINT },
        { "neg",    sample_conv_arith_neg,             0, NULL, SMP_T_SINT, SMP_T_SINT },
 
        { NULL, NULL, 0, 0, 0 },
index 520c866e9a935665c6008584189b1c61fa80ea41..7f1a07018b28b8c8f172adcfe733d2f43be6275d 100644 (file)
@@ -3613,8 +3613,6 @@ smp_fetch_ssl_x_i_dn(const struct arg *args, struct sample *smp, const char *kw,
 
                if (args[1].type == ARGT_SINT)
                        pos = args[1].data.sint;
-               else if (args[1].type == ARGT_UINT)
-                       pos =(int)args[1].data.uint;
 
                if (ssl_sock_get_dn_entry(name, &args[0].data.str, pos, smp_trash) <= 0)
                        goto out;
@@ -3715,8 +3713,6 @@ smp_fetch_ssl_x_s_dn(const struct arg *args, struct sample *smp, const char *kw,
 
                if (args[1].type == ARGT_SINT)
                        pos = args[1].data.sint;
-               else if (args[1].type == ARGT_UINT)
-                       pos =(int)args[1].data.uint;
 
                if (ssl_sock_get_dn_entry(name, &args[0].data.str, pos, smp_trash) <= 0)
                        goto out;
index baab845e4e2fc67309e709e387f3d4a02f066876..ff6b32bb1cc62736f29106daf6ef1cfe7d095cab 100644 (file)
@@ -2582,7 +2582,7 @@ smp_fetch_sc_stkctr(struct session *sess, struct stream *strm, const struct arg
 
        if (num == '_' - '0') {
                /* sc_* variant, args[0] = ctr# (mandatory) */
-               num = args[arg++].data.uint;
+               num = args[arg++].data.sint;
                if (num >= MAX_SESS_STKCTR)
                        return NULL;
        }
@@ -3168,25 +3168,25 @@ static struct acl_kw_list acl_kws = {ILH, {
  * Please take care of keeping this list alphabetically sorted.
  */
 static struct sample_fetch_kw_list smp_fetch_keywords = {ILH, {
-       { "sc_bytes_in_rate",   smp_fetch_sc_bytes_in_rate,  ARG2(1,UINT,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
-       { "sc_bytes_out_rate",  smp_fetch_sc_bytes_out_rate, ARG2(1,UINT,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
-       { "sc_clr_gpc0",        smp_fetch_sc_clr_gpc0,       ARG2(1,UINT,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
-       { "sc_conn_cnt",        smp_fetch_sc_conn_cnt,       ARG2(1,UINT,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
-       { "sc_conn_cur",        smp_fetch_sc_conn_cur,       ARG2(1,UINT,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
-       { "sc_conn_rate",       smp_fetch_sc_conn_rate,      ARG2(1,UINT,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
-       { "sc_get_gpc0",        smp_fetch_sc_get_gpc0,       ARG2(1,UINT,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
-       { "sc_gpc0_rate",       smp_fetch_sc_gpc0_rate,      ARG2(1,UINT,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
-       { "sc_http_err_cnt",    smp_fetch_sc_http_err_cnt,   ARG2(1,UINT,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
-       { "sc_http_err_rate",   smp_fetch_sc_http_err_rate,  ARG2(1,UINT,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
-       { "sc_http_req_cnt",    smp_fetch_sc_http_req_cnt,   ARG2(1,UINT,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
-       { "sc_http_req_rate",   smp_fetch_sc_http_req_rate,  ARG2(1,UINT,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
-       { "sc_inc_gpc0",        smp_fetch_sc_inc_gpc0,       ARG2(1,UINT,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
-       { "sc_kbytes_in",       smp_fetch_sc_kbytes_in,      ARG2(1,UINT,TAB), NULL, SMP_T_SINT, SMP_USE_L4CLI, },
-       { "sc_kbytes_out",      smp_fetch_sc_kbytes_out,     ARG2(1,UINT,TAB), NULL, SMP_T_SINT, SMP_USE_L4CLI, },
-       { "sc_sess_cnt",        smp_fetch_sc_sess_cnt,       ARG2(1,UINT,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
-       { "sc_sess_rate",       smp_fetch_sc_sess_rate,      ARG2(1,UINT,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
-       { "sc_tracked",         smp_fetch_sc_tracked,        ARG2(1,UINT,TAB), NULL, SMP_T_BOOL, SMP_USE_INTRN, },
-       { "sc_trackers",        smp_fetch_sc_trackers,       ARG2(1,UINT,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
+       { "sc_bytes_in_rate",   smp_fetch_sc_bytes_in_rate,  ARG2(1,SINT,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
+       { "sc_bytes_out_rate",  smp_fetch_sc_bytes_out_rate, ARG2(1,SINT,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
+       { "sc_clr_gpc0",        smp_fetch_sc_clr_gpc0,       ARG2(1,SINT,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
+       { "sc_conn_cnt",        smp_fetch_sc_conn_cnt,       ARG2(1,SINT,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
+       { "sc_conn_cur",        smp_fetch_sc_conn_cur,       ARG2(1,SINT,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
+       { "sc_conn_rate",       smp_fetch_sc_conn_rate,      ARG2(1,SINT,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
+       { "sc_get_gpc0",        smp_fetch_sc_get_gpc0,       ARG2(1,SINT,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
+       { "sc_gpc0_rate",       smp_fetch_sc_gpc0_rate,      ARG2(1,SINT,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
+       { "sc_http_err_cnt",    smp_fetch_sc_http_err_cnt,   ARG2(1,SINT,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
+       { "sc_http_err_rate",   smp_fetch_sc_http_err_rate,  ARG2(1,SINT,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
+       { "sc_http_req_cnt",    smp_fetch_sc_http_req_cnt,   ARG2(1,SINT,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
+       { "sc_http_req_rate",   smp_fetch_sc_http_req_rate,  ARG2(1,SINT,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
+       { "sc_inc_gpc0",        smp_fetch_sc_inc_gpc0,       ARG2(1,SINT,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
+       { "sc_kbytes_in",       smp_fetch_sc_kbytes_in,      ARG2(1,SINT,TAB), NULL, SMP_T_SINT, SMP_USE_L4CLI, },
+       { "sc_kbytes_out",      smp_fetch_sc_kbytes_out,     ARG2(1,SINT,TAB), NULL, SMP_T_SINT, SMP_USE_L4CLI, },
+       { "sc_sess_cnt",        smp_fetch_sc_sess_cnt,       ARG2(1,SINT,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
+       { "sc_sess_rate",       smp_fetch_sc_sess_rate,      ARG2(1,SINT,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
+       { "sc_tracked",         smp_fetch_sc_tracked,        ARG2(1,SINT,TAB), NULL, SMP_T_BOOL, SMP_USE_INTRN, },
+       { "sc_trackers",        smp_fetch_sc_trackers,       ARG2(1,SINT,TAB), NULL, SMP_T_SINT, SMP_USE_INTRN, },
        { "sc0_bytes_in_rate",  smp_fetch_sc_bytes_in_rate,  ARG1(0,TAB),      NULL, SMP_T_SINT, SMP_USE_INTRN, },
        { "sc0_bytes_out_rate", smp_fetch_sc_bytes_out_rate, ARG1(0,TAB),      NULL, SMP_T_SINT, SMP_USE_INTRN, },
        { "sc0_clr_gpc0",       smp_fetch_sc_clr_gpc0,       ARG1(0,TAB),      NULL, SMP_T_SINT, SMP_USE_INTRN, },